|
17 | 17 | from sc2reader.data import datapacks |
18 | 18 | from sc2reader.exceptions import SC2ReaderLocalizationError, CorruptTrackerFileError |
19 | 19 | from sc2reader.objects import Participant, Observer, Computer, Team, PlayerSummary, Graph, BuildEntry, MapInfo |
20 | | -from sc2reader.constants import REGIONS, GAME_SPEED_FACTOR, LOBBY_PROPERTIES |
| 20 | +from sc2reader.constants import GAME_SPEED_FACTOR, LOBBY_PROPERTIES |
21 | 21 |
|
22 | 22 |
|
23 | 23 | class Resource(object): |
@@ -120,8 +120,8 @@ class Replay(Resource): |
120 | 120 | #: The :class:`Length` of the replay in real time adjusted for the game speed |
121 | 121 | real_length = None |
122 | 122 |
|
123 | | - #: The gateway the game was played on: us, eu, sea, etc |
124 | | - gateway = str() |
| 123 | + #: The region the game was played on: us, eu, sea, etc |
| 124 | + region = str() |
125 | 125 |
|
126 | 126 | #: An integrated list of all the game events |
127 | 127 | events = list() |
@@ -211,7 +211,7 @@ def __init__(self, replay_file, filename=None, load_level=4, engine=sc2reader.en |
211 | 211 | self.is_private = False |
212 | 212 | self.map = None |
213 | 213 | self.map_hash = "" |
214 | | - self.gateway = "" |
| 214 | + self.region = "" |
215 | 215 | self.events = list() |
216 | 216 | self.teams, self.team = list(), dict() |
217 | 217 |
|
@@ -329,13 +329,13 @@ def load_details(self): |
329 | 329 |
|
330 | 330 | self.map_name = details['map_name'] |
331 | 331 |
|
332 | | - self.gateway = details['cache_handles'][0].server.lower() |
| 332 | + self.region = details['cache_handles'][0].server.lower() |
333 | 333 | self.map_hash = details['cache_handles'][-1].hash |
334 | 334 | self.map_file = details['cache_handles'][-1] |
335 | 335 |
|
336 | 336 | #Expand this special case mapping |
337 | | - if self.gateway == 'sg': |
338 | | - self.gateway = 'sea' |
| 337 | + if self.region == 'sg': |
| 338 | + self.region = 'sea' |
339 | 339 |
|
340 | 340 | dependency_hashes = [d.hash for d in details['cache_handles']] |
341 | 341 | if hashlib.sha256('Standard Data: Swarm.SC2Mod'.encode('utf8')).hexdigest() in dependency_hashes: |
@@ -467,7 +467,7 @@ def get_team(team_id): |
467 | 467 | self.recorder = None |
468 | 468 |
|
469 | 469 | entity_names = sorted(map(lambda p: p.name, self.entities)) |
470 | | - hash_input = self.gateway+":"+','.join(entity_names) |
| 470 | + hash_input = self.region+":"+','.join(entity_names) |
471 | 471 | self.people_hash = hashlib.sha256(hash_input.encode('utf8')).hexdigest() |
472 | 472 |
|
473 | 473 | # The presence of observers and/or computer players makes this not actually ladder |
@@ -616,17 +616,17 @@ class Map(Resource): |
616 | 616 | #: The map description as written by author |
617 | 617 | description = str() |
618 | 618 |
|
619 | | - def __init__(self, map_file, filename=None, gateway=None, map_hash=None, **options): |
| 619 | + def __init__(self, map_file, filename=None, region=None, map_hash=None, **options): |
620 | 620 | super(Map, self).__init__(map_file, filename, **options) |
621 | 621 |
|
622 | 622 | #: The unique hash used to identify this map on bnet's depots. |
623 | 623 | self.hash = map_hash |
624 | 624 |
|
625 | | - #: The gateway this map was posted to. Maps must be posted individually to each gateway. |
626 | | - self.gateway = gateway |
| 625 | + #: The region this map was posted to. Maps must be posted individually to each region. |
| 626 | + self.region = region |
627 | 627 |
|
628 | 628 | #: A URL reference to the location of this map on bnet's depots. |
629 | | - self.url = Map.get_url(gateway, map_hash) |
| 629 | + self.url = Map.get_url(self.region, map_hash) |
630 | 630 |
|
631 | 631 | #: The opened MPQArchive for this map |
632 | 632 | self.archive = mpyq.MPQArchive(map_file) |
@@ -672,12 +672,12 @@ def __init__(self, map_file, filename=None, gateway=None, map_hash=None, **optio |
672 | 672 | self.dependencies.append(dependency_node.text) |
673 | 673 |
|
674 | 674 | @classmethod |
675 | | - def get_url(cls, gateway, map_hash): |
| 675 | + def get_url(cls, region, map_hash): |
676 | 676 | """Builds a download URL for the map from its components.""" |
677 | | - if gateway and map_hash: |
| 677 | + if region and map_hash: |
678 | 678 | # it seems like sea maps are stored on us depots. |
679 | | - gateway = 'us' if gateway == 'sea' else gateway |
680 | | - return cls.url_template.format(gateway, map_hash) |
| 679 | + region = 'us' if region == 'sea' else region |
| 680 | + return cls.url_template.format(region, map_hash) |
681 | 681 | else: |
682 | 682 | return None |
683 | 683 |
|
@@ -837,8 +837,8 @@ def load_translations(self): |
837 | 837 | files.append(utils.DepotFile(file_hash)) |
838 | 838 | self.localization_urls[language] = files |
839 | 839 |
|
840 | | - # Grab the gateway from the one of the files |
841 | | - self.gateway = list(self.localization_urls.values())[0][0].server.lower() |
| 840 | + # Grab the region from the one of the files |
| 841 | + self.region = list(self.localization_urls.values())[0][0].server.lower() |
842 | 842 |
|
843 | 843 | # Each of the localization urls points to an XML file with a set of |
844 | 844 | # localization strings and their unique ids. After reading these mappings |
@@ -1008,9 +1008,9 @@ def load_players(self): |
1008 | 1008 | settings = self.player_settings[index] |
1009 | 1009 | player.is_ai = not isinstance(struct[0][1], dict) |
1010 | 1010 | if not player.is_ai: |
1011 | | - player.gateway = self.gateway |
| 1011 | + player.region = self.region |
1012 | 1012 | player.subregion = struct[0][1][0][2] |
1013 | | - player.region = REGIONS[player.gateway].get(player.subregion, 'Unknown') |
| 1013 | + player.region = REGIONS[player.region].get(player.subregion, 'Unknown') |
1014 | 1014 | player.bnetid = struct[0][1][0][3] |
1015 | 1015 | player.unknown1 = struct[0][1][0] |
1016 | 1016 | player.unknown2 = struct[0][1][1] |
|
0 commit comments