class TeamStarAwakePartData(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("teamStarAwakePart").get_all_data() print(self.config) def all_config(self): test_data = [] for k, v in self.config.items(): test_data.append(self.copy_key_to_value(k, v)) return test_data def get_attr(self): test_data = [] teamStarAwakeIndex = CommonLoad("teamStarAwakeIndex").get_all_data() for k, v in self.config.items(): awake = False if teamStarAwakeIndex[k[1:][:-3]].get("isAwake"): awake = True test_data.append([self.copy_key_to_value(k, v), awake]) return test_data def get_key_nums(self): all_key_nums = len(list(self.config.keys())) return [all_key_nums] def get_cost(self): test_data = [] tool = CommonLoad("tool").get_all_data().keys() for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), tool]) return test_data def get_nums_eq_6(self): test_data = [] tmp_key = [] for k, v in self.config.items(): id_last = k[-1] id_first = k[:-3] if f"{id_first}_{id_last}" not in tmp_key: tmp_key.append(f"{id_first}_{id_last}") for k in tmp_key: tmp_dict = {} for index in range(1, 7): key = k.replace("_", f"{index}0") tmp_dict[key] = { "score": self.config[key]['score'], "cost": self.config[key]['cost'] } test_data.append({k: tmp_dict}) return test_data def get_in_lang_data(self): test_data = [] lang = CommonLoad("lang").get_all_data().keys() for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), lang]) return test_data
class ToolGiftData(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("toolGift").get_all_data() def get_all_data(self): test_data = [] for k, v in self.config.items(): test_data.append(self.copy_key_to_value(k, v)) return test_data def in_tool(self): test_data = [] tool = CommonLoad("tool").get_all_data().keys() for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), tool]) return test_data def reward(self): test_data = [] static = [] tool = CommonLoad("tool").get_all_data().keys() static_json = CommonLoad("static").get_all_data() avatarFrame = CommonLoad("avatarFrame").get_all_data().keys() for k, v in static_json.items(): static.append(v["name"]) for k, v in self.config.items(): test_data.append( [self.copy_key_to_value(k, v), tool, static, avatarFrame]) return test_data
class tmHandsel(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("tmHandsel").get_all_data() def tmHandsel_data(self): tmHandsel_list = [] for k, v in self.config.items(): tmHandsel_list.append(self.copy_key_to_value(k, v)) return tmHandsel_list def speak_in_lang(self): lang = CommonLoad("lang").get_all_data().keys() tmHandsel_list = [] for k, v in self.config.items(): tmHandsel_list.append([self.copy_key_to_value(k, v), lang]) return tmHandsel_list def fool_in_tmProduct(self): tmProduct = CommonLoad("tmProduct").get_all_data().keys() tmHandsel_list = [] for k, v in self.config.items(): tmHandsel_list.append([self.copy_key_to_value(k, v), tmProduct]) return tmHandsel_list def reward_in_tool(self): tool = CommonLoad("tool").get_all_data().keys() tmHandsel_list = [] for k, v in self.config.items(): tmHandsel_list.append([self.copy_key_to_value(k, v), tool]) return tmHandsel_list
class TeamStarAwakeIndexData(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("teamStarAwakeIndex").get_all_data() def all_config(self): test_data = [] for k, v in self.config.items(): test_data.append(self.copy_key_to_value(k, v)) return test_data def is_awake_data(self): test_data = [] team = CommonLoad("team").get_all_data() for k, v in self.config.items(): if v.get("isAwake"): test_data.append([self.copy_key_to_value(k, v), team]) return test_data def get_main_id(self): test_data = [] _main_id = {} teamStarAwakeMain = CommonLoad( "teamStarAwakeMain").get_all_data().keys() for _id in teamStarAwakeMain: _main_id[_id[:-2]] = _main_id.get(_id[:-2], 0) + 1 for k, v in self.config.items(): test_data.append( [self.copy_key_to_value(k, v), teamStarAwakeMain, _main_id]) return test_data def get_part_data(self): test_data = [] _part_id = {} teamStarAwakePart = CommonLoad( "teamStarAwakePart").get_all_data().keys() for _id in teamStarAwakePart: _part_id[_id[:-2]] = _part_id.get(_id[:-2], 0) + 1 for k, v in self.config.items(): test_data.append( [self.copy_key_to_value(k, v), teamStarAwakePart, _part_id]) return test_data def get_in_lang_data(self): test_data = [] lang = CommonLoad("lang").get_all_data().keys() for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), lang]) return test_data
def get_diagramId_cost(self): test_data = [] config = CommonLoad("battleDiagram").get_all_data() print(config) for k, v in config.items(): if v.get("diagramId") and v.get("ecpend2"): diagramId = int(v["diagramId"]) if 1001 <= diagramId <= 3024 or 4001 <= diagramId <= 4030: test_data.append(self.copy_key_to_value(k, v)) return test_data
class TitleData(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("title").get_all_data() def get_id_key(self): key_data = [] for k, v in self.config.items(): key_data.append(self.copy_key_to_value(k, v)) return key_data
class europeTeamAltarConfig_data(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("europeTeamAltarConfig").get_all_data() def card_in_team(self): team = CommonLoad("team").get_all_data().items() key_data = [] for k, v in self.config.items(): key_data.append([self.copy_key_to_value(k, v), team]) return key_data
class shopArena_data(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("shopArena").get_all_data() def num_test(self): key_data = [] for k, v in self.config.items(): key_data.append(self.copy_key_to_value(k, v)) return key_data def key_in_tool(self): tool = CommonLoad("tool").get_all_data().keys() key_data = [] for k, v in self.config.items(): key_data.append([self.copy_key_to_value(k, v), tool]) return key_data def costType_in_static(self): static = CommonLoad("static").get_all_data().values() key_data = [] static_list = [] for _v in static: static_list.append(_v['name']) for k, v in self.config.items(): key_data.append([self.copy_key_to_value(k, v), static_list]) return key_data def grid_in_setting(self): setting = CommonLoad("setting").get_all_data() key_data = [] for k, v in self.config.items(): key_data.append([self.copy_key_to_value(k, v), setting]) return key_data def level_in_setting(self): key_data = [] for k, v in self.config.items(): key_data.append(self.copy_key_to_value(k, v)) return key_data
def reward(self): test_data = [] static = [] tool = CommonLoad("tool").get_all_data().keys() static_json = CommonLoad("static").get_all_data() avatarFrame = CommonLoad("avatarFrame").get_all_data().keys() for k, v in static_json.items(): static.append(v["name"]) for k, v in self.config.items(): test_data.append( [self.copy_key_to_value(k, v), tool, static, avatarFrame]) return test_data
class RuneData(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("rune").get_all_data() def get_rune_data(self): test_data = [] for k, v in self.config.items(): test_data.append(self.copy_key_to_value(k, v)) return test_data def in_lang(self): lang_data = CommonLoad("lang").get_all_data().keys() test_data = [] for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), lang_data]) return test_data def in_attr(self): runeAtt_data = CommonLoad("runeAtt").get_all_data().keys() test_data = [] for k, v in self.config.items(): if k[0] == "9": continue test_data.append([self.copy_key_to_value(k, v), runeAtt_data]) return test_data def long_key_quality(self): test_data = [] for k, v in self.config.items(): if len(k) > 5: test_data.append(self.copy_key_to_value(k, v)) return test_data def castData(self): test_data = [] for k, v in self.config.items(): if k[0] != "9" and k[0:3] != "401": test_data.append( [self.copy_key_to_value(k, v), self.config.keys()]) return test_data def get_9_401_data(self): test_data = [] for k, v in self.config.items(): if k[0] == "9" or k[0:3] == "401": test_data.append(self.copy_key_to_value(k, v)) return test_data def get_fixAddAtt(self): test_data = [] for k, v in self.config.items(): if v.get("fixAddAtt"): test_data.append(self.copy_key_to_value(k, v)) return test_data def get_skill_data(self): skill_data = { 1: CommonLoad("skill").get_all_data().keys(), 2: CommonLoad("skillPassive").get_all_data().keys(), 3: CommonLoad("skillCharacter").get_all_data().keys(), 4: CommonLoad("skillAttackEffect").get_all_data().keys() } test_data = [] for k, v in self.config.items(): test_data.append([self.copy_key_to_value(k, v), skill_data]) return test_data
class ToolJson(CommonBase, metaclass=Singleton): def __init__(self): super().__init__() self.tool_json = CommonLoad("tool").get_all_data() self.lang_json = CommonLoad("lang").get_all_data() self.team_json = CommonLoad("team").get_all_data() self.systemOpen_json = CommonLoad("systemOpen").get_all_data() self.setting_json = CommonLoad("setting").get_all_data() @DecoratorManager.performance def name_query(self,name,art=0):#根据中文名称获取道具id """ name为道具的中文名称 """ _tmp = [] for k,v in self.tool_json.items(): if "+" == name[-2:-1]: art = int(name[-1]) if name == self.lang_json.get(v["name"],False) and art == v.get("art1",0): _tmp.append(k) return max(_tmp) @DecoratorManager.performance def team_name_query(self,name):#根据中文名称获取兵营id """ name为兵团的中文名称 """ for k,v in self.team_json.items(): if name == self.lang_json.get(v["name"],False): return k @DecoratorManager.performance def tool_name(self,name):#根据tool表中name字段获取中文名称 """ name为tool表中的name字段 """ return self.lang_json[name] @DecoratorManager.performance def id_tool_name(self,tool_id):#根据id获取tool表中name字段 """ tool_id为道具的id,该方法为通过道具id获取tool表中的name字段 """ for k,v in self.tool_json.items(): if k == tool_id: return v.get("name") @DecoratorManager.performance def tool_name_id(self,name):#tool表中name获取id """ name为tool表中的name字段,该方法为通过此name获取tool表中的道具id """ for k,v in self.tool_json.items(): if name == v["name"]: return k @DecoratorManager.performance def get_tool_json(self): """ 获取 tool表的内容 """ return self.tool_json @DecoratorManager.performance def open_lv(self,keword): """ 获取对应功能的开启等级 keword 对应功能的标志位 """ for key, value in self.systemOpen_json.items(): if value["system"] == keword: return value["openLevel"] @DecoratorManager.performance def show_lv(self,keword): """ 获取对应功能的开启等级 keword 对应功能的标志位 """ for key, value in self.systemOpen_json.items(): if value["system"] == keword: return value["showLevel"] def setting(self,tag): """返回setting表的value Args: tag ([type]): [setting表的tag] Returns: [type]: [description] """ return self.setting_json[tag]["value"] def key_list(self): tool_dict = collections.defaultdict(list) for key,value in self.tool_json.items(): if value.get("typeId"): tool_dict[value.get("typeId")].append([key,value]) return dict(tool_dict) def race1_team(self): """筛选出以阵营为key,兵团id为list数组的数据 Returns: [dict]: [description] """ temp = dict() race1_dict = collections.defaultdict(list) for k,v in self.team_json.items(): if v.get("show"): temp[k] = v for teamid, value in temp.items(): race1_dict[value.get("race")[0]].append(teamid) return race1_dict def get_lang_key(self,name):#根据中文名称查询lang表中的key for k,v in self.lang_json.items(): if v == name: return k
class SpecialShopData(CommonBase,metaclass=Singleton): def __init__(self): super().__init__() self.config = CommonLoad("specialshop").get_all_data() def timetype_is_2_or_3(self): # key = "timetype_is_2_or_3" test_data = [] for k,v in self.config.items(): if v["timetype"] == "2" or v["timetype"] == "3": test_data.append(self.copy_key_to_value(k,v)) return test_data def timetype_is_1(self): test_data = [] for k,v in self.config.items(): if v["timetype"] == "1": test_data.append(self.copy_key_to_value(k, v)) return test_data def all_config(self): test_data = [] for k,v in self.config.items(): test_data.append(self.copy_key_to_value(k, v)) return test_data def in_hero(self): test_data = [] heros = CommonLoad("hero").get_all_data() for k,v in self.config.items(): if v.get("hero"): test_data.append([self.copy_key_to_value(k, v),heros]) return test_data def in_team(self): test_data = [] team = CommonLoad("team").get_all_data() for k,v in self.config.items(): if v.get("team"): test_data.append([self.copy_key_to_value(k, v),team]) return test_data def in_treasure(self): test_data = [] treasure = CommonLoad("comTreasure").get_all_data() treasureMerchant = CommonLoad("treasureMerchant").get_all_data() for k,v in self.config.items(): if v.get("treasure"): test_data.append([self.copy_key_to_value(k, v),treasure,treasureMerchant]) return test_data def in_cashGoodsLib(self): test_data = [] cashGoodsLib = CommonLoad("cashGoodsLib").get_all_data().keys() for k,v in self.config.items(): test_data.append([self.copy_key_to_value(k,v),cashGoodsLib]) return test_data def id_in_100001_100099(self): test_data = [] for k,v in self.config.items(): if 100001 <= int(k) <= 100099: test_data.append(self.copy_key_to_value(k, v)) return test_data def id_in_110000_119999(self): test_data = [] for k,v in self.config.items(): if 110000 <= int(k) <= 119999: test_data.append(self.copy_key_to_value(k, v)) return test_data def get_currency_test(self,_type): test_data = [] for k,v in self.config.items(): if v["currency"] in str(_type): test_data.append(self.copy_key_to_value(k, v)) return test_data def get_discount(self): test_data = [] for k,v in self.config.items(): if v.get("discount1") or v.get("discount2"): test_data.append(self.copy_key_to_value(k, v)) return test_data def get_invisible(self): test_data = [] hero_skin = CommonLoad("heroSkin").get_all_data().keys() tool = CommonLoad("tool").get_all_data().keys() for k,v in self.config.items(): if v.get("invisible"): test_data.append([self.copy_key_to_value(k, v),hero_skin,tool]) return test_data def get_weekShowTime(self): test_data = [] for k,v in self.config.items(): if 700004<=int(k)<=799999: test_data.append(self.copy_key_to_value(k, v)) return test_data