Beispiel #1
0
def password_command(actor, params, *args, **kwargs):
    from mud.entities.character import Character

    if len(params) < 2:
        actor.echo("Usage: password <old> <new>")
        return

    old = Character.get_password_hash(params[0])
    new = Character.get_password_hash(params[1])

    if actor.password != old:
        actor.echo("Invalid old password.")
        return

    actor.password = new
    actor.save()
    actor.echo("Password updated.")
Beispiel #2
0
    def handle_create_password_input(self, message):
        cleaned = message.strip()

        if not cleaned:
            self.writeln("You didn't provide a password, please try again.")
            self.write("Password: "******"Please confirm your password: "******"create_password_confirm"
Beispiel #3
0
    def handle_create_password_input(self, message):
        cleaned = message.strip()

        if not cleaned:
            self.writeln("You didn't provide a password, please try again.")
            self.write("Password: "******"Please confirm your password: "******"create_password_confirm"
Beispiel #4
0
    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")
Beispiel #5
0
    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")
Beispiel #6
0
    def handle_create_password_confirm_input(self, message):
        cleaned = message.strip()

        if Character.get_password_hash(cleaned) != self.actor.password:
            self.writeln("Passwords don't match.")
            self.write("Retype password: "******"create_password"
            return

        self.writeln("""\
+---------------------------[ Pick your Race ]----------------------------+

  Welcome to the birthing process of your character.  Below you will
  find a list of available races and their basic stats.  You will gain
  an additional +2 points on a specific stat depending on your choice
  of class.  For detailed information see our website located at
  http://waterdeep.org or type HELP (Name of Race) below.

            STR INT WIS DEX CON                 STR INT WIS DEX CON
  Avian     17  19  20  16  17      HalfElf     17  18  19  18  18
  Centaur   20  17  15  13  21      HalfOrc     19  15  15  20  21
  Draconian 22  18  16  15  21      Heucuva     25  10  10  25  25
  Drow      18  22  20  23  17      Human       21  19  19  19  21
  Dwarf     20  18  22  16  21      Kenku       19  19  21  20  19
  Elf       16  20  18  21  15      Minotaur    23  16  15  16  22
  Esper     14  21  21  20  14      Pixie       14  20  20  23  14
  Giant     22  15  18  15  20      Podrikev    25  18  18  15  25
  Gnoll     20  16  15  20  19      Thri'Kreen  17  22  22  16  25
  Gnome     16  23  19  15  15      Titan       25  18  18  15  25
  Goblin    16  20  16  19  20      Satyr       23  19  10  14  21
  Halfling  15  20  16  21  18

+-------------------------------------------------------------------------+

Please choose a race, or HELP (Name of Race) for more info: \
""")
        self.state = "create_race"
Beispiel #7
0
    def handle_create_password_confirm_input(self, message):
        cleaned = message.strip()

        if Character.get_password_hash(cleaned) != self.actor.password:
            self.writeln("Passwords don't match.")
            self.write("Retype password: "******"create_password"
            return

        self.writeln("""\
+---------------------------[ Pick your Race ]----------------------------+

  Welcome to the birthing process of your character.  Below you will
  find a list of available races and their basic stats.  You will gain
  an additional +2 points on a specific stat depending on your choice
  of class.  For detailed information see our website located at
  http://waterdeep.org or type HELP (Name of Race) below.

            STR INT WIS DEX CON                 STR INT WIS DEX CON
  Avian     17  19  20  16  17      HalfElf     17  18  19  18  18
  Centaur   20  17  15  13  21      HalfOrc     19  15  15  20  21
  Draconian 22  18  16  15  21      Heucuva     25  10  10  25  25
  Drow      18  22  20  23  17      Human       21  19  19  19  21
  Dwarf     20  18  22  16  21      Kenku       19  19  21  20  19
  Elf       16  20  18  21  15      Minotaur    23  16  15  16  22
  Esper     14  21  21  20  14      Pixie       14  20  20  23  14
  Giant     22  15  18  15  20      Podrikev    25  18  18  15  25
  Gnoll     20  16  15  20  19      Thri'Kreen  17  22  22  16  25
  Gnome     16  23  19  15  15      Titan       25  18  18  15  25
  Goblin    16  20  16  19  20      Satyr       23  19  10  14  21
  Halfling  15  20  16  21  18

+-------------------------------------------------------------------------+

Please choose a race, or HELP (Name of Race) for more info: \
""")
        self.state = "create_race"