Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix replay.gateway, add a test for china, and fix the china gateway.

  • Loading branch information...
commit 2b480d46f4bc1b5cc89f4ba9b74f1d9256d41906 1 parent bb34412
@GraylinKim authored
View
2  sc2reader/constants.py
@@ -80,7 +80,7 @@
1:'us',
2:'eu',
3:'kr',
- 5:'ch',
+ 5:'cn',
6:'sea',
98:'xx',
}
View
16 sc2reader/resources.py
@@ -279,14 +279,6 @@ def __init__(self, replay_file, filename=None, load_level=4, **options):
def load_details(self):
if 'replay.initData' in self.raw_data:
initData = self.raw_data['replay.initData']
- if initData.map_data:
- self.gateway = initData.map_data[0].server.lower()
- self.map_hash = initData.map_data[-1].hash
- self.map_file = initData.map_data[-1]
-
- #Expand this special case mapping
- if self.gateway == 'sg':
- self.gateway = 'sea'
if 'replay.attributes.events' in self.raw_data:
# Organize the attribute data to be useful
@@ -307,6 +299,14 @@ def load_details(self):
self.map_name = details.map
+ self.gateway = details.dependencies[0].server.lower()
+ self.map_hash = details.dependencies[-1].hash
+ self.map_file = details.dependencies[-1]
+
+ #Expand this special case mapping
+ if self.gateway == 'sg':
+ self.gateway = 'sea'
+
dependency_hashes = [d.hash for d in details.dependencies]
if hashlib.sha256('Standard Data: Swarm.SC2Mod').hexdigest() in dependency_hashes:
self.expansion = 'HotS'
View
BIN  test_replays/2.0.5.25092/cn1.SC2Replay
Binary file not shown
View
5 test_replays/test_all.py
@@ -247,3 +247,8 @@ def test_WoL_204():
def test_send_resources():
replay = sc2reader.load_replay("test_replays/2.0.4.24944/Backwater Complex (15).SC2Replay")
+def test_cn_replays():
+ replay = sc2reader.load_replay("test_replays/2.0.5.25092/cn1.SC2Replay")
+ assert replay.gateway == 'cn'
+ assert replay.expansion == 'WoL'
+
Please sign in to comment.
Something went wrong with that request. Please try again.