def handle_create_weapon_input(self, message): self.display_motd() self.state = "motd" # First save! self.actor = Character.add(self.actor.data, self.game) self.actor.set_connection(self) self.actor.save()
def handle_login_password_input(self, message): ch_data = Character.get_from_file(self.username, self.game) cleaned = message.strip() if not cleaned: self.writeln("Invalid password.") self.destroy() return password = Character.get_password_hash(cleaned) if password != ch_data["password"]: self.writeln("Invalid password.") self.destroy() return connection = self.game.get_actor_connection(actor_id=self.username) if connection is None: Character.add(ch_data, self.game) ch = Character.get_by_uid(self.username, self.game) self.actor = ch self.actor.set_connection(self) self.state = "motd" self.display_motd() else: connection.close() self.actor = connection.actor self.actor.set_connection(self) self.server.remove_connection(connection) self.state = "playing" self.playing = True self.writeln("Reconnecting..") self.writeln() self.actor.handle_input("look")