Exemplo n.º 1
0
 def _get_char_data(char_values):
     """ Return a new CharacterData object from char_values. """
     return CharacterData(
         guid     = _CharacterCreator._get_unused_guid(),
         account  = char_values["account"],
         name     = char_values["name"],
         race     = char_values["race"].value,
         class_id = char_values["class"].value,
         gender   = char_values["gender"].value
     )
Exemplo n.º 2
0
 def _get_checked_character(self, guid):
     """ Get the character data associated to that GUID, but only if this
     character belongs to the connected account, else return None. """
     try:
         character = CharacterData.get(
             CharacterData.guid == guid
             and CharacterData.account == self.conn.account)
         return character
     except CharacterData.DoesNotExist:
         return None
Exemplo n.º 3
0
 def _get_checked_character(self, guid):
     """ Get the character data associated to that GUID, but only if this
     character belongs to the connected account, else return None. """
     try:
         character = CharacterData.get(
             CharacterData.guid == guid
             and CharacterData.account == self.conn.account
         )
         return character
     except CharacterData.DoesNotExist:
         return None
Exemplo n.º 4
0
    def _delete_char(guid):
        character = CharacterData.get(CharacterData.guid == guid)

        _CharacterDestructor._delete_char_skills(character)
        _CharacterDestructor._delete_char_spells(character)

        features = character.features
        stats = character.stats
        position = character.position

        character.delete_instance()
        features.delete_instance()
        stats.delete_instance()
        position.delete_instance()

        LOG.debug("Character " + str(guid) + " deleted.")
        return 0
Exemplo n.º 5
0
    def _delete_char(guid):
        character = CharacterData.get(CharacterData.guid == guid)

        _CharacterDestructor._delete_char_skills(character)
        _CharacterDestructor._delete_char_spells(character)

        features = character.features
        stats = character.stats
        position = character.position

        character.delete_instance()
        features.delete_instance()
        stats.delete_instance()
        position.delete_instance()

        LOG.debug("Character " + str(guid) + " deleted.")
        return 0
Exemplo n.º 6
0
 def does_char_with_guid_exist(guid):
     """ Return whether or not a character with that GUID exists in DB. """
     return CharacterData.select().where(CharacterData.guid == guid).exists()
Exemplo n.º 7
0
 def does_char_with_name_exist(name):
     """ Return whether or not a character with that name exists in DB. """
     return CharacterData.select().where(CharacterData.name == name).exists()
Exemplo n.º 8
0
 def get_char_data(guid):
     """ Get the CharacterData associated to that GUID, or None. """
     try:
         return CharacterData.get(CharacterData.guid == guid)
     except CharacterData.DoesNotExist:
         return None
Exemplo n.º 9
0
 def does_char_with_guid_exist(guid):
     """ Return whether or not a character with that GUID exists in DB. """
     return CharacterData.select().where(CharacterData.guid == guid).exists()
Exemplo n.º 10
0
 def does_char_with_name_exist(name):
     """ Return whether or not a character with that name exists in DB. """
     return CharacterData.select().where(CharacterData.name == name).exists()
Exemplo n.º 11
0
 def get_char_data(guid):
     """ Get the CharacterData associated to that GUID, or None. """
     try:
         return CharacterData.get(CharacterData.guid == guid)
     except CharacterData.DoesNotExist:
         return None