Skip to content

Commit e251f47

Browse files
committed
clear up region/gateway confusion for s2gs
1 parent 077838f commit e251f47

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

sc2reader/objects.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@ class PlayerSummary():
272272
#: Subregion id of player
273273
subregion = int()
274274

275+
#: The player's gateway, such as us, eu
276+
gateway = str()
277+
278+
#: The player's region, such as na, la, eu or ru. This is
279+
# provided for convenience, but as of 20121018 is strictly a
280+
# function of gateway and subregion.
281+
region = str()
282+
275283
#: unknown1
276284
unknown1 = int()
277285

sc2reader/resources.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def load_translations(self):
781781
self.localization_urls[language] = files
782782

783783
# Grab the gateway from the one of the files
784-
self.region = self.localization_urls.values()[0][0].server
784+
self.gateway = self.localization_urls.values()[0][0].server
785785

786786
# Each of the localization urls points to an XML file with a set of
787787
# localization strings and their unique ids. After reading these mappings
@@ -954,8 +954,9 @@ def load_players(self):
954954
settings = self.player_settings[index]
955955
player.is_ai = not isinstance(struct[0][1], dict)
956956
if not player.is_ai:
957-
player.region = self.region
957+
player.gateway = self.gateway
958958
player.subregion = struct[0][1][0][2]
959+
player.region = REGIONS[player.gateway][player.subregion]
959960
player.bnetid = struct[0][1][0][3]
960961
player.unknown1 = struct[0][1][0]
961962
player.unknown2 = struct[0][1][1]

0 commit comments

Comments
 (0)