@@ -914,8 +914,6 @@ def __getstate__(self):
914
914
915
915
916
916
class Map (Resource ):
917
- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2ma"
918
-
919
917
def __init__ (self , map_file , filename = None , region = None , map_hash = None , ** options ):
920
918
super (Map , self ).__init__ (map_file , filename , ** options )
921
919
@@ -998,9 +996,7 @@ def __init__(self, map_file, filename=None, region=None, map_hash=None, **option
998
996
def get_url (cls , region , map_hash ):
999
997
"""Builds a download URL for the map from its components."""
1000
998
if region and map_hash :
1001
- # it seems like sea maps are stored on us depots.
1002
- region = "us" if region == "sea" else region
1003
- return cls .url_template .format (region , map_hash )
999
+ return utils .get_resource_url (region , hash , "s2ma" )
1004
1000
else :
1005
1001
return None
1006
1002
@@ -1021,8 +1017,6 @@ class GameSummary(Resource):
1021
1017
that the data is not necessarily in the places we expect.
1022
1018
"""
1023
1019
1024
- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2gs"
1025
-
1026
1020
#: Game speed
1027
1021
game_speed = str ()
1028
1022
@@ -1450,10 +1444,6 @@ def __str__(self):
1450
1444
class MapHeader (Resource ):
1451
1445
"""**Experimental**"""
1452
1446
1453
- base_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.{}"
1454
- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mh"
1455
- image_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mv"
1456
-
1457
1447
#: The name of the map
1458
1448
name = str ()
1459
1449
@@ -1488,21 +1478,21 @@ def __init__(self, header_file, filename=None, **options):
1488
1478
# Parse image hash
1489
1479
parsed_hash = utils .parse_hash (self .data [0 ][1 ])
1490
1480
self .image_hash = parsed_hash ["hash" ]
1491
- self .image_url = self . image_url_template . format (
1492
- parsed_hash ["server" ], parsed_hash ["hash" ]
1481
+ self .image_url = utils . get_resource_url (
1482
+ parsed_hash ["server" ], parsed_hash ["hash" ], "s2mv"
1493
1483
)
1494
1484
1495
1485
# Parse map hash
1496
1486
parsed_hash = utils .parse_hash (self .data [0 ][2 ])
1497
1487
self .map_hash = parsed_hash ["hash" ]
1498
- self .map_url = self . base_url_template . format (
1488
+ self .map_url = utils . get_resource_url (
1499
1489
parsed_hash ["server" ], parsed_hash ["hash" ], parsed_hash ["type" ]
1500
1490
)
1501
1491
1502
1492
# Parse localization hashes
1503
1493
l18n_struct = self .data [0 ][4 ][8 ]
1504
1494
for l in l18n_struct :
1505
1495
parsed_hash = utils .parse_hash (l [1 ][0 ])
1506
- self .localization_urls [l [0 ]] = self . base_url_template . format (
1496
+ self .localization_urls [l [0 ]] = utils . get_resource_url (
1507
1497
parsed_hash ["server" ], parsed_hash ["hash" ], parsed_hash ["type" ]
1508
1498
)
0 commit comments