Exemplo n.º 1
0
	def getItemFromListByName(self, needle, haystack):
		if not haystack:
			raise self.CommandException('You don\'t see that here.')
		for candidate in haystack:
			if utility.matchList(needle, candidate.keywords):
				return candidate
		raise self.CommandException('You don\'t see that here.')
Exemplo n.º 2
0
	def getTargetFromListByName(self, needle, haystack):
		if not haystack:
			raise self.CommandException('You don\'t see them here.')
		for candidate in haystack:
			if utility.matchList(needle, candidate.keywords):
				return candidate
		print 'getTargetFromListByName is DEPRECATED, use getMobileFromListByName or getItemFromListByName instead.'
		raise self.CommandException('You don\'t see them here.')
Exemplo n.º 3
0
	def execute(self, args, config):
		sender = config['sender']

		for e in sender.equipment:
			if sender.equipment[e] and utility.matchList(args[0], sender.equipment[e].keywords):
				sender.inventory.append(sender.equipment[e])
				buf = 'You remove {item}.'.format(item=sender.equipment[e].getName(sender))
				sender.equipment[e] = None
				sender.sendToClient(buf)
				return
		sender.sendToClient('You aren\'t wearing that.')
Exemplo n.º 4
0
	def execute(self, args, config):
		sender = config['sender']
		inventory = sender.inventory

		for item in inventory:
			if utility.matchList(args[0], item.keywords):
				sender.inventory.remove(item)
				sender.room.items.append(item)
				sender.sendToClient('You drop {item}.'.format(item=item.getName(sender)))
				sender.game.sendCondition(
					(lambda a: a.room == sender.room and a is not sender), '{0} drops {1}', [sender, item])
				return
		sender.sendToClient('You don\'t have that.')
Exemplo n.º 5
0
	def execute(self, args, config):
		sender = config['sender']
		items = sender.room.items

		if len(args) <= 0:
			sender.sendToClient('Examine what?')
			return

		for item in items:
			if utility.matchList(args[0], item.keywords):
				if 'description' in item.stats:
					sender.sendToClient(item.stats['description'])
					return
		sender.sendToClient('You don\'t see that here.')
Exemplo n.º 6
0
	def execute(self, args, config):
		sender = config['sender']

		for item in sender.inventory:
			if utility.matchList(args[0], item.keywords):
				# if item already in eq slot, remove it first
				if not item.wear:
					sender.sendToClient('You can\'t wear that!')
					return
				if item.wear in sender.equipment and sender.equipment[item.wear]:
					sender.inventory.append(sender.equipment[item.wear])
					sender.sendToClient('You stop using {item}.'.format(item=sender.equipment[item.wear].getName(sender)))
				# put item in eq slot, remove from inventory
				sender.equipment[item.wear] = item
				sender.inventory.remove(item)
				sender.sendToClient('You now wear {item}.'.format(item=item.getName(sender)))
				return

		sender.sendToClient('You don\'t have that.')
Exemplo n.º 7
0
	def execute(self, args, config):
		sender = config['sender']
		sender.sendToClient('You look around.')
		return


		if len(args) == 0:
			if sender.isAffectedBy('blind'):
				sender.sendToClient('You can\'t see anything!')
				return

			sender.sendToClient('@u{name}@x\n\r@g{exits}@x\n\r{mobiles}\n\r{items}'.format(
				name=sender.room.name,
				exits=sender.room.exits,
				mobiles='\n\r'.join([mobile.getName(sender) for mobile in self.game.mobiles if mobile.room is sender.room and mobile is not sender]),
				items='\n\r'.join([item.getName(sender) for item in sender.room.items]))
			)
		else:
			if sender.isAffectedBy('blind'):
				sender.sendToClient('You don\'t see them here.')
				return

			targets = [mobile.name for mobile in self.game.mobiles if mobile.room is sender.room and utility.matchList(args[0], mobile.keywords)]
			if len(targets) == 0:
				sender.sendToClient('You don\'t see them here.')
			else:
				sender.sendToClient('It\'s {name}!  How about that!'.format(name=targets[0]))