chevcast/hearthstone-log-watcher

Question: Getting player names?

Closed this issue · 4 comments

I'm not talking about battletag, just player names... Is it possible to get them from the logs? So I can post into my back-end something like "Josh123 just won a duel against Yess456"

I assume you closing this means you realized the game-start event gives you their names? :)

Exactly haha my bad, I wasn't properly passing the players callback. Thank you for this!
By the way, you should add a class property to the object returning the players on game-start, in my opinion.

{
    id: 1
    class: 'Hunter' //or the in-game class ID
    name: 'Chevex'
    team: 'FRIENDLY'
}

I'm not sure how easy that is, but I'll take a look at the log lines and see if that info is easily parsable :)

I found a solution anyway;You just need to filter the zone-change events for the ones containing data.cardId.substr(0, 4) === 'HERO' && data.toTeam === 'FRIENDLY' so you get the object needed, then create a map for the different classes, like "HERO_01: {name: "Garrosh Hellscream"}" and finally do something like yourMapList["HERO_01"].name.
Didn't test it yet but that's a way... Don't worry about this