Пример #1
0
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
Пример #2
0
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