Exemplo n.º 1
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.cloth > 0:			
			if half:
				needed = int(math.ceil(self.cloth / 2))
			else:
				needed = self.cloth
		
			assert(len(arguments) >= 2)
			cloth = wolfpack.finditem(arguments[1])
			if not player.canreach(cloth, -1):
				player.socket.clilocmessage(1044456) # You don't have any ready cloth...
				return False
			elif cloth.amount < needed:
				player.socket.clilocmessage(1044287) # You don't have enough...
				return False

			# Replace the second argument with the color of the cloth
			arguments[1] = cloth.color

			if needed == cloth.amount:
				cloth.delete()
			else:
				cloth.amount -= needed
				cloth.update()

		return result
Exemplo n.º 2
0
    def consumematerial(self, player, arguments, half=0):
        result = CraftItemAction.consumematerial(self, player, arguments, half)

        if result and self.cloth > 0:
            if half:
                needed = int(math.ceil(self.cloth / 2))
            else:
                needed = self.cloth

            assert (len(arguments) >= 2)
            cloth = wolfpack.finditem(arguments[1])
            if not player.canreach(cloth, -1):
                player.socket.clilocmessage(
                    1044456)  # You don't have any ready cloth...
                return False
            elif cloth.amount < needed:
                player.socket.clilocmessage(
                    1044287)  # You don't have enough...
                return False

            # Replace the second argument with the color of the cloth
            arguments[1] = cloth.color

            if needed == cloth.amount:
                cloth.delete()
            else:
                cloth.amount -= needed
                cloth.update()

        return result
Exemplo n.º 3
0
    def consumematerial(self, player, arguments, half=0):
        result = CraftItemAction.consumematerial(self, player, arguments, half)
        if not result:
            return False

        if self.flour:
            result = False
            content = player.getbackpack().content
            flours = []
            for item in content:
                if item.baseid in flour and item.hastag('quantity'):
                    flours.append(item)
            toconsume = self.flouramount
            while toconsume > 0:
                for flou in flours:
                    amount = consume(flou, toconsume)
                    toconsume -= amount
                    if toconsume == 0:
                        break  # break out of for loop

        # Check if we have enough water in our backpack
        if self.water:
            content = player.getbackpack().content
            for item in content:
                if item.hasscript('beverage') and item.gettag(
                        'fluid') == 'water' and item.hastag('quantity'):
                    if beverage.consume(item):
                        return True

            player.socket.clilocmessage(
                1044253)  # You don't have the components needed to make that.
            return False

        return result
Exemplo n.º 4
0
    def consumematerial(self, player, arguments, half=0):
        result = CraftItemAction.consumematerial(self, player, arguments, half)
        if not result:
            return False

        if self.flour:
            result = False
            content = player.getbackpack().content
            flours = []
            for item in content:
                if item.baseid in flour and item.hastag("quantity"):
                    flours.append(item)
            toconsume = self.flouramount
            while toconsume > 0:
                for flou in flours:
                    amount = consume(flou, toconsume)
                    toconsume -= amount
                    if toconsume == 0:
                        break  # break out of for loop

                        # Check if we have enough water in our backpack
        if self.water:
            content = player.getbackpack().content
            for item in content:
                if item.hasscript("beverage") and item.gettag("fluid") == "water" and item.hastag("quantity"):
                    if beverage.consume(item):
                        return True

            player.socket.clilocmessage(1044253)  # You don't have the components needed to make that.
            return False

        return result
Exemplo n.º 5
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		# Check if we have enough water in our backpack
		if result and self.water:
			content = player.getbackpack().content
			for item in content:
				if item.hasscript('beverage') and item.gettag('fluid') == 'water' and item.hastag('quantity'):
					if beverage.consume(item):
						return True
						
			player.socket.clilocmessage(1044253) # You don't have the components needed to make that.
			return False

		return result
Exemplo n.º 6
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.mana > 0:			
			if half:
				needed = int(math.ceil(self.mana / 2))
			else:
				needed = self.mana

			if player.mana >= needed:
				player.mana -= needed
				player.updatemana()
			else:
				return False

		return result
Exemplo n.º 7
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.mana > 0:			
			if half:
				needed = int(math.ceil(self.mana / 2))
			else:
				needed = self.mana

			if player.mana >= needed:
				player.mana -= needed
				player.updatemana()
			else:
				return False

		return result
Exemplo n.º 8
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.runes > 0:
			if half:
				needed = int(math.ceil(self.runes / 2))
			else:
				needed = self.runes
			
			backpack = player.getbackpack()
			for item in backpack.content:
				if item.baseid in ['1f14', '1f15', '1f16', '1f17'] and not item.hastag('location') and item.gettag('marked') == 0:
					item.delete()
					needed -= 1
					if needed < 1:
						break
			
			if needed > 0:
				player.socket.clilocmessage(1044253)
				return False

		return result
Exemplo n.º 9
0
	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.runes > 0:
			if half:
				needed = int(math.ceil(self.runes / 2))
			else:
				needed = self.runes
			
			backpack = player.getbackpack()
			for item in backpack.content:
				if item.baseid in ['1f14', '1f15', '1f16', '1f17'] and not item.hastag('location') and item.gettag('marked') == 0:
					item.delete()
					needed -= 1
					if needed < 1:
						break
			
			if needed > 0:
				player.socket.clilocmessage(1044253)
				return False

		return result