Skip to content

Commit 5eca833

Browse files
committed
Fixed issue 59
1 parent cf65672 commit 5eca833

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

sc2reader/constants.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@
157157

158158
## Names of the different properties found in the s2gs files lobby part
159159
LOBBY_PROPERTY_NAMES = {
160+
1 : 'unknown1', #0001/0002
161+
2 : 'unknown2', #0001/0002
160162
500 : 'Slot type', #Clsd/Open/Humn/Comp
161-
1000 : 'unknown1', #Dflt
163+
1000 : 'unknown3', #Dflt
162164
1001 : 'Melee', #no/yes no->2000, yes->2001
163165
2000 : 'Custom mode', #t2/t3/t4/t5/FFA/Cust (tX = X teams)
164166
2001 : 'Melee mode', #1v1/2v2/3v3/4v4/5v5/6v6/FFA
@@ -177,14 +179,14 @@
177179
2018 : "'Custom' team", #(T1/T2/T3/T4/T5/T6)*5
178180
3000 : 'Game speed', #Slor/Slow/Norm/Fast/Fasr
179181
3001 : 'Race', #Terr/Zerg/Prot/RAND
180-
3002 : 'Color', #tc01/tc02/tc03/tc04/tc05/tc06/tc07/tc08
182+
3002 : 'Color', #tc01/tc02/tc03/tc04/.../tc15
181183
3003 : 'Handicap', #50/60/70/80/90/100
182184
3004 : 'Difficulty', #VyEy/Easy/Medi/Hard/VyHd/Insa
183185
3006 : 'Game countdown', #3/5/7/10/15/20/25/30 (countdown timer in lobby (seconds))
184186
3007 : 'Player mode', #Part/Watch (Participating/Watching) Watch->3008
185187
3008 : 'Spectate mode', #Obs/Ref
186188
3009 : 'Lobby type', #Priv/Pub/Amm
187-
3010 : 'unknown3', #no/yes (Never required)
189+
3010 : 'unknown4', #no/yes (Never required)
188190
}
189191

190192
BUILD_ORDER_UPGRADES = {

sc2reader/resources.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,9 @@ def load_player_info(self):
801801
if not player.teamid in self.teams:
802802
self.team[player.teamid] = list()
803803
self.team[player.teamid].append(player.pid)
804-
self.teams = [self.team[tid] for tid in sorted(self.team.keys())]
804+
805+
# What does this do?
806+
#self.teams = [self.team[tid] for tid in sorted(self.team.keys())]
805807

806808
def load_lobby_properties(self):
807809
#Monster function used to parse lobby properties in GameSummary
@@ -871,8 +873,11 @@ def load_lobby_properties(self):
871873
left_lobby = deque([k for k in defs if defs[k]['lobby_prop']])
872874

873875
lobby_props = dict()
876+
last_success = 0
877+
max = len(left_lobby)
874878
# We cycle through all property values 'til we're done
875-
while len(left_lobby) > 0:
879+
while len(left_lobby) > 0 and not (last_success > max+1):
880+
last_success += 1
876881
propid = left_lobby.popleft()
877882
can_be_parsed = True
878883
active = True
@@ -889,6 +894,7 @@ def load_lobby_properties(self):
889894
# Try parse this later
890895
left_lobby.append(propid)
891896
continue
897+
last_success = 0
892898
if not active:
893899
# Ok, so the reqs weren't fullfilled, don't use this property
894900
continue
@@ -930,8 +936,8 @@ def load_lobby_properties(self):
930936

931937
player_props[pid] = player
932938

933-
self.lobby_props = lobby_props
934-
self.player_props = player_props
939+
self.lobby_properties = lobby_props
940+
self.lobby_player_properties = player_props
935941

936942
def __str__(self):
937943
return "{} - {} {}".format(time.ctime(self.time),self.game_length,

0 commit comments

Comments
 (0)