nydus / heroprotocol

heroprotocol is a Javascript port of Blizzard/heroprotocol for Heroes of the Storm .StormReplay parsing
Other
19 stars 10 forks source link

Battletags #12

Closed ebshimizu closed 6 years ago

ebshimizu commented 6 years ago

Battletag data is stored in the replay.server.battlelobby file, which the reference implementation does not decode for some reason.

It is apparently possible to get the battletags without actually fully decoding the file. The HotsLogs C# parser manages this by just unpacking the MPQ into a string and running the following regex: https://github.com/barrett777/Heroes.ReplayParser/blob/7a4b95d0d6058446ef0888cb9972ecd1fab60ab3/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs#L510

(that's (\p{L}|\d){3,24}#\d{4,10}[zØ]? in js)

I'm sure there are some corner cases in here, but something is better than nothing. Would it be possible for this library to get the list of tags in the replay with this method?

ebshimizu commented 6 years ago

lobby.txt Here's an example decode of a battlelobby for reference, you'll see the tags just sitting there in plain text.

jnovack commented 6 years ago

You should never do anything with battletag.

1) Blizzard doesn't like that. they have repeated stated it's intentionally not provided within their python library.

2) It can change.

A person is unique by their realm ID, which is linked.

ebshimizu commented 6 years ago

Didn't look too deeply into Blizzard's reasoning but while I can respect that, I also disagree.

My argument for using them is that the ToonHandle is not public and if you're doing a lookup purely based on the information provided to you in the Battle.net client, the battletag is what you use. App writers would be expected to use ToonHandles internally while maintaining a list of seen battletags for each handle. Battletags also allow you to identify the same user (unless they change tags frequently) across different regions.

Just a thought though, feel free to ignore if we want to stay on Blizzard's good side. :)

WhatIsACore commented 6 years ago

When I was working with this before all I had to do was modify the heroprotocol index to include an additional flag that decoded the battlelobby.

You can see the modified file here (I named it RAW_DATA, I forgot why)

Afterward it was easy to find battletags with a search script as seen here

where player is simply the username of the player.

EDIT: Those files are pretty old though so I don't know if anything is broken

WhatIsACore commented 6 years ago

Also, you kind of need the BattleTag to do many things. Blizzard's own realm ID is near useless as it's incredibly inconsistent with where it's shown, BattleTag is the only way you can link an in-game account to something like, say, Blizzard's own OAuth

ebshimizu commented 6 years ago

If anyone is looking to grab battletags in the replay files with pure js, you can use this file: https://github.com/ebshimizu/stats-of-the-storm/blob/dev/parser/battletags.js

Requires the empeeku package used by heroprotocol.js and xregexp for unicode regex support.

Going to mark as closed as well, as I don't recommend adding this to the core library.