def _add_default_skills(char_data, consts): skills_id = consts["class"]["skills"] for skill_id in skills_id: values = skills_id[skill_id] max_values = SKILL_MAX_LEVELS[skill_id] try: Skill.create( character = char_data, ident = skill_id.value, level = values[0], stat_level = values[1], max_level = max_values[0], max_stat_level = max_values[1] ) except PeeweeException as exc: LOG.error("Couldn't add skill {} for char {}".format( skill_id.name, char_data.guid )) LOG.error(str(exc))
def import_skills(self, char_data): """ Import skills in the local skills list and in the update fields. """ with self.lock: self.skills = [] skills = (Skill.select().where( Skill.character == char_data).order_by(Skill.ident).limit( self.NUM_SKILLS)) for skill in skills: slot = len(self.skills) self.skills.append(skill) self._set_skill_fields(slot, skill)
def _delete_char_skills(character): Skill.delete().where(Skill.character == character).execute()