Skip to content

Commit 205e46d

Browse files
committed
Updated the extract.py
Thanks to netherh's post I'm now able to parse a lot more about both the players and the lobby :D
1 parent 3eebdaa commit 205e46d

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

extract.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,82 @@
3939
0x4402 : 'Metabolic Boost',
4040

4141
}
42+
lobby_properties = {
43+
3000 : 'game_speed',
44+
2001 : 'game_type', #1v1/2v2/3v3/4v4/5v5/6v6/FFA
45+
3010 : 'unknown1', #yes/no
46+
3006 : 'unknown2', #3/5/7/10/15/20/25/30
47+
1001 : 'unknown3', #yes/no
48+
1000 : 'unknown4', #Dflt
49+
2000 : 'unknown5', #t2/t3/FFA/Cust
50+
3009 : 'lobby_type' #Priv/Pub/Amm (Auto MatchMaking)
51+
52+
}
53+
player_properties = {
54+
500 : 'slot_state', #Clsd/Open/Humn/Comp
55+
3001 : 'race',
56+
3003 : 'energy',
57+
3002 : 'color',
58+
3004 : 'difficulty',
59+
3008 : 'nonplayer_mode' #Obs/Ref
60+
}
4261

4362
def getRealm(str):
4463
if str == '\x00\x00S2':
4564
return "EU"
4665

4766
return "?"
67+
def loadPlayerPropTemplate(prop_struct):
68+
ret = dict()
69+
for prop in prop_struct:
70+
if not prop[0][1] in player_properties:
71+
continue
72+
73+
ret[prop[0][1]] = [o[0] for o in prop[1]]
74+
return ret
75+
def loadLobbyPropTemplate(prop_struct):
76+
ret = dict()
77+
for prop in prop_struct:
78+
if not prop[0][1] in lobby_properties:
79+
continue
80+
ret[prop[0][1]] = [o[0] for o in prop[1]]
81+
return ret
82+
def getLobbyProperties(prop_struct, prop_template):
83+
ret = dict()
84+
for p in prop_struct:
85+
if not p[0][1] in prop_template:
86+
continue
87+
ret[lobby_properties[p[0][1]]] =(
88+
prop_template[p[0][1]][p[1][0]])
89+
return ret
90+
91+
def getLobby(data):
92+
props = loadLobbyPropTemplate(data[0][5])
93+
94+
return {
95+
'properties':getLobbyProperties(data[0][6][6], props)
96+
}
97+
98+
def getPlayerProperties(pindex, prop_struct, prop_template):
99+
ret = dict()
100+
for p in prop_struct:
101+
if not p[0][1] in prop_template:
102+
continue
103+
ret[player_properties[p[0][1]]] =(
104+
prop_template[p[0][1]][p[1][pindex][0]])
105+
return ret
106+
48107
def getPlayers(data):
108+
109+
props = loadPlayerPropTemplate(data[0][5])
110+
49111
players = []
50112
parr = data[0][3]
51113
for i in range(16):
52114
if not (parr[i][0][1] == 0):
53-
players.append(getPlayer(data, i))
115+
player = getPlayer(data, i)
116+
player['properties'] = getPlayerProperties(i, data[0][6][6], props)
117+
players.append(player)
54118

55119
return players
56120
def getIncomeGraph(data, index):
@@ -174,6 +238,8 @@ def main():
174238

175239
if arg == "players":
176240
pprint.PrettyPrinter(indent=2).pprint(getPlayers(data))
241+
elif arg == "lobby":
242+
pprint.PrettyPrinter(indent=2).pprint(getLobby(data))
177243
elif arg == "pprint":
178244
pprint.PrettyPrinter(indent=2).pprint(data)
179245
elif arg == "bo":

0 commit comments

Comments
 (0)