Exemple #1
0
    def character_create(self, packet: CharacterCreateRequestPacket,
                         address: Address):
        session = SessionManager.get_session(address)
        user = Database.get_user(session['user_id'])

        names = AssetLoader.load_names()
        name = names[0][packet.predef1].strip() + names[1][
            packet.predef2].strip() + names[2][packet.predef3].strip()

        # TODO: generate starter kit

        char = Character(user=user,
                         name=name,
                         unapproved_name=packet.name,
                         shirt_color=packet.shirt_color,
                         shirt_style=packet.shirt_style,
                         pants_color=packet.pants_color,
                         hair_style=packet.hair_style,
                         hair_color=packet.hair_color,
                         lh=packet.lh,
                         rh=packet.rh,
                         eyebrow_style=packet.eyebrow_style,
                         eye_style=packet.eye_style,
                         mouth_style=packet.mouth_style)
        char.save()

        self.server.send(CharacterCreateResponsePacket(0x00), address)
        self.character_list(CharacterListPacket(), address)
Exemple #2
0
    def character_list(self, packet: CharacterListPacket, address: Address):
        session = SessionManager.get_session(address)
        user = Database.get_user(session['user_id'])

        self.server.send(
            CharacterListPacket(user.front_character, user.characters),
            address)