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
def addPotion(player, plant, potiontypes): # Try to find an item to pour into the plant potion = None backpack = player.getbackpack() for item in backpack.content: if item.hasscript("potions"): potiontype = potions.utilities.getPotionType(item) if potiontype in potiontypes: potion = item break elif potionkeg.isPotionkeg(item) and item.gettag("kegfill"): potiontype = potions.utilities.getPotionType(item) if potiontype in potiontypes: potion = item break if potion: plants.plant.pour(player, plant, potion) else: # If we CAN apply a potion of the type, show a target if plants.plant.applyPotion(player, plant, potiontypes[0], True): player.socket.clilocmessage(1061884) # You don't have any strong potions of that type in your pack. player.socket.clilocmessage( 1060808, "#%u" % plants.plant.getStatusCliloc(plant) ) # Target the container you wish to use to water the ~1_val~. player.socket.attachtarget("plants.plant.pour_target", [plant.serial]) # otherwise just print a message else: plant.say( 1053065, "", "", False, 0x3B2, player.socket ) # The plant is already soaked with this type of potion! send(player, plant) # Resend the main gump
def response(player, arguments, response): plant = wolfpack.finditem(arguments[0]) if response.button == 0 or not plant or plants.plant.getStatus(plant) != STATUS_STAGE9 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.reproductiongump.send(player, plant) # Help elif response.button == 2: send(player, plant) plants.sendCodexOfWisdom(player.socket, 70) # Turn into a decorative plant elif response.button == 3: plants.plant.setStatus(plant, STATUS_DECORATIVE) plant.say(1053077, '', '', False, 0x3b2, player.socket) # You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.
def addPotion(player, plant, potiontypes): # Try to find an item to pour into the plant potion = None backpack = player.getbackpack() for item in backpack.content: if item.hasscript('potions'): potiontype = potions.utilities.getPotionType(item) if potiontype in potiontypes: potion = item break elif potionkeg.isPotionkeg(item) and item.gettag('kegfill'): potiontype = potions.utilities.getPotionType(item) if potiontype in potiontypes: potion = item break if potion: plants.plant.pour(player, plant, potion) else: # If we CAN apply a potion of the type, show a target if plants.plant.applyPotion(player, plant, potiontypes[0], True): player.socket.clilocmessage( 1061884 ) # You don't have any strong potions of that type in your pack. player.socket.clilocmessage( 1060808, "#%u" % plants.plant.getStatusCliloc(plant) ) # Target the container you wish to use to water the ~1_val~. player.socket.attachtarget('plants.plant.pour_target', [plant.serial]) # otherwise just print a message else: plant.say( 1053065, '', '', False, 0x3b2, player.socket ) # The plant is already soaked with this type of potion! send(player, plant) # Resend the main gump
def pollinate_target(player, arguments, target): plant = wolfpack.finditem(arguments[0]) if not plant or plants.plant.getStatus(plant) >= STATUS_DECORATIVE: return # Cancel if not plants.plant.checkAccess(player, plant): plant.say(1061856, '', '', False, 0x3b2, player.socket) return 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! # Check the target item now elif not target.item or not target.item.hasscript('plants.plant'): plant.say(1053070, '', '', False, 0x3b2, player.socket) # You can only pollinate other specially grown plants! else: # Get the neccesary information for the target tgenus = plants.plant.getGenus(target.item) thue = plants.plant.getHue(target.item) tstatus = plants.plant.getStatus(target.item) # It's not really a plant if tstatus >= STATUS_DECORATIVE or tstatus <= STATUS_DIRT: plant.say(1053070, '', '', False, 0x3b2, player.socket) # You can only pollinate other specially grown plants! # It's not reachable elif not plants.plant.checkAccess(player, target.item): target.item.say(1061856, '', '', False, 0x3b2, player.socket) # You must have the item in your backpack or locked down in order to use it. # It's not crossable elif not tgenus.crossable or not thue.crossable: target.item.say(1053073, '', '', False, 0x3b2, player.socket) # You cannot cross-pollinate with a mutated plant! # It's not producing pollen elif tstatus < STATUS_FULLGROWN: target.item.say(1053074, '', '', False, 0x3b2, player.socket) # This plant is not in the flowering stage. You cannot pollinate it! # Not healthy enough elif plants.plant.getHealthStatus(target.item) in [HEALTH_WILTED, HEALTH_DYING]: target.item.say(1053075, '', '', False, 0x3b2, player.socket) # You cannot pollinate an unhealthy plant! # Already pollinated elif plants.plant.getPollinated(target.item): target.item.say(1053072, '', '', False, 0x3b2, player.socket) # This plant has already been pollinated! # Self Pollination elif target.item == plant: plants.plant.setPollinated(target.item, True) plants.plant.setSeedGenus(target.item, genus) plants.plant.setSeedHue(target.item, hue) target.item.say(1053071, '', '', False, 0x3b2, player.socket) # You pollinate the plant with its own pollen. # Cross Pollination else: plants.plant.setPollinated(target.item, True) plants.plant.setSeedGenus(target.item, genus.cross(tgenus)) plants.plant.setSeedHue(target.item, hue.cross(thue)) target.item.say(1053076, '', '', False, 0x3b2, player.socket) # You successfully cross-pollinate the plant. send(player, plant) # In the end always resend the gump
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)
def pollinate_target(player, arguments, target): plant = wolfpack.finditem(arguments[0]) if not plant or plants.plant.getStatus(plant) >= STATUS_DECORATIVE: return # Cancel if not plants.plant.checkAccess(player, plant): plant.say(1061856, '', '', False, 0x3b2, player.socket) return 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! # Check the target item now elif not target.item or not target.item.hasscript('plants.plant'): plant.say(1053070, '', '', False, 0x3b2, player.socket ) # You can only pollinate other specially grown plants! else: # Get the neccesary information for the target tgenus = plants.plant.getGenus(target.item) thue = plants.plant.getHue(target.item) tstatus = plants.plant.getStatus(target.item) # It's not really a plant if tstatus >= STATUS_DECORATIVE or tstatus <= STATUS_DIRT: plant.say(1053070, '', '', False, 0x3b2, player.socket ) # You can only pollinate other specially grown plants! # It's not reachable elif not plants.plant.checkAccess(player, target.item): target.item.say( 1061856, '', '', False, 0x3b2, player.socket ) # You must have the item in your backpack or locked down in order to use it. # It's not crossable elif not tgenus.crossable or not thue.crossable: target.item.say( 1053073, '', '', False, 0x3b2, player.socket ) # You cannot cross-pollinate with a mutated plant! # It's not producing pollen elif tstatus < STATUS_FULLGROWN: target.item.say( 1053074, '', '', False, 0x3b2, player.socket ) # This plant is not in the flowering stage. You cannot pollinate it! # Not healthy enough elif plants.plant.getHealthStatus( target.item) in [HEALTH_WILTED, HEALTH_DYING]: target.item.say( 1053075, '', '', False, 0x3b2, player.socket) # You cannot pollinate an unhealthy plant! # Already pollinated elif plants.plant.getPollinated(target.item): target.item.say( 1053072, '', '', False, 0x3b2, player.socket) # This plant has already been pollinated! # Self Pollination elif target.item == plant: plants.plant.setPollinated(target.item, True) plants.plant.setSeedGenus(target.item, genus) plants.plant.setSeedHue(target.item, hue) target.item.say( 1053071, '', '', False, 0x3b2, player.socket) # You pollinate the plant with its own pollen. # Cross Pollination else: plants.plant.setPollinated(target.item, True) plants.plant.setSeedGenus(target.item, genus.cross(tgenus)) plants.plant.setSeedHue(target.item, hue.cross(thue)) target.item.say( 1053076, '', '', False, 0x3b2, player.socket) # You successfully cross-pollinate the plant. send(player, plant) # In the end always resend the gump
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)
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 # Reproduction Menu if response.button == 1: if plants.plant.getStatus(plant) > STATUS_DIRT: plants.reproductiongump.send(player, plant) pass else: player.socket.clilocmessage( 1061885) # You need to plant a seed in the bowl first. send(player, plant) # Infestation elif response.button == 2: send(player, plant) plants.sendCodexOfWisdom(player.socket, 54) # Fungus elif response.button == 3: send(player, plant) plants.sendCodexOfWisdom(player.socket, 56) # Poison elif response.button == 4: send(player, plant) plants.sendCodexOfWisdom(player.socket, 58) # Disease elif response.button == 5: send(player, plant) plants.sendCodexOfWisdom(player.socket, 60) # Water elif response.button == 6: addWater(player, plant) # Poison Potion elif response.button == 7: addPotion(player, plant, [16, 17]) # Cure Potion elif response.button == 8: addPotion(player, plant, [6]) # Heal Potion elif response.button == 9: addPotion(player, plant, [3]) # Strength Potion elif response.button == 10: addPotion(player, plant, [10]) # Help elif response.button == 11: send(player, plant) plants.sendCodexOfWisdom(player.socket, 48) # Empty the Bowl elif response.button == 12: plants.emptybowlgump.send(player, plant) pass
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 # Reproduction Menu if response.button == 1: if plants.plant.getStatus(plant) > STATUS_DIRT: plants.reproductiongump.send(player, plant) pass else: player.socket.clilocmessage(1061885) # You need to plant a seed in the bowl first. send(player, plant) # Infestation elif response.button == 2: send(player, plant) plants.sendCodexOfWisdom(player.socket, 54) # Fungus elif response.button == 3: send(player, plant) plants.sendCodexOfWisdom(player.socket, 56) # Poison elif response.button == 4: send(player, plant) plants.sendCodexOfWisdom(player.socket, 58) # Disease elif response.button == 5: send(player, plant) plants.sendCodexOfWisdom(player.socket, 60) # Water elif response.button == 6: addWater(player, plant) # Poison Potion elif response.button == 7: addPotion(player, plant, [16, 17]) # Cure Potion elif response.button == 8: addPotion(player, plant, [6]) # Heal Potion elif response.button == 9: addPotion(player, plant, [3]) # Strength Potion elif response.button == 10: addPotion(player, plant, [10]) # Help elif response.button == 11: send(player, plant) plants.sendCodexOfWisdom(player.socket, 48) # Empty the Bowl elif response.button == 12: plants.emptybowlgump.send(player, plant) pass