def _add_default_spells(char_data, consts): spells_id = consts["class"]["spells"] for spell_id in spells_id: try: Spell.create( character = char_data, ident = spell_id.value ) except PeeweeException as exc: LOG.error("Couldn't add spell {} for char {}".format( spell_id.name, char_data.guid )) LOG.error(str(exc))
def import_spells(self, char_data): with self.lock: self.spells = [] spells = (Spell.select().where( Spell.character == char_data).order_by(Spell.ident).limit( self.NUM_SPELLS)) for spell in spells: self.spells.append(spell)
def _delete_char_spells(character): Spell.delete().where(Spell.character == character).execute()