コード例 #1
0
 def __load_extra(self):
     self.SHINKAI_EXTRA = jsonFile2dic(DB_PATH + SHINKAI_EXTRA_JSON)
     wikia_data = jsonFile2dic(DB_PATH + WIKIA_OUTPUT_JSON)
     for _id, value in wikia_data.items():
         if _id not in self.SHINKAI_EXTRA:
             self.SHINKAI_EXTRA[_id] = {}
         self.SHINKAI_EXTRA[_id].update(value)
コード例 #2
0
    def __init__(self):
        self.shipclass_data = {}
        self.CLASS_ID_NAME_MAP = {}

        self.SHIP_CLASSES_DB = jsonFile2dic(DB_PATH + SHIP_CLASSES_DB +
                                            '.json',
                                            masterKey='id')
        self.SHIPS_DB = jsonFile2dic(DB_PATH + SHIPS_DB + '.json',
                                     masterKey='id')
コード例 #3
0
 def __init__(self):
     super().__init__()
     self.items_id_map = {}
     self.items_data = {}
     self.ships_data = {}
     self.SHINKAI_EXTRA = {}
     self.SLOTITEMS_KCDATA = jsonFile2dic(DB_PATH +
                                          KCDATA_SLOTITEM_ALL_JSON,
                                          masterKey='id')
     self.SHIPS_KCDATA = jsonFile2dic(DB_PATH + KCDATA_SHIP_ALL_JSON,
                                      masterKey='id')
コード例 #4
0
 def __load_ship_types(self):
     SHIP_TYPES = jsonFile2dic(DB_PATH + SHIP_TYPES_DB + '.json', masterKey='id')
     SHIP_TYPE_COLLECTIONS = jsonFile2dic(DB_PATH + SHIP_TYPE_COLLECTIONS_DB + '.json', masterKey='id')
     for collections in SHIP_TYPE_COLLECTIONS.values():
         types = collections['types']
         for _type in types:
             if type(_type) is list:
                 for _t in _type:
                     self.SHIP_TYPES_DB[_t] = SHIP_TYPES[_type[0]]['name']['zh_cn']
             else:
                 self.SHIP_TYPES_DB[_type] = SHIP_TYPES[_type]['name']['zh_cn']
コード例 #5
0
    async def start(self):
        self.items = utils.jsonFile2dic(DB_PATH + 'items.json', masterKey='id')
        akashi_json = {
            'week': ['日', '月', '火', '水', '木', '金', '土'],
            # 从11星开始
            'pre_star': [
                '(5,6)', '(6,6)', '(6,7)', '(7,7)', '(7,8)', '(8,8)', '(8,9)',
                '(9,9)', '(9,10)', '(10×2)', '(7×3)', '(7,7,8)', '(7,8,8)',
                '(8×3)', '(8,8,9)', '(8,9,9)', '(9×3)', '(9,9,10)',
                '(9,10,10)', '(10×3)', '(7,8×3)', '(8×4)', '(8×3,9)',
                '(8,9)×2', '(8,9×3)', '(9×4)', '(9×3,10)', '(9,10)×2',
                '(9,10×3)', '(10×4)'
            ]
        }

        id_list = await self.get_weaponlist()

        print('Akashi-List: Total {} items.'.format(len(id_list)))
        tasks = []
        for weapon_id in id_list:
            tasks.append(asyncio.ensure_future(self.get_detail(weapon_id)))
        self.weapon_list = {}
        dones, pendings = await asyncio.wait(tasks)
        for task in dones:
            detail = task.result()
            if not detail:
                continue
            wp_id = int(detail['id'])
            self.weapon_list[wp_id] = detail
        print('Akashi-List: {} done, {} pendings.'.format(
            len(dones), len(pendings)))
        akashi_json['items'] = self.weapon_list
        with open(OUPUT_PATH + JSON_PATH + AKASHI_LIST_OUTPUT_JSON,
                  'w',
                  encoding='utf_8') as fjson:
            json.dump(akashi_json,
                      fjson,
                      ensure_ascii=False,
                      indent=2,
                      sort_keys=True)
        weapon_list = OrderedDict()
        for item_id, item_info in sorted(self.weapon_list.items()):
            weapon_list[item_id] = item_info
        self.weapon_list = weapon_list
        lua_table = self.gen_luatable()
        with open(OUPUT_PATH + LUATABLE_PATH + AKASHI_LIST_OUTPUT_LUA,
                  'w',
                  encoding='utf-8') as flua:
            flua.write(lua_table)
コード例 #6
0
    def __init__(self):
        self.ships_data = {}
        self.items_data = {}

        self.SHIP_REMODEL_EXTRA = jsonFile2dic(DB_PATH + SHIP_REMODEL_EXTRA)
        self.ITEM_REMARKS_EXTRA = jsonFile2dic(DB_PATH + ITEM_REMARKS_EXTRA)

        self.SHIPS_KCDATA = jsonFile2dic(DB_PATH + KCDATA_SHIP_ALL_JSON, masterKey='id')
        self.SLOTITEMS_KCDATA = jsonFile2dic(DB_PATH + KCDATA_SLOTITEM_ALL_JSON, masterKey='id')
        self.SHIPS_DB = jsonFile2dic(DB_PATH + SHIPS_DB + '.json', masterKey='id')
        self.ITEMS_DB = jsonFile2dic(DB_PATH + ITEMS_DB + '.json', masterKey='id')
        self.ITEM_TYPES_DB = jsonFile2dic(DB_PATH + ITEM_TYPES_DB + '.json', masterKey='id')
        self.SHIP_NAMESUFFIX_DB = jsonFile2dic(DB_PATH + SHIP_NAMESUFFIX_DB + '.json', masterKey='id')
        self.SHIP_CLASSES_DB = jsonFile2dic(DB_PATH + SHIP_CLASSES_DB + '.json', masterKey='id')
        self.SHIP_SERIES_DB = jsonFile2dic(DB_PATH + SHIP_SERIES_DB + '.json', masterKey='id')
        self.ENTITIES_DB = jsonFile2dic(DB_PATH + ENTITIES_DB + '.json', masterKey='id')
        self.BONUS = jsonFile2dic(DB_PATH + BONUS_JSON)

        self.ITEM_LINKS = {}
        self.SHIP_TYPES_DB = {}