@@ -27,38 +27,106 @@ def __call__(self, data, replay):
2727 init_data = dict ( #58
2828 player_init_data = [dict ( #38
2929 name = data .read_aligned_bytes (data .read_uint8 ()),
30+ clan_tag = None ,
31+ highest_league = None ,
32+ combined_race_levels = None ,
3033 random_seed = data .read_uint32 (),
3134 race_preference = data .read_uint8 () if data .read_bool () else None , #38
3235 team_preference = data .read_uint8 () if data .read_bool () else None , #39
3336 test_map = data .read_bool (),
3437 test_auto = data .read_bool (),
3538 examine = data .read_bool (),
39+ custom_interface = None ,
3640 observe = data .read_bits (2 ),
3741 ) for i in range (data .read_bits (5 ))
3842 ],
43+
44+ game_description = dict ( # 48
45+ random_value = None ,
46+ game_cache_name = None ,
47+ game_options = dict ( #40
48+ lock_teams = None ,
49+ teams_together = None ,
50+ advanced_shared_control = None ,
51+ random_races = None ,
52+ battle_net = None ,
53+ amm = None ,
54+ competitive = None ,
55+ no_victory_or_defeat = None ,
56+ fog = None ,
57+ observers = None ,
58+ user_difficulty = None ,
59+ client_debug_flags = None ,
60+ ),
61+ game_speed = None ,
62+ game_type = None ,
63+ max_users = None ,
64+ max_observers = None ,
65+ max_players = None ,
66+ max_teams = None ,
67+ max_colors = None ,
68+ max_races = None ,
69+ max_controls = None ,
70+ map_size_x = None ,
71+ map_size_y = None ,
72+ map_file_sync_checksum = None ,
73+ map_file_name = None ,
74+ map_author_name = None ,
75+ mod_file_sync_checksum = None ,
76+ slot_descriptions = [dict ( #47
77+ allowed_colors = None ,
78+ allowed_races = None ,
79+ allowedDifficulty = None ,
80+ allowedControls = None ,
81+ allowed_observe_types = None ,
82+ allowed_ai_builds = None ,
83+ ) for i in range (0 )],
84+ default_difficulty = None ,
85+ default_AI_build = None ,
86+ cache_handles = [],
87+ is_blizzardMap = None ,
88+ is_premade_ffa = None ,
89+ is_coop_mode = None ,
90+ ),
91+
92+ lobby_state = dict ( #56
93+ phase = None ,
94+ max_users = None ,
95+ max_observers = None ,
96+ slots = [dict ( #54
97+ control = None ,
98+ user_id = None ,
99+ team_id = None ,
100+ colorPref = None ,
101+ race_pref = None ,
102+ difficulty = None ,
103+ ai_build = None ,
104+ handicap = None ,
105+ observe = None ,
106+ working_set_slot_id = None ,
107+ rewards = [],
108+ toon_handle = None ,
109+ licenses = [],
110+ ) for i in range (0 )], # 58
111+ random_seed = None ,
112+ host_user_id = None ,
113+ is_single_player = None ,
114+ game_duration = None ,
115+ default_difficulty = None ,
116+ default_ai_build = 0 ,
117+ ),
39118 )
40119
41120 distance = data .read_range (data .tell (), data .length ).find ('s2ma' )
42121 data .read_aligned_bytes (distance )
43122
44- # The final block of this file that we concern ourselves with is a list
45- # of what appears to be map data with the s2ma header on each element.
46- # Each element consists of two unknown bytes, a realm id (e.g EU or US)
47- # and a map hash which probably ties back to the sc2map files.
48- #
49- # Some replays don't seem to have a maps section at all, now we can't
50- # know what gateway its from? Very strange...
51- #
52- # TODO: Figure out how we could be missing a maps section.
53123 map_data = list ()
54124 while data .peek (4 ) == 's2ma' :
55- map_data .append (DepotFile (data .read_aligned_bytes (40 )))
125+ depot_file = DepotFile (data .read_aligned_bytes (40 ))
126+ init_data ['game_description' ]['cache_handles' ].append (depot_file )
56127
57- return AttributeDict (
58- map_data = map_data ,
59- player_names = [d ['name' ] for d in init_data ['player_init_data' ] if d ['name' ]],
60- sc_account_id = None ,#sc_account_id,
61- )
128+ init_data .setdefault ('game_description' ,dict ())['cache_handles' ] = map_data
129+ return init_data
62130
63131class InitDataReader_23260 (Reader ):
64132
@@ -68,12 +136,16 @@ def __call__(self, data, replay):
68136 init_data = dict ( #58
69137 player_init_data = [dict ( #38
70138 name = data .read_aligned_bytes (data .read_uint8 ()),
139+ clan_tag = None ,
140+ highest_league = None ,
141+ combined_race_levels = None ,
71142 random_seed = data .read_uint32 (),
72143 race_preference = data .read_uint8 () if data .read_bool () else None , #38
73144 team_preference = data .read_uint8 () if data .read_bool () else None , #39
74145 test_map = data .read_bool (),
75146 test_auto = data .read_bool (),
76147 examine = data .read_bool (),
148+ custom_interface = None ,
77149 observe = data .read_bits (2 ),
78150 ) for i in range (data .read_bits (5 ))
79151 ],
@@ -116,13 +188,16 @@ def __call__(self, data, replay):
116188 allowedDifficulty = data .read_bits (data .read_bits (6 )),
117189 allowedControls = data .read_bits (data .read_uint8 ()),
118190 allowed_observe_types = data .read_bits (data .read_bits (2 )),
191+ allowed_ai_builds = None
119192 ) for i in range (data .read_bits (5 ))],
120193 default_difficulty = data .read_bits (6 ),
194+ default_AI_build = None ,
121195 cache_handles = [
122196 DepotFile (data .read_aligned_bytes (40 )) for i in range (data .read_bits (6 ))
123197 ],
124198 is_blizzardMap = data .read_bool (),
125199 is_premade_ffa = data .read_bool (),
200+ is_coop_mode = None ,
126201 ),
127202
128203 lobby_state = dict ( #56
@@ -136,8 +211,10 @@ def __call__(self, data, replay):
136211 colorPref = data .read_bits (5 ) if data .read_bool () else None ,
137212 race_pref = data .read_uint8 () if data .read_bool () else None ,
138213 difficulty = data .read_bits (6 ),
214+ ai_build = None ,
139215 handicap = data .read_bits (7 ),
140216 observe = data .read_bits (2 ),
217+ working_set_slot_id = None ,
141218 rewards = [data .read_uint32 () for i in range (data .read_bits (5 ))], # 52
142219 toon_handle = data .read_aligned_bytes (data .read_bits (7 )), # 14
143220 licenses = [data .read_uint32 () for i in range (data .read_bits (9 ))], # 53
@@ -147,14 +224,11 @@ def __call__(self, data, replay):
147224 is_single_player = data .read_bool (), # 27
148225 game_duration = data .read_uint32 (), # 4
149226 default_difficulty = data .read_bits (6 ), # 1
227+ default_ai_build = 0
150228 ),
151229 )
152230
153- return AttributeDict (
154- map_data = init_data ['game_description' ]['cache_handles' ],
155- player_names = [d ['name' ] for d in init_data ['player_init_data' ] if d ['name' ]],
156- sc_account_id = None ,#sc_account_id,
157- )
231+ return init_data
158232
159233class InitDataReader_24764 (InitDataReader_Base ):
160234
@@ -255,11 +329,8 @@ def __call__(self, data, replay):
255329 default_ai_build = data .read_bits (7 ), # 0
256330 ),
257331 )
258- return AttributeDict (
259- map_data = init_data ['game_description' ]['cache_handles' ],
260- player_names = [d ['name' ] for d in init_data ['player_init_data' ] if d ['name' ]],
261- sc_account_id = None ,#sc_account_id,
262- )
332+
333+ return init_data
263334
264335
265336class AttributesEventsReader_Base (Reader ):
0 commit comments