Пример #1
0
    def do_give(self, session, line):
        if not line: session.push(tpl.SYNTAX_GIVE)
        else:
            self.argu = line.lower()
            #if not self.argu.strip(): session.push("> ")
            self.parts = line.split(' ', 3)

            if self.parts[1] == "to":
                try:
                    self.itom = Select.getItemInstance(session.p_id, self.parts[0].lower()) # Given item info

                    # Check if given to a player.
                    self.transf = Select.getPlayerInRoom(session.is_in, self.parts[2].lower())

                    # Check if given to a mob.
                    self.mob = Select.getNpcInRoom(session.is_in, self.parts[2].lower())

                    if self.transf:
                        Update.setItemOwner(self.transf[0], self.itom[0])
                        session.push(tpl.GIVE % (self.parts[0],self.parts[2]))
                        # the following line is commented out -- not sure if I'll tell the whole room + it doesn't work
                        #self.RoomBroadcast(session, session.is_in, " gives %s to %s" % (self.parts[0],self.parts[2]))
                        
                    elif self.mob:
                        Update.setItemNpcOwner(self.mob[0], self.itom[0])
                        session.push(tpl.GIVE % (self.parts[0],self.parts[2]))
                        #Effects.RoomBroadcast(session, session.is_in, " gives %s to %s" % (self.parts[0], self.parts[2]))
                    else: session.push(tpl.PLAYER_NOT_FOUND)

                except: session.push(tpl.SYNTAX_GIVE)

            else: session.push(tpl.SYNTAX_GIVE)
Пример #2
0
    def do_get(self, session, line):
        self.objonfloor = Select.getItem(session.is_in, line.lower())

        try:
            Update.setItemOwner(session.p_id, self.objonfloor[0])
            session.push(tpl.GET % line)
        except:
            session.push(tpl.NOT_HERE)