Skip to content

Commit 7bc551e

Browse files
committed
fix for CN
1 parent 44e0f33 commit 7bc551e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sc2reader/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@ class DepotFile(object):
2020
"""
2121

2222
#: The url template for all DepotFiles
23-
url_template = "https://{}-s2-depot.classic.blizzard.com{}/{}.{}"
23+
url_template = "{}://{}-s2-depot.{}/{}.{}"
2424

2525
def __init__(self, bytes):
2626
#: The server the file is hosted on
2727
self.server = bytes[4:8].decode("utf-8").strip("\x00 ")
2828

2929
# Used to make it possible to load maps from CN.
3030
# This isn't needed for any other region and so is blank by default.
31-
self.url_suffix = ""
31+
self.scheme = "https"
32+
self.domain = "classic.blizzard.com"
3233

3334
# There is no SEA depot, use US instead
3435
if self.server == "SEA":
3536
self.server = "US"
3637
elif self.server == "CN":
37-
self.url_suffix = ".cn"
38+
self.scheme = "http"
39+
self.domain = "battlenet.com.cn"
3840

3941
#: The unique content based hash of the file
4042
self.hash = binascii.b2a_hex(bytes[8:]).decode("utf8")
@@ -46,7 +48,7 @@ def __init__(self, bytes):
4648
def url(self):
4749
"""Returns url of the depot file."""
4850
return self.url_template.format(
49-
self.server, self.url_suffix, self.hash, self.type
51+
self.scheme, self.server, self.domain, self.hash, self.type
5052
)
5153

5254
def __hash__(self):

0 commit comments

Comments
 (0)