dethredic / WC3StreamerOverlay

A simple tool for wc3 streamers to display their opponent's race and stats
GNU General Public License v3.0
30 stars 7 forks source link

RoC game client #1

Closed JFGHT closed 5 years ago

JFGHT commented 5 years ago

First of all, thanks for the effort. I didn't know reading the packets was so easy.

Second, could you please make a functional release for Reign of Chaos? The stats gathered are only from TFT.

Thanks again.

dethredic commented 5 years ago

Two things: 1) To query ROC stats you can change the url in bnet_stats_scraper.py to: http://classic.battle.net/war3/ladder/war3-player-profile.aspx (W3XP -> war3)

2) I'm not sure if the ROC game servers will be on the same subnets as the TFT game servers. I've been searching for a ROC game for ~15 minutes with no success so I can't check. If the subnets are not the same the sniffer won't work.

If you changed 1) and things still don't work:

If you regularly play both ROC and TFT I could try to make it more flexible so it will detect the one you are playing automatically.

JFGHT commented 5 years ago

1.- Kinda obvious but not flexible.

I wanted to make a PR in order to detect the game client and the get the proper stats but I don't have time till Tuesday.

Btw, does the obs shared memory show the game client type?

Ps: I play RoC regularly.

dethredic commented 5 years ago

It does not: see the ObserverSharedMemory struct. The part I omitted in that stuct is player information (name, race, resources, upgrades, etc) which only gets filled in if you are an observer.

You could potentially use the game servers; IPs to check TFT vs ROC, but if they end up being the same you will have to come up with something else.

A valid option would be adding a command line option to the tool, i.e. python src/main.py --roc. This would require restarting the tool when switching from TFT to ROC though

JFGHT commented 5 years ago

https://github.com/dethredic/wc3_race_stat_bot/pull/2

As a temporary solution.

I scanned w3 memory and it's possible to get the game client by searching for w3xp but I'm new to Python so I just did it this way.

dethredic commented 5 years ago

I just spent a couple minutes grepping through the registry and it looks like we could use HKEY_CURRENT_USER/Software/Blizzard Entertainment/Warcraft III/Preferred Game Version. The value is 0 for ROC and 1 for TFT

I whipped something up quick: https://github.com/dethredic/wc3_race_stat_bot/pull/3 can you test it out and let me know if it works for you?

JFGHT commented 5 years ago

It works perfectly, nice find there.

By the way, I'd check the game client in main and pass it down to the class. Who knows, maybe in a future you need to know which version you are in, for some new features!

dethredic commented 5 years ago

Awesome. I refactored it a bit to put the logic in it's own module so it can be included anywhere.