コード例 #1
0
ファイル: emptybowlgump.py プロジェクト: thooge/Wolfpack
def response(player, arguments, response):
	plant = wolfpack.finditem(arguments[0])

	if response.button == 0 or not plant or plants.plant.getStatus(plant) >= STATUS_DECORATIVE or not player.canreach(plant, 3):
		return # Cancel

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

	# Cancel
	if response.button == 1:
		plants.maingump.send(player, plant)

	# Help
	elif response.button == 2:
		send(player, plant)
		plants.sendCodexOfWisdom(player.socket, 71)

	# Ok
	elif response.button == 3:		
		bowl = wolfpack.additem(plants.bowl.BOWL_BASEID) # Create an empty bowl
		if not wolfpack.utilities.tobackpack(bowl, player):
			bowl.update()

		status = plants.plant.getStatus(plant)

		# Create a seed if we have one
		if status > STATUS_DIRT and status < STATUS_PLANT:
			seed = plants.seed.create(plants.plant.getGenus(plant), plants.plant.getHue(plant), plants.plant.getShowType(plant))
			if not wolfpack.utilities.tobackpack(seed, player):
				seed.update()

		plant.delete() # Delete the plant
コード例 #2
0
def response(player, arguments, response):
	plant = wolfpack.finditem(arguments[0])
	
	if response.button == 0 or not plant or plants.plant.getStatus(plant) >= STATUS_DECORATIVE or not player.canreach(plant, 3):
		return # Cancel
	
	if not plants.plant.checkAccess(player, plant):
		plant.say(1061856, '', '', False, 0x3b2, player.socket)
		return

	# Back to maingump
	if response.button == 1:
		plants.maingump.send(player, plant)
		
	# Set to decorative mode
	elif response.button == 2:
		status = plants.plant.getStatus(plant)
		if status == STATUS_STAGE9:
			plants.makedecorativegump.send(player, plant)
		
	# Pollination Help
	elif response.button == 3:
		send(player, plant)
		plants.sendCodexOfWisdom(player.socket, 67)
		
	# Resources Help
	elif response.button == 4:
		send(player, plant)
		plants.sendCodexOfWisdom(player.socket, 69)
		
	# Seed Help
	elif response.button == 5:
		send(player, plant)
		plants.sendCodexOfWisdom(player.socket, 68)		

	# Gather Pollen
	elif response.button == 6:
		genus = plants.plant.getGenus(plant)
		hue = plants.plant.getHue(plant)
		status = plants.plant.getStatus(plant)
		
		# Not crossable -> no pollen
		if not genus.crossable or not hue.crossable:
			plant.say(1053050, '', '', False, 0x3b2, player.socket) # You cannot gather pollen from a mutated plant!
		
		# Too early to gather pollen
		elif status < STATUS_FULLGROWN:
			plant.say(1053051, '', '', False, 0x3b2, player.socket) # You cannot gather pollen from a plant in this stage of development!
			
		# Not healthy enough
		elif plants.plant.getHealthStatus(plant) in [HEALTH_WILTED, HEALTH_DYING]:
			plant.say(1053052, '', '', False, 0x3b2, player.socket) # You cannot gather pollen from an unhealthy plant!

		# Show a target to pollinate another plant
		else:
			plant.say(1053054, '', '', False, 0x3b2, player.socket) # Target the plant you wish to cross-pollinate to.
			player.socket.attachtarget('plants.reproductiongump.pollinate_target', [plant.serial])
			
		send(player, plant) # Resend our gump

	# Gather resources
	elif response.button == 7:
		available = plants.plant.getAvailableResources(plant)
		genus = plants.plant.getGenus(plant)
		hue = plants.plant.getHue(plant)
		
		# The plant doesn't produce resources
		if not plants.resources.canProduce(genus, hue):
			if not genus.crossable or not hue.crossable:
				plant.say(1053055, '', '', False, 0x3b2, player.socket) # Mutated plants do not produce resources!
			else:
				plant.say(1053056, '', '', False, 0x3b2, player.socket) # This plant has no resources to gather!

		# Nothing available at the moment
		elif available == 0:
			plant.say(1053056, '', '', False, 0x3b2, player.socket) # This plant has no resources to gather!
			
		# Create resources
		else:
			res = plants.resources.create(genus, hue)
			if not wolfpack.utilities.tobackpack(res, player):
				res.update()					
			
			plants.plant.setAvailableResources(plant, available - 1) # Reduce available resources
			plant.say(1053059, '', '', False, 0x3b2, player.socket) # You gather resources from the plant.

		send(player, plant)

	# Gather Seeds
	elif response.button == 8:
		available = plants.plant.getAvailableSeeds(plant)
		genus = plants.plant.getGenus(plant)
		hue = plants.plant.getHue(plant)
		
		# The plant doesn't produce seeds
		if not genus.crossable or not hue.crossable:
			plant.say(1053060, '', '', False, 0x3b2, player.socket) # Mutated plants do not produce seeds!

		# Nothing available at the moment
		elif available == 0:
			plant.say(1053061, '', '', False, 0x3b2, player.socket) # This plant has no seeds to gather!
			
		# Create seeds
		else:
			seed = plants.seed.create(plants.plant.getSeedGenus(plant), plants.plant.getSeedHue(plant), True)
			if not wolfpack.utilities.tobackpack(seed, player):
				seed.update()
			
			plants.plant.setAvailableSeeds(plant, available - 1) # Reduce available seeds.
			plant.say(1053063, '', '', False, 0x3b2, player.socket) # You gather seeds from the plant.

		send(player, plant)
