Esempio n. 1
0
    def __init__(self, header_file, filename=None, **options):
        super(MapHeader, self).__init__(header_file, filename, **options)
        self.data = BitPackedDecoder(header_file).read_struct()

        # Name
        self.name = self.data[0][1]

        # Blizzard
        self.blizzard = (self.data[0][11] == 'BLIZ')

        # Parse image hash
        parsed_hash = utils.parse_hash(self.data[0][1])
        self.image_hash = parsed_hash['hash']
        self.image_url = self.image_url_template.format(
            parsed_hash['server'], parsed_hash['hash'])

        # Parse map hash
        parsed_hash = utils.parse_hash(self.data[0][2])
        self.map_hash = parsed_hash['hash']
        self.map_url = self.base_url_template.format(parsed_hash['server'],
                                                     parsed_hash['hash'],
                                                     parsed_hash['type'])

        # Parse localization hashes
        l18n_struct = self.data[0][4][8]
        for l in l18n_struct:
            parsed_hash = utils.parse_hash(l[1][0])
            self.localization_urls[l[0]] = self.base_url_template.format(
                parsed_hash['server'], parsed_hash['hash'],
                parsed_hash['type'])
Esempio n. 2
0
    def __init__(self, header_file, filename=None, **options):
        super(MapHeader, self).__init__(header_file, filename, **options)
        self.data = BitPackedDecoder(header_file).read_struct()

        # Name
        self.name = self.data[0][1]

        # Blizzard
        self.blizzard = (self.data[0][11] == 'BLIZ')

        # Parse image hash
        parsed_hash = utils.parse_hash(self.data[0][1])
        self.image_hash = parsed_hash['hash']
        self.image_url = self.image_url_template.format(parsed_hash['server'], parsed_hash['hash'])

        # Parse map hash
        parsed_hash = utils.parse_hash(self.data[0][2])
        self.map_hash = parsed_hash['hash']
        self.map_url = self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type'])

        # Parse localization hashes
        l18n_struct = self.data[0][4][8]
        for l in l18n_struct:
            parsed_hash = utils.parse_hash(l[1][0])
            self.localization_urls[l[0]] = self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type'])
Esempio n. 3
0
 def __init__(self, info_file, filename=None, **options):
     super(MapInfo, self).__init__(info_file, filename, **options)
     self.data = BitPackedDecoder(info_file).read_struct()
     self.map_name = self.data[0][7]
     self.language = self.data[0][13]
     parsed_hash = utils.parse_hash(self.data[0][1])
     self.s2mh_hash =  parsed_hash['hash']
     self.s2mh_url = MapHeader.url_template.format(parsed_hash['server'], self.s2mh_hash)
Esempio n. 4
0
    def load_map_data(self):
        # Parse map localization data
        for l in self.parts[0][6][8]:
            lang = l[0]
            urls = list()
            for hash in l[1]:
                parsed_hash = utils.parse_hash(hash)
                if not parsed_hash['server']:
                    continue
                urls.append(self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type']))

            self.localization_urls[lang] = urls

        # Parse map images
        for hash in self.parts[0][6][7]:
            parsed_hash = utils.parse_hash(hash)
            self.image_urls.append(self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type']))
Esempio n. 5
0
 def __init__(self, info_file, filename=None, **options):
     super(MapInfo, self).__init__(info_file, filename, **options)
     self.data = BitPackedDecoder(info_file).read_struct()
     self.map_name = self.data[0][7]
     self.language = self.data[0][13]
     parsed_hash = utils.parse_hash(self.data[0][1])
     self.s2mh_hash =  parsed_hash['hash']
     self.s2mh_url = MapHeader.url_template.format(parsed_hash['server'], self.s2mh_hash)
Esempio n. 6
0
    def load_map_data(self):
        # Parse map localization data
        for l in self.parts[0][6][8]:
            lang = l[0]
            urls = list()
            for hash in l[1]:
                parsed_hash = utils.parse_hash(hash)
                if not parsed_hash['server']:
                    continue
                urls.append(
                    self.base_url_template.format(parsed_hash['server'],
                                                  parsed_hash['hash'],
                                                  parsed_hash['type']))

            self.localization_urls[lang] = urls

        # Parse map images
        for hash in self.parts[0][6][7]:
            parsed_hash = utils.parse_hash(hash)
            self.image_urls.append(
                self.base_url_template.format(parsed_hash['server'],
                                              parsed_hash['hash'],
                                              parsed_hash['type']))