def handle_login_username_input(self, message): self.username = Character.get_clean_name(message) if not self.username: self.write("Sorry, try again: ") else: ch_data = Character.get_from_file(self.username, self.game) if not ch_data: starting_room = Room.find_by("id", "3001", game=self.game) self.actor = Character(self.game, { "uid": self.username, "id": self.username, "name": self.username, "room_id": starting_room.id, "room_uid": starting_room.uid, }) self.actor.set_connection(self) self.state = "create_confirm_username" self.write("""\ +------------------------[ Welcome to Waterdeep ]-------------------------+ We are a roleplaying -encouraged- mud, meaning roleplaying is not required by our players but we ask that non-roleplayers abide to a few rules and regulations. All names are to be roleplayish in nature and this policy is enforced by the staff. 1. Do not use names such as Joe, Bob, Larry, Carl and so forth. 2. Names of Forgotten Realms Deities are reserved for staff members. 3. Do not use combo word names such as Blackbeard or Rockdeath, etc. If we find your name is not suitable for our environment, an immortal staff member will appear before you and offer you a rename. Please be nice and civil, and we will return with the same. +--------------[ This MUD is rated R for Mature Audiences ]---------------+ Did I get that right, {} (Y/N)? """.format( self.username )) return self.write("Password: "******"login_password"
def handle_login_username_input(self, message): self.username = Character.get_clean_name(message) if not self.username: self.write("Sorry, try again: ") else: ch_data = Character.get_from_file(self.username, self.game) if not ch_data: starting_room = Room.find_by("id", "3001", game=self.game) self.actor = Character( self.game, { "uid": self.username, "id": self.username, "name": self.username, "room_id": starting_room.id, "room_uid": starting_room.uid, }) self.actor.set_connection(self) self.state = "create_confirm_username" self.write("""\ +------------------------[ Welcome to Waterdeep ]-------------------------+ We are a roleplaying -encouraged- mud, meaning roleplaying is not required by our players but we ask that non-roleplayers abide to a few rules and regulations. All names are to be roleplayish in nature and this policy is enforced by the staff. 1. Do not use names such as Joe, Bob, Larry, Carl and so forth. 2. Names of Forgotten Realms Deities are reserved for staff members. 3. Do not use combo word names such as Blackbeard or Rockdeath, etc. If we find your name is not suitable for our environment, an immortal staff member will appear before you and offer you a rename. Please be nice and civil, and we will return with the same. +--------------[ This MUD is rated R for Mature Audiences ]---------------+ Did I get that right, {} (Y/N)? """.format(self.username)) return self.write("Password: "******"login_password"
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")
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")