コード例 #3
0
ファイル: reproductiongump.py プロジェクト: thooge/Wolfpack
def response(player, arguments, response):
    plant = wolfpack.finditem(arguments[0])

    if response.button == 0 or not plant or plants.plant.getStatus(
            plant) >= STATUS_DECORATIVE or not player.canreach(plant, 3):
        return  # Cancel

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

    # Back to maingump
    if response.button == 1:
        plants.maingump.send(player, plant)

    # Set to decorative mode
    elif response.button == 2:
        status = plants.plant.getStatus(plant)
        if status == STATUS_STAGE9:
            plants.makedecorativegump.send(player, plant)

    # Pollination Help
    elif response.button == 3:
        send(player, plant)
        plants.sendCodexOfWisdom(player.socket, 67)

    # Resources Help
    elif response.button == 4:
        send(player, plant)
        plants.sendCodexOfWisdom(player.socket, 69)

    # Seed Help
    elif response.button == 5:
        send(player, plant)
        plants.sendCodexOfWisdom(player.socket, 68)

    # Gather Pollen
    elif response.button == 6:
        genus = plants.plant.getGenus(plant)
        hue = plants.plant.getHue(plant)
        status = plants.plant.getStatus(plant)

        # Not crossable -> no pollen
        if not genus.crossable or not hue.crossable:
            plant.say(1053050, '', '', False, 0x3b2, player.socket
                      )  # You cannot gather pollen from a mutated plant!

        # Too early to gather pollen
        elif status < STATUS_FULLGROWN:
            plant.say(
                1053051, '', '', False, 0x3b2, player.socket
            )  # You cannot gather pollen from a plant in this stage of development!

        # Not healthy enough
        elif plants.plant.getHealthStatus(plant) in [
                HEALTH_WILTED, HEALTH_DYING
        ]:
            plant.say(1053052, '', '', False, 0x3b2, player.socket
                      )  # You cannot gather pollen from an unhealthy plant!

        # Show a target to pollinate another plant
        else:
            plant.say(1053054, '', '', False, 0x3b2, player.socket
                      )  # Target the plant you wish to cross-pollinate to.
            player.socket.attachtarget(
                'plants.reproductiongump.pollinate_target', [plant.serial])

        send(player, plant)  # Resend our gump

    # Gather resources
    elif response.button == 7:
        available = plants.plant.getAvailableResources(plant)
        genus = plants.plant.getGenus(plant)
        hue = plants.plant.getHue(plant)

        # The plant doesn't produce resources
        if not plants.resources.canProduce(genus, hue):
            if not genus.crossable or not hue.crossable:
                plant.say(
                    1053055, '', '', False, 0x3b2,
                    player.socket)  # Mutated plants do not produce resources!
            else:
                plant.say(
                    1053056, '', '', False, 0x3b2,
                    player.socket)  # This plant has no resources to gather!

        # Nothing available at the moment
        elif available == 0:
            plant.say(1053056, '', '', False, 0x3b2,
                      player.socket)  # This plant has no resources to gather!

        # Create resources
        else:
            res = plants.resources.create(genus, hue)
            if not wolfpack.utilities.tobackpack(res, player):
                res.update()

            plants.plant.setAvailableResources(plant, available -
                                               1)  # Reduce available resources
            plant.say(1053059, '', '', False, 0x3b2,
                      player.socket)  # You gather resources from the plant.

        send(player, plant)

    # Gather Seeds
    elif response.button == 8:
        available = plants.plant.getAvailableSeeds(plant)
        genus = plants.plant.getGenus(plant)
        hue = plants.plant.getHue(plant)

        # The plant doesn't produce seeds
        if not genus.crossable or not hue.crossable:
            plant.say(1053060, '', '', False, 0x3b2,
                      player.socket)  # Mutated plants do not produce seeds!

        # Nothing available at the moment
        elif available == 0:
            plant.say(1053061, '', '', False, 0x3b2,
                      player.socket)  # This plant has no seeds to gather!

        # Create seeds
        else:
            seed = plants.seed.create(plants.plant.getSeedGenus(plant),
                                      plants.plant.getSeedHue(plant), True)
            if not wolfpack.utilities.tobackpack(seed, player):
                seed.update()

            plants.plant.setAvailableSeeds(plant, available -
                                           1)  # Reduce available seeds.
            plant.say(1053063, '', '', False, 0x3b2,
                      player.socket)  # You gather seeds from the plant.

        send(player, plant)