Closed imkindaprogrammermyself closed 2 years ago
I'll check it a bit later.
I think they added something new for player info.
def create_or_update_players(self, players_info):
for player_info in players_info:
player_dict = self._convert_to_dict(player_info)
self._players.setdefault(player_dict['id'], {}).update(player_dict)
self._players.setdefault(player_dict['id'], {}).update(player_dict)
will throw KeyError
since it can't find id
in player_dict
.
Printed some value and got this {'invitationsEnabled': 402720456, 'prebattleId': 0, 'realm': 268562699}
which doesn't make sense. invitationsEnabled
should be the id
and realm
shouldn't be that number. Did they add a new property for the player?
def onArenaStateReceived(self, avatar, arenaUniqueId, teamBuildTypeId, preBattlesInfo, playersStates,
observersState, buildingsInfo):
self._arena_id = arenaUniqueId
self._players.create_or_update_players(pickle.loads(playersStates))
This one throws an UnicodeDecodeError
error but adding encoding='latin1'
fixes it.
This could be the new mapping.
id_property_map = {0: 'accountDBID', 1: 'antiAbuseEnabled', 2: 'avatarId', 3: 'camouflageInfo', 4: 'clanColor',
5: 'clanID', 6: 'clanTag', 7: 'crewParams', 8: 'dogTag', 9: 'fragsCount', 10: 'friendlyFireEnabled',
11: 'id', 12: 'invitationsEnabled', 13: 'isAbuser', 14: 'isAlive', 15: 'isBot', 16: 'isClientLoaded',
17: 'isConnected', 18: 'isHidden', 19: 'isLeaver', 20: 'isPreBattleOwner', 21: 'isTShooter',
22: 'killedBuildingsCount', 23: 'maxHealth', 24: 'name', 25: 'playerMode', 26: 'preBattleIdOnStart',
27: 'preBattleSign', 28: 'prebattleId', 29: 'realm', 30: 'shipComponents', 31: 'shipConfigDump',
32: 'shipId', 33: 'shipParamsId', 34: 'skinId', 35: 'teamId', 36: 'ttkStatus'}
I checked and it aligns perfectly fine.
Wg updates that constants dict regulary.
Here's original one:
>>> BWPersonality.PlayersInfo.gSharedPInfo.numMemberMap {0: 'accountDBID', 1: 'antiAbuseEnabled', 2: 'avatarId', 3: 'camouflageInfo', 4: 'clanColor', 5: 'clanID', 6: 'clanTag', 7: 'crewParams', 8: 'dogTag', 9: 'fragsCount', 10: 'friendlyFireEnabled', 11: 'id', 12: 'invitationsEnabled', 13: 'isAbuser', 14: 'isAlive', 15: 'isBot', 16: 'isClientLoaded', 17: 'isConnected', 18: 'isHidden', 19: 'isLeaver', 20: 'isPreBattleOwner', 21: 'isTShooter', 22: 'killedBuildingsCount', 23: 'maxHealth', 24: 'name', 25: 'playerMode', 26: 'preBattleIdOnStart', 27: 'preBattleSign', 28: 'prebattleId', 29: 'realm', 30: 'shipComponents', 31: 'shipConfigDump', 32: 'shipId', 33: 'shipParamsId', 34: 'skinId', 35: 'teamId', 36: 'ttkStatus'}
Regarding UnicodeDecodeError... most likely we got this issue because wot/wows still uses python2 and parser works on python3. Maybe the right solution would be to set encoding='bytes' and decode only those values which are really test, but let's keep latin1 while it works.
Thanks for investigation.
It seems the data is shifted again, probably just like the last time but I can't find what's causing it.