diff --git a/data/dfndata/colors/colors.dfn b/data/dfndata/colors/colors.dfn index 73d0d56ea..2ef4b4afa 100644 --- a/data/dfndata/colors/colors.dfn +++ b/data/dfndata/colors/colors.dfn @@ -1663,4 +1663,13 @@ 0x8AD // blue 0x89B // red 0x08A0 // green +} + +// seed colors +[RANDOMCOLOR 10003] +{ +0x0 +0x66D +0x53D +0x8A5 } \ No newline at end of file diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn index e7fa16ffe..0efbde7d8 100644 --- a/data/dfndata/items/gear/armor/base_armor.dfn +++ b/data/dfndata/items/gear/armor/base_armor.dfn @@ -1938,216 +1938,175 @@ restock=10 // Shields -// Bronze Shield - Base item with shared DFN tags -[base_bronze_shield] +[base_shield] { get=base_item -name=bronze shield -id=0x1b72 +type=107 decay=1 +movable=1 good=16 layer=0x02 restock=10 +} + +// Bronze Shield - Base item with shared DFN tags +[base_bronze_shield] +{ +get=base_shield +name=bronze shield +id=0x1b72 str=20 } // Buckler - Base item with shared DFN tags [base_buckler] { -get=base_item +get=base_shield name=buckler id=0x1b73 -decay=1 -good=16 -layer=0x02 -restock=10 +str=20 } // Metal Kite Shield - Base item with shared DFN tags [base_metal_kite_shield] { -get=base_item +get=base_shield name=metal kite shield id=0x1b74 -decay=1 +str=20 dyeable=1 -good=16 -layer=0x02 -restock=10 } // Heater Shield - Base item with shared DFN tags [base_heater_shield] { -get=base_item +get=base_shield name=heater shield id=0x1b76 -decay=1 -good=16 -layer=0x02 -restock=10 +str=20 } // Metal Shield - Base item with shared DFN tags [base_metal_shield] { -get=base_item +get=base_shield name=metal shield id=0x1b7b -decay=1 -good=16 -layer=0x02 -restock=10 +str=20 } // Kite Shield (Wooden) - Base item with shared DFN tags [base_wooden_kite_shield] { -get=base_item +get=base_shield name=kite shield id=0x1b78 -decay=1 -good=16 -layer=2 -movable=1 -restock=10 +str=20 } // Wooden Shield - Base item with shared DFN tags [base_wooden_shield] { -get=base_item +get=base_shield name=wooden shield id=0x1b7a -decay=1 -good=16 -layer=2 -movable=1 -restock=10 +str=20 } // Order Shield - Base item with shared DFN tags [base_order_shield] { -get=base_item +get=base_shield name=order shield id=0x1bc4 -decay=1 -good=16 -layer=0x02 +str=20 } // Chaos Shield - Base item with shared DFN tags [base_chaos_shield] { -get=base_item +get=base_shield name=chaos shield id=0x1bc3 -decay=1 -good=16 -layer=0x02 +str=20 } // Gargish Chaos Shield - Base item with shared DFN tags [base_gargish_chaos_shield] { -get=base_item +get=base_shield name=gargish chaos shield id=0x4228 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Gargish Kite Shield - Base item with shared DFN tags [base_gargish_kite_shield] { -get=base_item +get=base_shield name=gargish kite shield id=0x4201 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Gargish Order Shield - Base item with shared DFN tags [base_gargish_order_shield] { -get=base_item +get=base_shield name=gargish order shield id=0x422a -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Large Plate Shield - Base item with shared DFN tags [base_large_plate_shield] { -get=base_item +get=base_shield name=large plate shield id=0x4204 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Large Stone Shield - Base item with shared DFN tags [base_large_stone_shield] { -get=base_item +get=base_shield name=large stone shield id=0x4205 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Medium Plate Shield - Base item with shared DFN tags [base_medium_plate_shield] { -get=base_item +get=base_shield name=medium plate shield id=0x4203 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Small Plate Shield - Base item with shared DFN tags [base_small_plate_shield] { -get=base_item +get=base_shield name=small plate shield id=0x4202 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 } // Gargish Wooden Shield - Base item with shared DFN tags [base_gargish_wooden_shield] { -get=base_item +get=base_shield name=gargish wooden shield id=0x4200 -decay=1 -good=16 -layer=0x02 +str=20 origin=sa -restock=10 -} +} \ No newline at end of file diff --git a/data/dfndata/items/misc/plantgrowing.dfn b/data/dfndata/items/misc/plantgrowing.dfn new file mode 100644 index 000000000..ab4b43432 --- /dev/null +++ b/data/dfndata/items/misc/plantgrowing.dfn @@ -0,0 +1,337 @@ +//Plant System Items +//Plant System js numbers adds this to your js file +//19100=custom/plantgrowing/plantsystem.js +//19101=custom/plantgrowing/plantbowl.js +//19102=custom/plantgrowing/seed.js + +[emptyplantbowl] +{ +get=base_item +name=a plant bowl +weight=10 +id=0x15FD +restock=20 +value=2 1 +decay=1 +script=19101 +} + +[plantbowlOfdirt] +{ +get=base_item +name=a bowl of dirt +weight=10 +id=0x1602 +hp=100 100 +decay=1 +script=19100 +} + +[base_seed] +{ +get=base_item +id=0xDCF +weight=10 +amount=1 +decay=1 +colourlist=10003 +script=19102 +} + +[CampionFlowerSeed] +{ +get=base_seed +name=Campion Flower Seed +custominttag=CampionFlowerSeed 1 +} + +[PoppiesSeed] +{ +get=base_seed +name=Poppie Seed +custominttag=PoppieSeed 1 +} + +[SnowdropSeed] +{ +get=base_seed +name=Snowdrop Seed +custominttag=SnowdropSeed 1 +} + +[BulrusheSeed] +{ +get=base_seed +name=Bulrushe Seed +custominttag=BulrusheSeed 1 +} + +[LilieSeed] +{ +get=base_seed +name=Lilie Seed +custominttag=LilieSeed 1 +} + +[PampasGrassSeed] +{ +get=base_seed +name=Pampas Grass Seed +color=0x2B +custominttag=PampasGrassSeed 1 +} + +[RusheSeed] +{ +get=base_seed +name=Rushe Seed +custominttag=RusheSeed 1 +} + +[ElephantEarPlantrSeed] +{ +get=base_seed +name=Elephant Ear Plant Seed +color=0x21 +custominttag=ElephantEarPlantrSeed 1 +} + +[FernSeed] +{ +get=base_seed +name=Fern Seed +custominttag=FernSeed 1 +} + +[PonytailPalmSeed] +{ +get=base_seed +name=Ponytail Palm Seed +color=0x21 +custominttag=PonytailPalmSeed 1 +} + +[SmallPalmSeed] +{ +get=base_seed +name=Small Palm Seed +custominttag=SmallPalmSeed 1 +} + +[CenturyPlantSeed] +{ +get=base_seed +name=Century Plant Seed +color=0x21 +custominttag=CenturyPlantSeed 1 +} + +[WaterPlantSeed] +{ +get=base_seed +name=Water Plant Seed +custominttag=WaterPlantSeed 1 +} + +[SnakePlantSeed] +{ +get=base_seed +name=Snake Plant Seed +custominttag=SnakePlantSeed 1 +} + +[PricklyPearCactusSeed] +{ +get=base_seed +name=Prickly Pear Cactus Seed +custominttag=PricklyPearCactusSeed 1 +} + +[BarrelCactusSeed] +{ +get=base_seed +name=Barrel Cactus Seed +custominttag=BarrelCactusSeed 1 +} + +[TribarrelCactusSeed] +{ +get=base_seed +name=Tribarrel Cactus Seed +custominttag=TribarrelCactusSeed 1 +} + +[CommonGreenBonsaiSeed] +{ +get=base_seed +name=Common Green Bonsai Seed +custominttag=CommonGreenBonsaiSeed 1 +} + +[CommonPinkBonsaiSeed] +{ +get=base_seed +name=Common Pink Bonsai Seed +custominttag=CommonPinkBonsaiSeed 1 +} + +[UncommonGreenBonsaiSeed] +{ +get=base_seed +name=Uncommon Green Bonsai Seed +custominttag=UncommonGreenBonsai 1 +} + +[UncommonPinkBonsaiSeed] +{ +get=base_seed +name=Uncommon Pink Bonsai Seed +custominttag=UncommonPinkBonsai 1 +} + +[RareGreenBonsai] +{ +get=base_seed +name=Rare Green Bonsai Seed +custominttag=RareGreenBonsai 1 +} + +[RarePinkBonsai] +{ +get=base_seed +name=RarePinkBonsai Seed +custominttag=RarePinkBonsai 1 +} + +[ExceptionalBonsai] +{ +get=base_seed +name=Exceptional Bonsai Seed +custominttag=ExceptionalBonsai 1 +} + +[ExoticBonsai] +{ +get=base_seed +name=Exotic Bonsai Seed +custominttag=ExoticBonsai 1 +} + +[Cactus] +{ +get=base_seed +name=Cactus Seed +custominttag=Cactus 1 +} + +[FlaxFlowers] +{ +get=base_seed +name=Flax Flowers Seed +custominttag=FlaxFlowers 1 +} + +[FoxgloveFlowers] +{ +get=base_seed +name=Foxglove Flowers Seed +custominttag=FoxgloveFlowers 1 +} + +[HopsEast] +{ +get=base_seed +name=Hops East Seed +custominttag=HopsEast 1 +} + +[OrfluerFlowers] +{ +get=base_seed +name=Orfluer Flowers Seed +custominttag=OrfluerFlowers 1 +} + +[CypressTwisted] +{ +get=base_seed +name=CypressTwisted Seed +custominttag=CypressTwisted 1 +} + +[HedgeShort] +{ +get=base_seed +name=Hedge Short Seed +custominttag=HedgeShort 1 +} + +[JuniperBush] +{ +get=base_seed +name=Juniper Bush Seed +custominttag=JuniperBush 1 +} + +[SnowdropPatch] +{ +get=base_seed +name=Snowdrop Patch Seed +custominttag=SnowdropPatch 1 +} + +[Cattails] +{ +get=base_seed +name=Cattails Seed +custominttag=Cattails 1 +} + +[PoppyPatch] +{ +get=base_seed +name=Poppy Patch Seed +custominttag=PoppyPatch 1 +} + +[SpiderTree] +{ +get=base_seed +name=Spider Tree Seed +custominttag=SpiderTree 1 +} + +[WaterLily] +{ +get=base_seed +name=Water Lily Seed +custominttag=WaterLily 1 +} + +[CypressStraight] +{ +get=base_seed +name=Cypress Straight Seed +custominttag=CypressStraight 1 +} + +[HedgeTall] +{ +get=base_seed +name=Hedge Tall Seed +custominttag=HedgeTall 1 +} + +[HopsSouth] +{ +get=base_seed +name=Hops South Seed +custominttag=HopsSouth 1 +} + +[SugarCanes] +{ +get=base_seed +name=Sugar Canes Seed +custominttag=SugarCanes 1 +} diff --git a/data/dictionaries/dictionary.CSY b/data/dictionaries/dictionary.CSY index 9b6d32295..788ffa7b9 100644 --- a/data/dictionaries/dictionary.CSY +++ b/data/dictionaries/dictionary.CSY @@ -5311,6 +5311,40 @@ 19100=Úspěšně jste převedli kov. 19101=Najednou můžete převést pouze pět set ingotů. 19102=Pro výměnu musí být položka ve vašem batohu. +// [19110-19200] Pěstování rostlin +19110=Abyste mohli položku použít, musíte ji mít v batohu nebo uzamčenou. +19111=Nejprve musíte do misky zasadit semínko +19112=Prořezáváte rostlinu. Tato rostlina již nebude produkovat zdroje ani semena, ale nebude vyžadovat žádnou údržbu. +19113=Nemůžete sbírat pyl z mutované rostliny! +19114=Příliš brzy na sběr pylu +19115=Nemůžete sbírat pyl z nezdravé rostliny! +19116=Zaměřte se na rostlinu, kterou chcete křížově opylit. +19117=Můžete opylovat pouze jiné speciálně pěstované rostliny! +19118=Tato rostlina není ve fázi květu. Nemůžete to opylit! +19119=Nemůžete opylit nezdravou rostlinu! +19120=Nemůžete křížově opylovat mutovanou rostlinou! +19121=Tato rostlina již byla opylena! +19122=Opylujete rostlinu vlastním pylem. +19123=Úspěšně jste zkřížili - opylovali rostlinu. +19124=Tato rostlina nemá semena ke sběru! +19125=Sbíráte semena z rostliny. +19126=Do této rostliny nemůžete přidat vodu. +19127=Změkčíte špínu vodou. +19128=To ​​nemůžete použít na rostlinu! +19129=Ve svém balíčku nemáte žádné silné lektvary tohoto typu. +19130=Lektvary byste měli nalít pouze na rostlinu nebo semeno! +19131=Rostlina je tímto typem lektvaru již nasáklá! +19132=Abyste jej mohli použít, musíte mít předmět v batohu. +19133=Vyberte kousek špíny, který chcete nabrat. +19134=Potřebujete více nečistot k naplnění misky na rostliny! +19135=Naplňte misku čerstvou špínou. +19136=Budete chtít nasbírat čerstvou špínu, abyste vypěstovali zdravou rostlinu! +19137=Vyberte misku s hlínou, do které zasadíte toto semínko. +19138=Musíte použít semeno na připravenou půdu! +19139=Tato miska s nečistotami již obsahuje semínko %s! +19140=Nejprve je třeba změkčit nečistoty. +19141=Zasadíte semeno do misky s hlínou. +19142=Musíte použít semínko na misku s nečistotami! // [19201-19300] Speciální pohyby 19201=K provedení tohoto útoku potřebujete %i zbraň 19202=K provedení tohoto útoku potřebujete %i many diff --git a/data/dictionaries/dictionary.ENG b/data/dictionaries/dictionary.ENG index 28be828cd..4d1253220 100644 --- a/data/dictionaries/dictionary.ENG +++ b/data/dictionaries/dictionary.ENG @@ -5312,6 +5312,40 @@ 19100=You've successfully converted the metal. 19101=You can only convert five hundred ingots at a time. 19102=The item must be in your backpack to be exchanged. +// [19110-19200] Plant Growing +19110=You must have the item in your backpack or locked down in order to use it. +19111=You need to plant a seed in the bowl first +19112=You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep. +19113=You cannot gather pollen from a mutated plant! +19114=Too early to gather pollen +19115=You cannot gather pollen from an unhealthy plant! +19116=Target the plant you wish to cross-pollinate to. +19117=You can only pollinate other specially grown plants! +19118=This plant is not in the flowering stage. You cannot pollinate it! +19119=You cannot pollinate an unhealthy plant! +19120=You cannot cross-pollinate with a mutated plant! +19121=This plant has already been pollinated! +19122=You pollinate the plant with its own pollen. +19123=You successfully cross - pollinate the plant. +19124=This plant has no seeds to gather! +19125=You gather seeds from the plant. +19126=You can't add water to this plant. +19127=You soften the dirt with water. +19128=You can't use that on a plant! +19129=You don't have any strong potions of that type in your pack. +19130=You should only pour potions on a plant or seed! +19131=The plant is already soaked with this type of potion! +19132=You must have the object in your backpack to use it. +19133=Choose a patch of dirt to scoop up. +19134=You need more dirt to fill a plant bowl! +19135=You fill the bowl with fresh dirt. +19136=You'll want to gather fresh dirt in order to raise a healthy plant! +19137=Choose a bowl of dirt to plant this seed in. +19138=You must use a seed on some prepared soil! +19139=This bowl of dirt already has a seed %s in it! +19140=The dirt needs to be softened first. +19141=You plant the seed in the bowl of dirt. +19142=You must use a seed on a bowl of dirt! // [19201-19300] Special Moves 19201=You need %i weapon skill to perform that attack 19202=You need %i mana to perform that attack diff --git a/data/dictionaries/dictionary.FRE b/data/dictionaries/dictionary.FRE index d61ada06d..06680434d 100644 --- a/data/dictionaries/dictionary.FRE +++ b/data/dictionaries/dictionary.FRE @@ -5467,6 +5467,40 @@ 19100=Vous avez réussi à convertir le métal. 19101=Vous ne pouvez convertir que cinq cents lingots à la fois. 19102=L'article doit être dans votre sac à dos pour être échangé. +// [19110-19200] Culture de plantes +19110=Vous devez avoir l'objet dans votre sac à dos ou verrouillé pour pouvoir l'utiliser. +19111=Vous devez d'abord planter une graine dans le bol +19112=Vous taillez la plante. Cette plante ne produira plus de ressources ni de graines, mais ne nécessitera aucun entretien. +19113=Vous ne pouvez pas récolter le pollen d'une plante mutée ! +19114=Trop tôt pour récolter le pollen +19115=Vous ne pouvez pas récolter le pollen d'une plante en mauvaise santé ! +19116=Ciblez la plante avec laquelle vous souhaitez effectuer une pollinisation croisée. +19117=Vous ne pouvez polliniser que d'autres plantes spécialement cultivées ! +19118=Cette plante n'est pas en phase de floraison. Vous ne pouvez pas le polliniser ! +19119=Vous ne pouvez pas polliniser une plante en mauvaise santé ! +19120=Vous ne pouvez pas effectuer de pollinisation croisée avec une plante mutée ! +19121=Cette plante a déjà été pollinisée ! +19122=Vous pollinisez la plante avec son propre pollen. +19123=Vous avez réussi la pollinisation croisée de la plante. +19124=Cette plante n'a pas de graines à récolter ! +19125=Vous récoltez les graines de la plante. +19126=Vous ne pouvez pas ajouter d'eau à cette usine. +19127=Vous adoucissez la saleté avec de l'eau. +19128=Vous ne pouvez pas utiliser ça sur une plante ! +19129=Vous n'avez pas de potions puissantes de ce type dans votre pack. +19130=Vous ne devriez verser des potions que sur une plante ou une graine ! +19131=La plante est déjà imbibée de ce type de potion ! +19132=Vous devez avoir l'objet dans votre sac à dos pour l'utiliser. +19133=Choisissez une parcelle de terre à ramasser. +19134=Vous avez besoin de plus de terre pour remplir un bol de plante ! +19135=Vous remplissez le bol de terre fraîche. +19136=Vous aurez envie de ramasser de la terre fraîche afin de faire pousser une plante saine ! +19137=Choisissez un bol de terre pour y planter cette graine. +19138=Vous devez utiliser une graine sur un sol préparé ! +19139=Ce bol de terre contient déjà une graine %s ! +19140=La saleté doit d'abord être ramollie. +19141=Vous plantez la graine dans le bol de terre. +19142=Vous devez utiliser une graine sur un bol de terre ! // [19201-19300] Coups spéciaux 19201=Vous avez besoin de %i compétence d'arme pour effectuer cette attaque 19202=Vous avez besoin de %i mana pour effectuer cette attaque diff --git a/data/dictionaries/dictionary.GER b/data/dictionaries/dictionary.GER index e0cc39df1..2b7d8f19c 100644 --- a/data/dictionaries/dictionary.GER +++ b/data/dictionaries/dictionary.GER @@ -5311,6 +5311,40 @@ 19100=Sie haben das Metall erfolgreich umgewandelt. 19101=Sie können jeweils nur fünfhundert Barren umwandeln. 19102=Der Artikel muss sich zum Umtausch in Ihrem Rucksack befinden. +// [19110-19200] Pflanzenbau +19110=Sie müssen den Gegenstand in Ihrem Rucksack haben oder verschlossen haben, um ihn verwenden zu können. +19111=Sie müssen zuerst einen Samen in die Schüssel pflanzen +19112=Sie beschneiden die Pflanze. Diese Pflanze produziert keine Ressourcen oder Samen mehr, benötigt aber keine Pflege. +19113=Sie können keinen Pollen von einer mutierten Pflanze sammeln! +19114=Zu früh, um Pollen zu sammeln +19115=Sie können keinen Pollen von einer ungesunden Pflanze sammeln! +19116=Zielen Sie auf die Pflanze, die Sie kreuzbestäuben möchten. +19117=Sie können nur andere speziell gezüchtete Pflanzen bestäuben! +19118=Diese Pflanze befindet sich nicht in der Blütephase. Sie können es nicht bestäuben! +19119=Sie können eine ungesunde Pflanze nicht bestäuben! +19120=Eine Kreuzbestäubung mit einer mutierten Pflanze ist nicht möglich! +19121=Diese Pflanze wurde bereits bestäubt! +19122=Sie bestäuben die Pflanze mit ihrem eigenen Pollen. +19123=Sie haben die Pflanze erfolgreich kreuzbestäubt. +19124=Diese Pflanze hat keine Samen zum Sammeln! +19125=Sie sammeln Samen von der Pflanze. +19126=Sie können dieser Pflanze kein Wasser hinzufügen. +19127=Sie weichen den Schmutz mit Wasser auf. +19128=Das kannst du nicht bei einer Pflanze anwenden! +19129=Du hast keine starken Tränke dieser Art in deinem Rucksack. +19130=Du solltest Tränke nur auf eine Pflanze oder einen Samen gießen! +19131=Die Pflanze ist bereits mit dieser Art von Trank getränkt! +19132=Sie müssen das Objekt in Ihrem Rucksack haben, um es verwenden zu können. +19133=Wählen Sie ein Stück Erde zum Aufsammeln. +19134=Sie benötigen mehr Erde, um eine Pflanzschale zu füllen! +19135=Sie füllen die Schüssel mit frischer Erde. +19136=Sie möchten frische Erde sammeln, um eine gesunde Pflanze zu züchten! +19137=Wählen Sie eine Schüssel mit Erde, in die Sie diesen Samen pflanzen möchten. +19138=Sie müssen einen Samen auf vorbereitetem Boden verwenden! +19139=Diese Schüssel voller Erde enthält bereits einen Samen %s! +19140=Der Schmutz muss zuerst aufgeweicht werden. +19141=Sie pflanzen den Samen in die Schüssel mit Erde. +19142=Sie müssen einen Samen auf eine Schüssel voller Erde verwenden! // [19201-19300] Spezialbewegungen 19201=Sie benötigen %i Waffenfähigkeit, um diesen Angriff auszuführen 19202=Du brauchst %i Mana, um diesen Angriff auszuführen diff --git a/data/dictionaries/dictionary.ITA b/data/dictionaries/dictionary.ITA index 2a20d9062..9f4d2dd0f 100644 --- a/data/dictionaries/dictionary.ITA +++ b/data/dictionaries/dictionary.ITA @@ -5311,6 +5311,40 @@ 19100=Hai convertito con successo il metallo. 19101=Puoi convertire solo cinquecento lingotti alla volta. 19102=L'articolo deve essere nel tuo zaino per essere scambiato. +// [19110-19200] Coltivazione di piante +19110=Devi avere l'oggetto nello zaino o chiuso a chiave per poterlo utilizzare. +19111=Devi prima piantare un seme nella ciotola +19112=Poti la pianta. Questa pianta non produrrà più risorse o semi, ma non richiederà manutenzione. +19113=Non puoi raccogliere il polline da una pianta mutata! +19114=Troppo presto per raccogliere il polline +19115=Non puoi raccogliere il polline da una pianta malata! +19116=Prendi come bersaglio la pianta su cui desideri effettuare l'impollinazione incrociata. +19117=Puoi impollinare solo altre piante coltivate appositamente! +19118=Questa pianta non è in fase di fioritura. Non puoi impollinarlo! +19119=Non puoi impollinare una pianta malata! +19120=Non puoi effettuare l'impollinazione incrociata con una pianta mutata! +19121=Questa pianta è già stata impollinata! +19122=Impollina la pianta con il suo stesso polline. +19123=Hai incrociato e impollinato con successo la pianta. +19124=Questa pianta non ha semi da raccogliere! +19125=Raccogli i semi dalla pianta. +19126=Non puoi aggiungere acqua a questa pianta. +19127=Ammorbidisci lo sporco con l'acqua. +19128=Non puoi usarlo su una pianta! +19129=Non hai pozioni forti di quel tipo nel tuo zaino. +19130=Dovresti versare pozioni solo su una pianta o un seme! +19131=La pianta è già intrisa di questo tipo di pozione! +19132=Devi avere l'oggetto nello zaino per usarlo. +19133=Scegli un pezzo di terra da raccogliere. +19134=Hai bisogno di più terra per riempire un vaso per piante! +19135=Riempi la ciotola con terra fresca. +19136=Avrai bisogno di raccogliere terra fresca per far crescere una pianta sana! +19137=Scegli una ciotola di terra in cui piantare questo seme. +19138=Devi usare un seme su un terreno preparato! +19139=Questa ciotola di terra contiene già un seme %s! +19140=Lo sporco deve prima essere ammorbidito. +19141=Pianta il seme nella ciotola di terra. +19142=Devi usare un seme su una ciotola di terra! // [19201-19300] Mosse speciali 19201=Hai bisogno di %i abilità con l'arma per eseguire quell'attacco 19202=Hai bisogno di %i mana per eseguire quell'attacco diff --git a/data/dictionaries/dictionary.POL b/data/dictionaries/dictionary.POL index 0ca11cd4a..4c63013a7 100644 --- a/data/dictionaries/dictionary.POL +++ b/data/dictionaries/dictionary.POL @@ -5311,6 +5311,40 @@ 19100=Udało Ci się przekonwertować metal. 19101=Możesz wymieniać tylko pięćset sztabek na raz. 19102=Przedmiot musi znajdować się w Twoim plecaku, aby można go było wymienić. +// [19110-19200] Uprawa roślin +19110=Musisz mieć ten przedmiot w plecaku lub zamknięty, aby go użyć. +19111=Najpierw musisz zasiać ziarno w misce +19112=Przycinasz roślinę. Ta roślina nie będzie już produkować zasobów ani nasion, ale nie będzie wymagać konserwacji. +19113=Nie możesz zbierać pyłku ze zmutowanej rośliny! +19114=Za wcześnie na zbieranie pyłku +19115=Nie możesz zbierać pyłku z niezdrowej rośliny! +19116=Wyceluj w roślinę, którą chcesz zapylić krzyżowo. +19117=Możesz zapylać tylko inne, specjalnie wyhodowane rośliny! +19118=Ta roślina nie jest w fazie kwitnienia. Nie można go zapylać! +19119=Nie możesz zapylać niezdrowej rośliny! +19120=Nie możesz zapylać krzyżowo ze zmutowaną rośliną! +19121=Ta roślina została już zapylona! +19122=Zapylasz roślinę własnym pyłkiem. +19123=Udało Ci się krzyżować - zapylić roślinę. +19124=Ta roślina nie ma nasion do zebrania! +19125=Zbierasz nasiona rośliny. +19126=Nie możesz dodać wody do tej rośliny. +19127=Zmiękczasz brud wodą. +19128=Nie możesz tego użyć na roślinie! +19129=Nie masz w swoim zestawie żadnych silnych mikstur tego typu. +19130=Powinieneś polewać miksturami tylko rośliny lub nasiona! +19131=Roślina jest już nasączona tego typu miksturą! +19132=Musisz mieć ten przedmiot w plecaku, aby z niego skorzystać. +19133=Wybierz kawałek ziemi do zebrania. +19134=Potrzebujesz więcej ziemi, aby wypełnić miskę z roślinami! +19135=Napełniasz miskę świeżą ziemią. +19136=Będziesz chciał zebrać świeżą ziemię, aby wyhodować zdrową roślinę! +19137=Wybierz miskę ziemi, w której chcesz zasadzić to ziarno. +19138=Musisz użyć nasion na przygotowanej glebie! +19139=W tej misce brudu jest już nasionko %s! +19140=Najpierw należy zmiękczyć brud. +19141=Zasiewasz ziarno w misce z ziemią. +19142=Musisz użyć nasion na misce ziemi! // [19201-19300] Ruchy specjalne 19201=Potrzebujesz %i umiejętności posługiwania się bronią, aby wykonać ten atak 19202=Potrzebujesz %i many, aby wykonać ten atak diff --git a/data/dictionaries/dictionary.PTG b/data/dictionaries/dictionary.PTG index 8ab1e9c06..976644413 100644 --- a/data/dictionaries/dictionary.PTG +++ b/data/dictionaries/dictionary.PTG @@ -5311,6 +5311,40 @@ 19100=Você converteu o metal com sucesso. 19101=Você só pode converter quinhentos lingotes por vez. 19102=O item deve estar em sua mochila para ser trocado. +// [19110-19200] Cultivo de Plantas +19110=Você deve ter o item em sua mochila ou trancado para poder usá-lo. +19111=Você precisa plantar uma semente na tigela primeiro +19112=Você poda a planta. Esta planta não produzirá mais recursos ou sementes, mas não exigirá manutenção. +19113=Você não pode coletar pólen de uma planta mutante! +19114=Muito cedo para coletar pólen +19115=Você não pode coletar pólen de uma planta insalubre! +19116=Escolha a planta que você deseja polinizar cruzadamente. +19117=Você só pode polinizar outras plantas especialmente cultivadas! +19118=Esta planta não está em fase de floração. Você não pode polinizá-lo! +19119=Você não pode polinizar uma planta insalubre! +19120=Você não pode fazer polinização cruzada com uma planta mutante! +19121=Esta planta já foi polinizada! +19122=Você poliniza a planta com seu próprio pólen. +19123=Você fez a polinização cruzada da planta com sucesso. +19124=Esta planta não tem sementes para colher! +19125=Você colhe sementes da planta. +19126=Você não pode adicionar água a esta planta. +19127=Você suaviza a sujeira com água. +19128=Você não pode usar isso em uma planta! +19129=Você não tem nenhuma poção forte desse tipo em seu pacote. +19130=Você só deve colocar poções em uma planta ou semente! +19131=A planta já está encharcada com esse tipo de poção! +19132=Você deve ter o objeto em sua mochila para usá-lo. +19133=Escolha um pedaço de terra para recolher. +19134=Você precisa de mais terra para encher um vaso de plantas! +19135=Você enche a tigela com terra fresca. +19136=Você vai querer juntar terra fresca para cultivar uma planta saudável! +19137=Escolha um recipiente com terra para plantar esta semente. +19138=Você deve usar uma semente em solo preparado! +19139=Esta tigela de terra já contém uma semente %s! +19140=A sujeira precisa ser amolecida primeiro. +19141=Você planta a semente na tigela de terra. +19142=Você deve usar uma semente em uma tigela de terra! // [19201-19300] Movimentos Especiais 19201=Você precisa de %i habilidade com arma para realizar esse ataque 19202=Você precisa de %i mana para realizar esse ataque diff --git a/data/dictionaries/dictionary.SPA b/data/dictionaries/dictionary.SPA index 11346b8d4..fd5255191 100644 --- a/data/dictionaries/dictionary.SPA +++ b/data/dictionaries/dictionary.SPA @@ -5311,6 +5311,40 @@ 19100=Has convertido exitosamente el metal. 19101=Sólo puedes convertir quinientos lingotes a la vez. 19102=El artículo debe estar en tu mochila para ser intercambiado. +// [19110-19200] Cultivo de plantas +19110=Debes tener el artículo en tu mochila o bajo llave para poder usarlo. +19111=Primero debes plantar una semilla en el recipiente +19112=Podas la planta. Esta planta ya no producirá recursos ni semillas, pero no requerirá mantenimiento. +19113=¡No puedes recolectar polen de una planta mutada! +19114=Demasiado pronto para recolectar polen +19115=¡No puedes recolectar polen de una planta enferma! +19116=Objetivo a la planta con la que desea realizar polinización cruzada. +19117=¡Solo puedes polinizar otras plantas especialmente cultivadas! +19118=Esta planta no se encuentra en etapa de floración. ¡No puedes polinizarlo! +19119=¡No puedes polinizar una planta enferma! +19120=¡No puedes realizar polinización cruzada con una planta mutada! +19121=¡Esta planta ya ha sido polinizada! +19122=Polinizas la planta con tu propio polen. +19123=Cruzas - polinizas exitosamente la planta. +19124=¡Esta planta no tiene semillas para recolectar! +19125=Recolectas semillas de la planta. +19126=No puedes agregar agua a esta planta. +19127=Ablandas la suciedad con agua. +19128=¡No puedes usar eso en una planta! +19129=No tienes ninguna poción fuerte de ese tipo en tu paquete. +19130=¡Solo debes verter pociones sobre una planta o semilla! +19131=¡La planta ya está empapada con este tipo de poción! +19132=Debes tener el objeto en tu mochila para usarlo. +19133=Elige un trozo de tierra para recoger. +19134=¡Necesitas más tierra para llenar un macetero! +19135=Llenas el recipiente con tierra fresca. +19136=¡Querrás recolectar tierra fresca para poder cultivar una planta saludable! +19137=Elija un recipiente con tierra para plantar esta semilla. +19138=¡Debes usar una semilla en algún suelo preparado! +19139=¡Este cuenco de tierra ya tiene una semilla %s! +19140=Primero es necesario ablandar la suciedad. +19141=Plantas la semilla en el cuenco de tierra. +19142=¡Debes usar una semilla en un recipiente con tierra! // [19201-19300] Movimientos especiales 19201=Necesitas %i habilidad con arma para realizar ese ataque 19202=Necesitas %i mana para realizar ese ataque diff --git a/data/dictionaries/dictionary.ZRO b/data/dictionaries/dictionary.ZRO index a8ea12a6f..bb1d66286 100644 --- a/data/dictionaries/dictionary.ZRO +++ b/data/dictionaries/dictionary.ZRO @@ -5306,6 +5306,40 @@ 19100=You've successfully converted the metal. 19101=You can only convert five hundred ingots at a time. 19102=The item must be in your backpack to be exchanged. +// [19110-19200] Plant Growing +19110=You must have the item in your backpack or locked down in order to use it. +19111=You need to plant a seed in the bowl first +19112=You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep. +19113=You cannot gather pollen from a mutated plant! +19114=Too early to gather pollen +19115=You cannot gather pollen from an unhealthy plant! +19116=Target the plant you wish to cross-pollinate to. +19117=You can only pollinate other specially grown plants! +19118=This plant is not in the flowering stage. You cannot pollinate it! +19119=You cannot pollinate an unhealthy plant! +19120=You cannot cross-pollinate with a mutated plant! +19121=This plant has already been pollinated! +19122=You pollinate the plant with its own pollen. +19123=You successfully cross - pollinate the plant. +19124=This plant has no seeds to gather! +19125=You gather seeds from the plant. +19126=You can't add water to this plant. +19127=You soften the dirt with water. +19128=You can't use that on a plant! +19129=You don't have any strong potions of that type in your pack. +19130=You should only pour potions on a plant or seed! +19131=The plant is already soaked with this type of potion! +19132=You must have the object in your backpack to use it. +19133=Choose a patch of dirt to scoop up. +19134=You need more dirt to fill a plant bowl! +19135=You fill the bowl with fresh dirt. +19136=You'll want to gather fresh dirt in order to raise a healthy plant! +19137=Choose a bowl of dirt to plant this seed in. +19138=You must use a seed on some prepared soil! +19139=This bowl of dirt already has a seed %s in it! +19140=The dirt needs to be softened first. +19141=You plant the seed in the bowl of dirt. +19142=You must use a seed on a bowl of dirt! // [19201-19300] Special Moves 19201=You need %i weapon skill to perform that attack 19202=You need %i mana to perform that attack diff --git a/data/js/item/disguisekit.js b/data/js/item/disguisekit.js index 0f7abeeeb..c4767dbc3 100644 --- a/data/js/item/disguisekit.js +++ b/data/js/item/disguisekit.js @@ -338,10 +338,15 @@ function onGumpPress( pSock, buttonID, gumpData ) // Start Disguise timer pUser.KillJSTimer( 1, 5023 ); + + TriggerEvent( 2204, "RemoveBuff", pUser, 1033 );// Remove Current Disguise Buff + pUser.StartTimer( disguiseDuration, 1, 5023 ); pSock.SysMessage( GetDictionaryEntry( 18037, pSock.language )); // Disguises wear off after 2 hours. : You're looking good. + TriggerEvent( 2204, "AddBuff", pUser, 1033, 1075821, 1075820, 7200, "" ); // Add Disguise Buff + // Resend Disguise Kit Gump ShowDisguiseKitMenu( pSock, pUser ); break; diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js new file mode 100644 index 000000000..29b0ad88a --- /dev/null +++ b/data/js/item/plant_growing/plantbowl.js @@ -0,0 +1,108 @@ +// Valid map target IDs for dirt +const validMapDirtIDs = [0x9 ,0x15 ,0x71 ,0x7C ,0x82 ,0xA7 ,0xDC ,0xE3 ,0xE8 ,0xEB + ,0x141 ,0x144 ,0x14C ,0x15C ,0x169 ,0x174 ,0x1DC ,0x1EF ,0x272 ,0x275 + ,0x27E ,0x281 ,0x2D0 ,0x2D7 ,0x2E5 ,0x2FF ,0x303 ,0x31F ,0x32C ,0x32F + ,0x33D ,0x340 ,0x345 ,0x34C ,0x355 ,0x358 ,0x367 ,0x36E ,0x377 ,0x37A + ,0x38D ,0x390 ,0x395 ,0x39C ,0x3A5 ,0x3A8 ,0x3F6 ,0x405 ,0x547 ,0x54E + ,0x553 ,0x556 ,0x597 ,0x59E ,0x623 ,0x63A ,0x6F3 ,0x6FA ,0x777 ,0x791 + ,0x79A ,0x7A9 ,0x7AE ,0x7B1 ,0x98C ,0x99F ,0x9AC ,0x9BF ,0x5B27 ,0x5B3E ,0x71F4 + ,0x71FB ,0x72C9 ,0x72CA +]; + +function onUseChecked( pUser, iBowl ) +{ + var socket = pUser.socket; + if( socket && iBowl && iBowl.isItem ) + { + var bowlOwner = GetPackOwner( iBowl, 0 ); + if( bowlOwner == null || bowlOwner != pUser ) + { + socket.SysMessage( GetDictionaryEntry( 19132, socket.language )); //You must have the object in your backpack to use it. + } + else + { + pUser.socket.tempObj = iBowl; + pUser.CustomTarget( 1, GetDictionaryEntry( 19133, socket.language ));//Choose a patch of dirt to scoop up. + return false; + } + } + return true; +} + +function onCallback1( socket, myTarget ) +{ + if( socket == null ) + return; + + var mChar = socket.currentChar; + if( ValidateObject(mChar) && mChar.isChar ) + { + var iBowl = socket.tempObj; + var tileID = 0; + var staticTile = true; + + if( socket.GetByte(1) ) + { + tileID = socket.GetWord( 17 ); + if( !tileID ) + { + tileID = GetTileIDAtMapCoord( socket.GetWord( 11 ), socket.GetWord( 13 ), mChar.worldNumber ); + staticTile = false; + } + } + else if( ValidateObject( myTarget ) && myTarget.isItem ) + { + // Make sure targeted object is in same world & instance as player + if( myTarget.worldnumber != mChar.worldnumber || myTarget.instanceID != mChar.instanceID ) + return; + + tileID = myTarget.id; + } + + var validTileIDFound = false; + if( tileID != 0 ) + { + if( staticTile == true || ( myTarget && myTarget.isItem )) // tileID is from a dynamic or static item + { + if( myTarget.id == 0x0f81 )// Fertile Dirt + { + if( myTarget.amount < 40 ) //amount needed + { + socket.SysMessage( GetDictionaryEntry( 19134, socket.language ));//You need more dirt to fill a plant bowl! + } + else + { + var bowlofdirt = CreateDFNItem( mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true ); + bowlofdirt.SetTag( "PlantInfo", 0 + "," + 0 + "," + 0 + "," + 1 ); + bowlofdirt.SetTag( "PlantStage", 14 ); + socket.SysMessage( GetDictionaryEntry( 19135, socket.language ));//You fill the bowl with fresh dirt. + iBowl.Delete(); + + if( myTarget.amount == 40 ) + myTarget.Delete(); + else if( myTarget.amount > 40 ) + myTarget.amount -= 40; + } + } + validTileIDFound = true; + } + else if( staticTile == false ) // tileID is from a map tile + { + if( validMapDirtIDs.indexOf( tileID ) != -1 ) // Dirt + { + var bowlofdirt = CreateDFNItem( mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true ); + bowlofdirt.SetTag( "PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0 ); + bowlofdirt.SetTag( "PlantStage", 14 );//dirt + socket.SysMessage( GetDictionaryEntry( 19135, socket.language ));//You fill the bowl with fresh dirt. + validTileIDFound = true; + iBowl.Delete(); + } + } + } + + if( !validTileIDFound ) + { + socket.SysMessage( GetDictionaryEntry( 19136, socket.language )); // "You'll want to gather fresh dirt in order to raise a healthy plant!" + } + } +} \ No newline at end of file diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js new file mode 100644 index 000000000..cdbb51916 --- /dev/null +++ b/data/js/item/plant_growing/plantsystem.js @@ -0,0 +1,2476 @@ +const scriptID = 19100;// this is the script id +const PlantDelayTimer = 82800000;//82800000 Every 23 hours plant grows + +function onUseChecked( pUser, iUsed ) +{ + var gumpID = scriptID + 0xffff; + var socket = pUser.socket; + + socket.tempObj = iUsed; + iUsed.tempObj = socket; + socket.CloseGump( gumpID, 0 ); + + var itemPack = GetPackOwner( iUsed, 0 ); + var iMulti = pUser.multi; + if (ValidateObject(iMulti) && (iMulti.IsOnOwnerList(pUser) + || (GetServerSetting("COOWNHOUSESONSAMEACCOUNT") && iMulti.owner.accountNum == pUser.accountNum)) || ( itemPack || itemPack == pUser ) && !iUsed.movable != 3 ) + { + PlantBowlGump(pUser, iUsed); + } + else + { + socket.SysMessage(GetDictionaryEntry(19110, socket.language));// You must have the item in your backpack or locked down in order to use it. + return false; + } +} + +function onCreateDFN( objMade, objType ) +{ + // This function initializes default settings when creating a new object, especially for objects like a bowl of dirt. + // If the object type is 0 (representing a bowl of dirt), the function checks if the object has specific plant information and stage. + if( objType == 0 ) + { + // Retrieves plant information and stage tags from the object. + var plantInfo = objMade.GetTag( "PlantInfo" ); + var plantStage = objMade.GetTag( "PlantStage" ); + + // If the object lacks plant information, or if its stage is not set or not equal to 14 (representing dirt), it sets the stage to 14. + if( !plantInfo ) + { + if( plantStage != 14 || !plantStage ) + { + // Sets the stage of the object to represent dirt. + objMade.SetTag( "PlantStage", 14 ); + } + + // Sets default values for plant information, potions, and infections tags. + objMade.SetTag( "PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0 ); + objMade.SetTag( "Potions", 0 + "," + 0 + "," + 0 + "," + 0 ); + objMade.SetTag( "Infections", 0 + "," + 0 + "," + 0 + "," + 0 ); + + // Stops further execution as default settings have been applied. + return false; + } + } +} + +function PlantBowlGump( pUser, iUsed ) +{ + var PlantGump = new Gump; + var socket = pUser.socket; + + var potionInfo = iUsed.GetTag( "Potions" ); + var infection = iUsed.GetTag( "Infections" ); + var waterLevel = iUsed.GetTag( "water" ); + var plantStage = iUsed.GetTag( "PlantStage" ); + + if( !potionInfo || !infection ) + { + return false; + } + + var potionLength = potionInfo.split( "," ); + var infectionLength = infection.split( "," ); + if( potionLength.length != 4 || infectionLength.length != 4 ) + { + return false; + } + + var greaterPoison = parseInt( potionLength[0] ); + var greaterCure = parseInt( potionLength[1] ); + var greaterHeal = parseInt( potionLength[2] ); + var greaterStrength = parseInt( potionLength[3] ); + + var infestationLevel = parseInt( infectionLength[0] ); + var fungusLevel = parseInt( infectionLength[1] ); + var poisonLevel = parseInt( infectionLength[2] ); + var diseaseLevel = parseInt( infectionLength[3] ); + + DrawBackground( PlantGump ); + DrawPlant( PlantGump, iUsed ); + + PlantGump.AddButton( 71, 67, 0xD4, 0xD4, 1, 1, 1 ); // Reproduction menu + PlantGump.AddPicture( 59, 68, 0xD08 ); + + PlantGump.AddButton( 71, 91, 0xD4, 0xD4, 2, 2, 2 ); // infestation + PlantGump.AddPicture( 8, 96, 0x372 ); + AddPlus( PlantGump, 95, 92, infestationLevel ); + + PlantGump.AddButton( 71, 115, 0xD4, 0xD4, 3, 3, 3 ); // fungus + PlantGump.AddPicture( 58, 115, 0xD16 ); + AddPlus( PlantGump, 95, 116, fungusLevel ); + + PlantGump.AddButton( 71, 139, 0xD4, 0xD4, 4, 4, 4 ); // poison + PlantGump.AddPicture( 59, 143, 0x1AE4 ); + AddPlus( PlantGump, 95, 140, poisonLevel ); + + PlantGump.AddButton( 71, 163, 0xD4, 0xD4, 5, 5, 5 ); // disease + PlantGump.AddPicture( 55, 167, 0x1727 ); + AddPlus( PlantGump, 95, 164, diseaseLevel ); + + PlantGump.AddButton( 209, 67, 0xD4, 0xD4, 6, 6, 6 ); // water + PlantGump.AddPicture( 193, 67, 0x1F9D ); + AddWaterLevel( PlantGump, 196, 67, waterLevel ); + + PlantGump.AddButton( 209, 91, 0xD4, 0xD4, 7, 7, 7 ); // poison potion + PlantGump.AddPicture( 201, 91, 0xF0A ); + PlantGump.AddText( 196, 91, 0x835, greaterPoison ); + + PlantGump.AddButton( 209, 115, 0xD4, 0xD4, 8, 8, 8 ); // Cure potion + PlantGump.AddPicture( 201, 115, 0xF07 ); + PlantGump.AddText( 196, 115, 0x835, greaterCure ); + + PlantGump.AddButton( 209, 139, 0xD4, 0xD4, 9, 9, 9 ); // Heal potion + PlantGump.AddPicture( 201, 139, 0xF0C ); + PlantGump.AddText( 196, 139, 0x835, greaterHeal ); + + PlantGump.AddButton( 209, 163, 0xD4, 0xD4, 10, 10, 10 ); // Strength potion + PlantGump.AddPicture( 201, 163, 0xF09 ); + PlantGump.AddText( 196, 163, 0x835, greaterStrength ); + + PlantGump.AddGump( 48, 47, 0xD2 ); + if( plantStage >= 1 && plantStage <= 9 ) + { + PlantGump.AddText(54, 47, 0x835, plantStage.toString() ); + } + + PlantGump.AddGump( 232, 47, 0xD2 ); + AddGrowthIndicator( PlantGump, iUsed ); + + PlantGump.AddButton( 48, 183, 0xD2, 0xD2, 11, 11, 11 ); // Help + PlantGump.AddText( 54, 183, 0x835, "?" ); + PlantGump.AddButton( 232, 183, 0xD4, 0xD4, 12, 12, 12 ); // Empty the bowl + PlantGump.AddPicture( 219, 180, 0x15FD ); + PlantGump.Send( socket ); + PlantGump.Free(); +} + +function DrawBackground( PlantGump ) +{ + PlantGump.AddBackground( 50, 50, 200, 150, 0xE10 ); + PlantGump.AddPicture( 45, 45, 0xCEF ); + PlantGump.AddPicture( 45, 118, 0xCF0 ); + PlantGump.AddPicture( 211, 45, 0xCEB ); + PlantGump.AddPicture( 211, 118, 0xCEC ); + return; +} + +function AddPlus( PlantGump, x, y, Level ) +{ + if( Level == 1 ) + PlantGump.AddText( x, y, 0x35, "+" ); + if( Level == 2 ) + PlantGump.AddText( x, y, 0x21, "+" ); + return; +} + +function AddWaterLevel( PlantGump, x, y, Level ) +{ + var addPlusMinus = ""; + var addHue = 0; + switch (Level) + { + case 0: // severely under-watered. + addHue = 0x21; + addPlusMinus = "-"; + break; + case 1: // slightly under-watered + addHue = 0x35; + addPlusMinus = "-"; + break; + case 3: // slightly over-watered + addHue = 0x35; + addPlusMinus = "+"; + break; + case 4: // severely over-watered + addHue = 0x21; + addPlusMinus = "+"; + break; + } + if( addPlusMinus != 0 ) + { + PlantGump.AddText(x, y, addHue, addPlusMinus ); + } + return; +} + +function HealthStatus( myPlant ) +{ + var status = myPlant.GetTag( "PlantStage" ); + var maxhealth = myPlant.maxhp + status * 2 + 10; + var health = ( myPlant.health / maxhealth ) * 100; + + var plantHealth = 0; + + if( health < 33 ) + { + plantHealth = 10; // Dying + } + else if( health < 66 ) + { + plantHealth = 11; // Wilted + } + else if( health < 100 ) + { + plantHealth = 12; // Healthy + } + else + { + plantHealth = 13; // Vibrant + } + + myPlant.SetTag( "PlantHealth", plantHealth ); +} + +function PlantDamage( iUsed ) +{ + var infection = iUsed.GetTag( "Infections" ); + + if( !infection ) + return false; + + var infectionLevels = infection.split( "," ); + if( infectionLevels.length != 4 ) + return false; + + var damage = 0; + + for( var i = 0; i < 4; i++ ) + { + var level = parseInt( infectionLevels[i] ); + if( level > 0 ) + damage += level * RandomNumber( 3, 6 ); + } + + var waterLevel = iUsed.GetTag( "water" ); + if( waterLevel >= 3 || waterLevel <= 1 ) + { + damage += Math.abs( 2 - waterLevel ) * RandomNumber( 3, 6 ); + } + + // Ensure health doesn't go below 0 + iUsed.health = Math.max( 0, iUsed.health - damage ); +} + +function AddGrowthIndicator( PlantGump, iUsed ) +{ + var plantInfo = iUsed.GetTag( "PlantInfo" ) + var plantStage = iUsed.GetTag( "PlantStage" ) + + if( !plantInfo ) + { + return false; + } + + var infoLength = plantInfo.split( "," ); + if( infoLength.length != 4 ) + return false; + + var fertialeDirt = parseInt( infoLength[3] ); + + if( plantStage >= 1 && plantStage <= 9) + { + const gi = iUsed.GetTag( "PlantHealth" ); + + if( iUsed.movable != 3 ) + { + PlantGump.AddText(239, 47, 0x21, "!" ); + } + else if( gi >= 10 && gi <= 11 ) + { + PlantGump.AddText( 239, 47, 0x21, "-" ); //Not Healthy + } + //else if(growthdelay) this takes place on server restart. + //PlantGump.AddText(239, 47, 0x35, "-");// delay + else if( plantStage == 9 ) + { + PlantGump.AddText( 239, 47, 0x3, "+" ); // Blue + : The plant successfully grew. + }// Green + : The plant successfully grew, and got an extra bonus growth from being planted in fertile dirt. + else if( fertialeDirt == 1 ) + { + PlantGump.AddText( 239, 47, 0x3F, "+" ); // Double Grown + } + return; + } +} + +function Die( myPlant ) +{ + // Check if the plant's stage is at its maximum value or beyond (representing a fully grown/dead plant) + if( myPlant.GetTag( "PlantStage" ) >= 9 ) + { + // Set the plant's stage to represent dead twigs + myPlant.SetTag( "PlantStage", 20 ); //dead twigs + // Change the plant's attributes to represent twigs + myPlant.id = 0x1B9D; // twig ID + myPlant.colour = 0; // twig color + myPlant.name = "twigs"; // twig name + // Reset the plant's attributes and state + ResetPlant( myPlant ); + } + else // If the plant is not fully grown/dead + { + // Change the plant's attributes to represent a bowl of dirt + myPlant.id = 0x1602; // dirt ID + myPlant.colour = 0; // dirt color + myPlant.name = "a bowl of dirt"; // dirt name + myPlant.health = 100; // reset the plant's health + // Clear various tags related to plant state + myPlant.SetTag( "water", null ); + myPlant.SetTag( "PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0 ); + myPlant.SetTag( "Potions", 0 + "," + 0 + "," + 0 + "," + 0 ); + myPlant.SetTag( "Infections", 0 + "," + 0 + "," + 0 + "," + 0 ); + myPlant.SetTag( "PlantCross", null ); + myPlant.SetTag( "PlantHealth", null ); + myPlant.SetTag( "Seed", null ); + // Set the plant's stage to represent dirt + myPlant.SetTag("PlantStage", 14);//dirt + // Add a script trigger (presumably for further processing) + myPlant.AddScriptTrigger( scriptID ); + // Kill any timers associated with the plant (presumably for growth or other processes) + myPlant.KillTimers(); + } + + return; // End the function +} + +function GrowthCheck( myPlant ) +{ + var waterLevel = parseInt( myPlant.GetTag( "water" )); + var infection = myPlant.GetTag( "Infections" ); + var potionInfo = myPlant.GetTag( "Potions" ); + var plantInfo = myPlant.GetTag( "PlantInfo" ); + + var infoLength = plantInfo.split( "," ); + var potionLength = potionInfo.split( "," ); + var infectionLength = infection.split( "," ); + + if( infoLength.length !== 4 || potionLength.length !== 4 || infectionLength.length !== 4) + { + return; + } + + var greaterPoison = parseInt( potionLength[0] ); + var greaterCure = parseInt( potionLength[1] ); + var greaterHeal = parseInt( potionLength[2] ); + var greaterStrength = parseInt( potionLength[3] ); + + var infestationLevel = parseInt( infectionLength[0] ); + var fungusLevel = parseInt( infectionLength[1] ); + var poisonLevel = parseInt( infectionLength[2] ); + var diseaseLevel = parseInt( infectionLength[3] ); + + var plantType = infoLength[0]; + var plantColor = infoLength[2]; + + var infestationChance = 0.30 - greaterStrength * 0.075 + ( waterLevel - 2 ) * 0.10; + + if( [1, 27, 28, 30].indexOf( plantType) !== -1 ) + { + infestationChance += 0.10; + } + + if( [21, 5, 38, 10, 42, 43].indexOf( plantColor) !== -1 ) + { + infestationChance += 0.10; + } + + if( infestationChance >= Math.random() && infestationLevel < 2 ) + { + infestationLevel++; + myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel ); + } + + var fungusChance = 0.15 - greaterStrength * 0.075 + ( waterLevel - 2 ) * 0.10; + + if( fungusChance >= Math.random() && fungusLevel < 2 ) + { + fungusLevel++; + myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel ); + } + + if( waterLevel > 0 && ( waterLevel >= 2 || 0.9 >= Math.random() )) + { + waterLevel--; + myPlant.SetTag( "water", waterLevel ); + } + + if( greaterPoison > 0 ) + { + greaterPoison--; + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + poisonLevel++; + myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel ); + } + + if( greaterCure > 0 ) + { + greaterCure--; + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + diseaseLevel++; + myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel ); + } + + if( greaterStrength > 0 ) + { + greaterStrength--; + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + } +} + +function ApplyPotions( myPlant ) +{ + var waterLevel = parseInt( myPlant.GetTag( "water" )); + var potionInfo = myPlant.GetTag( "Potions" ); + var infection = myPlant.GetTag( "Infections" ); + + var potionLength = potionInfo.split( "," ); + var infectionLength = infection.split( "," ); + + if( potionLength.length !== 4 || infectionLength.length !== 4 ) + { + return false; + } + + var greaterPoison = parseInt( potionLength[0] ); + var greaterCure = parseInt( potionLength[1] ); + var greaterHeal = parseInt( potionLength[2] ); + var greaterStrength = parseInt( potionLength[3] ); + + var infestationLevel = parseInt(infectionLength[0] ); + var fungusLevel = parseInt( infectionLength[1] ); + var poisonLevel = parseInt( infectionLength[2] ); + var diseaseLevel = parseInt( infectionLength[3] ); + + var infestation = 0; + if( greaterPoison >= infestationLevel ) + { + var poison = greaterPoison - infestationLevel; + myPlant.SetTag( "Potions", poison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + } + else + { + myPlant.SetTag( "Potions", 0 + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + infestation = infestationLevel - greaterPoison; + } + + var fungus = 0; + if( greaterCure >= fungusLevel ) + { + var cure = greaterCure - fungusLevel; + myPlant.SetTag( "Potions", greaterPoison + "," + cure + "," + greaterHeal + "," + greaterStrength ); + } + else + { + myPlant.SetTag( "Potions", greaterPoison + "," + 0 + "," + greaterHeal + "," + greaterStrength ); + fungus = fungusLevel - greaterCure; } + + var poison = 0; + if( greaterHeal >= poisonLevel ) + { + var heal = greaterHeal - poisonLevel; + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + heal + "," + greaterStrength ); + } + else + { + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + 0 + "," + greaterStrength ); + poison = poisonLevel - greaterHeal; + } + + myPlant.SetTag( "Infections", infestation + "," + fungus + "," + poison + "," + diseaseLevel ); + + if( infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2 ) + { + if( greaterHeal > 0 ) + { + myPlant.health += greaterHeal * 7; + } + else + { + myPlant.health += 2; + } + } + + if( greaterHeal > 0 ) + { + greaterHeal--; + myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength ); + } +} + +function onTimer( myPlant, timerID ) +{ + if( !ValidateObject( myPlant )) + return; + + var stage = myPlant.GetTag( "PlantStage" );//Starts at stage 1 + var Seeds = myPlant.GetTag( "Seed" ); + var CrossedPlants = myPlant.GetTag( "PlantCross" ); + var plantInfo = myPlant.GetTag( "PlantInfo" ); + + if( !CrossedPlants || !Seeds || !plantInfo ) + { + return false; + } + + var Crossed = CrossedPlants.split( "," ); + var Seedlength = Seeds.split( "," ); + var infoLength = plantInfo.split( "," ); + + if( Crossed.length != 3 || Seedlength.length != 3 || infoLength.length != 4 ) + { + return false; + } + + var Pollinated = parseInt( Crossed[0] ); + var SeedBreed = parseInt( Crossed[1] ); + var crossAble = parseInt( Crossed[2] ); + + var availableSeeds = parseInt( Seedlength[0] ); + var remainingSeeds = parseInt( Seedlength[1] ); + var hueSeeds = parseInt( Seedlength[2] ); + + var fertialeDirt = parseInt( infoLength[3] ); + + if( timerID == 1 ) + { + if( myPlant.health <= 0 ) + { + Die( myPlant ); + return false; + } + + if( myPlant.movable != 3 ) + { // Checks make sure the plant is lockdown if its not it loops timer until it no longer fails this check. + myPlant.StartTimer( PlantDelayTimer, 1, scriptID ); + return false; + } + else + { + if( myPlant.GetTag( "PlantHealth" ) != 10 && myPlant.GetTag( "PlantHealth" ) != 11 )//wilted or dying + { + if( fertialeDirt == 1 && stage <= 5 ) + { + //double growth to stage 5 + myPlant.SetTag( "PlantStage", stage + 2 ); + } + else if( stage < 9 ) + { + // Continue to the next stage if it does not have fertial dirt + myPlant.SetTag( "PlantStage", stage + 1 ); + } + else + { + //Produce Seeds + if( remainingSeeds > 0 && Pollinated == 1 ) + { + var rseeds = remainingSeeds - 1; + var aseeds = availableSeeds + 1; + myPlant.SetTag( "Seed", aseeds + "," + rseeds + "," + hueSeeds ); + } + } + + if( stage >= 2 && stage <= 3 ) + { + myPlant.id = 0x1600; + } + else if( stage == 9 ) + { + PlantBowl( myPlant ); + } + } + + if( stage >= 9 ) + { + if( Pollinated == 0 ) + { + myPlant.SetTag( "PlantCross", 1 + "," + SeedBreed + "," + crossAble ); + } + + } + + ApplyPotions( myPlant ) + HealthStatus( myPlant ); + PlantDamage( myPlant ); + GrowthCheck( myPlant ); + myPlant.Refresh(); + } + } + myPlant.StartTimer( PlantDelayTimer, 1, scriptID ); +} + +function DrawPlant( PlantGump, iUsed ) +{ + var plantStage = iUsed.GetTag( "PlantStage" ); + var plantHealth = iUsed.GetTag( "PlantHealth" ) + + if( plantStage >= 0 && plantStage < 9 || plantStage == 14 ) + { + PlantGump.AddGump( 110, 85, 0x589 ); + if( plantStage <= 14 ) + { + PlantGump.AddPicture( 122, 94, 0x914 ); + PlantGump.AddPicture( 135, 94, 0x914 ); + PlantGump.AddPicture( 120, 112, 0x914 ); + PlantGump.AddPicture( 135, 112, 0x914 ); + } + + if( plantStage >= 2 && plantStage < 3 ) + { + PlantGump.AddPicture( 127, 112, 0xC62 ); + } + if( plantStage == 3 || plantStage == 4 ) + { + PlantGump.AddPicture( 129, 85, 0xC7E ); + } + if( plantStage >= 4 && plantStage < 9 ) + { + PlantGump.AddPicture( 121, 117, 0xC62 ); + PlantGump.AddPicture( 133, 117, 0xC62 ); + } + if( plantStage >= 5 && plantStage < 9 ) + { + PlantGump.AddPicture( 110, 100, 0xC62 ); + PlantGump.AddPicture( 140, 100, 0xC62 ); + PlantGump.AddPicture( 110, 130, 0xC62 ); + PlantGump.AddPicture( 140, 130, 0xC62 ); + } + if( plantStage >= 6 && plantStage < 9 ) + { + PlantGump.AddPicture( 105, 115, 0xC62 ); + PlantGump.AddPicture( 145, 115, 0xC62 ); + PlantGump.AddPicture( 125, 90, 0xC62 ); + PlantGump.AddPicture( 125, 135, 0xC62 ); + } + } + else + { + PlantImage( PlantGump, iUsed ); + } + + if( plantStage != 14 ) //BowlOfDirt + { + switch( plantHealth ) + { + case 10: + PlantGump.AddPicture( 92, 167, 0x1B9D ); + PlantGump.AddPicture( 161, 167, 0x1B9D ); + PlantGump.AddHTMLGump( 136, 167, 42, 20, false, false, "" + "dying" + "" ); + break;// Dying + case 11: + PlantGump.AddPicture( 91, 164, 0x18E6 ); + PlantGump.AddPicture( 161, 164, 0x18E6 ); + PlantGump.AddHTMLGump( 132, 167, 42, 20, false, false, "" + "Wilted" + "" ); + break;// Wilted + case 12: + PlantGump.AddPicture( 96, 168, 0xC61 ); + PlantGump.AddPicture( 162, 168, 0xC61 ); + PlantGump.AddHTMLGump( 129, 167, 42, 20, false, false, "" + "Healthy" + "" ); + break;// Healthy + case 13: + PlantGump.AddPicture( 93, 162, 0x1A99 ); + PlantGump.AddPicture( 162, 162, 0x1A99 ); + PlantGump.AddHTMLGump( 129, 167, 42, 20, false, false, "" + "Vibrant" + "" ); + break;// Vibrant + } + } + return; +} + +function PlantImage( PlantGump, iUsed ) +{ + var plantInfo = iUsed.GetTag( "PlantInfo" ) + + if( !plantInfo ) + { + return false; + } + + var infoLength = plantInfo.split( "," ); + if( infoLength.length != 4 ) + { + return false; + } + + var plantType = parseInt( infoLength[0] ); + var plantColor = parseInt( infoLength[2] ); + var fertialeDirt = parseInt( infoLength[3] ); + + var plantArray = { + "3203": [0, 0], // 0x0c83 + "3206": [0, 0], // 0x0c86 + "3208": [0, 0], // 0x0c88 + "3220": [-15, 0], // 0xC94 + "3211": [0, 0], // 0xC8B + "3237": [-8, 0], // 0xCA5 + "3239": [-10, 0], // 0xCA7 + "3223": [-20, 0], // 0xC97 + "3231": [-20, 0], // 0xC9F + "3238": [-16, -5], // 0xCA6 + "3228": [-5, -10], // 0xC9C + "3377": [0, -27], // 0xD31 + "3332": [0, 10], // 0xD04 + "3241": [0, 0], // 0xCA9 + "3372": [0, 10], // 0xD2C + "3366": [0, 10], // 0xD26 + "3367": [0, 10], // 0xD27 + "10460": [-5, 5], //0x28DC + "10463": [-5, 5], // 0x28DF + "10461": [-5, 5], // 0x28DD + "10464": [-5, 5], // 0x28E0 + "10462": [-5, 5], // 0x28DE + "10465": [-5, 5], // 0x28E1 + "10466": [-5, 5], // 0x28E2 + "10467": [-5, 5], // 0x28E3 + "3365": [0, 0], // 0x0D25 + "6810": [5, 10], // 0x1A9A + "3204": [0, 0], // 0x0C84 + "6815": [5, 25], // 0x1A9F + "3265": [0, 0], // 0x0CC1 + "3326": [-45, -35], // 0x0CFE + "3215": [0, 0], // 0x0C8F + "3272": [0, 0], // 0x0CC8 + "3214": [-20, 0], // 0x0C8E + "3255": [0, 0], // 0x0CB7 + "3262": [-20, 0], // 0x0CBE + "3273": [0, 0], // 0x0CC9 + "3521": [-15, 15], // 0x0DC1 + "3323": [-45, -30], // 0x0CFB + "3512": [0, -20], // 0x0DB8 + "6817": [10, -25], // 0x1AA1 + "9324": [-25, -20] // 0x246C + }; + + var CampionFlowers = 3203; + var Poppies = 3206; + var Snowdrops = 3208; + var Bulrushes = 3220; + var Lilies = 3211; + var PampasGrass = 3237; + var Rushes = 3239; + var ElephantEarPlant = 3223; + var Fern = 3231; + var PonytailPalm = 3238; + var SmallPalm = 3228; + var CenturyPlant = 3377; + var WaterPlant = 3332; + var SnakePlant = 3241; + var PricklyPearCactus = 3372; + var BarrelCactus = 3366; + var TribarrelCactus = 3367; + var CommonGreenBonsai = 10460; + var CommonPinkBonsai = 10463; + var UncommonGreenBonsai = 10461; + var UncommonPinkBonsai = 10464; + var RareGreenBonsai = 10462; + var RarePinkBonsai = 10465; + var ExceptionalBonsai = 10466; + var ExoticBonsai = 10467; + var Cactus = 3365; + var FlaxFlowers = 6810; + var FoxgloveFlowers = 3204; + var HopsEast = 6815; + var OrfluerFlowers = 3265; + var CypressTwisted = 3326; + var HedgeShort = 3215; + var JuniperBush = 3272; + var SnowdropPatch = 3214; + var Cattails = 3255; + var PoppyPatch = 3262; + var SpiderTree = 3273; + var WaterLily = 3521; + var CypressStraight = 3323; + var HedgeTall = 3512; + var HopsSouth = 6817; + var SugarCanes = 9324; + + var plantID = 0; + var plantNewName = ""; + switch( plantType ) + { + case 1: + plantID = CampionFlowers; + plantNewName = "Campion Flowers"; + break; + case 2: + plantID = Poppies; + plantNewName = "Poppies"; + break; + case 3: + plantID = Snowdrops; + plantNewName = "Snowdrops"; + break; + case 4: + plantID = Bulrushes; + plantNewName = "Bulrushes"; + break; + case 5: + plantID = Lilies; + plantNewName = "Lilies"; + break; + case 6: + plantID = PampasGrass; + plantNewName = "Pampas Grass"; + break; + case 7: + plantID = Rushes; + plantNewName = "Rushes"; + break; + case 8: + plantID = ElephantEarPlant; + plantNewName = "Elephant Ear Plant"; + break; + case 9: + plantID = Fern; + plantNewName = "Fern"; + break; + case 10: + plantID = PonytailPalm; + plantNewName = "Ponytail Palm"; + break; + case 11: + plantID = SmallPalm; + plantNewName = "Small Palm"; + break; + case 12: + plantID = CenturyPlant; + plantNewName = "Century Plant"; + break; + case 13: + plantID = WaterPlant; + plantNewName = "Water Plant"; + break; + case 14: + plantID = SnakePlant; + plantNewName = "Snake Plant"; + break; + case 15: + plantID = PricklyPearCactus; + plantNewName = "Prickly Pear Cactus"; + break; + case 16: + plantID = BarrelCactus; + plantNewName = "Barrel Cactus"; + break; + case 17: + plantID = TribarrelCactus; + plantNewName = "Tribarrel Cactus"; + break; + case 18: + plantID = CommonGreenBonsai; + plantNewName = "Common Green Bonsai"; + break; + case 19: + plantID = CommonPinkBonsai; + plantNewName = "Common Pink Bonsai"; + break; + case 20: + plantID = UncommonGreenBonsai; + plantNewName = "Uncommon Green Bonsai"; + break; + case 21: + plantID = UncommonPinkBonsai; + plantNewName = "Uncommon Pink Bonsai"; + break; + case 22: + plantID = RareGreenBonsai; + plantNewName = "Rare Green Bonsai"; + break; + case 23: + plantID = RarePinkBonsai; + plantNewName = "Rare Pink Bonsai"; + break; + case 24: + plantID = ExceptionalBonsai; + plantNewName = "Exceptional Bonsai"; + break; + case 25: + plantID = ExoticBonsai; + plantNewName = "Exotic Bonsai"; + break; + case 26: + plantID = Cactus; + plantNewName = "Cactus"; + break; + case 27: + plantID = FlaxFlowers; + plantNewName = "Flax Flowers"; + break; + case 28: + plantID = FoxgloveFlowers; + plantNewName = "Foxglove Flowers"; + break; + case 29: + plantID = HopsEast; + plantNewName = "Hops East"; + break; + case 30: + plantID = OrfluerFlowers; + plantNewName = "Orfluer Flowers"; + break; + case 31: + plantID = CypressTwisted; + plantNewName = "Cypress Twisted"; + break; + case 32: + plantID = HedgeShort; + plantNewName = "Hedge Short"; + break; + case 33: + plantID = JuniperBush; + plantNewName = "Juniper Bush"; + break; + case 34: + plantID = SnowdropPatch; + plantNewName = "Snowdrop Patch"; + break; + case 35: + plantID = Cattails; + plantNewName = "Cattails"; + break; + case 36: + plantID = PoppyPatch; + plantNewName = "Poppy Patch"; + break; + case 37: + plantID = SpiderTree; + plantNewName = "Spider Tree"; + break; + case 38: + plantID = WaterLily; + plantNewName = "Water Lily"; + break; + case 39: + plantID = CypressStraight; + plantNewName = "Cypress Straight"; + break; + case 40: + plantID = HedgeTall; + plantNewName = "Hedge Tall"; + break; + case 41: + plantID = HopsSouth; + plantNewName = "Hops South"; + break; + case 42: + plantID = SugarCanes; + plantNewName = "Sugar Canes"; + break; + } + if( plantID == CypressTwisted || plantID == CypressStraight ) + { // The large images for these trees trigger a client crash, so use a smaller, generic tree for gump. + PlantGump.AddPictureColor( 130 + plantArray[plantID][0], 96 + plantArray[plantID][1], 0x0CCA, plantColor ); + } + else + { + PlantGump.AddPictureColor( 130 + plantArray[plantID][0], 96 + plantArray[plantID][1], plantID, plantColor ); + } + iUsed.SetTag( "PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt ); + return; +} + +function PlantBowl( iUsed ) +{ + var plantInfo = iUsed.GetTag( "PlantInfo" ) + + if( !plantInfo ) + { + return false; + } + + var infoLength = plantInfo.split( "," ); + if( infoLength.length != 4 ) + { + return false; + } + + var plantType = infoLength[0]; + var plantColor = infoLength[2]; + var fertialeDirt = infoLength[3]; + + var CampionFlowers = 3203; + var Poppies = 3206; + var Snowdrops = 3208; + var Bulrushes = 3220; + var Lilies = 3211; + var PampasGrass = 3237; + var Rushes = 3239; + var ElephantEarPlant = 3223; + var Fern = 3231; + var PonytailPalm = 3238; + var SmallPalm = 3228; + var CenturyPlant = 3377; + var WaterPlant = 3332; + var SnakePlant = 3241; + var PricklyPearCactus = 3372; + var BarrelCactus = 3366; + var TribarrelCactus = 3367; + var CommonGreenBonsai = 10460; + var CommonPinkBonsai = 10463; + var UncommonGreenBonsai = 10461; + var UncommonPinkBonsai = 10464; + var RareGreenBonsai = 10462; + var RarePinkBonsai = 10465; + var ExceptionalBonsai = 10466; + var ExoticBonsai = 10467; + var Cactus = 3365; + var FlaxFlowers = 6810; + var FoxgloveFlowers = 3204; + var HopsEast = 6815; + var OrfluerFlowers = 3265; + var CypressTwisted = 3326; + var HedgeShort = 3215; + var JuniperBush = 3272; + var SnowdropPatch = 3214; + var Cattails = 3255; + var PoppyPatch = 3262; + var SpiderTree = 3273; + var WaterLily = 3521; + var CypressStraight = 3323; + var HedgeTall = 3512; + var HopsSouth = 6817; + var SugarCanes = 9324; + + var plantID = 0; + var plantNewName = ""; + switch( plantType ) + { + case 1: + plantID = CampionFlowers; + plantNewName = "Campion Flowers"; + break; + case 2: + plantID = Poppies; + plantNewName = "Poppies"; + break; + case 3: + plantID = Snowdrops; + plantNewName = "Snowdrops"; + break; + case 4: + plantID = Bulrushes; + plantNewName = "Bulrushes"; + break; + case 5: + plantID = Lilies; + plantNewName = "Lilies"; + break; + case 6: + plantID = PampasGrass; + plantNewName = "Pampas Grass"; + break; + case 7: + plantID = Rushes; + plantNewName = "Rushes"; + break; + case 8: + plantID = ElephantEarPlant; + plantNewName = "Elephant Ear Plant"; + break; + case 9: + plantID = Fern; + plantNewName = "Fern"; + break; + case 10: + plantID = PonytailPalm; + plantNewName = "Ponytail Palm"; + break; + case 11: + plantID = SmallPalm; + plantNewName = "Small Palm"; + break; + case 12: + plantID = CenturyPlant; + plantNewName = "Century Plant"; + break; + case 13: + plantID = WaterPlant; + plantNewName = "Water Plant"; + break; + case 14: + plantID = SnakePlant; + plantNewName = "Snake Plant"; + break; + case 15: + plantID = PricklyPearCactus; + plantNewName = "Prickly Pear Cactus"; + break; + case 16: + plantID = BarrelCactus; + plantNewName = "Barrel Cactus"; + break; + case 17: + plantID = TribarrelCactus; + plantNewName = "Tribarrel Cactus"; + break; + case 18: + plantID = CommonGreenBonsai; + plantNewName = "Common Green Bonsai"; + break; + case 19: + plantID = CommonPinkBonsai; + plantNewName = "Common Pink Bonsai"; + break; + case 20: + plantID = UncommonGreenBonsai; + plantNewName = "Uncommon Green Bonsai"; + break; + case 21: + plantID = UncommonPinkBonsai; + plantNewName = "Uncommon Pink Bonsai"; + break; + case 22: + plantID = RareGreenBonsai; + plantNewName = "Rare Green Bonsai"; + break; + case 23: + plantID = RarePinkBonsai; + plantNewName = "Rare Pink Bonsai"; + break; + case 24: + plantID = ExceptionalBonsai; + plantNewName = "Exceptional Bonsai"; + break; + case 25: + plantID = ExoticBonsai; + plantNewName = "Exotic Bonsai"; + break; + case 26: + plantID = Cactus; + plantNewName = "Cactus"; + break; + case 27: + plantID = FlaxFlowers; + plantNewName = "Flax Flowers"; + break; + case 28: + plantID = FoxgloveFlowers; + plantNewName = "Foxglove Flowers"; + break; + case 29: + plantID = HopsEast; + plantNewName = "Hops East"; + break; + case 30: + plantID = OrfluerFlowers; + plantNewName = "Orfluer Flowers"; + break; + case 31: + plantID = CypressTwisted; + plantNewName = "Cypress Twisted"; + break; + case 32: + plantID = HedgeShort; + plantNewName = "Hedge Short"; + break; + case 33: + plantID = JuniperBush; + plantNewName = "Juniper Bush"; + break; + case 34: + plantID = SnowdropPatch; + plantNewName = "Snowdrop Patch"; + break; + case 35: + plantID = Cattails; + plantNewName = "Cattails"; + break; + case 36: + plantID = PoppyPatch; + plantNewName = "Poppy Patch"; + break; + case 37: + plantID = SpiderTree; + plantNewName = "Spider Tree"; + break; + case 38: + plantID = WaterLily; + plantNewName = "Water Lily"; + break; + case 39: + plantID = CypressStraight; + plantNewName = "Cypress Straight"; + break; + case 40: + plantID = HedgeTall; + plantNewName = "Hedge Tall"; + break; + case 41: + plantID = HopsSouth; + plantNewName = "Hops South"; + break; + case 42: + plantID = SugarCanes; + plantNewName = "Sugar Canes"; + break; + } + + iUsed.id = plantID; + iUsed.name = plantNewName; + iUsed.movable = 1; + iUsed.colour = plantColor; + iUsed.SetTag( "PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt ); + iUsed.Refresh(); +} + +function CodexOFWisdomPacket( socket, topicID ) +{ + var helpPacket = new Packet; // Create new packet stream + helpPacket.ReserveSize( 11 ); // Reserve packet size of 11, which is optimal for packet 0xBF in this case + helpPacket.WriteByte( 0, 0xBF ); // Write packetID (0xBF) at position 0 + helpPacket.WriteShort( 1, 11 ); // Write total packet length at position 1 (0+WriteByte, or 0+1) + helpPacket.WriteShort( 3, 0x17 ); // Write subcommand 0x17 (Codex of Wisdom) at position 3 (1+WriteShort, or 0+2) + helpPacket.WriteByte( 5, 0x01 ); // Write unknown 0x01 at position 5 (3+WriteShort, or 3+2) + helpPacket.WriteLong( 6, topicID); // Write topicID (???) at position 6 (5+WriteByte, or 5+2) + helpPacket.WriteByte( 10, 1 ); // Write 0 or 1 at position 10 (6+WriteLong, or 6+4) + socket.Send( helpPacket ); + helpPacket.Free(); +} + +function onGumpPress( socket, button, PlantGump ) +{ + var pUser = socket.currentChar; + var iUsed = socket.tempObj; + var gumpID = scriptID + 0xffff; + switch( button ) + { + case 0: + socket.CloseGump( gumpID, 0 ); + break;// abort and do nothing + case 1:// Reproduction menu + if( iUsed.GetTag( "PlantStage" ) >= 1 ) + { + ReproductionGump( pUser, iUsed ); + } + else + { + socket.SysMessage( GetDictionaryEntry( 19111, socket.language ));//You need to plant a seed in the bowl first + onUseChecked( pUser, iUsed ); + } + break; + case 2:// infestation + onUseChecked( pUser, iUsed ); + CodexOFWisdomPacket( socket, 54 ); + break; + case 3:// fungus + onUseChecked( pUser, iUsed ); + CodexOFWisdomPacket( socket, 56 ); + break; + case 4:// poison + onUseChecked( pUser, iUsed ); + CodexOFWisdomPacket( socket, 58 ); + break; + case 5:// disease + onUseChecked( pUser, iUsed ); + CodexOFWisdomPacket( socket, 60 ); + break; + case 6:// water + addWater( pUser, iUsed ); + onUseChecked( pUser, iUsed ); + break; + case 7:// poison potion + addPotion( pUser, iUsed, 7 ); + onUseChecked( pUser, iUsed ); + break; + case 8:// Cure potion + addPotion( pUser, iUsed, 8 ); + onUseChecked( pUser, iUsed ); + break; + case 9:// Heal potion + addPotion( pUser, iUsed, 9 ); + onUseChecked( pUser, iUsed ); + break; + case 10:// Strength potion + addPotion( pUser, iUsed, 10 ); + onUseChecked( pUser, iUsed ); + break; + case 11:// Help + onUseChecked( pUser, iUsed ); + CodexOFWisdomPacket( socket, 48 ); + break; + case 12:// Empty the bowl + socket.CloseGump( gumpID, 0 ); + EmptyBowlGump( pUser, iUsed ); + break; + case 13:// Empty Bowl Help + EmptyBowlGump( pUser, iUsed ); + CodexOFWisdomPacket( socket, 71 ); + break; + case 14:// Cancel Plant Bowl Gump + onUseChecked( pUser, iUsed ); + break; + case 15:// Okay Empty Bowl + if( iUsed.GetTag( "PlantStage") == 1) + { + GatherSeeds( pUser, iUsed ); + } + CreateDFNItem( pUser.socket, pUser, "emptyplantbowl", 1, "ITEM", true, 0 ); + iUsed.Delete( ); + break; + case 16:// Main Plant Gump + onUseChecked( pUser, iUsed ); + break; + case 17:// Set to decorative + SetToDecorativeGump( pUser, iUsed ); + break; + case 18:// Pollination + CodexOFWisdomPacket( socket, 67 ); + break; + case 19:// Resources + CodexOFWisdomPacket( socket, 69 ); + break; + case 20:// Seeds + CodexOFWisdomPacket( socket, 68 ); + break; + case 21:// Gather pollen + PollinatePlant( pUser, iUsed ); + onUseChecked( pUser, iUsed ); + break; + case 22:// Gather Resources + onUseChecked( pUser, iUsed ); + break; + case 23:// Gather seeds + GatherSeeds( pUser, iUsed ); + break; + case 24:// Cancel set decorative + ReproductionGump( pUser, iUsed ); + break; + case 25: + CodexOFWisdomPacket( socket, 70 ); + break; + case 26: + iUsed.SetTag( "PlantStage", 19 );//DecorativePlant + socket.CloseGump( gumpID, 0 ); + socket.SysMessage( GetDictionaryEntry( 19112, socket.language ));//You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep. + ResetPlant( iUsed ); + iUsed.Refresh(); + break; + default: break; + } +} + +function ResetPlant( iUsed ) +{ + iUsed.SetTag( "water", null ); + iUsed.SetTag( "PlantInfo", null ); + iUsed.SetTag( "Potions", null ); + iUsed.SetTag( "Infections", null ); + iUsed.SetTag( "PlantCross", null ); + iUsed.SetTag( "PlantHealth", null ); + iUsed.SetTag( "Seed", null ); + iUsed.RemoveScriptTrigger( scriptID ); + iUsed.KillTimers(); +} + +function PollinatePlant( pUser, iUsed ) +{ + pUser.socket.tempObj = iUsed; + var socket = pUser.socket; + var status = iUsed.GetTag( "PlantStage" ); + var CrossedPlants = iUsed.GetTag( "PlantCross" ); + var plantHealth = iUsed.GetTag( "PlantHealth" ); + + if( !CrossedPlants ) + { + pSock.SysMessage( GetDictionaryEntry( 19113, socket.language ));//You cannot gather pollen from a mutated plant! + return false; + } + else if( status < 7 ) + { + socket.SysMessage( GetDictionaryEntry( 19114, socket.language ));//Too early to gather pollen + return false; + } + else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying + { + socket.SysMessage( GetDictionaryEntry( 19115, socket.language ));//You cannot gather pollen from an unhealthy plant! + return false; + } + else + pUser.CustomTarget( 1, GetDictionaryEntry( 19116, socket.language ));//Target the plant you wish to cross-pollinate to. +} + +function onCallback1( pSock, myTarget ) +{ + var iUsed = pSock.tempObj; + var pUser = pSock.currentChar; + var status = iUsed.GetTag( "PlantStage" ); + var iCrossedPlants = iUsed.GetTag( "PlantCross" ) + var plantHealth = iUsed.GetTag( "PlantHealth" ) + + if( !iCrossedPlants ) + { + pSock.SysMessage( GetDictionaryEntry( 19113, pSock.language ));//You cannot gather pollen from a mutated plant! + return false; + } + if( status < 7 ) + { + pSock.SysMessage( GetDictionaryEntry( 19114, pSock.language )); + return false; + } + else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying + { + pSock.SysMessage( GetDictionaryEntry( 19115, pSock.language ));//You cannot gather pollen from an unhealthy plant! + return false; + } + else if( status > 7 && status < 9) + { + pSock.SysMessage( GetDictionaryEntry( 19117, pSock.language ));//You can only pollinate other specially grown plants! + return false; + } + else + { + var tstatus = myTarget.GetTag( "PlantStage" ); + var tCrossedPlants = myTarget.GetTag( "PlantCross" ); + var tplantHealth = myTarget.GetTag( "PlantHealth" ); + + if( !tCrossedPlants ) + { + pSock.SysMessage( GetDictionaryEntry( 19113, pSock.language ));//You cannot gather pollen from a mutated plant! + return false; + } + + var Crossed = tCrossedPlants.split( "," ); + if( Crossed.length != 3 ) + { + return false; + } + + var Pollinated = parseInt( Crossed[0] ); + var SeedBreed = parseInt( Crossed[1] ); + var crossAble = parseInt( Crossed[2] ); + + if( tstatus < 7 ) + { + pSock.SysMessage( GetDictionaryEntry( 19118, pSock.language ));//This plant is not in the flowering stage. You cannot pollinate it! + return false; + } + else if( tplantHealth == 10 && tplantHealth == 11 )//wilted or dying + { + pSock.SysMessage( GetDictionaryEntry( 19119, pSock.language ));//You cannot pollinate an unhealthy plant! + return false; + } + else if( tstatus > 7 && tstatus < 9 ) + { + pSock.SysMessage( GetDictionaryEntry( 19117, pSock.language ));//You can only pollinate other specially grown plants! + return false; + } + else if( crossAble == 0 ) + { + pSock.SysMessage( GetDictionaryEntry( 19120, pSock.language ));//You cannot cross-pollinate with a mutated plant! + return false; + } + else if( Pollinated == 1) + { + pSock.SysMessage( GetDictionaryEntry( 19121, pSock.language ));//This plant has already been pollinated! + } + else if( myTarget == iUsed ) + { + CrossPollinateTable( myTarget, iUsed, pSock ); + SeedColorsSet( myTarget, iUsed ); + pSock.SysMessage( GetDictionaryEntry( 19122, pSock.language ));//You pollinate the plant with its own pollen. + } + else + { + CrossPollinateTable( myTarget, iUsed, pSock ); + SeedColorsSet( myTarget, iUsed ); + pSock.SysMessage( GetDictionaryEntry( 19123, pSock.language ));//You successfully cross - pollinate the plant. + } + } +} + +function CrossPollinateTable( myTarget, iUsed, pSock ) +{ + var iinfo = iUsed.GetTag( "PlantInfo" ) + var tinfo = myTarget.GetTag( "PlantInfo" ); + + if( !iinfo || !tinfo ) + { + return false; + } + + var icrossLength = iinfo.split( "," ); + var tcrossLength = tinfo.split( "," ); + if( icrossLength.length != 4 || tcrossLength.length != 4 ) + { + return false; + } + + var cross = icrossLength[0]; + var cross2 = tcrossLength[0]; + + var setcross = 0; + + if( cross == 1 && cross2 == 1) + setcross = 1; // CampionFlowerSeed + + if( cross == 2 && cross2 == 2)//Poppies + Poppies + setcross = 2;// PoppieSeed + + if( cross == 1 && cross2 == 3)//Campion Flowers + Snowdrops + setcross = 2;// PoppieSeed + + if( cross == 3 && cross2 == 3)//Snowdrops + Snowdrops + setcross = 3;//SnowdropSeed + + if( cross == 2 && cross2 == 4)//Poppies + Bulrushes + setcross = 3;//SnowdropSeed + + if( cross == 1 && cross2 == 5)//Campion Flowers + Lilies + setcross = 3;//SnowdropSeed + + if( cross == 4 && cross2 == 4)//Bulrushes + Bulrushes + setcross = 4;//BulrusheSeed + + if( cross == 3 && cross2 == 5)//Snowdrops + Lilies + setcross = 4;//BulrusheSeed + + if( cross == 2 && cross2 == 6)//Poppies + Pampas Grass + setcross = 4;//BulrusheSeed + + if( cross == 1 && cross2 == 7)//Campion Flowers + Rushes + setcross = 4;//BulrusheSeed + + if( cross == 5 && cross2 == 5)//Lilies + Lilies + setcross = 5;//LilieSeed + + if( cross == 4 && cross2 == 6)//Bulrushes + Pampas Grass + setcross = 5;//LilieSeed + + if( cross == 3 && cross2 == 7)//Snowdrops + Rushes + setcross = 5;//LilieSeed + + if( cross == 2 && cross2 == 8)//Poppies + Elephant Ear Plant + setcross = 5;//LilieSeed + + if( cross == 1 && cross2 == 9)//Campion Flowers + Fern + setcross = 5;//LilieSeed + + if( cross == 6 && cross2 == 6)//Pampas Grass + Pampas Grass + setcross = 6;//PampasGrassSeed + + if( cross == 5 && cross2 == 7)//Lilies + Rushes + setcross = 6;//PampasGrassSeed + + if( cross == 4 && cross2 == 8)//Bulrushes + Elephant Ear Plant + setcross = 6;//PampasGrassSeed + + if( cross == 3 && cross2 == 9)//Snowdrops + Fern + setcross = 6;//PampasGrassSeed + + if( cross == 2 && cross2 == 10)//Poppies + Ponytail Palm + setcross = 6;//PampasGrassSeed + + if( cross == 1 && cross2 == 11)//Campion Flowers + Small Palm + setcross = 6;//PampasGrassSeed + + if( cross == 7 && cross2 == 7)//Rushes + Rushes + setcross = 7;//RusheSeed + + if( cross == 6 && cross2 == 8)//Pampas Grass + Elephant Ear Plant + setcross = 7;//RusheSeed + + if( cross == 5 && cross2 == 9)//Lilies + Fern + setcross = 7;//RusheSeed + + if( cross == 4 && cross2 == 10)//Bulrushes + Ponytail Palm + setcross = 7;//RusheSeed + + if( cross == 3 && cross2 == 11)//Snowdrops + Small Palm + setcross = 7;//RusheSeed + + if( cross == 2 && cross2 == 12)//Poppies + Century Plant + setcross = 7;//RusheSeed + + if( cross == 1 && cross2 == 13)//Campion Flowers + Water Plants + setcross = 7;//RusheSeed + + if( cross == 8 && cross2 == 8)//Elephant Ear Plant + Elephant Ear Plant + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 7 && cross2 == 9)//Rushes + Fern + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 6 && cross2 == 10)//Pampas Grass + Ponytail Palm + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 5 && cross2 == 11)//Lilies + Small Palm + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 4 && cross2 == 12)//Bulrushes + Century Plant + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 3 && cross2 == 13)//Snowdrops + Water Plants + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 2 && cross2 == 14)//Poppies + Snake Plant + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 1 && cross2 == 15)//Campion Flowers + Prickly Pear Cactus + setcross = 8;//ElephantEarPlantrSeed + + if( cross == 9 && cross2 == 9)//Fern + Fern + setcross = 9;//FernSeed + + if( cross == 8 && cross2 == 10)//Elephant Ear Plant + Ponytail Palm + setcross = 9;//FernSeed + + if( cross == 7 && cross2 == 11)//Rushes + Small Palm + setcross = 9;//FernSeed + + if( cross == 6 && cross2 == 12)//Pampas Grass + Century Plant + setcross = 9;//FernSeed + + if( cross == 5 && cross2 == 13)//Lilies + Water Plants + setcross = 9;//FernSeed + + if( cross == 4 && cross2 == 14)//Bulrushes + Snake Plant + setcross = 9;//FernSeed + + if( cross == 3 && cross2 == 15)//Snowdrops + Prickly Pear Cactus + setcross = 9;//FernSeed + + if( cross == 2 && cross2 == 16)//Poppies + Barrel Cactus + setcross = 9;//FernSeed + + if( cross == 1 && cross2 == 17)//Campion Flowers + Tribarrel Cactus + setcross = 9;//FernSeed + + if( cross == 10 && cross2 == 10)//Ponytail Palm + Ponytail Palm + setcross = 10;//PonytailPalmSeed + + if( cross == 9 && cross2 == 11)//Fern + Small Palm + setcross = 10;//PonytailPalmSeed + + if( cross == 8 && cross2 == 12)//Elephant Ear Plant + Century Plant + setcross = 10;//PonytailPalmSeed + + if( cross == 7 && cross2 == 13)//Rushes + Water Plants + setcross = 10;//PonytailPalmSeed + + if( cross == 6 && cross2 == 14)//Pampas Grass + Snake Plant + setcross = 10;//PonytailPalmSeed + + if( cross == 5 && cross2 == 15)//Lilies + Prickly Pear Cactus + setcross = 10;//PonytailPalmSeed + + if( cross == 4 && cross2 == 16)//Bulrushes + Barrel Cactus + setcross = 10;//PonytailPalmSeed + + if( cross == 3 && cross2 == 17)//Snowdrops + Tribarrel Cactus + setcross = 10;//PonytailPalmSeed + + if( cross == 11 && cross2 == 11)//Small Palm + Small Palm + setcross = 11;//SmallPalmSeed + + if( cross == 10 && cross2 == 12)//Ponytail Palm + Century Plant + setcross = 11;//SmallPalmSeed + + if( cross == 9 && cross2 == 13)//Fern + Water Plants + setcross = 11;//SmallPalmSeed + + if( cross == 8 && cross2 == 14)//Elephant Ear Plant + Snake Plant + setcross = 11;//SmallPalmSeed + + if( cross == 7 && cross2 == 15)//Rushes + Prickly Pear Cactus + setcross = 11;//SmallPalmSeed + + if( cross == 6 && cross2 == 16)//Pampas Grass + Barrel Cactus + setcross = 11;//SmallPalmSeed + + if( cross == 5 && cross2 == 17)//Lilies + Tribarrel Cactus + setcross = 11;//SmallPalmSeed + + if( cross == 12 && cross2 == 12)//Century Plant + Century Plant + setcross = 12;//CenturyPlantSeed + + if( cross == 11 && cross2 == 13)//Small Palm + Water Plants + setcross = 12;//CenturyPlantSeed + + if( cross == 10 && cross2 == 14)//Ponytail Palm + Snake Plant + setcross = 12;//CenturyPlantSeed + + if( cross == 9 && cross2 == 15)//Fern + Prickly Pear Cactus + setcross = 12;//CenturyPlantSeed + + if( cross == 8 && cross2 == 16)//Elephant Ear Plant + Barrel Cactus + setcross = 12;//CenturyPlantSeed + + if( cross == 7 && cross2 == 17)//Rushes + Tribarrel Cactus + setcross = 12;//CenturyPlantSeed + + if( cross == 13 && cross2 == 13)//Water Plants + Water Plants + setcross = 13;//WaterPlantSeed + + if( cross == 12 && cross2 == 14)//Century Plant + Snake Plant + setcross = 13;//WaterPlantSeed + + if( cross == 11 && cross2 == 15)//Small Palm + Prickly Pear Cactus + setcross = 13;//WaterPlantSeed + + if( cross == 10 && cross2 == 16)//Ponytail Palm + Barrel Cactus + setcross = 13;//WaterPlantSeed + + if( cross == 9 && cross2 == 17)//Fern + Tribarrel Cactus + setcross = 13;//WaterPlantSeed + + if( cross == 14 && cross2 == 14)//Snake Plant + Snake Plant + setcross = 14;//SnakePlantSeed + + if( cross == 13 && cross2 == 15)//Water Plants + Prickly Pear Cactus + setcross = 14;//SnakePlantSeed + + if( cross == 12 && cross2 == 16)//Century Plant + Barrel Cactus + setcross = 14;//SnakePlantSeed + + if( cross == 11 && cross2 == 17)//Small Palm + Tribarrel Cactus + setcross = 14;//SnakePlantSeed + + if( cross == 15 && cross2 == 15)//Prickly Pear Cactus + Prickly Pear Cactus + setcross = 15;//PricklyPearCactusSeed + + if( cross == 14 && cross2 == 16)//Snake Plant + Barrel Cactus + setcross = 15;//PricklyPearCactusSeed + + if( cross == 13 && cross2 == 17)//Water Plants + Tribarrel Cactus + setcross = 15;//PricklyPearCactusSeed + + if( cross == 16 && cross2 == 16)//Barrel Cactus + Barrel Cactus + setcross = 16;//BarrelCactusSeed + + if( cross == 15 && cross2 == 17)//Prickly Pear Cactus + Tribarrel Cactus + setcross = 16;//BarrelCactusSeed + + if( cross == 17 && cross2 == 17)//Tribarrel Cactus + Tribarrel Cactus + setcross = 17;//TribarrelCactusSeed + + myTarget.SetTag("PlantCross", 1 + "," + setcross + "," + 1); +} + +function SeedColorsSet(myTarget, iUsed) +{ + var Seeds = iUsed.GetTag("Seed"); + var plantInfo = iUsed.GetTag("PlantInfo") + var tplantInfo = myTarget.GetTag("PlantInfo") + + if( !Seeds || !plantInfo || !tplantInfo ) + { + return false; + } + + var infoLength = plantInfo.split(","); + var tinfoLength = tplantInfo.split(","); + var Seedlength = Seeds.split(","); + + if( Seedlength.length != 3 || infoLength.length != 4 || tinfoLength.length != 4 ) + { + return false; + } + + var iplantColor = parseInt( infoLength[2] ); + var tplantColor = parseInt( tinfoLength[2] ); + + var availableSeeds = parseInt( Seedlength[0] ); + var remainingSeeds = parseInt( Seedlength[1] ); + + // Define color combination object + var colorMap = { + "0_0": 0, // Plain + Plain + + "1645_1645": 33, // Red + Red = Bright Red + "1645_1341": 13, // Red + Blue = Purple + "1645_2213": 1135, // Red + Yellow = Orange + "1645_13": 1645, // Red + Purple = Red + "1645_1435": 1645, // Red + Green = Red + "1645_1135": 1645, // Red + Orange = Red + "1645_0": 0, // Red + Plain = Plain + + "1341_1341": 5, // Blue + Blue = Bright Blue + "1341_1645": 13, // Blue + Red = Purple + "1341_2213": 1435, // Blue + Yellow = Green + "1341_13": 1341, // Blue + Purple = Blue + "1341_1435": 1341, // Blue + Green = Blue + "1341_1135": 1341, // Blue + Orange = Blue + "1341_0": 0, // Blue + Plain = Plain + + "2213_2213": 56, // Yellow + Yellow = Bright Yellow + "2213_1645": 1135, // Yellow + Red = Orange + "2213_1341": 1435, // Yellow + Blue = Green + "2213_13": 2213, // Yellow + Purple = Yellow + "2213_1435": 2213, // Yellow + Green = Yellow + "2213_1135": 2213, // Yellow + Orange = Yellow + "2213_0": 0, // Yellow + Plain = Plain + + "13_1645": 1645, // Purple + Red = Red + "13_1341": 1341, // Purple + Blue = Blue + "13_2213": 2213, // Purple + Yellow = Yellow + "13_13": 16, // Purple + Purple = Bright Purple + "13_1435": 1341, // Purple + Green = Blue + "13_1135": 1645, // Purple + Orange = Red + "13_0": 0, // Purple + Plain = Plain + + "1435_1645": 1645, // Green + Red = Red + "1435_1341": 1341, // Green + Blue = Blue + "1435_2213": 2213, // Green + Yellow = Yellow + "1435_13": 1341, // Green + Purple = Blue + "1435_1435": 66, // Green + Green = Bright Green + "1435_1135": 2213, // Green + Orange = Yellow + "1435_0": 0, // Green + Plain = Plain + + "1135_1645": 1645, // Orange + Red = Red + "1135_1341": 1341, // Orange + Blue = Blue + "1135_2213": 2213, // Orange + Yellow = Yellow + "1135_13": 1645, // Orange + Purple = Red + "1135_1435": 2213, // Orange + Green = Yellow + "1135_1135": 43, // Orange + Orange = Bright Orange + "1135_0": 0, // Orange + Plain = Plain + + "1117_1117": 1117, // Black + Black + "1117_0": 1117, // Black + plain + + "1153_1153": 1153, // White + White + "1153_0": 1153, // Black + plain + + "1166_1166": 1166, // Pink + Pink + "1166_0": 1166, // Pink + plain + + "1158_1158": 1158, // Magenta + Magenta + "1158_0": 1158, // Magenta + plain + + "1173_1173": 1173, // Aqua + Aqua + "1173_0": 1173, // Aqua + plain + + "1161_1161": 1173, // FireRed + FireRed + "1161_0": 1173, // FireRed + plain + }; + + // Build key for the color combination + var key = iplantColor.toString() + "_" + tplantColor.toString(); + + // Get hue from the object + var sethue = colorMap[key] || 0; + + myTarget.SetTag("Seed", availableSeeds + "," + remainingSeeds + "," + sethue); +} + + +function GatherSeeds(pUser, iUsed) +{ + var socket = pUser.socket; + + var Seeds = iUsed.GetTag( "Seed" ) + var CrossedPlants = iUsed.GetTag( "PlantCross" ); + + if( !Seeds || !CrossedPlants ) + { + return false; + } + + var Seedlength = Seeds.split( "," ); + var Crossed = CrossedPlants.split( "," ); + if( Seedlength.length != 3 || Crossed.length != 3 ) + { + return false; + } + + var availableSeeds = parseInt( Seedlength[0] ); + var remainingSeeds = parseInt( Seedlength[1] ); + var hueSeeds = parseInt( Seedlength[2] ); + + var Pollinated = parseInt( Crossed[0] ); + var SeedBreed = parseInt( Crossed[1] ); + var crossAble = parseInt( Crossed[2] ); + + if( availableSeeds == 0 ) + { + socket.SysMessage( GetDictionaryEntry( 19124, socket.language ));//This plant has no seeds to gather! + } + else + { + var seedType = ""; + switch (SeedBreed) + { + case 1: + seedType = "CampionFlowerSeed"; + break; + case 2: + seedType = "PoppiesSeed"; + break; + case 3: + seedType = "SnowdropSeed"; + break; + case 4: + seedType = "BulrusheSeed"; + break; + case 5: + seedType = "LilieSeed"; + break; + case 6: + seedType = "PampasGrassSeed"; + break; + case 7: + seedType = "RusheSeed"; + break; + case 8: + seedType = "ElephantEarPlantrSeed"; + break; + case 9: + seedType = "FernSeed"; + break; + case 10: + seedType = "PonytailPalmSeed"; + break; + case 11: + seedType = "SmallPalmSeed"; + break; + case 12: + seedType = "CenturyPlantSeed"; + break; + case 13: + seedType = "WaterPlantSeed"; + break; + case 14: + seedType = "SnakePlantSeed"; + break; + case 15: + seedType = "PricklyPearCactusSeed"; + break; + case 16: + seedType = "BarrelCactusSeed"; + break; + case 17: + seedType = "TribarrelCactusSeed"; + break; + case 18: + seedType = "CommonGreenBonsaiSeed"; + break; + case 19: + seedType = "CommonPinkBonsaiSeed"; + break; + case 20: + seedType = "UncommonGreenBonsaiSeed"; + break; + case 21: + seedType = "UncommonPinkBonsaiSeed"; + break; + case 22: + seedType = "RareGreenBonsai"; + break; + case 23: + seedType = "RarePinkBonsai"; + break; + case 24: + seedType = "ExceptionalBonsai"; + break; + case 25: + seedType = "ExoticBonsai"; + break; + case 26: + seedType = "Cactus"; + break; + case 27: + seedType = "FlaxFlowers"; + break; + case 28: + seedType = "FoxgloveFlowers"; + break; + case 29: + seedType = "HopsEast"; + break; + case 30: + seedType = "OrfluerFlowers"; + break; + case 31: + seedType = "CypressTwisted"; + break; + case 32: + seedType = "HedgeShort"; + break; + case 33: + seedType = "JuniperBush"; + break; + case 34: + seedType = "SnowdropPatch"; + break; + case 35: + seedType = "Cattails"; + break; + case 36: + seedType = "PoppyPatch"; + break; + case 37: + seedType = "SpiderTree"; + break; + case 38: + seedType = "WaterLily"; + break; + case 39: + seedType = "CypressStraight"; + break; + case 40: + seedType = "HedgeTall"; + break; + case 41: + seedType = "HopsSouth"; + break; + case 42: + seedType = "SugarCanes"; + break; + } + if( seedType != null) + { + CreateDFNItem(pUser.socket, pUser, seedType, 1, "ITEM", true, hueSeeds); + + socket.SysMessage( GetDictionaryEntry( 19125, socket.language ));//You gather seeds from the plant. + + if( availableSeeds > 0) + { + var rseeds = availableSeeds - 1; + iUsed.SetTag("Seed", rseeds + "," + remainingSeeds + "," + hueSeeds); + } + } + } + onUseChecked( pUser, iUsed ); +} + +function EmptyBowlGump( pUser, iUsed ) +{ + var socket = pUser.socket; + var gumpID = scriptID + 0xffff; + var EmptyBowlGump = new Gump; + socket.tempObj = iUsed; + var plantStage = iUsed.GetTag( "PlantStage" ) + + EmptyBowlGump.AddBackground( 50, 50, 200, 150, 0xE10 ); + + EmptyBowlGump.AddPicture( 45, 45, 0xCEF ); + EmptyBowlGump.AddPicture( 45, 118, 0xCF0 ); + + EmptyBowlGump.AddPicture( 211, 45, 0xCEB ); + EmptyBowlGump.AddPicture( 211, 118, 0xCEC ); + + EmptyBowlGump.AddText( 90, 70, 0x44, "Empty the bowl?" ); + + EmptyBowlGump.AddPicture( 90, 100, 0x1602 ); + EmptyBowlGump.AddGump( 140, 102, 0x15E1 ); + EmptyBowlGump.AddPicture( 160, 100, 0x15FD ); + + if( plantStage != 14 && plantStage < 2 ) //BowlOfDirt + EmptyBowlGump.AddPicture( 156, 130, 0xDCF ); // Seed + + EmptyBowlGump.AddButton( 98, 150, 0x47E, 0x480, 14, 14, 14 ); // Cancel + + EmptyBowlGump.AddButton( 138, 151, 0xD2, 0xD2, 13, 13, 13 ); // Help + EmptyBowlGump.AddText( 143, 151, 0x835, "?" ); + + EmptyBowlGump.AddButton( 168, 150, 0x481, 0x483, 15, 15, 15 ); // Ok + EmptyBowlGump.Send( socket ); + EmptyBowlGump.Free(); +} + +function addWater(pUser, iUsed) +{ + var socket = pUser.socket; + var waterLevel = iUsed.GetTag( "water" ); + var pitcherofwater1 = pUser.FindItemSection( "0X1F9E" ); + var pitcherofwater2 = pUser.FindItemSection( "0X1F9D" ); + + // Check if water level is max + if( waterLevel >= 4 ) + { + socket.SysMessage( GetDictionaryEntry( 19126, socket.language ));//You can't add water to this plant. + return; + } + + // Check if pitcher1 or pitcher2 is valid + if( ValidateObject( pitcherofwater1 ) || ValidateObject( pitcherofwater2 )) + { + // Increase water level + iUsed.SetTag("water", waterLevel + 1); + + // Reduce uses remaining in pitcher + var pitcher = ValidateObject( pitcherofwater1 ) ? pitcherofwater1 : pitcherofwater2; + if( pitcher.usesLeft == 1 ) + { + // Pitcher is empty + pitcher.usesLeft = 0; + pitcher.SetTag( "ContentsName", "nothing" ); + TriggerEvent( 2100, "switchPitcherID", socket, pitcher ); + } + else + { + // Reduce uses left in pitcher by 1 + pitcher.usesLeft--; + pitcher.Refresh(); + } + + // Inform user + socket.SysMessage( GetDictionaryEntry( 19127, socket.language ));//You soften the dirt with water. + pUser.SoundEffect( 0x4e, 1 ); + } + else + { + socket.SysMessage( GetDictionaryEntry( 19128, socket.language ));//You can't use that on a plant! + } +} + +function addPotion( pUser, iUsed, button ) +{ + var socket = pUser.socket; + + pUser.socket.tempObj = iUsed; + pUser.SetTempTag( "ButtonPushed", button );// 7 = poison, 8 = cure, 9 = heal, 10 = strength + pUser.CustomTarget( 0 ); +} + +function onCallback0( pSock, myTarget ) +{ + var iUsed = pSock.tempObj; + var pUser = pSock.currentChar; + var buttonPushed = pUser.GetTempTag( "ButtonPushed" ); // 7 = poison, 8 = cure, 9 = heal, 10 = strength + + //Define maximum potion count + var maxPotionCount = 4; // Change this value to the desired maximum potion count + + // Check if the target is an item + if( !myTarget.isItem ) + return false; + + var potionInfo = iUsed.GetTag( "Potions" ); + if( !potionInfo ) + { + return false; + } + + var potionLength = potionInfo.split(","); + if( potionLength.length != 4 ) + { + return false; + } + + var greaterPoison = parseInt( potionLength[0] ); + var greaterCure = parseInt( potionLength[1] ); + var greaterHeal = parseInt( potionLength[2] ); + var greaterStrength = parseInt( potionLength[3] ); + + // Check if the item is in the user's backpack + var itemOwner = GetPackOwner( myTarget, 0 ); + if( itemOwner !== pUser ) + { + pSock.SysMessage( GetDictionaryEntry( 1763, pSock.language )); //That item must be in your backpack before it can be used. + return false; + } + + var potionTypeIDs = { + 7: ["greaterpoisonpotion", "0X0F09-B"], + 8: ["greatercurepotion", "0X0F07-C"], + 9: ["greaterhealpotion", "0X0F0C-C"], + 10: ["greaterstrengthpotion", "0X0F09-B"] + }; + + var potionType = potionTypeIDs[buttonPushed]; + + if( !potionType ) + { + pSock.SysMessage( GetDictionaryEntry( 19129, pSock.language ));//You don't have any strong potions of that type in your pack. + pSock.SysMessage("Borken 1"); + return false; + } + + if( myTarget.sectionID != potionType[0] && myTarget.sectionID != potionType[1] ) + { + pSock.SysMessage( GetDictionaryEntry( 19129, pSock.language ));//You don't have any strong potions of that type in your pack. + return false; + } + + if( iUsed.GetTag( "PlantStage" ) == 14 ) + { //dirt bowl + pSock.SysMessage( GetDictionaryEntry( 19130, pSock.language ));//You should only pour potions on a plant or seed! + return false; + } + + var potionIndex = buttonPushed - 7; + var potionCount = [greaterPoison, greaterCure, greaterHeal, greaterStrength]; + if( potionCount[potionIndex] >= maxPotionCount ) + { + pSock.SysMessage( GetDictionaryEntry( 19131, pSock.language ));//The plant is already soaked with this type of potion! + return false; + } + + potionCount[potionIndex]++; + var newPotionInfo = potionCount[0] + "," + potionCount[1] + "," + potionCount[2] + "," + potionCount[3]; + iUsed.SetTag( "Potions", newPotionInfo ); + + // Call onUseChecked + onUseChecked( pUser, iUsed ); + + // Decrease target amount or delete if amount is 1 + if( myTarget.amount > 1 ) + myTarget.amount--; + else + myTarget.Delete(); + + pUser.SoundEffect(0x240, 1); + + return false; +} + + +function ReproductionGump( pUser, iUsed ) +{ + var socket = pUser.socket; + var ReproductionGump = new Gump; + socket.tempObj = iUsed; + var plantStage = iUsed.GetTag("PlantStage") + + ReproductionGump.AddBackground( 50, 50, 200, 150, 0xE10 ); + + ReproductionGump.AddGump( 60, 90, 0xE17 ); + ReproductionGump.AddGump( 120, 90, 0xE17 ); + + ReproductionGump.AddGump( 60, 145, 0xE17 ); + ReproductionGump.AddGump( 120, 145, 0xE17 ); + + ReproductionGump.AddPicture( 45, 45, 0xCEF ); + ReproductionGump.AddPicture(45, 118, 0xCF0 ); + + ReproductionGump.AddPicture( 211, 45, 0xCEB ); + ReproductionGump.AddPicture( 211, 118, 0xCEC ); + + ReproductionGump.AddButton( 70, 67, 0xD4, 0xD4, 16, 16, 16 ); // Main menu + ReproductionGump.AddPicture( 57, 65, 0x1600 ); + + ReproductionGump.AddText( 108, 67, 0x835, "Reproduction" ); + + if( plantStage == 9 ) + { + ReproductionGump.AddButton( 212, 67, 0xD4, 0xD4, 17, 17, 17 ); // Set to decorative + ReproductionGump.AddPicture( 202, 68, 0xC61 ); + ReproductionGump.AddText( 216, 66, 0x21, "/" ); + } + + ReproductionGump.AddButton( 80, 116, 0xD4, 0xD4, 18, 18, 18 ); // Pollination + ReproductionGump.AddPicture( 66, 117, 0x1AA2 ); + AddPollinationState( ReproductionGump, iUsed, 106, 116 ); + + ReproductionGump.AddButton( 128, 116, 0xD4, 0xD4, 19, 19, 19 ); // Resources + ReproductionGump.AddPicture( 113, 120, 0x1021 ); + AddResourcesState( ReproductionGump, iUsed, 149, 116 ); + + ReproductionGump.AddButton( 177, 116, 0xD4, 0xD4, 20, 20, 20 ); // Seeds + ReproductionGump.AddPicture( 160, 121, 0xDCF ); + AddSeedsState( ReproductionGump, iUsed,199, 116 ); + + ReproductionGump.AddButton( 70, 163, 0xD2, 0xD2, 21, 21, 21 ); // Gather pollen + ReproductionGump.AddPicture( 56, 164, 0x1AA2 ); + + ReproductionGump.AddButton( 138, 163, 0xD2, 0xD2, 22, 22, 22 ); // Gather resources + ReproductionGump.AddPicture( 123, 167, 0x1021 ); + + ReproductionGump.AddButton( 212, 163, 0xD2, 0xD2, 23, 23, 23 ); // Gather seeds + ReproductionGump.AddPicture( 195, 168, 0xDCF ); + ReproductionGump.Send( socket ); + ReproductionGump.Free(); +} + +function AddResourcesState(ReproductionGump, iUsed, x, y) +{ + var Seeds = iUsed.GetTag( "Seed" ) + + if( !Seeds ) + { + return false; + } + + var Seedlength = Seeds.split( "," ); + if( Seedlength.length != 3 ) + { + return false; + } + + var availableSeeds = parseInt( Seedlength[0] ); + var remainingSeeds = parseInt( Seedlength[1] ); + var hueSeeds = parseInt(Seedlength[2]); + + if( availableSeeds == 0 && remainingSeeds == 0 ) + { + ReproductionGump.AddText( x + 5, y, 0x21, "X" ); + } + else + { + ReproductionGump.AddText( x, y, hueSeeds, availableSeeds + "/" + remainingSeeds ); + } + return; +} + +function AddSeedsState( ReproductionGump, iUsed, x, y ) +{ + var Seeds = iUsed.GetTag( "Seed" ) + + if( !Seeds ) + { + return false; + } + + var Seedlength = Seeds.split( "," ); + if( Seedlength.length != 3 ) + { + return false; + } + + var availableSeeds = parseInt( Seedlength[0] ); + var remainingSeeds = parseInt( Seedlength[1] ); + var hueSeeds = parseInt( Seedlength[2] ); + + if( availableSeeds == 0 && remainingSeeds == 0 ) + { + ReproductionGump.AddText( x + 5, y, 0x21, "X" ); + } + else + { + ReproductionGump.AddText( x, y, hueSeeds, availableSeeds + "/" + remainingSeeds ); + } +} + +function AddPollinationState(ReproductionGump, iUsed, x, y) +{ + var status = parseInt( iUsed.GetTag( "PlantStage" )); + + var tCrossedPlants = iUsed.GetTag( "PlantCross" ); + + if( !tCrossedPlants ) + { + return false; + } + + var Crossed = tCrossedPlants.split( "," ); + if( Crossed.length != 2 ) + { + return false; + } + + var Pollinated = parseInt( Crossed[0] ); + + if( status < 7 ) + { + ReproductionGump.AddText( x, y, 0x35, "-" ); + } + else if( status >= 7 && Pollinated == 0 ) + { + ReproductionGump.AddText( x, y, 0x21, "!" ); + } + else + { + ReproductionGump.AddText( x, y, 0x3F, "+" ); + } +} + +function SetToDecorativeGump( pUser, iUsed ) +{ + var socket = pUser.socket; + var SetToDecorativeGump = new Gump; + socket.tempObj = iUsed; + + SetToDecorativeGump.AddBackground( 50, 50, 200, 150, 0xE10 ); + + SetToDecorativeGump.AddPicture( 25, 45, 0xCEB ); + SetToDecorativeGump.AddPicture( 25, 118, 0xCEC ); + + SetToDecorativeGump.AddPicture( 227, 45, 0xCEF ); + SetToDecorativeGump.AddPicture( 227, 118, 0xCF0 ); + + SetToDecorativeGump.AddText( 115, 85, 0x44, "Set plant" ); + SetToDecorativeGump.AddText( 82, 105, 0x44, "to decorative mode?" ); + + SetToDecorativeGump.AddButton( 98, 140, 0x47E, 0x480, 24, 24, 24 ); // Cancel + + SetToDecorativeGump.AddButton( 138, 141, 0xD2, 0xD2, 25, 25, 25 ); // Help + SetToDecorativeGump.AddText( 143, 141, 0x835, "?" ); + + SetToDecorativeGump.AddButton( 168, 140, 0x481, 0x483, 26, 26, 26 ); // Ok + SetToDecorativeGump.Send( socket ); + SetToDecorativeGump.Free(); +} + +function onTooltip( myPlant ) +{ + var tooltipText = ""; + var status = parseInt( myPlant.GetTag( "PlantStage" )); + var plantHealth = myPlant.GetTag( "PlantHealth" ); + var plantInfo = myPlant.GetTag( "PlantInfo" ); + + if( !plantInfo ) + { + return false; + } + + var infoLength = plantInfo.split( "," ); + if( infoLength.length != 4 ) + { + return false; + } + + var plantType = parseInt( infoLength[0] ); + var PlantName = infoLength[1]; + var plantColor = parseInt( infoLength[2] ); + var fertialeDirt = parseInt( infoLength[3] ); + + var colorname = ""; + switch( plantColor ) + { + case 0: colorname = "plain"; break; + case 1645: colorname = "red"; break; + case 1341: colorname = "blue"; break; + case 13: colorname = "purple"; break; + case 1135: colorname = "orange"; break; + case 2213: colorname = "yellow"; break; + case 1435: colorname = "green"; break; + case 33: colorname = "bright red"; break; + case 66: colorname = "bright green"; break; + case 5: colorname = "bright blue"; break; + case 56: colorname = "bright yellow"; break; + case 43: colorname = "bright orange"; break; + case 16: colorname = "bright purple"; break; + default: colorname = "plain"; + } + + var healthStatus = { + 10: "Drying", + 11: "Wilted", + 12: "Healthy", + 13: "Vibrant" + }; + + var health = healthStatus[plantHealth] || "Vibrant"; + + var waterLevel = myPlant.GetTag( "water" ); + + var waterStatus = { + 1: "Hard", + 2: "Soft", + 3: "Squishy", + 4: "Sopping wet" + }; + + var water = waterStatus[waterLevel] || "Hard"; + + if( status === 0 || status === 14 ) + { + tooltipText = "A bowl of " + water + " dirt"; + } + if( status === 1 ) + { + tooltipText = "A bowl of " + water + " dirt with a " + health + " " + PlantName.toString(); + } + else if( status >= 2 && status <= 8 ) + { + tooltipText = "A bowl of " + water + " dirt with a " + health + " " + colorname + " " + PlantName.toString() + " Plant"; + } + else if( status == 9 ) + { + tooltipText = "a " + health + " " + colorname + " " + PlantName.toString() + " Plant"; + } + + return tooltipText; +} + +function _restorecontext_() {} \ No newline at end of file diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js new file mode 100644 index 000000000..25b8a24ca --- /dev/null +++ b/data/js/item/plant_growing/seed.js @@ -0,0 +1,162 @@ +function onUseChecked( pUser, iUsed ) +{ + var socket = pUser.socket; + if( socket && iUsed && iUsed.isItem ) + { + var itemOwner = GetPackOwner( iUsed, 0 ); + if( itemOwner == null || itemOwner != pUser ) + { + socket.SysMessage( GetDictionaryEntry( 1763, pUser.socket.language )); //That item must be in your backpack before it can be used. + } + else + { + pUser.socket.tempObj = iUsed; + pUser.CustomTarget( 0, GetDictionaryEntry(19137, socket.language ));//Choose a bowl of dirt to plant this seed in. + return false; + } + } + return true; +} + +function onCallback0( pSock, myTarget ) +{ + const PlantDelayTimer = 82800000;//82800000 Every 23 hours plant grows + var iUsed = pSock.tempObj; + var pUser = pSock.currentChar; + + // That must be in your pack for you to use it. + if( !pSock.GetWord( 1 ) && myTarget.isItem ) + { + var plantStage = myTarget.GetTag("PlantStage"); + var plantInfo = myTarget.GetTag( "PlantInfo" ); + var waterLevel = myTarget.GetTag( "water" ); + + if( !plantInfo ) + { + return false; + } + + var infoLength = plantInfo.split( "," ); + if( infoLength.length != 4 ) + { + return false; + } + + var plantType = parseInt( infoLength[0] ); + var PlantName = infoLength[1]; + var plantColor = parseInt( infoLength[2] ); + var fertialeDirt = parseInt( infoLength[3] ); + var itemOwner = GetPackOwner( myTarget, 0 ); + + if( itemOwner == null || itemOwner != pUser ) + { + pSock.SysMessage( GetDictionaryEntry( 1763, pSock.language )); //That item must be in your backpack before it can be used. + } + else + { + if( ValidateObject( myTarget ) && myTarget.id == 0x1602 || myTarget.sectionID == "plantbowlOfdirt" ) //checking to make sure its a full bowl of dirt + { + if( plantStage >= 18 ) // FullGrownPlant + { + // You must use a seed on some prepared soil! + pSock.SysMessage( GetDictionaryEntry( 19138, pSock.language ));//You must use a seed on some prepared soil! + } + else if( plantStage != 14 && PlantName ) // BowlOfDirt or PlantName + { + var tempMsg = GetDictionaryEntry( 19139, socket.language ); + pSock.SysMessage( tempMsg.replace( /%s/gi, PlantName ));//This bowl of dirt already has a seed %s in it! + // This bowl of dirt already has a seed of %s in it! + } + else if( waterLevel < 2 ) // not enough water + { + pSock.SysMessage( GetDictionaryEntry( 19140, pSock.language ));//The dirt needs to be softened first. + } + else + { + const seedToPlantType = { + "CampionFlowerSeed": { type: 1, crossable: 1 }, + "PoppieSeed": { type: 2, crossable: 1 }, + "SnowdropSeed": { type: 3, crossable: 1 }, + "BulrusheSeed": { type: 4, crossable: 1 }, + "LilieSeed": { type: 5, crossable: 1 }, + "PampasGrassSeed": { type: 6, crossable: 1 }, + "RusheSeed": { type: 7, crossable: 1 }, + "ElephantEarPlantrSeed": { type: 8, crossable: 1 }, + "FernSeed": { type: 9, crossable: 1 }, + "PonytailPalmSeed": { type: 10, crossable: 1 }, + "SmallPalmSeed": { type: 11, crossable: 1 }, + "CenturyPlantSeed": { type: 12, crossable: 1 }, + "WaterPlantSeed": { type: 13, crossable: 1 }, + "SnakePlantSeed": { type: 14, crossable: 1 }, + "PricklyPearCactusSeed": { type: 15, crossable: 1 }, + "BarrelCactusSeed": { type: 16, crossable: 1 }, + "TribarrelCactusSeed": { type: 17, crossable: 1 }, + "CommonGreenBonsaiSeed": { type: 18, crossable: 0 }, + "CommonPinkBonsaiSeed": { type: 19, crossable: 0 }, + "UncommonGreenBonsai": { type: 20, crossable: 0 }, + "UncommonPinkBonsai": { type: 21, crossable: 0 }, + "RareGreenBonsai": { type: 22, crossable: 0 }, + "RarePinkBonsai": { type: 23, crossable: 0 }, + "ExceptionalBonsai": { type: 24, crossable: 0 }, + "ExoticBonsai": { type: 25, crossable: 0 }, + "Cactus": { type: 26, crossable: 0 }, + "FlaxFlowers": { type: 27, crossable: 0 }, + "FoxgloveFlowers": { type: 28, crossable: 0 }, + "HopsEast": { type: 29, crossable: 0 }, + "OrfluerFlowers": { type: 30, crossable: 0 }, + "CypressTwisted": { type: 31, crossable: 0 }, + "HedgeShort": { type: 32, crossable: 0 }, + "JuniperBush": { type: 33, crossable: 0 }, + "SnowdropPatch": { type: 34, crossable: 0 }, + "Cattails": { type: 35, crossable: 0 }, + "PoppyPatch": { type: 36, crossable: 0 }, + "SpiderTree": { type: 37, crossable: 0 }, + "WaterLily": { type: 38, crossable: 0 }, + "CypressStraight": { type: 39, crossable: 0 }, + "HedgeTall": { type: 40, crossable: 0 }, + "HopsSouth": { type: 41, crossable: 0 }, + "SugarCanes": { type: 42, crossable: 0 } + }; + + // Loop through the keys of seedToPlantType to find the matching tag + for( var tagName in seedToPlantType ) + { + if( parseInt( iUsed.GetTag( tagName )) == 1 ) + { + var tplantType = seedToPlantType[tagName]; + if( !isNaN( tplantType.type )) + { + myTarget.SetTag( "PlantInfo", tplantType.type + "," + iUsed.name + "," + iUsed.colour + "," + fertialeDirt ); + myTarget.SetTag( "PlantCross", 0 + "," + tplantType.type + "," + tplantType.crossable ); + break; + } + else + { + // Handle the case where the plantType is not a valid number + pSock.SysMessage( "Invalid plantType:", tplantType.type, "Page and GM" ); + break; + } + } + } + + myTarget.StartTimer( PlantDelayTimer, 1, 19100 ); + myTarget.SetTag( "PlantStage", 1 );//Seed + myTarget.SetTag( "Seed", 0 + "," + 8 + "," + iUsed.colour );//Min/max/color + pSock.SysMessage( GetDictionaryEntry( 19141, pSock.language ));//You plant the seed in the bowl of dirt. + + if( iUsed.amount > 1 ) + iUsed.amount--; + else + iUsed.Delete(); + } + } + else + { + pUser.SysMessage( GetDictionaryEntry( 19142, pSock.language ));//You must use a seed on a bowl of dirt! + return false; + } + } + return false; + } + return false; +} \ No newline at end of file diff --git a/data/js/jse_fileassociations.scp b/data/js/jse_fileassociations.scp index 66e6cf568..59121461b 100644 --- a/data/js/jse_fileassociations.scp +++ b/data/js/jse_fileassociations.scp @@ -98,6 +98,7 @@ 2201=server/misc/hint_tooltip.js 2202=server/misc/warning_trigger.js 2203=server/misc/charges_left_tooltip.js +2204=server/network/0xDF_buffBar.js 2205=server/network/0xbf_special_move.js // Server Data [2500-2749] @@ -285,6 +286,10 @@ 5059=item/powderoftranslocation.js 5060=item/elixirofingots.js +19100=item/plant_growing/plantsystem.js +19101=item/plant_growing/plantbowl.js +19102=item/plant_growing/seed.js + //------------------------------------------- // treasure maps and chest [5400-5405] //------------------------------------------- diff --git a/data/js/server/global.js b/data/js/server/global.js index 582a9d268..aab7de6a4 100644 --- a/data/js/server/global.js +++ b/data/js/server/global.js @@ -37,10 +37,21 @@ function onLogin( socket, pChar ) TriggerEvent( 8001, "CheckYoungStatus", socket, pChar, true ); } + //Attach the special moves Book if( !pChar.npc && !pChar.HasScriptTrigger( 7001 )) { pChar.AddScriptTrigger( 7001 ); + } + + // Re-adds Buff for disguise kit if player still has time left. + var currentTime = GetCurrentClock(); + var disguiseKitTime = pChar.GetJSTimer( 1, 5023 ); + var timeLeft = Math.round(( disguiseKitTime - currentTime ) / 1000 ); + if( disguiseKitTime > 0 ) + { + TriggerEvent( 2204, "RemoveBuff", pChar, 1033 ); + TriggerEvent( 2204, "AddBuff", pChar, 1033, 1075821, 1075820, timeLeft, "" ); } } diff --git a/data/js/server/network/0xDF_buffBar.js b/data/js/server/network/0xDF_buffBar.js new file mode 100644 index 000000000..2f90ee46c --- /dev/null +++ b/data/js/server/network/0xDF_buffBar.js @@ -0,0 +1,91 @@ +// how to use +// TriggerEvent( 2204, "AddBuff", mChar, buffIcon, priCliloc, scndCliloc, seconds, " " + ourObj.name ); name sent +// TriggerEvent( 2204, "AddBuff", mChar, buffIcon, priCliloc, scndCliloc, seconds, " " + "blah blah msg" ); any msg sent +// TriggerEvent( 2204, "AddBuff", mChar, buffIcon, priCliloc, scndCliloc, seconds, " " );//No text msg sent +// TriggerEvent( 2204, "AddBuff", mChar, buffIcon, priCliloc, scndCliloc, 0, " " );// No msg no timer sent + +const BuffEnabled = true; // Turn buffs on and off here. + +function AddBuff( pUser, iconID, priCliloc, scndCliloc, seconds, stringData ) +{ + if( !BuffEnabled ) + { + return false; + } + + var pSocket = pUser.socket; + if( seconds >= 1 ) + { + pUser.StartTimer( seconds * 1000, iconID, 2204 ); + } + + var pStream = new Packet; + var hasArgs = ( stringData.length != 0 ); + + var utf16Bytes = []; + + if( hasArgs ) + { + for( var i = 0; i < stringData.length; ++i ) + { + var charCode = stringData.charCodeAt( i ); + utf16Bytes.push( charCode & 0xFF ); // lower byte + utf16Bytes.push( ( charCode >> 8 ) & 0xFF ); // upper byte + } + } + + var size = hasArgs ? ( 48 + utf16Bytes.length + 2 ) : 44; + pStream.ReserveSize( size ); + pStream.WriteByte( 0, 0xDF ); + pStream.WriteShort( 1, size ); + pStream.WriteLong( 3, pUser.serial ); + pStream.WriteShort( 7, iconID ); + pStream.WriteShort( 9, 1 ); + // Skip 4 .., so 11-14 + pStream.WriteShort( 15, iconID ); + pStream.WriteShort( 17, 1 ); + // Skip 4 .., so 19-22 + pStream.WriteShort( 23, seconds ); + // Skip 3 .., so 25-27 + pStream.WriteLong( 28, priCliloc ); + pStream.WriteLong( 32, scndCliloc ); + + if( hasArgs ) + { + // Skip 4 .., so 36-39 + pStream.WriteShort( 40, 1 ); + // Skip 2 .., so 42-43 + for( var k = 0; k < utf16Bytes.length; ++k ) + { + pStream.WriteByte( 44 + k, utf16Bytes[k] ); + } + pStream.WriteShort( 44 + utf16Bytes.length, 2 ); + } + pSocket.Send( pStream ); + pStream.Free(); +} + +function RemoveBuff( pUser, iconID ) +{ + var pSocket = pUser.socket; + var pStream = new Packet; + + pStream.ReserveSize( 13 ); + pStream.WriteByte( 0, 0xDF ); + pStream.WriteShort( 1, 13 ); + pStream.WriteLong( 3, pUser.serial ); + pStream.WriteShort( 7, iconID ); + pStream.WriteShort( 9, 0 ); + pSocket.Send( pStream ); + pStream.Free(); + + pUser.KillJSTimer( iconID, 2204 ); +} + +function onTimer( pUser, timerID ) +{ + if( !ValidateObject( pUser )) + return; + + RemoveBuff( pUser, timerID ); +} diff --git a/data/js/skill/healing.js b/data/js/skill/healing.js index eb7cf9703..668ae4646 100644 --- a/data/js/skill/healing.js +++ b/data/js/skill/healing.js @@ -123,17 +123,26 @@ function onCallback1( socket, ourObj ) var healSkill; var skillNum; + var buffIcon; + var priCliloc; + var scndCliloc; if( IsTargetHealable( ourObj, false )) { // Target can be healed with Healing skill healSkill = mChar.baseskills.healing; skillNum = 17; + buffIcon = 1069; + priCliloc = 1002082; + scndCliloc = 1151400; } else if( IsTargetHealable( ourObj, true ) || ( ourObj.tamed && ourObj.owner )) { // Target can be healed with Veterinary skill healSkill = mChar.baseskills.veterinary; skillNum = 39; + buffIcon = 1101; + priCliloc = 1002167; + scndCliloc = 1151400; } else { @@ -295,6 +304,18 @@ function onCallback1( socket, ourObj ) mChar.AddScriptTrigger( 4014 ); // Add healing_slip.js script SetSkillInUse( socket, mChar, ourObj, skillNum, healTimer, true ); + + var seconds = Math.round(healTimer / 1000); + // Add buff to target or yourself + if (ourObj != mChar && ourObj.socket) + { + TriggerEvent( 2204, "AddBuff", ourObj, buffIcon, priCliloc, scndCliloc, seconds, " " + ourObj.name ); + } + else + { + TriggerEvent( 2204, "AddBuff", mChar, buffIcon, priCliloc, scndCliloc, seconds, " " + ourObj.name ); + } + mChar.StartTimer( healTimer, 2, true ); } } diff --git a/source/CPacketSend.cpp b/source/CPacketSend.cpp index e1d8ee4ca..ba30f52d8 100644 --- a/source/CPacketSend.cpp +++ b/source/CPacketSend.cpp @@ -7459,6 +7459,14 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou } FinalizeData( tempEntry, totalStringLen ); } + + if( cItem.GetArtifactRarity() > 0) + { + tempEntry.stringNum = 1061078; // // artifact rarity ~1_val~ + tempEntry.ourText = oldstrutil::number( cItem.GetArtifactRarity() ); + FinalizeData( tempEntry, totalStringLen ); + } + if( cItem.GetType() == IT_MAGICWAND && cItem.GetTempVar( CITV_MOREZ )) { tempEntry.stringNum = 1060584; // uses remaining: ~1_val~ diff --git a/source/Changelog.txt b/source/Changelog.txt index 0e0d3678e..282dfe4eb 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,9 +1,18 @@ + 25/05/2024 - Dragon Slayer - Added special_moves.js There is 12 special aos moves you can find on uoguide.com + Added special_moves.js There is 12 special aos moves you can find on uoguide.com. Added blockequip.js This script is used to block reqeuiping weapons. - Thanks to Xuri for making unequipattemp work for chars and not just items + Thanks to Xuri for making unequipattemp work for chars and not just items. Added OnCombatHit - -Triggers for character with event attached when someone has taken damage + -Triggers for character with event attached when someone has taken damage. + +13/05/2024 - Dragon Slayer + Added New Shield Type 107 so shield ID's no longer have to be in hard code for shields to work properly + +09/05/2024 - Dragon Slayer + Added ArtifactRarity AOS Property for items + -ARTIFACTRARITY=# + -Artifact Rarity is an item property that is visible on some artifacts and meant to give players an idea of how rare the item is. Items with rarity 1 are supposed to be common while rarity 12 are extremely scarce. 1/05/2024 - Dragon Slayer/Xuri Fixed AutoUnequipAttempt function in clumsy.js, createfood.js level1target.js, will no longer fail on casting and return to hardcode. diff --git a/source/UOXJSPropertyEnums.h b/source/UOXJSPropertyEnums.h index af309d496..45517f28d 100644 --- a/source/UOXJSPropertyEnums.h +++ b/source/UOXJSPropertyEnums.h @@ -461,6 +461,7 @@ enum CI_Properties CIP_DAMAGEPOISON, CIP_DAMAGERAIN, CIP_DAMAGESNOW, + CIP_ARTIFACTRARITY, CIP_NAME2, CIP_ISITEM, CIP_ISCHAR, diff --git a/source/UOXJSPropertyFuncs.cpp b/source/UOXJSPropertyFuncs.cpp index 3823356f9..5fc2a3a82 100644 --- a/source/UOXJSPropertyFuncs.cpp +++ b/source/UOXJSPropertyFuncs.cpp @@ -676,6 +676,7 @@ JSBool CItemProps_getProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp case CIP_DAMAGERAIN: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( RAIN )); break; case CIP_DAMAGESNOW: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( SNOW )); break; case CIP_SPEED: *vp = INT_TO_JSVAL( gPriv->GetSpeed() ); break; + case CIP_ARTIFACTRARITY: *vp = INT_TO_JSVAL( gPriv->GetArtifactRarity() ); break; case CIP_NAME2: tString = JS_NewStringCopyZ( cx, gPriv->GetName2().c_str() ); *vp = STRING_TO_JSVAL( tString ); @@ -1321,6 +1322,7 @@ JSBool CItemProps_setProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp case CIP_DAMAGERAIN: gPriv->SetWeatherDamage( RAIN, encaps.toBool() ); break; case CIP_DAMAGESNOW: gPriv->SetWeatherDamage( SNOW, encaps.toBool() ); break; case CIP_SPEED: gPriv->SetSpeed( static_cast( encaps.toInt() )); break; + case CIP_ARTIFACTRARITY: gPriv->SetArtifactRarity( static_cast( encaps.toInt() )); break; case CIP_NAME2: gPriv->SetName2( encaps.toString() ); break; case CIP_RACE: gPriv->SetRace( static_cast( encaps.toInt() )); break; case CIP_MAXHP: gPriv->SetMaxHP( static_cast( encaps.toInt() )); break; diff --git a/source/UOXJSPropertySpecs.h b/source/UOXJSPropertySpecs.h index 3149dc0ec..8607ffab5 100644 --- a/source/UOXJSPropertySpecs.h +++ b/source/UOXJSPropertySpecs.h @@ -535,6 +535,7 @@ inline JSPropertySpec CItemProps[] = { "ammoFXHue", CIP_AMMOFXHUE, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "ammoFXRender", CIP_AMMOFXRENDER, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "speed", CIP_SPEED, JSPROP_ENUMANDPERM, nullptr, nullptr }, + { "artifactRarity", CIP_ARTIFACTRARITY, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "multi", CIP_MULTI, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "maxRange", CIP_MAXRANGE, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "baseRange", CIP_BASERANGE, JSPROP_ENUMANDPERM, nullptr, nullptr }, diff --git a/source/cItem.cpp b/source/cItem.cpp index 3c6523d5d..3a2acd106 100644 --- a/source/cItem.cpp +++ b/source/cItem.cpp @@ -93,6 +93,7 @@ const UI16 DEFITEM_MAXUSES = 0; const UI16 DEFITEM_REGIONNUM = 255; const UI16 DEFITEM_TEMPLASTTRADED = 0; const SI08 DEFITEM_STEALABLE = 1; +const SI16 DEFITEM_ARTIFACTRARITY = 0; //o------------------------------------------------------------------------------------------------o //| Function - CItem() @@ -107,7 +108,7 @@ spd( DEFITEM_SPEED ), maxHp( DEFITEM_MAXHP ), amount( DEFITEM_AMOUNT ), layer( DEFITEM_LAYER ), type( DEFITEM_TYPE ), offspell( DEFITEM_OFFSPELL ), entryMadeFrom( DEFITEM_ENTRYMADEFROM ), creator( DEFITEM_CREATOR ), gridLoc( DEFITEM_GRIDLOC ), weightMax( DEFITEM_WEIGHTMAX ), baseWeight( DEFITEM_BASEWEIGHT ), maxItems( DEFITEM_MAXITEMS ), maxRange( DEFITEM_MAXRANGE ), baseRange( DEFITEM_BASERANGE ), maxUses( DEFITEM_MAXUSES ), usesLeft( DEFITEM_USESLEFT ), regionNum( DEFITEM_REGIONNUM ), -tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE ) +tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE ), artifactRarity(DEFITEM_ARTIFACTRARITY) { spells[0] = spells[1] = spells[2] = 0; value[0] = value[1] = value[2] = 0; @@ -542,6 +543,23 @@ auto CItem::SetSpawnerList( bool newValue ) -> void UpdateRegion(); } +//o------------------------------------------------------------------------------------------------o +//| Function - CBaseObject::GetArtifactRarity() +//| CBaseObject::SetArtifactRarity() +//| Date - 9 May, 2024 +//o------------------------------------------------------------------------------------------------o +//| Purpose - Gets/Sets the Artifacts Rarity of the object +//o------------------------------------------------------------------------------------------------o +SI16 CItem::GetArtifactRarity( void ) const +{ + return artifactRarity; +} +void CItem::SetArtifactRarity( SI16 newValue ) +{ + artifactRarity = newValue; + UpdateRegion(); +} + //o------------------------------------------------------------------------------------------------o //| Function - CItem::GetName2() //| CItem::SetName2() @@ -1443,9 +1461,7 @@ auto CItem::LockDown( CMultiObj *multiObj ) -> void //o------------------------------------------------------------------------------------------------o auto CItem::IsShieldType() const -> bool { - return ( id >= 0x1B72 && id <= 0x1B7B ) || ( id >= 0x1BC3 && id <= 0x1BC7 ) || - ( id >= 0x4200 && id <= 0x420B ) || ( id >= 0x4228 && id <= 0x422C ) || - ( id == 0xA649 || id == 0xA64A ) || ( id == 0xA831 || id == 0xA832 ); + return type == IT_SHIELD; } //o------------------------------------------------------------------------------------------------o @@ -1638,6 +1654,7 @@ auto CItem::CopyData( CItem *target ) -> void target->SetRndValueRate( GetRndValueRate() ); target->SetSpawn( GetSpawn() ); target->SetSpeed( GetSpeed() ); + target->SetArtifactRarity( GetArtifactRarity() ); target->SetSpell( 0, GetSpell( 0 )); target->SetSpell( 1, GetSpell( 1 )); target->SetSpell( 2, GetSpell( 2 )); @@ -1737,6 +1754,7 @@ bool CItem::DumpBody( std::ostream &outStream ) const outStream << "MaxItems=" + std::to_string( GetMaxItems() ) + newLine; outStream << "MaxHP=" + std::to_string( GetMaxHP() ) + newLine; outStream << "Speed=" + std::to_string( GetSpeed() ) + newLine; + outStream << "ArtifactRarity=" + std::to_string( GetArtifactRarity() ) + newLine; outStream << "Movable=" + std::to_string( GetMovable() ) + newLine; outStream << "Priv=" + std::to_string( GetPriv() ) + newLine; outStream << "Value=" + std::to_string( GetBuyValue() ) + "," + std::to_string( GetSellValue() ) + "," + std::to_string( GetVendorPrice() ) + newLine; @@ -1773,7 +1791,12 @@ bool CItem::HandleLine( std::string &UTag, std::string &data ) switch(( UTag.data()[0] )) { case 'A': - if( UTag == "AMMO" ) + if( UTag == "ARTIFACTRARITY" ) + { + SetArtifactRarity( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 ))); + rValue = true; + } + else if( UTag == "AMMO" ) { if( csecs.size() == 2 ) { diff --git a/source/cItem.h b/source/cItem.h index 3a3b60e5d..4b220999e 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -48,6 +48,7 @@ class CItem : public CBaseObject UI16 entryMadeFrom; SERIAL creator; // Store the serial of the player made this item SI08 gridLoc; + SI16 artifactRarity; SI32 weightMax; // Maximum weight a container can hold SI32 baseWeight; // Base weight of item. Applied when item is created for the first time, based on weight. Primarily used to determine base weight of containers UI16 maxItems; // Maximum amount of items a container can hold @@ -110,6 +111,9 @@ class CItem : public CBaseObject auto GetGridLocation() const -> SI08; auto SetGridLocation( SI08 newLoc ) -> void; + virtual SI16 GetArtifactRarity(void) const; + virtual void SetArtifactRarity(SI16 newValue); + auto GetStealable() const -> UI08; auto SetStealable( UI08 newValue ) -> void; diff --git a/source/cPlayerAction.cpp b/source/cPlayerAction.cpp index d667a6598..5d58ccbd5 100644 --- a/source/cPlayerAction.cpp +++ b/source/cPlayerAction.cpp @@ -3392,6 +3392,7 @@ void InitTagToItemType( void ) tagToItemType["SEXTANT"] = IT_SEXTANT; tagToItemType["HAIRDYE"] = IT_HAIRDYE; tagToItemType["SPELLCHANNELING"] = IT_SPELLCHANNELING; + tagToItemType["SHIELD"] = IT_SHIELD; } ItemTypes FindItemTypeFromTag( const std::string &strToFind ) diff --git a/source/enums.h b/source/enums.h index 75e8786ae..1383bbd10 100644 --- a/source/enums.h +++ b/source/enums.h @@ -527,6 +527,7 @@ enum ItemTypes IT_UNMORPHOBJECT = 102, IT_DRINK = 105, IT_STANDINGHARP = 106, + IT_SHIELD = 107, IT_ZEROKILLSGATE = 111, IT_PLANK = 117, IT_FIREWORKSWAND = 118, diff --git a/source/items.cpp b/source/items.cpp index 1cd4a2aaf..a95e80f70 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -81,6 +81,7 @@ auto ApplyItemSection( CItem *applyTo, CScriptSection *toApply, std::string sect auto ssecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( cdata, "//" )), " " ); switch( tag ) { + case DFNTAG_ARTIFACTRARITY: applyTo->SetArtifactRarity( static_cast( ndata )); break; case DFNTAG_AMMO: applyTo->SetAmmoId( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 ))); if( ssecs.size() > 1 ) diff --git a/source/ssection.cpp b/source/ssection.cpp index c2a563b47..fae41e7a1 100644 --- a/source/ssection.cpp +++ b/source/ssection.cpp @@ -22,6 +22,7 @@ const UI08 dfnDataTypes[DFNTAG_COUNTOFTAGS] = DFN_UPPERSTRING, // DFNTAG_ADDMENUITEM, DFN_NUMERIC, // DFNTAG_ADVOBJ, DFN_DOUBLENUMERIC, // DFNTAG_ALCHEMY, + DFN_NUMERIC, // DFNTAG_ARTIFACTRARITY DFN_STRING, // DFNTAG_AMMO, DFN_STRING, // DFNTAG_AMMOFX, DFN_NUMERIC, // DFNTAG_AMOUNT, @@ -268,6 +269,7 @@ const std::map strToDFNTag {"ADDMENUITEM"s, DFNTAG_ADDMENUITEM}, {"ADVOBJ"s, DFNTAG_ADVOBJ}, {"ALCHEMY"s, DFNTAG_ALCHEMY}, + {"ARTIFACTRARITY"s, DFNTAG_ARTIFACTRARITY}, {"AMMO"s, DFNTAG_AMMO}, {"AMMOFX"s, DFNTAG_AMMOFX}, {"AMOUNT"s, DFNTAG_AMOUNT}, diff --git a/source/ssection.h b/source/ssection.h index a2a660aec..c652b9d3b 100644 --- a/source/ssection.h +++ b/source/ssection.h @@ -29,6 +29,7 @@ enum DFNTAGS DFNTAG_ADDMENUITEM, DFNTAG_ADVOBJ, DFNTAG_ALCHEMY, + DFNTAG_ARTIFACTRARITY, DFNTAG_AMMO, DFNTAG_AMMOFX, DFNTAG_AMOUNT,