예제 #1
0
    def get_room(self):
        room = Room.find_by("uid", self.room_uid, game=self.game)
        if room:
            return room

        room = Room.find_by("id", self.room_id, game=self.game)
        if room:
            return room

        return None
예제 #2
0
def goto_command(actor, game, params, *args, **kwargs):
    from mud.entities.room import Room

    actor.echo("Warning: Mob and character goto not yet supported.")

    room_id = "3001"
    if params:
        room_id = params[0]

    target_room = Room.find_by("uid", room_id, game=game)
    if not target_room:
        target_room = Room.find_by("id", room_id, game=game)
        if not target_room:
            actor.echo("Could not find room by id or uid.")
            return

    actor.set_room(target_room)
    actor.force("look")
예제 #3
0
 def die(self):
     from mud.entities.room import Room
     # FIXME CONSTANT
     self.act_around("[actor.name] has died!")
     room = Room.find_by("id", "3001", game=self.game)
     self.set_room(room)
     self.hp = 1
     # self.set_position("resting")
     self.echo("YOU HAVE DIED!")
     self.force("look")
예제 #4
0
def recall_command(actor, game, *args, **kwargs):
    from mud.entities.room import Room

    room = Room.find_by("id", "3001", game=game)

    if not room:
        actor.echo("You failed.")
        return

    actor.set_room(room)
    actor.force("look")
예제 #5
0
    def get_room(self):
        room = Room.get_by_uid(self.room_uid, game=self.game)
        if room is not None:
            return room

        # TODO Make this figure out if this entity can be present in one
        # of these rooms, otherwise.. return None
        rooms = list(Room.query_by_id(self.room_id, game=self.game))
        if rooms:
            room = rooms[0]
            self.set_room(room)
            return self.get_room()

        # FIXME Make this a fallback configuration setting somewhere
        tol = Room.find_by("id", "3001", game=self.game)
        print("tol")
        if tol:
            self.set_room(tol)
            return self.get_room()

        return None
예제 #6
0
    def get_room(self):
        room = Room.get_by_uid(self.room_uid, game=self.game)
        if room is not None:
            return room

        # TODO Make this figure out if this entity can be present in one
        # of these rooms, otherwise.. return None
        rooms = list(Room.query_by_id(self.room_id, game=self.game))
        if rooms:
            room = rooms[0]
            self.set_room(room)
            return self.get_room()

        # FIXME Make this a fallback configuration setting somewhere
        tol = Room.find_by("id", "3001", game=self.game)
        print("tol")
        if tol:
            self.set_room(tol)
            return self.get_room()

        return None
예제 #7
0
    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"
예제 #8
0
    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"
예제 #9
0
 def add_children(self):
     from mud.entities.room import Room
     for room_vnum, room in self.data["rooms"].items():
         room["id"] = room_vnum
         Room.add(room, game=self.game)
예제 #10
0
 def add_children(self):
     from mud.entities.room import Room
     for room_vnum, room in self.data["rooms"].items():
         room["id"] = room_vnum
         Room.add(room, game=self.game)