Пример #1
0
    def logout(self):
        self.player.status = 0
        send_to(self.player.position, "%s left" % (self.player.username))
        del self.playerBox
        del self.roomDisplay
        del self.spellInput
        del self.eventlog

        self.loginManager = component.Component(QuestLogin())
        self.loginManager.on_answer(self.startGame)
        self.model("login")
Пример #2
0
    def enterRoom(self, room, force = False):
        if self.player.status == 0:
            self.logout()
            return

        oldpos = self.player.position

        if isinstance(room, Room):
            newposition = room
        else:
            newposition = session.query(Room).get(room)
        
        # when we start the game, we have no old position.
        if oldpos == newposition:
            print "ignoring GameSession.enterRoom."
            send_to(self.player.position, "%s entered" % (self.player.username))
            return

        # find the door object. if it's locked, don't let us through, if it's lockable, shut it behind us.
        door = oldpos.doorTo(newposition)

        if door.locked and door.lockable():
            if force:
                door.locked = False # unlock it so that one person can get through behind us
            else:
                raise DoorLockedException
        if door.lockable() and not force:
            door.locked = True # TODO: delay this by a few seconds, so that party members can come along?

        send_to(newposition, "%s entered" % (self.player.username))
        oldpos, self.player.position = self.player.position, newposition
        send_to(oldpos, "%s left" % (self.player.username))
        self.player.activity()
Пример #3
0
def send_fail():
    send_to(1, "hello")
Пример #4
0
def send_test():
    # no browser is connected, thus it will return false.
    send_to("testuser", "testuser left")
    send_to("idontexist", "what?")
Пример #5
0
def send_fail():
    send_to(1, "hello")
Пример #6
0
def send_test():
    # no browser is connected, thus it will return false.
    send_to("testuser", "testuser left")
    send_to("idontexist", "what?")