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)
def do_drop(self, session, line): try: self.drop = Select.getItemInstance(session.p_id, line.lower()) self.drop = Update.dropItem(session.is_in, self.drop[0]) #self.msg = session.pname + " dropped " + line + "." #self.RoomBroadcast(session, session.is_in, self.msg) session.push(tpl.DROP % (session.pname, line)) except: session.push(tpl.DROP_CANT)