Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnEntity / OnGameEvent callbacks didn't fired #124

Open
SeregaSE opened this issue Jul 23, 2020 · 1 comment
Open

OnEntity / OnGameEvent callbacks didn't fired #124

SeregaSE opened this issue Jul 23, 2020 · 1 comment

Comments

@SeregaSE
Copy link

SeregaSE commented Jul 23, 2020

Try to parse replay.dem file, can't get game events or entities,

  • is parser up to date?
  • does my code use parser correctly?
package main

import (
	"github.com/dotabuff/manta"
	"log"
	"os"
)

func main() {
	f, err := os.Open("replays/5530602426.dem")

	if err != nil {
		log.Fatal(err)
	}

	defer f.Close()

	p, err := manta.NewStreamParser(f)

	if err != nil {
		log.Fatal(err)
	}

	gotEntityEvents := int32(0)
	gotCombatLogEvents := int32(0)

	p.OnEntity(func(e *manta.Entity, o manta.EntityOp) error {
		gotEntityEvents += 1
		return nil
	})

	p.OnGameEvent("dota_combatlog", func(m *manta.GameEvent) error {
		gotCombatLogEvents += 1
		return nil
	})

	p.Start()

	log.Printf("gotEntityEvents: %v\n", gotEntityEvents)
	log.Printf("gotCombatLogEvents: %v\n", gotCombatLogEvents)
}

Output

 go run ./cmd/parse/*.go
2020/07/23 19:57:17 gotEntityEvents: 0
2020/07/23 19:57:17 gotCombatLogEvents: 0
@SeregaSE SeregaSE changed the title OnGameEvent callback didn't fired OnGameEvent / OnGameEvent callbacks didn't fired Jul 24, 2020
@SeregaSE SeregaSE changed the title OnGameEvent / OnGameEvent callbacks didn't fired OnEntity / OnGameEvent callbacks didn't fired Jul 24, 2020
@NikitaAnname
Copy link

You can use callbacks for the combat log
p.Callbacks.OnCMsgDOTACombatLogEntry(func(m *dota.CMsgDOTACombatLogEntry) error { fmt.Printf("log: %s\n", m) return nil })

DOTA_COMBATLOG_TYPES list
https://github.com/dotabuff/manta/blob/a9a3e4d31a834e746b7929e38688f6185eddf0f3/dota/dota_shared_enums.proto

Description of the old combat log
https://steamcommunity.com/sharedfiles/filedetails/?id=309868072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants