예제 #1
0
def pour(player, plant, item):
	status = getStatus(plant)
	
	if status >= STATUS_DEAD:
		return
		
	if status == STATUS_DECORATIVE:
		plant.say(1053049, '', '', False, 0x3b2, player.socket) # This is a decorative plant, it does not need watering!
		return
		
	if not checkAccess(player, plant):
		plant.say(1061856, '', '', False, 0x3b2, player.socket)
		return

	# Beverage -> Water
	if item.hasscript('beverage'):
		# It's not water or doesn't have enough content
		if item.gettag('fluid') != 'water' or not item.gettag('quantity'):
			plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!
		else:
			beverage.consume(item) # Consume one use
			setWater(plant, getWater(plant) + 1) # Give one more water unit
			plant.resendtooltip()
			
			player.soundeffect(0x4e) # Soundeffect
			plant.say(1061858, '', '', False, 0x3b2, player.socket) # You soften the dirt with water.			
			
	# Potion
	elif item.hasscript('potions'):
		potiontype = potions.utilities.getPotionType(item)
		if applyPotion(player, plant, potiontype):			
			potions.utilities.consumePotion(player, item)
			player.soundeffect(0x240)
			
	# Potion Keg
	elif potionkeg.isPotionkeg(item):
		# Empty potion kegs won't work
		if not item.gettag('kegfill'):
			plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!
		else:
			potiontype = potions.utilities.getPotionType(item)
			if applyPotion(player, plant, potiontype):
				item.settag('kegfill', item.gettag('kegfill') - 1)
				item.resendtooltip()
				player.soundeffect(0x240)
				
	# Something Else
	else:
		plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!	
예제 #2
0
def pour(player, plant, item):
	status = getStatus(plant)
	
	if status >= STATUS_DEAD:
		return

	if status == STATUS_DECORATIVE:
		plant.say(1053049, '', '', False, 0x3b2, player.socket) # This is a decorative plant, it does not need watering!
		return

	if not checkAccess(player, plant):
		plant.say(1061856, '', '', False, 0x3b2, player.socket)
		return

	# Beverage -> Water
	if item.hasscript('beverage'):
		# It's not water or doesn't have enough content
		if item.gettag('fluid') != 'water' or not item.gettag('quantity'):
			plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!
		else:
			beverage.consume(item) # Consume one use
			setWater(plant, getWater(plant) + 1) # Give one more water unit
			plant.resendtooltip()
			
			player.soundeffect(0x4e) # Soundeffect
			plant.say(1061858, '', '', False, 0x3b2, player.socket) # You soften the dirt with water.			

	# Potion
	elif item.hasscript('potions'):
		potiontype = potions.utilities.getPotionType(item)
		if applyPotion(player, plant, potiontype):			
			potions.utilities.consumePotion(player, item)
			player.soundeffect(0x240)

	# Potion Keg
	elif potionkeg.isPotionkeg(item):
		# Empty potion kegs won't work
		if not item.gettag('kegfill'):
			plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!
		else:
			potiontype = potions.utilities.getPotionType(item)
			if applyPotion(player, plant, potiontype):
				item.settag('kegfill', item.gettag('kegfill') - 1)
				item.resendtooltip()
				player.soundeffect(0x240)

	# Something Else
	else:
		plant.say(1053069, '', '', False, 0x3b2, player.socket) # You can't use that on a plant!	
예제 #3
0
파일: cooking.py 프로젝트: thooge/Wolfpack
    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
예제 #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
예제 #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