Пример #1
0
    def load_database(self,
                      skip_skills=False,
                      skip_bonus=False,
                      skip_extra=False):
        base_dir = self.base_dir
        raw_cards = card.load_card_data(data_dir=base_dir)
        self.dungeons = dungeon.load_dungeon_data(data_dir=base_dir)

        if not skip_bonus:
            self.bonus_sets = {
                g.value: bonus.load_bonus_data(data_dir=base_dir,
                                               server=self.server,
                                               data_group=g.value)
                for g in StarterGroup
            }

        if not skip_skills:
            self.skills = skill.load_skill_data(data_dir=base_dir)
            parser = SkillParser()
            parser.parse(self.skills)
            self.leader_skills = parser.leader_skills
            self.active_skills = parser.active_skills
            self.skill_id_to_leader_skill = {
                s.skill_id: s
                for s in self.leader_skills
            }
            self.skill_id_to_active_skill = {
                s.skill_id: s
                for s in self.active_skills
            }

        self.raw_enemy_skills = enemy_skill.load_enemy_skill_data(
            data_dir=base_dir)
        es_parser = BehaviorParser()
        es_parser.parse(self.raw_enemy_skills)
        self.enemy_skills = es_parser.enemy_behaviors

        if not skip_extra:
            self.exchange = exchange.load_data(data_dir=base_dir,
                                               server=self.server)
            self.egg_machines = extra_egg_machine.load_data(data_dir=base_dir,
                                                            server=self.server)

        self.bonuses = _clean_bonuses(self.server, self.bonus_sets,
                                      self.dungeons)
        self.enemies = _clean_enemy(raw_cards, self.enemy_skills)
        self.cards = _clean_cards(self.server, raw_cards, self.enemies, self)

        self.dungeon_id_to_dungeon = {d.dungeon_id: d for d in self.dungeons}
        self.monster_no_to_card = {c.monster_no: c for c in self.cards}
        if self.server == Server.jp:
            self.monster_id_to_card = self.monster_no_to_card
        else:
            self.monster_id_to_card = {
                nakr_no_to_monster_id(c.monster_no): c
                for c in self.cards
            }

        self.enemy_id_to_enemy = {e.enemy_id: e for e in self.enemies}
Пример #2
0
    def load_database(self,
                      skip_skills=False,
                      skip_bonus=False,
                      skip_extra=False):
        base_dir = self.base_dir
        raw_cards = card.load_card_data(data_dir=base_dir)
        self.dungeons = dungeon.load_dungeon_data(data_dir=base_dir)

        if not skip_bonus:
            self.bonus_sets = {
                g.value: bonus.load_bonus_data(data_dir=base_dir,
                                               server=self.server,
                                               data_group=g.value)
                for g in StarterGroup
            }

        if not skip_skills:
            self.skills = skill.load_skill_data(data_dir=base_dir)
            self.skill_id_to_skill = {s.skill_id: s for s in self.skills}
            # TODO: need to compute skill data here

        self.enemy_skills = enemy_skill.load_enemy_skill_data(
            data_dir=base_dir)

        if not skip_extra:
            self.exchange = exchange.load_data(data_dir=base_dir)
            self.egg_machines = egg_machine.load_data(data_dir=base_dir)

        self.bonuses = _clean_bonuses(self.server, self.bonus_sets,
                                      self.dungeons)
        self.enemies = _clean_enemy(raw_cards, self.enemy_skills)
        self.cards = _clean_cards(self.server, raw_cards, self.skills,
                                  self.enemies)

        self.dungeon_id_to_dungeon = {d.dungeon_id: d for d in self.dungeons}
        self.monster_no_to_card = {c.monster_no: c for c in self.cards}
        if self.server == Server.jp:
            self.monster_id_to_card = self.monster_no_to_card
        else:
            self.monster_id_to_card = {
                nakr_no_to_monster_id(c.monster_no): c
                for c in self.cards
            }

        self.enemy_id_to_enemy = {e.enemy_id: e for e in self.enemies}