From 6618390ddc7305a95e6002602003fda0ae396a3a Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Fri, 8 Mar 2024 21:54:52 -0600
Subject: [PATCH 01/34] Plant Growing
This is the OSI LBR Era Plant Growing System,
https://uo.stratics.com/content/basics/plantgrowing_archive.shtml
Close as i can get to the full system, still needs some work in the crossing and pollenating stages, the frame work for that is there but alot to go but wanted to get this up as a pr so if some one could help me with it.
---
data/dfndata/items/misc/plantgrowing.dfn | 336 ++++
data/js/item/plant_growing/plantbowl.js | 102 ++
data/js/item/plant_growing/plantsystem.js | 1743 +++++++++++++++++++++
data/js/item/plant_growing/seed.js | 341 ++++
data/js/jse_fileassociations.scp | 4 +
5 files changed, 2526 insertions(+)
create mode 100644 data/dfndata/items/misc/plantgrowing.dfn
create mode 100644 data/js/item/plant_growing/plantbowl.js
create mode 100644 data/js/item/plant_growing/plantsystem.js
create mode 100644 data/js/item/plant_growing/seed.js
diff --git a/data/dfndata/items/misc/plantgrowing.dfn b/data/dfndata/items/misc/plantgrowing.dfn
new file mode 100644
index 000000000..dea0e12b7
--- /dev/null
+++ b/data/dfndata/items/misc/plantgrowing.dfn
@@ -0,0 +1,336 @@
+//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
+script=19101
+}
+
+[plantbowlOfdirt]
+{
+get=base_item
+name=a bowl of dirt
+weight=10
+id=0x1602
+hp=100 100
+script=19100
+}
+
+[base_seed]
+{
+get=base_item
+id=0xDCF
+weight=10
+amount=1
+colourlist=30
+script=19102
+}
+
+[CampionFlowerSeed]
+{
+get=base_seed
+name=Campion Flower Seed
+custominttag=CampionFlowerSeed 1
+}
+
+[PoppiesSeed]
+{
+get=base_seed
+name=Poppie Seed
+colour=43
+custominttag=PoppieSeed 1
+}
+
+[SnowdropSeed]
+{
+get=base_seed
+name=Snowdrop Seed
+custominttag=SnowdropSeed 1
+}
+
+[BulrusheSeed]
+{
+get=base_seed
+name=Bulrushe Seed
+color=0x2B
+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
+color=0x42
+custominttag=SnakePlantSeed 1
+}
+
+[PricklyPearCactusSeed]
+{
+get=base_seed
+name=Prickly Pear Cactus Seed
+custominttag=PricklyPearCactusSeed 1
+}
+
+[BarrelCactusSeed]
+{
+get=base_seed
+name=Barrel Cactus Seed
+color=0x42
+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/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
new file mode 100644
index 000000000..e13f5f466
--- /dev/null
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -0,0 +1,102 @@
+// Valid map target IDs for dirt
+const validMapDirtIDs = [0x9 ,0x15 ,0x71 ,0x7C ,0x82 ,0xA7 ,0xDC ,0xE3 ,0xE8 ,0xEB ||
+ tileID == tileID == 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 bowlOwner = GetPackOwner(iBowl, 0);
+ if (bowlOwner == null || bowlOwner != pUser)
+ {
+ pUser.SysMessage("You must have the object in your backpack to use it."); //You must have the object in your backpack to use it.
+ }
+ else
+ {
+ pUser.socket.tempObj = iBowl;
+ pUser.CustomTarget(1, "Choose a patch of dirt to scoop up.");//Choose a patch of dirt to scoop up.
+ }
+ return false;
+}
+
+function onCallback1(socket, ourObj)
+{
+ 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(ourObj) && ourObj.isItem)
+ {
+ // Make sure targeted object is in same world & instance as player
+ if (ourObj.worldnumber != mChar.worldnumber || ourObj.instanceID != mChar.instanceID)
+ return;
+
+ tileID = ourObj.id;
+ if (ourObj.id == 0x0f81)// Fertile Dirt
+ {
+ if (ourObj.amount < 40) //amount needed
+ {
+ socket.SysMessage("You need more dirt to fill a plant bowl!")
+ }
+ else {
+ var bowlofdirt = CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
+ bowlofdirt.SetTag("FertialeDirt", 1);
+ socket.SysMessage("You fill the bowl with fresh dirt.")
+ iBowl.Delete();
+
+ if (ourObj.amount == 40)
+ ourObj.Delete();
+ else if (ourObj.amount > 40)
+ ourObj.amount -= 40;
+ }
+ }
+ else
+ socket.SysMessage("You'll want to gather fresh dirt in order to raise a healthy plant!"); // "You'll want to gather fresh dirt in order to raise a healthy plant!"
+ return;
+ }
+
+ var validTileIDFound = false;
+ if (tileID != 0)
+ {
+ if (staticTile == true || (ourObj && ourObj.isItem)) // tileID is from a dynamic or static item
+ {
+ validTileIDFound = true;
+ }
+ else if (staticTile == false) // tileID is from a map tile
+ {
+ if (validMapDirtIDs.indexOf(tileID) != -1 ) // Dirt
+ {
+ CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
+ socket.SysMessage("You fill the bowl with fresh dirt.")
+ validTileIDFound = true;
+ iBowl.Delete();
+ }
+ }
+ }
+
+ if (!validTileIDFound)
+ {
+ socket.SysMessage("You'll want to gather fresh dirt in order to raise a healthy plant!"); // "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..832fd80ce
--- /dev/null
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -0,0 +1,1743 @@
+const scriptID = 19100;// this is the script id
+const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
+
+function onUseChecked(pUser, iUsed)
+{
+ var gumpID = scriptID + 0xffff;
+ var socket = pUser.socket;
+ socket.tempObj = iUsed;
+ socket.CloseGump(gumpID, 0);
+
+ PlantBowlGump(pUser, iUsed);
+
+ iUsed.Refresh();
+}
+
+function PlantBowlGump(pUser, iUsed)
+{
+ var PlantGump = new Gump;
+ var socket = pUser.socket;
+ var greaterPoison = iUsed.GetTag("GreaterPoison");
+ var greaterCure = iUsed.GetTag("GreaterCure");
+ var greaterHeal = iUsed.GetTag("GreaterHeal");
+ var greaterStrength = iUsed.GetTag("GreaterStrength");
+
+ 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, iUsed);
+
+ PlantGump.AddButton(71, 115, 0xD4, 0xD4, 3, 3, 3); // fungus
+ PlantGump.AddPicture(58, 115, 0xD16);
+ AddPlus(PlantGump, iUsed);
+
+ PlantGump.AddButton(71, 139, 0xD4, 0xD4, 4, 4, 4); // poison
+ PlantGump.AddPicture(59, 143, 0x1AE4);
+ AddPlus(PlantGump, iUsed);
+
+ PlantGump.AddButton(71, 163, 0xD4, 0xD4, 5, 5, 5); // disease
+ PlantGump.AddPicture(55, 167, 0x1727);
+ AddPlus(PlantGump, iUsed);
+
+ PlantGump.AddButton(209, 67, 0xD4, 0xD4, 6, 6, 6); // water
+ PlantGump.AddPicture(193, 67, 0x1F9D);
+ AddWaterLevel(PlantGump, iUsed);
+
+ 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);
+ PlantGump.AddText(54, 47, 0x835, iUsed.GetTag("PlantStage").toString());
+
+ PlantGump.AddGump(232, 47, 0xD2);
+ if (iUsed.GetTag("PlantType"))
+ {
+ 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, iUsed)
+{
+ // Define positions and colors for each tag
+ var tagPositions = {
+ "infestation": { "position": 92, "color1": 0x35, "color2": 0x21 },
+ "fungus": { "position": 116, "color1": 0x35, "color2": 0x21 },
+ "poison": { "position": 140, "color1": 0x35, "color2": 0x21 },
+ "disease": { "position": 164, "color1": 0x35, "color2": 0x21 }
+ };
+
+ // Loop through each tag and add "+" accordingly
+ for (var tag in tagPositions)
+ {
+ var positionInfo = tagPositions[tag];
+ var tagValue = iUsed.GetTag(tag);
+ var color = tagValue == 1 ? positionInfo.color1 : (tagValue == 2 ? positionInfo.color2 : null);
+ if (color !== null) {
+ PlantGump.AddText(95, positionInfo.position, color, "+");
+ }
+ }
+}
+
+function AddWaterLevel( PlantGump, iUsed )
+{
+ var addPlusMinus = "";
+ var addHue = 0;
+ switch( iUsed.GetTag( "water" ))
+ {
+ 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( 196, 67, 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)
+{
+ if (iUsed.health <= 0)
+ {
+ Die(iUsed);
+ return;
+ }
+
+ var damage = 0;
+ var tags = ["infestation", "fungus", "poison", "disease"];
+ var tag;
+ for (var i = 0, len = tags.length; i < len; i++)
+ {
+ tag = tags[i];
+ if (iUsed.GetTag(tag) > 0)
+ {
+ damage += iUsed.GetTag(tag) * 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, myPlant )
+{
+ if (myPlant.GetTag("PlantStage") >= 1 && myPlant.GetTag("PlantStage") <= 9)
+ {
+ const gi = myPlant.GetTag("PlantHealth");
+
+ if (!inValidLocation(myPlant))
+ {
+ PlantGump.AddText(239, 47, 0x21, "!");
+ }
+ else if (gi >= 10 && gi <= 11)
+ {
+ PlantGump.AddText(239, 47, 0x21, "-"); //Not Healthy
+ }
+ //else if(growthdelay)
+ //PlantGump.AddText(239, 47, 0x35, "-");// delay
+ else if (myPlant.GetTag("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 (myPlant.GetTag("FertialeDirt"))
+ {
+ PlantGump.AddText(239, 47, 0x3F, "+"); // Double Grown
+ }
+ return;
+ }
+}
+
+function Die(myPlant)
+{
+ myPlant.KillTimers();
+
+ if (myPlant.GetTag( "PlantStage" ) >= 9 )
+ {
+ myPlant.SetTag("PlantStage", 20);//dead twigs
+ myPlant.id = 0x1B9D;
+ myPlant.colour = 0;
+ myPlant.name = "twigs";
+ myPlant.RemoveScriptTrigger(scriptID);
+ }
+ else
+ {
+ myPlant.SetTag("PlantStage", 14);//dirt
+ }
+
+ ResetPlant(myPlant);
+
+ return;
+}
+
+function inValidLocation(myPlant)
+{
+ if (myPlant.movable != 2 && myPlant.movable != 3)
+ {
+ return true; // Plant can be placed here
+ }
+ else
+ {
+ return false; // Plant cannot be placed here
+ }
+}
+
+function GrowthCheck( myPlant, pUser )
+{
+ var waterLevel = myPlant.GetTag("water");
+ var infestsationLevel = myPlant.GetTag("infestation");
+ var fungusLevel = myPlant.GetTag("fungus");
+ var poisonLevel = myPlant.GetTag("poison");
+ var diseaseLevel = myPlant.GetTag("disease");
+
+ var greaterPoison = myPlant.GetTag("GreaterPoison");
+ var greaterCure = myPlant.GetTag("GreaterCure");
+ var greaterStrength = myPlant.GetTag("GreaterStrength");
+
+ var chanceType = 0;
+ switch( myPlant.GetTag( "PlantType" ))
+ {
+ case 1:
+ chanceType = 1;
+ break;
+ case 27:
+ chanceType = 27;
+ break;
+ case 28:
+ chanceType = 28;
+ break;
+ case 30:
+ chanceType = 30;
+ break;
+ default:
+ chanceType = 0;
+ break;
+ }
+
+ var chanceColor = 0
+ switch( myPlant.GetTag( "PlantColor" ))
+ {
+ case 21:
+ chanceColor = 21; // Bright Red
+ break;
+ case 5:
+ chanceColor = 5; // Bright Blue
+ break;
+ case 38:
+ chanceColor = 38; // Bright Yellow
+ break;
+ case 10:
+ chanceColor = 10; // Bright Purple
+ break;
+ case 42:
+ chanceColor = 42; // Bright Green
+ break;
+ case 43:
+ chanceColor = 43; // Bright Orange
+ break;
+ default:
+ chanceColor = 0;
+ break;
+ }
+ var infestationChance = 0.30 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10;
+
+ // Flowers have a 10% higher chance to become infected
+ if (chanceType == 1 || chanceType == 27 || chanceType == 30)
+ {
+ infestationChance += 0.10;
+ }
+
+ // For plants with a bright color, the chance is another 10% higher
+ if (chanceColor == 21 || chanceColor == 5 || chanceColor == 38 || chanceColor == 10 || chanceColor == 42 || chanceColor == 43)
+ {
+ infestationChance += 0.10;
+ }
+
+ if( infestationChance >= Math.random())
+ {
+ myPlant.SetTag( "infestation", infestsationLevel + 1 );
+ }
+
+ // Check if the plant gets infected with fungus
+ var fungusChance = 0.15 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10
+
+ if (fungusChance >= Math.random())
+ {
+ myPlant.SetTag( "fungus", fungusLevel + 1 );
+ }
+
+ if (waterLevel >= 2 || 0.9 >= Math.random())
+ {
+ myPlant.SetTag("water", waterLevel - 1);
+ }
+
+ //Too many poison and cure potions will cause disease and poison
+ if (greaterPoison > 0)
+ {
+ myPlant.SetTag("GreaterPoison", greaterPoison - 1);
+ myPlant.SetTag("poison", poisonLevel + greaterPoison);
+ }
+
+ if (greaterCure > 0)
+ {
+ myPlant.SetTag("GreaterCure", greaterCure - 1);
+ myPlant.SetTag("disease", diseaseLevel + greaterCure);
+ }
+
+ if (greaterStrength > 0)
+ {
+ myPlant.SetTag("GreaterStrength", greaterStrength - 1);
+ }
+
+ return;
+}
+
+function ApplyPotions(myPlant)
+{
+ var waterLevel = myPlant.GetTag("water");
+ var infestsationLevel = myPlant.GetTag("infestation");
+ var fungusLevel = myPlant.GetTag("fungus");
+ var poisonLevel = myPlant.GetTag("poison");
+ var diseaseLevel = myPlant.GetTag("disease");
+
+ var greaterPoison = myPlant.GetTag("GreaterPoison");
+ var greaterCure = myPlant.GetTag("GreaterCure");
+ var greaterHeal = myPlant.GetTag("GreaterHeal");
+ var greaterStrength = myPlant.GetTag("GreaterStrength");
+
+ //Poison potions kill off infestations
+ if (greaterPoison >= infestsationLevel)
+ {
+ myPlant.SetTag("GreaterPoison", greaterPoison - infestsationLevel);
+ myPlant.SetTag("infestation", 0);
+ }
+ else
+ {
+ myPlant.SetTag("GreaterPoison", 0);
+ myPlant.SetTag("infestation", infestsationLevel - greaterPoison);
+ }
+
+ //cure potions kill off fungus
+ if (greaterCure >= fungusLevel)
+ {
+ myPlant.SetTag("GreaterCure", greaterCure - fungusLevel);
+ myPlant.SetTag("fungus", 0);
+ }
+ else
+ {
+ myPlant.SetTag("GreaterCure", 0);
+ myPlant.SetTag("fungus", fungusLevel - greaterCure);
+ }
+
+ //heal potions kill off poison
+ if (greaterHeal >= diseaseLevel)
+ {
+ myPlant.SetTag("GreaterHeal", greaterHeal - poisonLevel);
+ myPlant.SetTag("poison", 0);
+ }
+ else
+ {
+ myPlant.SetTag("GreaterHeal", 0);
+ myPlant.SetTag("poison", poisonLevel - greaterHeal);
+ }
+
+ //heal potions kill off disease
+ if (greaterHeal >= diseaseLevel)
+ {
+ myPlant.SetTag("GreaterHeal", greaterHeal - diseaseLevel);
+ myPlant.SetTag("disease", 0);
+ }
+ else
+ {
+ myPlant.SetTag("GreaterHeal", 0);
+ myPlant.SetTag("disease", diseaseLevel - greaterHeal);
+ }
+
+ if (infestsationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2)
+ {
+ if (greaterHeal > 0)
+ {
+ myPlant.health = myPlant.health + greaterHeal * 7;
+ }
+ else
+ myPlant.health = myPlant.health + 2;
+ }
+
+ if (greaterHeal > 0)
+ {
+ myPlant.SetTag("GreaterHeal", greaterHeal - 1);
+ }
+}
+
+function onTimer( myPlant, timerID )
+{
+ if ( !ValidateObject( myPlant ))
+ {
+ return;
+ }
+
+ var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
+ var availableSeeds = myPlant.GetTag("AvailableSeed");
+ var remainingSeeds = myPlant.GetTag("RemainingSeeds");
+
+ if (timerID == 1 )
+ {
+ if (!inValidLocation(myPlant)) // Checks make sure the plant is lockdown
+ {
+ return;
+ }
+ else
+ {
+ if (myPlant.GetTag("PlantHealth") != 10 && myPlant.GetTag("PlantHealth") != 11)//wilted or dying
+ {
+ if (myPlant.GetTag("FertialeDirt") && 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);
+ }
+
+ if (stage >= 2 && stage <= 3)
+ {
+ myPlant.id = 0x1600;
+ }
+ else if (stage == 9)
+ {
+ PlantBowl(myPlant);
+ }
+ }
+
+ //Produce Seeds
+ if (stage >= 9)
+ {
+ if (remainingSeeds > 0 )
+ {
+ myPlant.SetTag("RemainingSeeds", remainingSeeds - 1);
+ myPlant.SetTag("AvailableSeeds", availableSeeds + 1);
+ }
+ }
+
+ ApplyPotions(myPlant)
+ HealthStatus(myPlant);
+ PlantDamage(myPlant);
+ GrowthCheck(myPlant);
+ myPlant.Refresh();
+ }
+ }
+ myPlant.StartTimer(PlantDelayTimer, 1, scriptID);
+}
+
+function DrawPlant( PlantGump, iUsed )
+{
+ if( iUsed.GetTag( "PlantStage" ) >= 0 && iUsed.GetTag( "PlantStage") < 9 )
+ {
+ PlantGump.AddGump( 110, 85, 0x589 );
+
+ PlantGump.AddPicture( 122, 94, 0x914 );
+ PlantGump.AddPicture( 135, 94, 0x914 );
+ PlantGump.AddPicture( 120, 112, 0x914 );
+ PlantGump.AddPicture( 135, 112, 0x914 );
+
+ if( iUsed.GetTag( "PlantStage") >= 2 )
+ {
+ PlantGump.AddPicture( 127, 112, 0xC62 );
+ }
+ if( iUsed.GetTag( "PlantStage" ) == 3 || iUsed.GetTag( "PlantStage" ) == 4 )
+ {
+ PlantGump.AddPicture(129, 85, 0xC7E);
+ }
+ if( iUsed.GetTag( "PlantStage" ) >= 4 )
+ {
+ PlantGump.AddPicture( 121, 117, 0xC62 );
+ PlantGump.AddPicture( 133, 117, 0xC62 );
+ }
+ if( iUsed.GetTag("PlantStage") >= 5)
+ {
+ PlantGump.AddPicture( 110, 100, 0xC62 );
+ PlantGump.AddPicture( 140, 100, 0xC62 );
+ PlantGump.AddPicture( 110, 130, 0xC62 );
+ PlantGump.AddPicture( 140, 130, 0xC62 );
+ }
+ if( iUsed.GetTag( "PlantStage" ) > 6 )
+ {
+ PlantGump.AddPicture( 105, 115, 0xC62 );
+ PlantGump.AddPicture( 145, 115, 0xC62 );
+ PlantGump.AddPicture( 125, 90, 0xC62 );
+ PlantGump.AddPicture( 125, 135, 0xC62 );
+ }
+ }
+ else
+ {
+ PlantType( PlantGump, iUsed );
+ iUsed.Refresh();
+ }
+
+ if( iUsed.GetTag( "PlantStage" ) != 14 && iUsed.GetTag( "PlantType" )) //BowlOfDirt
+ {
+ switch( iUsed.GetTag( "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 PlantType( PlantGump, iUsed )
+{
+ 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 plantColor = iUsed.GetTag( "PlantColor" );
+ var plantID = 0;
+ var plantName = "";
+ switch(iUsed.GetTag( "PlantType" ))
+ {
+ case 1:
+ plantID = CampionFlowers;
+ plantName = "Campion Flowers";
+ break;
+ case 2:
+ plantID = Poppies;
+ plantName = "Poppies";
+ break;
+ case 3:
+ plantID = Snowdrops;
+ plantName = "Snowdrops";
+ break;
+ case 4:
+ plantID = Bulrushes;
+ plantName = "Bulrushes";
+ break;
+ case 5:
+ plantID = Lilies;
+ plantName = "Lilies";
+ break;
+ case 6:
+ plantID = PampasGrass;
+ plantName = "Pampas Grass";
+ break;
+ case 7:
+ plantID = Rushes;
+ plantName = "Rushes";
+ break;
+ case 8:
+ plantID = ElephantEarPlant;
+ plantName = "Elephant Ear Plant";
+ break;
+ case 9:
+ plantID = Fern;
+ plantName = "Fern";
+ break;
+ case 10:
+ plantID = PonytailPalm;
+ plantName = "Ponytail Palm";
+ break;
+ case 11:
+ plantID = SmallPalm;
+ plantName = "Small Palm";
+ break;
+ case 12:
+ plantID = CenturyPlant;
+ plantName = "Century Plant";
+ break;
+ case 13:
+ plantID = WaterPlant;
+ plantName = "Water Plant";
+ break;
+ case 14:
+ plantID = SnakePlant;
+ plantName = "Snake Plant";
+ break;
+ case 15:
+ plantID = PricklyPearCactus;
+ plantName = "Prickly Pear Cactus";
+ break;
+ case 16:
+ plantID = BarrelCactus;
+ plantName = "Barrel Cactus";
+ break;
+ case 17:
+ plantID = TribarrelCactus;
+ plantName = "Tribarrel Cactus";
+ break;
+ case 18:
+ plantID = CommonGreenBonsai;
+ plantName = "Common Green Bonsai";
+ break;
+ case 19:
+ plantID = CommonPinkBonsai;
+ plantName = "Common Pink Bonsai";
+ break;
+ case 20:
+ plantID = UncommonGreenBonsai;
+ plantName = "Uncommon Green Bonsai";
+ break;
+ case 21:
+ plantID = UncommonPinkBonsai;
+ plantName = "Uncommon Pink Bonsai";
+ break;
+ case 22:
+ plantID = RareGreenBonsai;
+ plantName = "Rare Green Bonsai";
+ break;
+ case 23:
+ plantID = RarePinkBonsai;
+ plantName = "Rare Pink Bonsai";
+ break;
+ case 24:
+ plantID = ExceptionalBonsai;
+ plantName = "Exceptional Bonsai";
+ break;
+ case 25:
+ plantID = ExoticBonsai;
+ plantName = "Exotic Bonsai";
+ break;
+ case 26:
+ plantID = Cactus;
+ plantName = "Cactus";
+ break;
+ case 27:
+ plantID = FlaxFlowers;
+ plantName = "Flax Flowers";
+ break;
+ case 28:
+ plantID = FoxgloveFlowers;
+ plantName = "Foxglove Flowers";
+ break;
+ case 29:
+ plantID = HopsEast;
+ plantName = "Hops East";
+ break;
+ case 30:
+ plantID = OrfluerFlowers;
+ plantName = "Orfluer Flowers";
+ break;
+ case 31:
+ plantID = CypressTwisted;
+ plantName = "Cypress Twisted";
+ break;
+ case 32:
+ plantID = HedgeShort;
+ plantName = "Hedge Short";
+ break;
+ case 33:
+ plantID = JuniperBush;
+ plantName = "Juniper Bush";
+ break;
+ case 34:
+ plantID = SnowdropPatch;
+ plantName = "Snowdrop Patch";
+ break;
+ case 35:
+ plantID = Cattails;
+ plantName = "Cattails";
+ break;
+ case 36:
+ plantID = PoppyPatch;
+ plantName = "Poppy Patch";
+ break;
+ case 37:
+ plantID = SpiderTree;
+ plantName = "Spider Tree";
+ break;
+ case 38:
+ plantID = WaterLily;
+ plantName = "Water Lily";
+ break;
+ case 39:
+ plantID = CypressStraight;
+ plantName = "Cypress Straight";
+ break;
+ case 40:
+ plantID = HedgeTall;
+ plantName = "Hedge Tall";
+ break;
+ case 41:
+ plantID = HopsSouth;
+ plantName = "Hops South";
+ break;
+ case 42:
+ plantID = SugarCanes;
+ plantName = "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.Refresh();
+ return;
+}
+
+function PlantBowl( iUsed )
+{
+ 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 plantColor = iUsed.GetTag( "PlantColor" );
+ var plantID = 0;
+ var plantName = "";
+ switch( iUsed.GetTag( "PlantType" ))
+ {
+ case 1:
+ plantID = CampionFlowers;
+ plantName = "Campion Flowers";
+ break;
+ case 2:
+ plantID = Poppies;
+ plantName = "Poppies";
+ break;
+ case 3:
+ plantID = Snowdrops;
+ plantName = "Snowdrops";
+ break;
+ case 4:
+ plantID = Bulrushes;
+ plantName = "Bulrushes";
+ break;
+ case 5:
+ plantID = Lilies;
+ plantName = "Lilies";
+ break;
+ case 6:
+ plantID = PampasGrass;
+ plantName = "Pampas Grass";
+ break;
+ case 7:
+ plantID = Rushes;
+ plantName = "Rushes";
+ break;
+ case 8:
+ plantID = ElephantEarPlant;
+ plantName = "Elephant Ear Plant";
+ break;
+ case 9:
+ plantID = Fern;
+ plantName = "Fern";
+ break;
+ case 10:
+ plantID = PonytailPalm;
+ plantName = "Ponytail Palm";
+ break;
+ case 11:
+ plantID = SmallPalm;
+ plantName = "Small Palm";
+ break;
+ case 12:
+ plantID = CenturyPlant;
+ plantName = "Century Plant";
+ break;
+ case 13:
+ plantID = WaterPlant;
+ plantName = "Water Plant";
+ break;
+ case 14:
+ plantID = SnakePlant;
+ plantName = "Snake Plant";
+ break;
+ case 15:
+ plantID = PricklyPearCactus;
+ plantName = "Prickly Pear Cactus";
+ break;
+ case 16:
+ plantID = BarrelCactus;
+ plantName = "Barrel Cactus";
+ break;
+ case 17:
+ plantID = TribarrelCactus;
+ plantName = "Tribarrel Cactus";
+ break;
+ case 18:
+ plantID = CommonGreenBonsai;
+ plantName = "Common Green Bonsai";
+ break;
+ case 19:
+ plantID = CommonPinkBonsai;
+ plantName = "Common Pink Bonsai";
+ break;
+ case 20:
+ plantID = UncommonGreenBonsai;
+ plantName = "Uncommon Green Bonsai";
+ break;
+ case 21:
+ plantID = UncommonPinkBonsai;
+ plantName = "Uncommon Pink Bonsai";
+ break;
+ case 22:
+ plantID = RareGreenBonsai;
+ plantName = "Rare Green Bonsai";
+ break;
+ case 23:
+ plantID = RarePinkBonsai;
+ plantName = "Rare Pink Bonsai";
+ break;
+ case 24:
+ plantID = ExceptionalBonsai;
+ plantName = "Exceptional Bonsai";
+ break;
+ case 25:
+ plantID = ExoticBonsai;
+ plantName = "Exotic Bonsai";
+ break;
+ case 26:
+ plantID = Cactus;
+ plantName = "Cactus";
+ break;
+ case 27:
+ plantID = FlaxFlowers;
+ plantName = "Flax Flowers";
+ break;
+ case 28:
+ plantID = FoxgloveFlowers;
+ plantName = "Foxglove Flowers";
+ break;
+ case 29:
+ plantID = HopsEast;
+ plantName = "Hops East";
+ break;
+ case 30:
+ plantID = OrfluerFlowers;
+ plantName = "Orfluer Flowers";
+ break;
+ case 31:
+ plantID = CypressTwisted;
+ plantName = "Cypress Twisted";
+ break;
+ case 32:
+ plantID = HedgeShort;
+ plantName = "Hedge Short";
+ break;
+ case 33:
+ plantID = JuniperBush;
+ plantName = "Juniper Bush";
+ break;
+ case 34:
+ plantID = SnowdropPatch;
+ plantName = "Snowdrop Patch";
+ break;
+ case 35:
+ plantID = Cattails;
+ plantName = "Cattails";
+ break;
+ case 36:
+ plantID = PoppyPatch;
+ plantName = "Poppy Patch";
+ break;
+ case 37:
+ plantID = SpiderTree;
+ plantName = "Spider Tree";
+ break;
+ case 38:
+ plantID = WaterLily;
+ plantName = "Water Lily";
+ break;
+ case 39:
+ plantID = CypressStraight;
+ plantName = "Cypress Straight";
+ break;
+ case 40:
+ plantID = HedgeTall;
+ plantName = "Hedge Tall";
+ break;
+ case 41:
+ plantID = HopsSouth;
+ plantName = "Hops South";
+ break;
+ case 42:
+ plantID = SugarCanes;
+ plantName = "Sugar Canes";
+ break;
+ }
+
+ iUsed.id = plantID;
+ iUsed.name = plantName;
+ iUsed.movable = 1;
+ iUsed.colour = plantColor;
+ 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
+ {
+ pUser.SysMessage("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
+ 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);
+ //TriggerEvent( 5040, "EmptyBowl", 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
+ iUsed.KillTimers();
+ ResetPlant(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.KillTimers();
+ ResetPlant(iUsed);
+ iUsed.RemoveScriptTrigger(scriptID);
+ socket.CloseGump(gumpID, 0);
+ socket.SysMessage("You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.");
+ iUsed.Refresh();
+ break;
+ default: break;
+ }
+}
+
+function ResetPlant(iUsed)
+{
+ iUsed.SetTag("infestation", null);
+ iUsed.SetTag("fungus", null);
+ iUsed.SetTag("poison", null);
+ iUsed.SetTag("disease", null);
+ iUsed.SetTag("water", null);
+ iUsed.SetTag("PlantType", null);
+ iUsed.SetTag("PlantStage", null);
+ iUsed.SetTag("PlantColor", null);
+ iUsed.SetTag("PlantHealth", null);
+ iUsed.SetTag("AvailableSeeds", null);
+ iUsed.SetTag("RemainingSeeds", null);
+ iUsed.SetTag("GreaterPoison", null);
+ iUsed.SetTag("GreaterCure", null);
+ iUsed.SetTag("GreaterHeal", null);
+ iUsed.SetTag("GreaterStrength", null);
+}
+
+function PollinatePlant(pUser, iUsed)
+{
+ pUser.socket.tempObj = iUsed;
+ var status = iUsed.GetTag("PlantStage");
+ //Not crossable -> no pollen
+ //You cannot gather pollen from a mutated plant! msg
+ if (status < 9)
+ {
+ socket.SysMessage("Too early to gather pollen");
+ }
+ else if (iUsed.GetTag("PlantHealth") != 10 && iUsed.GetTag("PlantHealth") != 11)//wilted or dying
+ {
+ socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ }
+ else
+ pUser.CustomTarget(1, "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");
+ //Not crossable -> no pollen
+ //You cannot gather pollen from a mutated plant! msg
+ if (status < 9)
+ {
+ socket.SysMessage("Too early to gather pollen");
+ }
+ else if (iUsed.GetTag("PlantHealth") != 10 && iUsed.GetTag("PlantHealth") != 11)//wilted or dying
+ {
+ socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ }
+ else if (!myTarget.GetTag("PlantType"))
+ {
+ socket.SysMessage("You can only pollinate other specially grown plants!");
+ }
+ else
+ {
+ var tstatus = myTarget.GetTag("PlantStage");
+ var type = iUsed.GetTag("PlantType");
+ var color = iUsed.GetTag("PlantColor");
+
+ //Not crossable -> no pollen
+ //You cannot gather pollen from a mutated plant! msg
+ if (tstatus < 9) {
+ socket.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
+ }
+ else if (myTarget.GetTag("PlantHealth") != 10 && myTarget.GetTag("PlantHealth") != 11)//wilted or dying
+ {
+ socket.SysMessage("You cannot pollinate an unhealthy plant!");
+ }
+ else if (!myTarget.GetTag("PlantType"))
+ {
+ socket.SysMessage("You can only pollinate other specially grown plants!");
+ }
+ //check if is both plants can be crossesed.
+ //You cannot cross-pollinate with a mutated plant!
+ else if (myTarget.GetTag("Pollinated") == 1)
+ {
+ socket.SysMessage("This plant has already been pollinated!");
+ }
+ else if (myTarget == iUsed)
+ {
+ myTarget.SetTag("Pollinated", 1);
+ socket.SysMessage("You pollinate the plant with its own pollen.");
+ }
+ }
+}
+
+function GatherSeeds(pUser, iUsed)
+{
+ var availableSeeds = iUsed.GetTag("AvailableSeeds");
+ if (availableSeeds == 0)
+ {
+ socket.SysMessage("This plant has no seeds to gather!");
+ }
+ else
+ {
+ var plantColor = iUsed.GetTag("PlantColor");
+ var seedType = "";
+ switch (iUsed.GetTag("PlantType"))
+ {
+ 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, plantColor);
+
+ socket.SysMessage("You gather seeds from the plant.")
+
+ if (availableSeeds > 0)
+ {
+ iUsed.SetTag("AvailableSeeds", availableSeeds - 1);
+ }
+ }
+ }
+ onUseChecked(pUser, iUsed);
+}
+
+function EmptyBowlGump(pUser, iUsed)
+{
+ var socket = pUser.socket;
+ var gumpID = scriptID + 0xffff;
+ var EmptyBowlGump = new Gump;
+ socket.tempObj = iUsed;
+
+ 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 (iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantType")) //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 addPotion(pUser, iUsed, button)
+{
+ var itemOwner = GetPackOwner(iUsed, 0);
+ if (itemOwner == null || itemOwner != pUser)
+ {
+ pUser.SysMessage(GetDictionaryEntry(1763, pUser.socket.language)); //That item must be in your backpack before it can be used.
+ }
+ else
+ {
+ 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)
+ {
+ // Check if the item is in the user's backpack
+ var itemOwner = GetPackOwner(myTarget, 0);
+ if (itemOwner !== pUser)
+ {
+ pUser.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
+ return false;
+ }
+
+ // Define potion types
+ var potionTypes = {
+ "greaterstrengthpotion": { "type": "GreaterStrength", "button": 10 },
+ "0x0F09-b": { "type": "GreaterStrength", "button": 10 },
+ "greaterpoisonpotion": { "type": "GreaterPoison", "button": 7 },
+ "0x0F0A-c": { "type": "GreaterPoison", "button": 7 },
+ "greatercurepotion": { "type": "GreaterCure", "button": 8 },
+ "0x0F07-c": { "type": "GreaterCure", "button": 8 },
+ "greaterhealpotion": { "type": "GreaterHeal", "button": 9 },
+ "0x0F0C-c": { "type": "GreaterHeal", "button": 9 }
+ };
+
+ // Check if the sectionID is a valid potion type
+ var potionInfo = potionTypes[myTarget.sectionID];
+ if (potionInfo)
+ {
+ // Check if the button pushed matches the potion type
+ if (buttonPushed === potionInfo.button)
+ {
+ // Increase potion count if within maximum limit
+ var potionCount = iUsed.GetTag(potionInfo.type);
+ if (potionCount < maxPotionCount)
+ {
+ iUsed.SetTag(potionInfo.type, potionCount >= 0 ? potionCount + 1 : 1);
+ }
+ else
+ {
+ pUser.SysMessage("The plant is already soaked with this type of potion!");
+ return false;
+ }
+
+ // Call onUseChecked
+ onUseChecked(pUser, iUsed);
+
+ // Decrease target amount or delete if amount is 1
+ if (myTarget.amount > 1)
+ myTarget.amount--;
+ else
+ myTarget.Delete();
+ }
+ else
+ {
+ pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ }
+ }
+ else
+ {
+ pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ }
+ }
+ return false;
+}
+
+function ReproductionGump(pUser, iUsed)
+{
+ var socket = pUser.socket;
+ var ReproductionGump = new Gump;
+ socket.tempObj = iUsed;
+
+ 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 (iUsed.GetTag("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 availableSeeds = iUsed.GetTag("AvailableSeeds");
+ var remainingSeeds = iUsed.GetTag("RemainingSeeds");
+
+ if (availableSeeds == 0 && remainingSeeds == 0)
+ {
+ ReproductionGump.AddText(x + 5, y, 0x21, "X");
+ }
+ else
+ {
+ ReproductionGump.AddText(x, y, plantColor, availableSeeds + "/" + remainingSeeds);
+ }
+ return;
+}
+
+function AddSeedsState(ReproductionGump, iUsed, x, y)
+{
+ var availableSeeds = iUsed.GetTag("AvailableSeeds");
+ var remainingSeeds = iUsed.GetTag("RemainingSeeds");
+ var plantColor = iUsed.GetTag("PlantColor");
+
+ if (availableSeeds == 0 && remainingSeeds == 0)
+ {
+ ReproductionGump.AddText(x + 5, y, 0x21, "X");
+ }
+ else
+ {
+ ReproductionGump.AddText(x, y, plantColor, availableSeeds + "/" + remainingSeeds);
+ }
+}
+
+function AddPollinationState(ReproductionGump, iUsed, x, y)
+{
+ //if not producing pollen
+ //ReproductionGump.AddText(x, y, 0x35, "-");
+ //if not pollenated
+ //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 waterLevel = myPlant.GetTag("water");
+
+ var waterStatus = {
+ 1: "Hard",
+ 2: "Soft",
+ 3: "Squishy",
+ 4: "Sopping wet"
+ };
+
+ var water = waterStatus[waterLevel] || "Hard";
+
+ if (status === 0)
+ {
+ tooltipText = "A bowl of " + water + " dirt";
+ } else
+ {
+ tooltipText = "Plant Stage: " + status + " : " + myPlant.health;
+ }
+
+ return tooltipText;
+}
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
new file mode 100644
index 000000000..733a655b1
--- /dev/null
+++ b/data/js/item/plant_growing/seed.js
@@ -0,0 +1,341 @@
+function onUseChecked( pUser, iUsed )
+{
+ var itemOwner = GetPackOwner( iUsed, 0 );
+ if( itemOwner == null || itemOwner != pUser )
+ {
+ pUser.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, "Choose a bowl of dirt to plant this seed in." );
+ }
+ return false;
+}
+
+function onCallback0(pSock, myTarget)
+{
+ 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 itemOwner = GetPackOwner(myTarget, 0);
+ if (itemOwner == null || itemOwner != pUser)
+ {
+ pUser.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
+ }
+ else
+ {
+ if (ValidateObject(myTarget) && myTarget.id == 0x1602) //checking to make sure its a full bowl of dirt
+ {
+ if (myTarget.GetTag("PlantStage") >= 18) // FullGrownPlant
+ {
+ // You must use a seed on some prepared soil!
+ pSock.SysMessage("You must use a seed on some prepared soil!");
+ }
+ else if (myTarget.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantName")) // BowlOfDirt or PlantName
+ {
+ pUser.SysMessage("This bowl of dirt already has a seed " + myTarget.GetTag("PlantName") + " in it!");
+ // This bowl of dirt already has a seed of %s in it!
+ }
+ else if (myTarget.GetTag("water") < 2) // not enough water
+ {
+ pSock.SysMessage("The dirt needs to be softened first.");
+ }
+ else
+ {
+ // You plant the seed in the bowl of dirt.
+ /*pUser.SysMessage("You plant the seed in the bowl of dirt.");
+ if (parseInt(iUsed.GetTag("CampionFlowerSeed")) == 1) {
+ myTarget.SetTag("planttype", 1);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("PoppieSeed")) == 1) {
+ myTarget.SetTag("planttype", 2);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SnowdropSeed")) == 1) {
+ myTarget.SetTag("planttype", 3);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("BulrusheSeed")) == 1) {
+ myTarget.SetTag("planttype", 4);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("LilieSeed")) == 1) {
+ myTarget.SetTag("planttype", 5);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("PampasGrassSeed")) == 1) {
+ myTarget.SetTag("planttype", 6);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("RusheSeed")) == 1) {
+ myTarget.SetTag("planttype", 7);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("ElephantEarPlantrSeed")) == 1) {
+ myTarget.SetTag("planttype", 8);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("FernSeed")) == 1) {
+ myTarget.SetTag("planttype", 9);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("PonytailPalmSeed")) == 1) {
+ myTarget.SetTag("planttype", 10);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SmallPalmSeed")) == 1) {
+ myTarget.SetTag("planttype", 11);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("CenturyPlantSeed")) == 1) {
+ myTarget.SetTag("planttype", 12);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("WaterPlantSeed")) == 1) {
+ myTarget.SetTag("planttype", 13);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SnakePlantSeed")) == 1) {
+ myTarget.SetTag("planttype", 14);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("PricklyPearCactusSeed")) == 1) {
+ myTarget.SetTag("planttype", 15);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("BarrelCactusSeed")) == 1) {
+ myTarget.SetTag("planttype", 16);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("TribarrelCactusSeed")) == 1) {
+ myTarget.SetTag("planttype", 17);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("CommonGreenBonsaiSeed")) == 1) {
+ myTarget.SetTag("planttype", 18);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("CommonPinkBonsaiSeed")) == 1) {
+ myTarget.SetTag("planttype", 19);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("UncommonGreenBonsai")) == 1) {
+ myTarget.SetTag("planttype", 20);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("UncommonPinkBonsai")) == 1) {
+ myTarget.SetTag("planttype", 21);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("RareGreenBonsai")) == 1) {
+ myTarget.SetTag("planttype", 22);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("RarePinkBonsai")) == 1) {
+ myTarget.SetTag("planttype", 23);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("ExceptionalBonsai")) == 1) {
+ myTarget.SetTag("planttype", 24);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("ExoticBonsai")) == 1) {
+ myTarget.SetTag("planttype", 25);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("Cactus")) == 1) {
+ myTarget.SetTag("planttype", 26);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("FlaxFlowers")) == 1) {
+ myTarget.SetTag("planttype", 27);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("FoxgloveFlowers")) == 1) {
+ myTarget.SetTag("planttype", 28);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("HopsEast")) == 1) {
+ myTarget.SetTag("planttype", 29);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("OrfluerFlowers")) == 1) {
+ myTarget.SetTag("planttype", 30);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("CypressTwisted")) == 1) {
+ myTarget.SetTag("planttype", 31);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("HedgeShort")) == 1) {
+ myTarget.SetTag("planttype", 32);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("JuniperBush")) == 1) {
+ myTarget.SetTag("planttype", 33);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SnowdropPatch")) == 1) {
+ myTarget.SetTag("planttype", 34);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("Cattails")) == 1) {
+ myTarget.SetTag("planttype", 35);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("PoppyPatch")) == 1) {
+ myTarget.SetTag("planttype", 36);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SpiderTree")) == 1) {
+ myTarget.SetTag("planttype", 37);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("WaterLily")) == 1) {
+ myTarget.SetTag("planttype", 38);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("CypressStraight")) == 1) {
+ myTarget.SetTag("planttype", 39);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("HedgeTall")) == 1) {
+ myTarget.SetTag("planttype", 40);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("HopsSouth")) == 1) {
+ myTarget.SetTag("planttype", 41);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }
+ else if (parseInt(iUsed.GetTag("SugarCanes")) == 1) {
+ myTarget.SetTag("planttype", 42);
+ myTarget.SetTag("plantname", iUsed.name);
+ myTarget.SetTag("plantcolor", iUsed.colour);
+ }*/
+
+ // Define a mapping between seed names and plant types
+ const seedToPlantType = {
+ "CampionFlowerSeed": 1,
+ "PoppieSeed": 2,
+ "SnowdropSeed": 3,
+ "BulrusheSeed": 4,
+ "LilieSeed": 5,
+ "PampasGrassSeed": 6,
+ "RusheSeed": 7,
+ "ElephantEarPlantrSeed": 8,
+ "FernSeed": 9,
+ "PonytailPalmSeed": 10,
+ "SmallPalmSeed": 11,
+ "CenturyPlantSeed": 12,
+ "WaterPlantSeed": 13,
+ "SnakePlantSeed": 14,
+ "PricklyPearCactusSeed": 15,
+ "BarrelCactusSeed": 16,
+ "TribarrelCactusSeed": 17,
+ "CommonGreenBonsaiSeed": 18,
+ "CommonPinkBonsaiSeed": 19,
+ "UncommonGreenBonsai": 20,
+ "UncommonPinkBonsai": 21,
+ "RareGreenBonsai": 22,
+ "RarePinkBonsai": 23,
+ "ExceptionalBonsai": 24,
+ "ExoticBonsai": 25,
+ "Cactus": 26,
+ "FlaxFlowers": 27,
+ "FoxgloveFlowers": 28,
+ "HopsEast": 29,
+ "OrfluerFlowers": 30,
+ "CypressTwisted": 31,
+ "HedgeShort": 32,
+ "JuniperBush": 33,
+ "SnowdropPatch": 34,
+ "Cattails": 35,
+ "PoppyPatch": 36,
+ "SpiderTree": 37,
+ "WaterLily": 38,
+ "CypressStraight": 39,
+ "HedgeTall": 40,
+ "HopsSouth": 41,
+ "SugarCanes": 42
+ };
+
+ // You plant the seed in the bowl of dirt.
+ pUser.SysMessage("You plant the seed in the bowl of dirt.");
+
+ // Loop through the keys of seedToPlantType to find the matching tag
+ for (var tagName in seedToPlantType) {
+ if (seedToPlantType.hasOwnProperty(tagName)) {
+ if (parseInt(iUsed.GetTag(tagName)) === 1) {
+ var plantType = seedToPlantType[tagName];
+ myTarget.SetTag("PlantType", plantType); // Type of plant it is from dfn files
+ myTarget.SetTag("PlantName", iUsed.name); // Name of plant it is from dfn files
+ myTarget.SetTag("PlantColor", iUsed.colour); // Colour of plant it is from dfn files
+ break; // Exit the loop once a match is found
+ }
+ }
+ }
+ const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
+
+ myTarget.StartTimer(PlantDelayTimer, 1, 19100);
+ myTarget.SetTag("PlantStage", 1);
+ myTarget.SetTag("RemainingSeeds", 8);
+
+ if (iUsed.amount > 1)
+ iUsed.amount--;
+ else
+ iUsed.Delete();
+ }
+ }
+ else
+ pUser.SysMessage("You must use a seed on a bowl of dirt!");//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 7b408e980..4e2d3b529 100644
--- a/data/js/jse_fileassociations.scp
+++ b/data/js/jse_fileassociations.scp
@@ -282,6 +282,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]
//-------------------------------------------
From ccd0d6b6ee08bda0e7606d39bb649d934cc9c15c Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 10 Mar 2024 00:01:04 -0600
Subject: [PATCH 02/34] Lots of Changes
Added Cross Pollinating plants.
Fixed Timers
Combined couple tags to make more sense
cleaned up some if and else statments
Put check in so water it can not drain water past 0.
commented out damage why its in testing phase.
Added New Tag PlantCross and redid the seed js some.
---
data/dfndata/colors/colors.dfn | 9 +
data/dfndata/items/misc/plantgrowing.dfn | 2 +-
data/js/item/plant_growing/plantsystem.js | 606 ++++++++++++++++++++--
data/js/item/plant_growing/seed.js | 18 +-
4 files changed, 575 insertions(+), 60 deletions(-)
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/misc/plantgrowing.dfn b/data/dfndata/items/misc/plantgrowing.dfn
index dea0e12b7..c66994ecf 100644
--- a/data/dfndata/items/misc/plantgrowing.dfn
+++ b/data/dfndata/items/misc/plantgrowing.dfn
@@ -29,7 +29,7 @@ get=base_item
id=0xDCF
weight=10
amount=1
-colourlist=30
+colourlist=10003
script=19102
}
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 832fd80ce..3d3e214e6 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -66,7 +66,10 @@ function PlantBowlGump(pUser, iUsed)
PlantGump.AddText(196, 163, 0x835, greaterStrength);
PlantGump.AddGump(48, 47, 0xD2);
- PlantGump.AddText(54, 47, 0x835, iUsed.GetTag("PlantStage").toString());
+ if (iUsed.GetTag("PlantStage") >= 1)
+ {
+ PlantGump.AddText(54, 47, 0x835, iUsed.GetTag("PlantStage").toString());
+ }
PlantGump.AddGump(232, 47, 0xD2);
if (iUsed.GetTag("PlantType"))
@@ -348,7 +351,7 @@ function GrowthCheck( myPlant, pUser )
myPlant.SetTag( "fungus", fungusLevel + 1 );
}
- if (waterLevel >= 2 || 0.9 >= Math.random())
+ if ( waterLevel > 0 && waterLevel >= 2 || 0.9 >= Math.random())
{
myPlant.SetTag("water", waterLevel - 1);
}
@@ -459,8 +462,33 @@ function onTimer( myPlant, timerID )
}
var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
- var availableSeeds = myPlant.GetTag("AvailableSeed");
- var remainingSeeds = myPlant.GetTag("RemainingSeeds");
+ var Seeds = myPlant.GetTag("Seeds")
+ var CrossedPlants = myPlant.GetTag("PlantCross")
+
+ if (!CrossedPlants)
+ {
+ return false;
+ }
+
+ var Crossed = CrossedPlants.split(",");
+ if (Crossed.length != 2)
+ return false;
+
+ var Pollinated = parseInt(Crossed[0]);
+ var SeedBreed = parseInt(Crossed[1]);
+
+ 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 (timerID == 1 )
{
@@ -472,16 +500,26 @@ function onTimer( myPlant, timerID )
{
if (myPlant.GetTag("PlantHealth") != 10 && myPlant.GetTag("PlantHealth") != 11)//wilted or dying
{
- if (myPlant.GetTag("FertialeDirt") && stage <= 5)
+ if (myPlant.GetTag("FertialeDirt") && stage <= 5)
{
//double growth to stage 5
myPlant.SetTag("PlantStage", stage + 2);
}
- else if (stage < 9)
+ 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("Seeds", aseeds + "," + rseeds + "," + hueSeeds);
+ }
+ }
if (stage >= 2 && stage <= 3)
{
@@ -493,19 +531,18 @@ function onTimer( myPlant, timerID )
}
}
- //Produce Seeds
- if (stage >= 9)
+ if (stage >= 9)
{
- if (remainingSeeds > 0 )
+ if (Pollinated == 0)
{
- myPlant.SetTag("RemainingSeeds", remainingSeeds - 1);
- myPlant.SetTag("AvailableSeeds", availableSeeds + 1);
+ myPlant.SetTag("PlantCross", 1 + "," + SeedBreed);
}
+
}
ApplyPotions(myPlant)
HealthStatus(myPlant);
- PlantDamage(myPlant);
+ //PlantDamage(myPlant);
GrowthCheck(myPlant);
myPlant.Refresh();
}
@@ -555,7 +592,6 @@ function DrawPlant( PlantGump, iUsed )
else
{
PlantType( PlantGump, iUsed );
- iUsed.Refresh();
}
if( iUsed.GetTag( "PlantStage" ) != 14 && iUsed.GetTag( "PlantType" )) //BowlOfDirt
@@ -1236,8 +1272,8 @@ function ResetPlant(iUsed)
iUsed.SetTag("PlantStage", null);
iUsed.SetTag("PlantColor", null);
iUsed.SetTag("PlantHealth", null);
- iUsed.SetTag("AvailableSeeds", null);
- iUsed.SetTag("RemainingSeeds", null);
+ iUsed.SetTag("Seeds", null);
+ iUsed.SetTag("PlantCross", null);
iUsed.SetTag("GreaterPoison", null);
iUsed.SetTag("GreaterCure", null);
iUsed.SetTag("GreaterHeal", null);
@@ -1247,16 +1283,24 @@ function ResetPlant(iUsed)
function PollinatePlant(pUser, iUsed)
{
pUser.socket.tempObj = iUsed;
+ var socket = pUser.socket;
var status = iUsed.GetTag("PlantStage");
- //Not crossable -> no pollen
- //You cannot gather pollen from a mutated plant! msg
- if (status < 9)
+ var CrossedPlants = iUsed.GetTag("PlantCross")
+
+ if (!CrossedPlants)
+ {
+ pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ return false;
+ }
+ else if (status < 9)
{
socket.SysMessage("Too early to gather pollen");
+ return false;
}
- else if (iUsed.GetTag("PlantHealth") != 10 && iUsed.GetTag("PlantHealth") != 11)//wilted or dying
+ else if (iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
{
socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ return false;
}
else
pUser.CustomTarget(1, "Target the plant you wish to cross-pollinate to.");
@@ -1267,56 +1311,462 @@ function onCallback1(pSock, myTarget)
var iUsed = pSock.tempObj;
var pUser = pSock.currentChar;
var status = iUsed.GetTag("PlantStage");
- //Not crossable -> no pollen
- //You cannot gather pollen from a mutated plant! msg
+ var iCrossedPlants = iUsed.GetTag("PlantCross")
+
+ if (!iCrossedPlants)
+ {
+ pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ return false;
+ }
if (status < 9)
{
- socket.SysMessage("Too early to gather pollen");
+ pSock.SysMessage("Too early to gather pollen");
+ return false;
}
- else if (iUsed.GetTag("PlantHealth") != 10 && iUsed.GetTag("PlantHealth") != 11)//wilted or dying
+ else if (iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
{
- socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ pSock.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ return false;
}
else if (!myTarget.GetTag("PlantType"))
{
- socket.SysMessage("You can only pollinate other specially grown plants!");
+ pSock.SysMessage("You can only pollinate other specially grown plants!");
+ return false;
}
else
{
var tstatus = myTarget.GetTag("PlantStage");
var type = iUsed.GetTag("PlantType");
var color = iUsed.GetTag("PlantColor");
+ var tCrossedPlants = myTarget.GetTag("PlantCross")
- //Not crossable -> no pollen
- //You cannot gather pollen from a mutated plant! msg
- if (tstatus < 9) {
- socket.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
+ if (!tCrossedPlants)
+ {
+ pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ return false;
}
- else if (myTarget.GetTag("PlantHealth") != 10 && myTarget.GetTag("PlantHealth") != 11)//wilted or dying
+
+ var Crossed = tCrossedPlants.split(",");
+ if (Crossed.length != 2)
+ return false;
+
+ var Pollinated = parseInt(Crossed[0]);
+ var SeedBreed = parseInt(Crossed[1]);
+
+ if (tstatus < 9)
{
- socket.SysMessage("You cannot pollinate an unhealthy plant!");
+ pSock.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
+ return false;
}
- else if (!myTarget.GetTag("PlantType"))
+ else if (myTarget.GetTag("PlantHealth") == 10 && myTarget.GetTag("PlantHealth") == 11)//wilted or dying
{
- socket.SysMessage("You can only pollinate other specially grown plants!");
+ pSock.SysMessage("You cannot pollinate an unhealthy plant!");
+ return false;
}
- //check if is both plants can be crossesed.
- //You cannot cross-pollinate with a mutated plant!
- else if (myTarget.GetTag("Pollinated") == 1)
+ else if (!myTarget.GetTag("PlantType"))
{
- socket.SysMessage("This plant has already been pollinated!");
+ pSock.SysMessage("You can only pollinate other specially grown plants!");
+ return false;
+ }
+ else if (!iCrossedPlants && !tCrossedPlants)
+ {
+ pSock.SysMessage("You cannot cross-pollinate with a mutated plant!");
+ return false;
+ }
+ else if (Pollinated == 1)
+ {
+ pSock.SysMessage("This plant has already been pollinated!");
}
else if (myTarget == iUsed)
{
- myTarget.SetTag("Pollinated", 1);
- socket.SysMessage("You pollinate the plant with its own pollen.");
+ CrossPollinateTable(myTarget, iUsed, pSock);
+ SeedColorsSet(myTarget, iUsed);
+ pSock.SysMessage("You pollinate the plant with its own pollen.");
}
+ else
+ {
+ CrossPollinateTable(myTarget, iUsed, pSock);
+ SeedColorsSet(myTarget, iUsed);
+ pSock.SysMessage("You successfully cross - pollinate the plant.");
+ }
+ }
+}
+
+function CrossPollinateTable(myTarget, iUsed, pSock)
+{
+ var cross = iUsed.GetTag("PlantType");
+ var cross2 = myTarget.GetTag("PlantType");
+
+ 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
+
+ //pSock.SysMessage("You Set the Seed " + setcross);
+ myTarget.SetTag("PlantCross", 1 + "," + setcross);
+}
+
+function SeedColorsSet(myTarget, iUsed) {
+ var Seeds = iUsed.GetTag("Seeds");
+ var iplantColor = iUsed.GetTag("PlantColor");
+ var tplantColor = myTarget.GetTag("PlantColor");
+
+ 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]);
+
+ // 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("Seeds", availableSeeds + "," + remainingSeeds + "," + sethue);
}
+
function GatherSeeds(pUser, iUsed)
{
- var availableSeeds = iUsed.GetTag("AvailableSeeds");
+ var socket = pUser.socket;
+
+ var Seeds = iUsed.GetTag("Seeds")
+
+ 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]);
+
+ var CrossedPlants = iUsed.GetTag("PlantCross").split( "," );
+ var Pollinated = parseInt(CrossedPlants[0]);
+ var SeedBreed = parseInt(CrossedPlants[1]);
+
if (availableSeeds == 0)
{
socket.SysMessage("This plant has no seeds to gather!");
@@ -1325,7 +1775,7 @@ function GatherSeeds(pUser, iUsed)
{
var plantColor = iUsed.GetTag("PlantColor");
var seedType = "";
- switch (iUsed.GetTag("PlantType"))
+ switch (SeedBreed)
{
case 1:
seedType = "CampionFlowerSeed";
@@ -1456,13 +1906,14 @@ function GatherSeeds(pUser, iUsed)
}
if (seedType != null)
{
- CreateDFNItem(pUser.socket, pUser, seedType, 1, "ITEM", true, plantColor);
+ CreateDFNItem(pUser.socket, pUser, seedType, 1, "ITEM", true, hueSeeds);
socket.SysMessage("You gather seeds from the plant.")
if (availableSeeds > 0)
{
- iUsed.SetTag("AvailableSeeds", availableSeeds - 1);
+ var rseeds = availableSeeds - 1;
+ iUsed.SetTag("Seeds", rseeds + "," + remainingSeeds + "," + hueSeeds);
}
}
}
@@ -1649,8 +2100,20 @@ function ReproductionGump(pUser, iUsed)
function AddResourcesState(ReproductionGump, iUsed, x, y)
{
- var availableSeeds = iUsed.GetTag("AvailableSeeds");
- var remainingSeeds = iUsed.GetTag("RemainingSeeds");
+ var Seeds = iUsed.GetTag("Seeds")
+
+ 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)
{
@@ -1665,8 +2128,21 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
function AddSeedsState(ReproductionGump, iUsed, x, y)
{
- var availableSeeds = iUsed.GetTag("AvailableSeeds");
- var remainingSeeds = iUsed.GetTag("RemainingSeeds");
+ var Seeds = iUsed.GetTag("Seeds")
+
+ 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]);
+
var plantColor = iUsed.GetTag("PlantColor");
if (availableSeeds == 0 && remainingSeeds == 0)
@@ -1675,18 +2151,40 @@ function AddSeedsState(ReproductionGump, iUsed, x, y)
}
else
{
- ReproductionGump.AddText(x, y, plantColor, availableSeeds + "/" + remainingSeeds);
+ ReproductionGump.AddText(x, y, hueSeeds, availableSeeds + "/" + remainingSeeds);
}
}
function AddPollinationState(ReproductionGump, iUsed, x, y)
{
- //if not producing pollen
- //ReproductionGump.AddText(x, y, 0x35, "-");
- //if not pollenated
- //ReproductionGump.AddText(x, y, 0x21, "!");
- //else
- //ReproductionGump.AddText(x, y, 0x3F, "+");
+ 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]);
+ var SeedBreed = parseInt(Crossed[1]);
+
+ 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)
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index 733a655b1..019aa353f 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -309,21 +309,29 @@ function onCallback0(pSock, myTarget)
// Loop through the keys of seedToPlantType to find the matching tag
for (var tagName in seedToPlantType) {
- if (seedToPlantType.hasOwnProperty(tagName)) {
- if (parseInt(iUsed.GetTag(tagName)) === 1) {
- var plantType = seedToPlantType[tagName];
- myTarget.SetTag("PlantType", plantType); // Type of plant it is from dfn files
+ if (parseInt(iUsed.GetTag(tagName)) === 1)
+ {
+ var plantType = seedToPlantType[tagName];
+ if (!isNaN(plantType))
+ { // Check if plantType is a valid number
+ myTarget.SetTag("PlantType", plantType);
myTarget.SetTag("PlantName", iUsed.name); // Name of plant it is from dfn files
myTarget.SetTag("PlantColor", iUsed.colour); // Colour of plant it is from dfn files
break; // Exit the loop once a match is found
}
+ else
+ {
+ // Handle the case where the plantType is not a valid number
+ pUser.SysMessage("Invalid plantType:", plantType, "Page and GM");
+ }
}
}
const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
myTarget.StartTimer(PlantDelayTimer, 1, 19100);
myTarget.SetTag("PlantStage", 1);
- myTarget.SetTag("RemainingSeeds", 8);
+ myTarget.SetTag("Seeds", 0 + "," + 8 + "," + iUsed.colour);
+ myTarget.SetTag("PlantCross", 0 + "," + plantType);
if (iUsed.amount > 1)
iUsed.amount--;
From e34897069f868500e7429c054243678d6f0dcd80 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 10 Mar 2024 12:59:36 -0500
Subject: [PATCH 03/34] Another Major Update
removed about 4 tags and combined into 1 new tag,
Added Crossable settings on seed js
Fixed more errors
Some code cleanup
---
data/js/item/plant_growing/plantbowl.js | 8 +-
data/js/item/plant_growing/plantsystem.js | 195 +++++++++----
data/js/item/plant_growing/seed.js | 331 +++++-----------------
3 files changed, 207 insertions(+), 327 deletions(-)
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index e13f5f466..b66705ef4 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -58,9 +58,10 @@ function onCallback1(socket, ourObj)
{
socket.SysMessage("You need more dirt to fill a plant bowl!")
}
- else {
+ else
+ {
var bowlofdirt = CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
- bowlofdirt.SetTag("FertialeDirt", 1);
+ bowlofdirt.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 1);
socket.SysMessage("You fill the bowl with fresh dirt.")
iBowl.Delete();
@@ -86,7 +87,8 @@ function onCallback1(socket, ourObj)
{
if (validMapDirtIDs.indexOf(tileID) != -1 ) // Dirt
{
- CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
+ var bowlofdirt = CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
+ bowlofdirt.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
socket.SysMessage("You fill the bowl with fresh dirt.")
validTileIDFound = true;
iBowl.Delete();
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 3d3e214e6..07b61a167 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -5,12 +5,26 @@ function onUseChecked(pUser, iUsed)
{
var gumpID = scriptID + 0xffff;
var socket = pUser.socket;
+
socket.tempObj = iUsed;
socket.CloseGump(gumpID, 0);
PlantBowlGump(pUser, iUsed);
+}
- iUsed.Refresh();
+function onCreateDFN(objMade, objType)
+{
+ if (objType == 0)
+ {
+ var plantInfo = objMade.GetTag("PlantInfo")
+
+ if (!plantInfo)
+ {
+ objMade.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
+ objMade.SetTag("Potions", 0 + "," + 0 + "," + 0 + "," + 0);
+ return false;
+ }
+ }
}
function PlantBowlGump(pUser, iUsed)
@@ -66,16 +80,13 @@ function PlantBowlGump(pUser, iUsed)
PlantGump.AddText(196, 163, 0x835, greaterStrength);
PlantGump.AddGump(48, 47, 0xD2);
- if (iUsed.GetTag("PlantStage") >= 1)
+ if (iUsed.GetTag("PlantStage") >= 1)
{
PlantGump.AddText(54, 47, 0x835, iUsed.GetTag("PlantStage").toString());
}
PlantGump.AddGump(232, 47, 0xD2);
- if (iUsed.GetTag("PlantType"))
- {
- AddGrowthIndicator(PlantGump, iUsed);
- }
+ AddGrowthIndicator(PlantGump, iUsed);
PlantGump.AddButton(48, 183, 0xD2, 0xD2, 11, 11, 11); // Help
PlantGump.AddText(54, 183, 0x835, "?");
@@ -205,13 +216,29 @@ function PlantDamage(iUsed)
iUsed.health = Math.max(0, iUsed.health - damage);
}
-function AddGrowthIndicator( PlantGump, myPlant )
+function AddGrowthIndicator(PlantGump, iUsed )
{
- if (myPlant.GetTag("PlantStage") >= 1 && myPlant.GetTag("PlantStage") <= 9)
+ 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 PlantName = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
+
+ if (iUsed.GetTag("PlantStage") >= 1 && iUsed.GetTag("PlantStage") <= 9)
{
- const gi = myPlant.GetTag("PlantHealth");
+ const gi = iUsed.GetTag("PlantHealth");
- if (!inValidLocation(myPlant))
+ if (!inValidLocation(iUsed))
{
PlantGump.AddText(239, 47, 0x21, "!");
}
@@ -221,11 +248,11 @@ function AddGrowthIndicator( PlantGump, myPlant )
}
//else if(growthdelay)
//PlantGump.AddText(239, 47, 0x35, "-");// delay
- else if (myPlant.GetTag("PlantStage") < 9)
+ else if (iUsed.GetTag("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 (myPlant.GetTag("FertialeDirt"))
+ else if (fertialeDirt == 1)
{
PlantGump.AddText(239, 47, 0x3F, "+"); // Double Grown
}
@@ -279,8 +306,22 @@ function GrowthCheck( myPlant, pUser )
var greaterCure = myPlant.GetTag("GreaterCure");
var greaterStrength = myPlant.GetTag("GreaterStrength");
+ 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 = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
+
var chanceType = 0;
- switch( myPlant.GetTag( "PlantType" ))
+ switch (plantType)
{
case 1:
chanceType = 1;
@@ -457,35 +498,24 @@ function ApplyPotions(myPlant)
function onTimer( myPlant, timerID )
{
if ( !ValidateObject( myPlant ))
- {
return;
- }
var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
var Seeds = myPlant.GetTag("Seeds")
var CrossedPlants = myPlant.GetTag("PlantCross")
- if (!CrossedPlants)
- {
+ if (!CrossedPlants || !Seeds)
return false;
- }
var Crossed = CrossedPlants.split(",");
- if (Crossed.length != 2)
+ var Seedlength = Seeds.split(",");
+
+ if (Crossed.length != 3 || Seedlength.length != 3)
return false;
var Pollinated = parseInt(Crossed[0]);
var SeedBreed = parseInt(Crossed[1]);
-
- if (!Seeds)
- {
- return false;
- }
-
- var Seedlength = Seeds.split(",");
- if (Seedlength.length != 3)
- return false;
-
+ var crossAble = parseInt(Crossed[2]);
var availableSeeds = parseInt(Seedlength[0]);
var remainingSeeds = parseInt(Seedlength[1]);
var hueSeeds = parseInt(Seedlength[2]);
@@ -535,7 +565,7 @@ function onTimer( myPlant, timerID )
{
if (Pollinated == 0)
{
- myPlant.SetTag("PlantCross", 1 + "," + SeedBreed);
+ myPlant.SetTag("PlantCross", 1 + "," + SeedBreed + "," + crossAble);
}
}
@@ -591,10 +621,10 @@ function DrawPlant( PlantGump, iUsed )
}
else
{
- PlantType( PlantGump, iUsed );
+ PlantGump( PlantGump, iUsed );
}
- if( iUsed.GetTag( "PlantStage" ) != 14 && iUsed.GetTag( "PlantType" )) //BowlOfDirt
+ if( iUsed.GetTag( "PlantStage" ) != 14 ) //BowlOfDirt
{
switch( iUsed.GetTag( "PlantHealth" ))
{
@@ -623,8 +653,23 @@ function DrawPlant( PlantGump, iUsed )
return;
}
-function PlantType( PlantGump, iUsed )
+function PlantGump( 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 PlantName = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
+
var plantArray = {
"3203": [0, 0], // 0x0c83
"3206": [0, 0], // 0x0c86
@@ -713,10 +758,9 @@ function PlantType( PlantGump, iUsed )
var HopsSouth = 6817;
var SugarCanes = 9324;
- var plantColor = iUsed.GetTag( "PlantColor" );
var plantID = 0;
var plantName = "";
- switch(iUsed.GetTag( "PlantType" ))
+ switch (plantType)
{
case 1:
plantID = CampionFlowers;
@@ -901,6 +945,21 @@ function PlantType( PlantGump, iUsed )
function PlantBowl( 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 PlantName = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
+
var CampionFlowers = 3203;
var Poppies = 3206;
var Snowdrops = 3208;
@@ -944,10 +1003,9 @@ function PlantBowl( iUsed )
var HopsSouth = 6817;
var SugarCanes = 9324;
- var plantColor = iUsed.GetTag( "PlantColor" );
var plantID = 0;
var plantName = "";
- switch( iUsed.GetTag( "PlantType" ))
+ switch(plantType)
{
case 1:
plantID = CampionFlowers;
@@ -1292,7 +1350,7 @@ function PollinatePlant(pUser, iUsed)
pSock.SysMessage("You cannot gather pollen from a mutated plant!");
return false;
}
- else if (status < 9)
+ else if (status < 7)
{
socket.SysMessage("Too early to gather pollen");
return false;
@@ -1318,7 +1376,7 @@ function onCallback1(pSock, myTarget)
pSock.SysMessage("You cannot gather pollen from a mutated plant!");
return false;
}
- if (status < 9)
+ if (status < 7)
{
pSock.SysMessage("Too early to gather pollen");
return false;
@@ -1328,7 +1386,7 @@ function onCallback1(pSock, myTarget)
pSock.SysMessage("You cannot gather pollen from an unhealthy plant!");
return false;
}
- else if (!myTarget.GetTag("PlantType"))
+ else if (status > 7 && status < 9)
{
pSock.SysMessage("You can only pollinate other specially grown plants!");
return false;
@@ -1336,8 +1394,6 @@ function onCallback1(pSock, myTarget)
else
{
var tstatus = myTarget.GetTag("PlantStage");
- var type = iUsed.GetTag("PlantType");
- var color = iUsed.GetTag("PlantColor");
var tCrossedPlants = myTarget.GetTag("PlantCross")
if (!tCrossedPlants)
@@ -1347,13 +1403,14 @@ function onCallback1(pSock, myTarget)
}
var Crossed = tCrossedPlants.split(",");
- if (Crossed.length != 2)
+ if (Crossed.length != 3)
return false;
var Pollinated = parseInt(Crossed[0]);
var SeedBreed = parseInt(Crossed[1]);
+ var crossAble = parseInt(Crossed[2]);
- if (tstatus < 9)
+ if (tstatus < 7)
{
pSock.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
return false;
@@ -1363,12 +1420,12 @@ function onCallback1(pSock, myTarget)
pSock.SysMessage("You cannot pollinate an unhealthy plant!");
return false;
}
- else if (!myTarget.GetTag("PlantType"))
+ else if (tstatus > 7 && tstatus < 9)
{
pSock.SysMessage("You can only pollinate other specially grown plants!");
return false;
}
- else if (!iCrossedPlants && !tCrossedPlants)
+ else if (crossAble == 0)
{
pSock.SysMessage("You cannot cross-pollinate with a mutated plant!");
return false;
@@ -1394,8 +1451,21 @@ function onCallback1(pSock, myTarget)
function CrossPollinateTable(myTarget, iUsed, pSock)
{
- var cross = iUsed.GetTag("PlantType");
- var cross2 = myTarget.GetTag("PlantType");
+ 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 = parseInt(icrossLength[0]);
+ var cross2 = parseInt(tcrossLength[0]);
var setcross = 0;
@@ -1643,22 +1713,28 @@ function CrossPollinateTable(myTarget, iUsed, pSock)
setcross = 17;//TribarrelCactusSeed
//pSock.SysMessage("You Set the Seed " + setcross);
- myTarget.SetTag("PlantCross", 1 + "," + setcross);
+ myTarget.SetTag("PlantCross", 1 + "," + setcross + "," + 1);
}
-function SeedColorsSet(myTarget, iUsed) {
+function SeedColorsSet(myTarget, iUsed)
+{
var Seeds = iUsed.GetTag("Seeds");
- var iplantColor = iUsed.GetTag("PlantColor");
- var tplantColor = myTarget.GetTag("PlantColor");
+ var plantInfo = iUsed.GetTag("PlantInfo")
+ var tplantInfo = myTarget.GetTag("PlantInfo")
- if (!Seeds) {
+ if (!Seeds || !plantInfo || !tplantInfo)
return false;
- }
+ var infoLength = plantInfo.split(",");
+ var tinfoLength = tplantInfo.split(",");
var Seedlength = Seeds.split(",");
- if (Seedlength.length != 3)
+
+ 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]);
var hueSeeds = parseInt(Seedlength[2]);
@@ -1766,6 +1842,7 @@ function GatherSeeds(pUser, iUsed)
var CrossedPlants = iUsed.GetTag("PlantCross").split( "," );
var Pollinated = parseInt(CrossedPlants[0]);
var SeedBreed = parseInt(CrossedPlants[1]);
+ var crossAble = parseInt(Crossed[2]);
if (availableSeeds == 0)
{
@@ -1773,7 +1850,6 @@ function GatherSeeds(pUser, iUsed)
}
else
{
- var plantColor = iUsed.GetTag("PlantColor");
var seedType = "";
switch (SeedBreed)
{
@@ -1941,7 +2017,7 @@ function EmptyBowlGump(pUser, iUsed)
EmptyBowlGump.AddGump(140, 102, 0x15E1);
EmptyBowlGump.AddPicture(160, 100, 0x15FD);
- if (iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantType")) //BowlOfDirt
+ if (iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantStage") < 2 ) //BowlOfDirt
EmptyBowlGump.AddPicture(156, 130, 0xDCF); // Seed
EmptyBowlGump.AddButton(98, 150, 0x47E, 0x480, 14, 14, 14); // Cancel
@@ -2232,10 +2308,11 @@ function onTooltip(myPlant)
if (status === 0)
{
tooltipText = "A bowl of " + water + " dirt";
- } else
+ }
+ else
{
tooltipText = "Plant Stage: " + status + " : " + myPlant.health;
}
return tooltipText;
-}
+}
\ No newline at end of file
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index 019aa353f..9ff4c6374 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -17,10 +17,27 @@ function onCallback0(pSock, myTarget)
{
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 plantInfo = myTarget.GetTag("PlantInfo")
+
+ if (!plantInfo)
+ {
+ return false;
+ }
+
+ var infoLength = plantInfo.split(",");
+ if (infoLength.length != 4)
+ return false;
+
+ var plantType = parseInt(infoLength[0]);
+ var PlantName = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
var itemOwner = GetPackOwner(myTarget, 0);
+
if (itemOwner == null || itemOwner != pUser)
{
pUser.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
@@ -45,263 +62,49 @@ function onCallback0(pSock, myTarget)
}
else
{
- // You plant the seed in the bowl of dirt.
- /*pUser.SysMessage("You plant the seed in the bowl of dirt.");
- if (parseInt(iUsed.GetTag("CampionFlowerSeed")) == 1) {
- myTarget.SetTag("planttype", 1);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("PoppieSeed")) == 1) {
- myTarget.SetTag("planttype", 2);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SnowdropSeed")) == 1) {
- myTarget.SetTag("planttype", 3);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("BulrusheSeed")) == 1) {
- myTarget.SetTag("planttype", 4);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("LilieSeed")) == 1) {
- myTarget.SetTag("planttype", 5);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("PampasGrassSeed")) == 1) {
- myTarget.SetTag("planttype", 6);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("RusheSeed")) == 1) {
- myTarget.SetTag("planttype", 7);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("ElephantEarPlantrSeed")) == 1) {
- myTarget.SetTag("planttype", 8);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("FernSeed")) == 1) {
- myTarget.SetTag("planttype", 9);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("PonytailPalmSeed")) == 1) {
- myTarget.SetTag("planttype", 10);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SmallPalmSeed")) == 1) {
- myTarget.SetTag("planttype", 11);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("CenturyPlantSeed")) == 1) {
- myTarget.SetTag("planttype", 12);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("WaterPlantSeed")) == 1) {
- myTarget.SetTag("planttype", 13);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SnakePlantSeed")) == 1) {
- myTarget.SetTag("planttype", 14);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("PricklyPearCactusSeed")) == 1) {
- myTarget.SetTag("planttype", 15);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("BarrelCactusSeed")) == 1) {
- myTarget.SetTag("planttype", 16);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("TribarrelCactusSeed")) == 1) {
- myTarget.SetTag("planttype", 17);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("CommonGreenBonsaiSeed")) == 1) {
- myTarget.SetTag("planttype", 18);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("CommonPinkBonsaiSeed")) == 1) {
- myTarget.SetTag("planttype", 19);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("UncommonGreenBonsai")) == 1) {
- myTarget.SetTag("planttype", 20);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("UncommonPinkBonsai")) == 1) {
- myTarget.SetTag("planttype", 21);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("RareGreenBonsai")) == 1) {
- myTarget.SetTag("planttype", 22);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("RarePinkBonsai")) == 1) {
- myTarget.SetTag("planttype", 23);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("ExceptionalBonsai")) == 1) {
- myTarget.SetTag("planttype", 24);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("ExoticBonsai")) == 1) {
- myTarget.SetTag("planttype", 25);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("Cactus")) == 1) {
- myTarget.SetTag("planttype", 26);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("FlaxFlowers")) == 1) {
- myTarget.SetTag("planttype", 27);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("FoxgloveFlowers")) == 1) {
- myTarget.SetTag("planttype", 28);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("HopsEast")) == 1) {
- myTarget.SetTag("planttype", 29);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("OrfluerFlowers")) == 1) {
- myTarget.SetTag("planttype", 30);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("CypressTwisted")) == 1) {
- myTarget.SetTag("planttype", 31);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("HedgeShort")) == 1) {
- myTarget.SetTag("planttype", 32);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("JuniperBush")) == 1) {
- myTarget.SetTag("planttype", 33);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SnowdropPatch")) == 1) {
- myTarget.SetTag("planttype", 34);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("Cattails")) == 1) {
- myTarget.SetTag("planttype", 35);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("PoppyPatch")) == 1) {
- myTarget.SetTag("planttype", 36);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SpiderTree")) == 1) {
- myTarget.SetTag("planttype", 37);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("WaterLily")) == 1) {
- myTarget.SetTag("planttype", 38);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("CypressStraight")) == 1) {
- myTarget.SetTag("planttype", 39);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("HedgeTall")) == 1) {
- myTarget.SetTag("planttype", 40);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("HopsSouth")) == 1) {
- myTarget.SetTag("planttype", 41);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }
- else if (parseInt(iUsed.GetTag("SugarCanes")) == 1) {
- myTarget.SetTag("planttype", 42);
- myTarget.SetTag("plantname", iUsed.name);
- myTarget.SetTag("plantcolor", iUsed.colour);
- }*/
-
- // Define a mapping between seed names and plant types
const seedToPlantType = {
- "CampionFlowerSeed": 1,
- "PoppieSeed": 2,
- "SnowdropSeed": 3,
- "BulrusheSeed": 4,
- "LilieSeed": 5,
- "PampasGrassSeed": 6,
- "RusheSeed": 7,
- "ElephantEarPlantrSeed": 8,
- "FernSeed": 9,
- "PonytailPalmSeed": 10,
- "SmallPalmSeed": 11,
- "CenturyPlantSeed": 12,
- "WaterPlantSeed": 13,
- "SnakePlantSeed": 14,
- "PricklyPearCactusSeed": 15,
- "BarrelCactusSeed": 16,
- "TribarrelCactusSeed": 17,
- "CommonGreenBonsaiSeed": 18,
- "CommonPinkBonsaiSeed": 19,
- "UncommonGreenBonsai": 20,
- "UncommonPinkBonsai": 21,
- "RareGreenBonsai": 22,
- "RarePinkBonsai": 23,
- "ExceptionalBonsai": 24,
- "ExoticBonsai": 25,
- "Cactus": 26,
- "FlaxFlowers": 27,
- "FoxgloveFlowers": 28,
- "HopsEast": 29,
- "OrfluerFlowers": 30,
- "CypressTwisted": 31,
- "HedgeShort": 32,
- "JuniperBush": 33,
- "SnowdropPatch": 34,
- "Cattails": 35,
- "PoppyPatch": 36,
- "SpiderTree": 37,
- "WaterLily": 38,
- "CypressStraight": 39,
- "HedgeTall": 40,
- "HopsSouth": 41,
- "SugarCanes": 42
+ "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 }
};
// You plant the seed in the bowl of dirt.
@@ -311,18 +114,17 @@ function onCallback0(pSock, myTarget)
for (var tagName in seedToPlantType) {
if (parseInt(iUsed.GetTag(tagName)) === 1)
{
- var plantType = seedToPlantType[tagName];
- if (!isNaN(plantType))
- { // Check if plantType is a valid number
- myTarget.SetTag("PlantType", plantType);
- myTarget.SetTag("PlantName", iUsed.name); // Name of plant it is from dfn files
- myTarget.SetTag("PlantColor", iUsed.colour); // Colour of plant it is from dfn files
- break; // Exit the loop once a match is found
+ 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
- pUser.SysMessage("Invalid plantType:", plantType, "Page and GM");
+ pUser.SysMessage("Invalid plantType:", tplantType.type, "Page and GM");
}
}
}
@@ -331,7 +133,6 @@ function onCallback0(pSock, myTarget)
myTarget.StartTimer(PlantDelayTimer, 1, 19100);
myTarget.SetTag("PlantStage", 1);
myTarget.SetTag("Seeds", 0 + "," + 8 + "," + iUsed.colour);
- myTarget.SetTag("PlantCross", 0 + "," + plantType);
if (iUsed.amount > 1)
iUsed.amount--;
From 7705d4f335204adc2a24c277f34376df541158a7 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Mon, 11 Mar 2024 16:40:52 -0500
Subject: [PATCH 04/34] More Code Changes
Did some more code changings as i progress thru this system.
---
data/js/item/plant_growing/plantbowl.js | 2 +
data/js/item/plant_growing/plantsystem.js | 583 ++++++++++++----------
2 files changed, 316 insertions(+), 269 deletions(-)
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index b66705ef4..3e61d8761 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -62,6 +62,7 @@ function onCallback1(socket, ourObj)
{
var bowlofdirt = CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
bowlofdirt.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 1);
+ bowlofdirt.SetTag("PlantStage", 14);
socket.SysMessage("You fill the bowl with fresh dirt.")
iBowl.Delete();
@@ -89,6 +90,7 @@ function onCallback1(socket, ourObj)
{
var bowlofdirt = CreateDFNItem(mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true);
bowlofdirt.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
+ bowlofdirt.SetTag("PlantStage", 14);//dirt
socket.SysMessage("You fill the bowl with fresh dirt.")
validTileIDFound = true;
iBowl.Delete();
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 07b61a167..c5ff3704a 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -7,6 +7,7 @@ function onUseChecked(pUser, iUsed)
var socket = pUser.socket;
socket.tempObj = iUsed;
+ iUsed.tempObj = socket;
socket.CloseGump(gumpID, 0);
PlantBowlGump(pUser, iUsed);
@@ -20,8 +21,14 @@ function onCreateDFN(objMade, objType)
if (!plantInfo)
{
- objMade.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
+ if (objMade.GetTag("PlantStage") != 14 || objMade.GetTag("PlantStage") == null)
+ {
+ objMade.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
+ objMade.SetTag("PlantStage", 14);//dirt bowl
+ }
+
objMade.SetTag("Potions", 0 + "," + 0 + "," + 0 + "," + 0);
+ objMade.SetTag("Infections", 0 + "," + 0 + "," + 0 + "," + 0);
return false;
}
}
@@ -31,10 +38,28 @@ function PlantBowlGump(pUser, iUsed)
{
var PlantGump = new Gump;
var socket = pUser.socket;
- var greaterPoison = iUsed.GetTag("GreaterPoison");
- var greaterCure = iUsed.GetTag("GreaterCure");
- var greaterHeal = iUsed.GetTag("GreaterHeal");
- var greaterStrength = iUsed.GetTag("GreaterStrength");
+
+ var potionInfo = iUsed.GetTag("Potions")
+ var infection = iUsed.GetTag("Infections");
+ var waterLevel = iUsed.GetTag("water")
+
+ if (!potionInfo || !infection)
+ return false;
+
+ var potionLength = potionInfo.split(",");
+ var infectionLevels = infection.split(",");
+ if (potionLength.length != 4 || infectionLevels.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(infectionLevels[0], 10);
+ var fungusLevel = parseInt(infectionLevels[1], 10);
+ var poisonLevel = parseInt(infectionLevels[2], 10);
+ var diseaseLevel = parseInt(infectionLevels[3], 10);
DrawBackground(PlantGump);
@@ -45,23 +70,23 @@ function PlantBowlGump(pUser, iUsed)
PlantGump.AddButton(71, 91, 0xD4, 0xD4, 2, 2, 2); // infestation
PlantGump.AddPicture(8, 96, 0x372);
- AddPlus(PlantGump, iUsed);
+ AddPlus(PlantGump, 95, 92, infestationLevel);
PlantGump.AddButton(71, 115, 0xD4, 0xD4, 3, 3, 3); // fungus
PlantGump.AddPicture(58, 115, 0xD16);
- AddPlus(PlantGump, iUsed);
+ AddPlus(PlantGump, 95, 116, fungusLevel);
PlantGump.AddButton(71, 139, 0xD4, 0xD4, 4, 4, 4); // poison
PlantGump.AddPicture(59, 143, 0x1AE4);
- AddPlus(PlantGump, iUsed);
+ AddPlus(PlantGump, 95, 140, poisonLevel);
PlantGump.AddButton(71, 163, 0xD4, 0xD4, 5, 5, 5); // disease
PlantGump.AddPicture(55, 167, 0x1727);
- AddPlus(PlantGump, iUsed);
+ AddPlus(PlantGump, 95, 164, diseaseLevel);
PlantGump.AddButton(209, 67, 0xD4, 0xD4, 6, 6, 6); // water
PlantGump.AddPicture(193, 67, 0x1F9D);
- AddWaterLevel(PlantGump, iUsed);
+ AddWaterLevel(PlantGump, 196, 67, waterLevel);
PlantGump.AddButton(209, 91, 0xD4, 0xD4, 7, 7, 7); // poison potion
PlantGump.AddPicture(201, 91, 0xF0A);
@@ -106,33 +131,20 @@ function DrawBackground( PlantGump )
return;
}
-function AddPlus(PlantGump, iUsed)
+function AddPlus(PlantGump, x, y, Level)
{
- // Define positions and colors for each tag
- var tagPositions = {
- "infestation": { "position": 92, "color1": 0x35, "color2": 0x21 },
- "fungus": { "position": 116, "color1": 0x35, "color2": 0x21 },
- "poison": { "position": 140, "color1": 0x35, "color2": 0x21 },
- "disease": { "position": 164, "color1": 0x35, "color2": 0x21 }
- };
-
- // Loop through each tag and add "+" accordingly
- for (var tag in tagPositions)
- {
- var positionInfo = tagPositions[tag];
- var tagValue = iUsed.GetTag(tag);
- var color = tagValue == 1 ? positionInfo.color1 : (tagValue == 2 ? positionInfo.color2 : null);
- if (color !== null) {
- PlantGump.AddText(95, positionInfo.position, color, "+");
- }
- }
+ if (Level == 1)
+ PlantGump.AddText(x, y, 0x35, "+");
+ if (Level == 2)
+ PlantGump.AddText(x, y, 0x21, "+");
+ return;
}
-function AddWaterLevel( PlantGump, iUsed )
+function AddWaterLevel( PlantGump, x, y, Level )
{
var addPlusMinus = "";
var addHue = 0;
- switch( iUsed.GetTag( "water" ))
+ switch (Level)
{
case 0: // severely under-watered.
addHue = 0x21;
@@ -153,7 +165,7 @@ function AddWaterLevel( PlantGump, iUsed )
}
if ( addPlusMinus != 0 )
{
- PlantGump.AddText( 196, 67, addHue, addPlusMinus );
+ PlantGump.AddText(x, y, addHue, addPlusMinus );
}
return;
}
@@ -188,22 +200,22 @@ function HealthStatus(myPlant)
function PlantDamage(iUsed)
{
- if (iUsed.health <= 0)
- {
- Die(iUsed);
- return;
- }
+ var infection = iUsed.GetTag("Infections");
+
+ if (!infection)
+ return false;
+
+ var infectionLevels = infection.split(",");
+ if (infectionLevels.length != 4)
+ return false;
var damage = 0;
- var tags = ["infestation", "fungus", "poison", "disease"];
- var tag;
- for (var i = 0, len = tags.length; i < len; i++)
+
+ for (var i = 0; i < 4; i++)
{
- tag = tags[i];
- if (iUsed.GetTag(tag) > 0)
- {
- damage += iUsed.GetTag(tag) * RandomNumber(3, 6);
- }
+ var level = parseInt(infectionLevels[i]);
+ if (level > 0)
+ damage += level * RandomNumber(3, 6);
}
var waterLevel = iUsed.GetTag("water");
@@ -262,23 +274,31 @@ function AddGrowthIndicator(PlantGump, iUsed )
function Die(myPlant)
{
- myPlant.KillTimers();
-
if (myPlant.GetTag( "PlantStage" ) >= 9 )
{
myPlant.SetTag("PlantStage", 20);//dead twigs
myPlant.id = 0x1B9D;
myPlant.colour = 0;
myPlant.name = "twigs";
- myPlant.RemoveScriptTrigger(scriptID);
+ ResetPlant(myPlant);
}
else
{
+ myPlant.id = 0x1602;
+ myPlant.colour = 0;
+ myPlant.name = "a bowl of dirt";
+ myPlant.health = 100;
+ 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("Seeds", null);
myPlant.SetTag("PlantStage", 14);//dirt
+ myPlant.KillTimers();
}
- ResetPlant(myPlant);
-
return;
}
@@ -294,207 +314,148 @@ function inValidLocation(myPlant)
}
}
-function GrowthCheck( myPlant, pUser )
-{
- var waterLevel = myPlant.GetTag("water");
- var infestsationLevel = myPlant.GetTag("infestation");
- var fungusLevel = myPlant.GetTag("fungus");
- var poisonLevel = myPlant.GetTag("poison");
- var diseaseLevel = myPlant.GetTag("disease");
-
- var greaterPoison = myPlant.GetTag("GreaterPoison");
- var greaterCure = myPlant.GetTag("GreaterCure");
- var greaterStrength = myPlant.GetTag("GreaterStrength");
+function GrowthCheck(myPlant) {
+ var waterLevel = parseInt(myPlant.GetTag("water"), 10) || 0;
+ var infection = myPlant.GetTag("Infections") || "0,0,0,0";
+ var potionInfo = myPlant.GetTag("Potions") || "0,0,0,0";
+ var plantInfo = myPlant.GetTag("PlantInfo") || "0,0,0,0";
- var plantInfo = myPlant.GetTag("PlantInfo")
+ var infoLength = plantInfo.split(",");
+ var potionLength = potionInfo.split(",");
+ var infectionLength = infection.split(",");
- if (!plantInfo)
- return false;
+ if (infoLength.length !== 4 || potionLength.length !== 4 || infectionLength.length !== 4) {
+ return;
+ }
- var infoLength = plantInfo.split(",");
- if (infoLength.length != 4)
- return false;
+ var greaterPoison = parseInt(potionLength[0], 10);
+ var greaterCure = parseInt(potionLength[1], 10);
+ var greaterHeal = parseInt(potionLength[2], 10);
+ var greaterStrength = parseInt(potionLength[3], 10);
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
- var fertialeDirt = parseInt(infoLength[3]);
+ var infestationLevel = parseInt(infectionLength[0], 10);
+ var fungusLevel = parseInt(infectionLength[1], 10);
+ var poisonLevel = parseInt(infectionLength[2], 10);
+ var diseaseLevel = parseInt(infectionLength[3], 10);
- var chanceType = 0;
- switch (plantType)
- {
- case 1:
- chanceType = 1;
- break;
- case 27:
- chanceType = 27;
- break;
- case 28:
- chanceType = 28;
- break;
- case 30:
- chanceType = 30;
- break;
- default:
- chanceType = 0;
- break;
- }
+ var plantType = parseInt(infoLength[0], 10);
+ var plantColor = parseInt(infoLength[2], 10);
- var chanceColor = 0
- switch( myPlant.GetTag( "PlantColor" ))
- {
- case 21:
- chanceColor = 21; // Bright Red
- break;
- case 5:
- chanceColor = 5; // Bright Blue
- break;
- case 38:
- chanceColor = 38; // Bright Yellow
- break;
- case 10:
- chanceColor = 10; // Bright Purple
- break;
- case 42:
- chanceColor = 42; // Bright Green
- break;
- case 43:
- chanceColor = 43; // Bright Orange
- break;
- default:
- chanceColor = 0;
- break;
- }
var infestationChance = 0.30 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10;
- // Flowers have a 10% higher chance to become infected
- if (chanceType == 1 || chanceType == 27 || chanceType == 30)
- {
+ if ([1, 27, 28, 30].indexOf(plantType) !== -1) {
infestationChance += 0.10;
}
- // For plants with a bright color, the chance is another 10% higher
- if (chanceColor == 21 || chanceColor == 5 || chanceColor == 38 || chanceColor == 10 || chanceColor == 42 || chanceColor == 43)
- {
+ if ([21, 5, 38, 10, 42, 43].indexOf(plantColor) !== -1) {
infestationChance += 0.10;
}
- if( infestationChance >= Math.random())
- {
- myPlant.SetTag( "infestation", infestsationLevel + 1 );
+ if (infestationChance >= Math.random() && infestationLevel < 2) {
+ infestationLevel++;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
}
- // Check if the plant gets infected with fungus
- var fungusChance = 0.15 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10
+ var fungusChance = 0.15 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10;
- if (fungusChance >= Math.random())
- {
- myPlant.SetTag( "fungus", fungusLevel + 1 );
+ if (fungusChance >= Math.random() && fungusLevel < 2) {
+ fungusLevel++;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
}
- if ( waterLevel > 0 && waterLevel >= 2 || 0.9 >= Math.random())
- {
- myPlant.SetTag("water", waterLevel - 1);
+ if (waterLevel > 0 && (waterLevel >= 2 || 0.9 >= Math.random())) {
+ waterLevel--;
+ myPlant.SetTag("water", waterLevel);
}
- //Too many poison and cure potions will cause disease and poison
- if (greaterPoison > 0)
- {
- myPlant.SetTag("GreaterPoison", greaterPoison - 1);
- myPlant.SetTag("poison", poisonLevel + greaterPoison);
+ if (greaterPoison > 0) {
+ greaterPoison--;
+ myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ poisonLevel++;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
}
- if (greaterCure > 0)
- {
- myPlant.SetTag("GreaterCure", greaterCure - 1);
- myPlant.SetTag("disease", diseaseLevel + greaterCure);
+ if (greaterCure > 0) {
+ greaterCure--;
+ myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ diseaseLevel++;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
}
- if (greaterStrength > 0)
- {
- myPlant.SetTag("GreaterStrength", greaterStrength - 1);
+ if (greaterStrength > 0) {
+ greaterStrength--;
+ myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
}
-
- return;
}
-function ApplyPotions(myPlant)
-{
- var waterLevel = myPlant.GetTag("water");
- var infestsationLevel = myPlant.GetTag("infestation");
- var fungusLevel = myPlant.GetTag("fungus");
- var poisonLevel = myPlant.GetTag("poison");
- var diseaseLevel = myPlant.GetTag("disease");
-
- var greaterPoison = myPlant.GetTag("GreaterPoison");
- var greaterCure = myPlant.GetTag("GreaterCure");
- var greaterHeal = myPlant.GetTag("GreaterHeal");
- var greaterStrength = myPlant.GetTag("GreaterStrength");
-
- //Poison potions kill off infestations
- if (greaterPoison >= infestsationLevel)
- {
- myPlant.SetTag("GreaterPoison", greaterPoison - infestsationLevel);
- myPlant.SetTag("infestation", 0);
- }
- else
- {
- myPlant.SetTag("GreaterPoison", 0);
- myPlant.SetTag("infestation", infestsationLevel - greaterPoison);
- }
- //cure potions kill off fungus
- if (greaterCure >= fungusLevel)
- {
- myPlant.SetTag("GreaterCure", greaterCure - fungusLevel);
- myPlant.SetTag("fungus", 0);
- }
- else
- {
- myPlant.SetTag("GreaterCure", 0);
- myPlant.SetTag("fungus", fungusLevel - greaterCure);
- }
+function ApplyPotions(myPlant)
+{
+ var waterLevel = parseInt(myPlant.GetTag("water"), 10) || 0;
+ var potionInfo = myPlant.GetTag("Potions") || "0,0,0,0";
+ var infection = myPlant.GetTag("Infections") || "0,0,0,0";
- //heal potions kill off poison
- if (greaterHeal >= diseaseLevel)
- {
- myPlant.SetTag("GreaterHeal", greaterHeal - poisonLevel);
- myPlant.SetTag("poison", 0);
- }
- else
- {
- myPlant.SetTag("GreaterHeal", 0);
- myPlant.SetTag("poison", poisonLevel - greaterHeal);
- }
+ var potionLength = potionInfo.split(",");
+ var infectionLength = infection.split(",");
- //heal potions kill off disease
- if (greaterHeal >= diseaseLevel)
- {
- myPlant.SetTag("GreaterHeal", greaterHeal - diseaseLevel);
- myPlant.SetTag("disease", 0);
- }
- else
- {
- myPlant.SetTag("GreaterHeal", 0);
- myPlant.SetTag("disease", diseaseLevel - greaterHeal);
- }
+ if (potionLength.length !== 4 || infectionLength.length !== 4)
+ return false;
- if (infestsationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2)
- {
- if (greaterHeal > 0)
- {
- myPlant.health = myPlant.health + greaterHeal * 7;
+ var greaterPoison = parseInt(potionLength[0], 10);
+ var greaterCure = parseInt(potionLength[1], 10);
+ var greaterHeal = parseInt(potionLength[2], 10);
+ var greaterStrength = parseInt(potionLength[3], 10);
+
+ var infestationLevel = parseInt(infectionLength[0], 10);
+ var fungusLevel = parseInt(infectionLength[1], 10);
+ var poisonLevel = parseInt(infectionLength[2], 10);
+ var diseaseLevel = parseInt(infectionLength[3], 10);
+
+ if (greaterPoison >= infestationLevel) {
+ var poison = greaterPoison - infestationLevel;
+ myPlant.SetTag("Potions", [poison, greaterCure, greaterHeal, greaterStrength].join(","));
+ myPlant.SetTag("Infections", "0," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ } else {
+ myPlant.SetTag("Potions", "0," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ var infestation = infestationLevel - greaterPoison;
+ myPlant.SetTag("Infections", [infestation, fungusLevel, poisonLevel, diseaseLevel].join(","));
+ }
+
+ if (greaterCure >= fungusLevel) {
+ var cure = greaterCure - fungusLevel;
+ myPlant.SetTag("Potions", [greaterPoison, cure, greaterHeal, greaterStrength].join(","));
+ myPlant.SetTag("Infections", infestationLevel + ",0," + poisonLevel + "," + diseaseLevel);
+ } else {
+ myPlant.SetTag("Potions", greaterPoison + ",0," + greaterHeal + "," + greaterStrength);
+ var fungus = fungusLevel - greaterCure;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungus + "," + poisonLevel + "," + diseaseLevel);
+ }
+
+ if (greaterHeal >= poisonLevel) {
+ var heal = greaterHeal - poisonLevel;
+ myPlant.SetTag("Potions", [greaterPoison, greaterCure, heal, greaterStrength].join(","));
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + ",0," + diseaseLevel);
+ } else {
+ myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + ",0," + greaterStrength);
+ var poison = poisonLevel - greaterHeal;
+ myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poison + "," + diseaseLevel);
+ }
+
+ if (infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2) {
+ if (greaterHeal > 0) {
+ myPlant.health += greaterHeal * 7;
+ } else {
+ myPlant.health += 2;
}
- else
- myPlant.health = myPlant.health + 2;
}
- if (greaterHeal > 0)
- {
- myPlant.SetTag("GreaterHeal", greaterHeal - 1);
+ if (greaterHeal > 0) {
+ greaterHeal--;
+ myPlant.SetTag("Potions", [greaterPoison, greaterCure, greaterHeal, greaterStrength].join(","));
}
}
+
function onTimer( myPlant, timerID )
{
if ( !ValidateObject( myPlant ))
@@ -503,14 +464,16 @@ function onTimer( myPlant, timerID )
var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
var Seeds = myPlant.GetTag("Seeds")
var CrossedPlants = myPlant.GetTag("PlantCross")
+ var plantInfo = myPlant.GetTag("PlantInfo")
- if (!CrossedPlants || !Seeds)
+ 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)
+ if (Crossed.length != 3 || Seedlength.length != 3 || infoLength.length != 4)
return false;
var Pollinated = parseInt(Crossed[0]);
@@ -519,9 +482,19 @@ function onTimer( myPlant, timerID )
var availableSeeds = parseInt(Seedlength[0]);
var remainingSeeds = parseInt(Seedlength[1]);
var hueSeeds = parseInt(Seedlength[2]);
+ var plantType = parseInt(infoLength[0]);
+ var PlantName = parseInt(infoLength[1]);
+ var plantColor = parseInt(infoLength[2]);
+ var fertialeDirt = parseInt(infoLength[3]);
if (timerID == 1 )
{
+ if (myPlant.health <= 0)
+ {
+ Die(myPlant);
+ return false;
+ }
+
if (!inValidLocation(myPlant)) // Checks make sure the plant is lockdown
{
return;
@@ -530,7 +503,7 @@ function onTimer( myPlant, timerID )
{
if (myPlant.GetTag("PlantHealth") != 10 && myPlant.GetTag("PlantHealth") != 11)//wilted or dying
{
- if (myPlant.GetTag("FertialeDirt") && stage <= 5)
+ if (fertialeDirt == 1 && stage <= 5)
{
//double growth to stage 5
myPlant.SetTag("PlantStage", stage + 2);
@@ -572,7 +545,7 @@ function onTimer( myPlant, timerID )
ApplyPotions(myPlant)
HealthStatus(myPlant);
- //PlantDamage(myPlant);
+ PlantDamage(myPlant);
GrowthCheck(myPlant);
myPlant.Refresh();
}
@@ -621,7 +594,7 @@ function DrawPlant( PlantGump, iUsed )
}
else
{
- PlantGump( PlantGump, iUsed );
+ PlantImage( PlantGump, iUsed );
}
if( iUsed.GetTag( "PlantStage" ) != 14 ) //BowlOfDirt
@@ -653,7 +626,7 @@ function DrawPlant( PlantGump, iUsed )
return;
}
-function PlantGump( PlantGump, iUsed )
+function PlantImage( PlantGump, iUsed )
{
var plantInfo = iUsed.GetTag("PlantInfo")
@@ -1181,7 +1154,6 @@ function PlantBowl( iUsed )
iUsed.name = plantName;
iUsed.movable = 1;
iUsed.colour = plantColor;
- iUsed.Refresh();
}
function CodexOFWisdomPacket(socket, topicID)
@@ -1271,8 +1243,10 @@ function onGumpPress(socket, button, PlantGump)
onUseChecked(pUser, iUsed);
break;
case 15:// Okay Empty Bowl
- iUsed.KillTimers();
- ResetPlant(iUsed);
+ if(iUsed.GetTag("PlantStage") == 1)
+ {
+ GatherSeeds(pUser, iUsed);
+ }
CreateDFNItem(pUser.socket, pUser, "emptyplantbowl", 1, "ITEM", true, 0);
iUsed.Delete();
break;
@@ -1308,9 +1282,8 @@ function onGumpPress(socket, button, PlantGump)
CodexOFWisdomPacket(socket, 70);
break;
case 26:
- iUsed.KillTimers();
ResetPlant(iUsed);
- iUsed.RemoveScriptTrigger(scriptID);
+ iUsed.SetTag("PlantStage", 19);//DecorativePlant
socket.CloseGump(gumpID, 0);
socket.SysMessage("You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.");
iUsed.Refresh();
@@ -1321,21 +1294,15 @@ function onGumpPress(socket, button, PlantGump)
function ResetPlant(iUsed)
{
- iUsed.SetTag("infestation", null);
- iUsed.SetTag("fungus", null);
- iUsed.SetTag("poison", null);
- iUsed.SetTag("disease", null);
iUsed.SetTag("water", null);
- iUsed.SetTag("PlantType", null);
- iUsed.SetTag("PlantStage", null);
- iUsed.SetTag("PlantColor", null);
+ iUsed.SetTag("PlantInfo", null);
+ iUsed.SetTag("Potions", null);
+ iUsed.SetTag("Infections", null);
+ iUsed.SetTag("PlantCross", null);
iUsed.SetTag("PlantHealth", null);
iUsed.SetTag("Seeds", null);
- iUsed.SetTag("PlantCross", null);
- iUsed.SetTag("GreaterPoison", null);
- iUsed.SetTag("GreaterCure", null);
- iUsed.SetTag("GreaterHeal", null);
- iUsed.SetTag("GreaterStrength", null);
+ iUsed.RemoveScriptTrigger(scriptID);
+ iUsed.KillTimers();
}
function PollinatePlant(pUser, iUsed)
@@ -1712,7 +1679,6 @@ function CrossPollinateTable(myTarget, iUsed, pSock)
if (cross == 17 && cross2 == 17)//Tribarrel Cactus + Tribarrel Cactus
setcross = 17;//TribarrelCactusSeed
- //pSock.SysMessage("You Set the Seed " + setcross);
myTarget.SetTag("PlantCross", 1 + "," + setcross + "," + 1);
}
@@ -2057,63 +2023,142 @@ function onCallback0(pSock, myTarget)
// Check if the target is an item
if (myTarget.isItem)
{
+
+ 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)
{
- pUser.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
+ pSock.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
return false;
}
- // Define potion types
- var potionTypes = {
- "greaterstrengthpotion": { "type": "GreaterStrength", "button": 10 },
- "0x0F09-b": { "type": "GreaterStrength", "button": 10 },
- "greaterpoisonpotion": { "type": "GreaterPoison", "button": 7 },
- "0x0F0A-c": { "type": "GreaterPoison", "button": 7 },
- "greatercurepotion": { "type": "GreaterCure", "button": 8 },
- "0x0F07-c": { "type": "GreaterCure", "button": 8 },
- "greaterhealpotion": { "type": "GreaterHeal", "button": 9 },
- "0x0F0C-c": { "type": "GreaterHeal", "button": 9 }
- };
-
- // Check if the sectionID is a valid potion type
- var potionInfo = potionTypes[myTarget.sectionID];
- if (potionInfo)
+ var poison = greaterPoison + 1;
+ var cure = greaterCure + 1;
+ var heal = greaterHeal + 1;
+ var strength = greaterStrength + 1;
+ if (buttonPushed == 7)// poison button
{
- // Check if the button pushed matches the potion type
- if (buttonPushed === potionInfo.button)
+ if (myTarget.sectionID == "greaterpoisonpotion" || myTarget.sectionID == "0x0F09-b")
{
- // Increase potion count if within maximum limit
- var potionCount = iUsed.GetTag(potionInfo.type);
- if (potionCount < maxPotionCount)
+
+ if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
+ {
+ pSock.SysMessage("You should only pour potions on a plant or seed!");
+ return false;
+ }
+ if (greaterPoison < maxPotionCount)
{
- iUsed.SetTag(potionInfo.type, potionCount >= 0 ? potionCount + 1 : 1);
- }
+ iUsed.SetTag("Potions", poison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ }
else
{
pUser.SysMessage("The plant is already soaked with this type of potion!");
return false;
}
+ }
+ else
+ {
+ pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ return false;
+ }
+ }
+ else if (buttonPushed == 8)// cure button
+ {
+ if (myTarget.sectionID == "greatercurepotion" || myTarget.sectionID == "0x0F07-c")
+ {
+ if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
+ {
+ pSock.SysMessage("You should only pour potions on a plant or seed!");
+ return false;
+ }
+ if (greaterCure < maxPotionCount) {
+ iUsed.SetTag("Potions", greaterPoison + "," + cure + "," + greaterHeal + "," + greaterStrength);
+ }
+ else {
+ pUser.SysMessage("The plant is already soaked with this type of potion!");
+ return false;
+ }
+ }
+ else {
+ pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ return false;
+ }
+ }
+ else if (buttonPushed == 9)// heal button
+ {
+ if (myTarget.sectionID == "greaterhealpotion" || myTarget.sectionID == "0x0F0C-c")
+ {
+ if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
+ {
+ pSock.SysMessage("You should only pour potions on a plant or seed!");
+ return false;
+ }
- // Call onUseChecked
- onUseChecked(pUser, iUsed);
-
- // Decrease target amount or delete if amount is 1
- if (myTarget.amount > 1)
- myTarget.amount--;
- else
- myTarget.Delete();
+ if (greaterHeal < maxPotionCount) {
+ iUsed.SetTag("Potions", greaterPoison + "," + greaterCure + "," + heal + "," + greaterStrength);
+ }
+ else {
+ pUser.SysMessage("The plant is already soaked with this type of potion!");
+ return false;
+ }
}
else
{
pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ return false;
}
}
- else
+ else if (buttonPushed == 10)// strength button
+ {
+ if (myTarget.sectionID == "greaterstrengthpotion" || myTarget.sectionID == "0x0F09-b")
+ {
+ if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
+ {
+ pSock.SysMessage("You should only pour potions on a plant or seed!");
+ return false;
+ }
+
+ if (greaterStrength < maxPotionCount) {
+ iUsed.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + strength);
+ }
+ else {
+ pUser.SysMessage("The plant is already soaked with this type of potion!");
+ return false;
+ }
+ }
+ else {
+ pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ return false;
+ }
+ }
+ else
{
pUser.SysMessage("You don't have any strong potions of that type in your pack.");
+ return false;
}
+
+ // Call onUseChecked
+ onUseChecked(pUser, iUsed);
+
+ // Decrease target amount or delete if amount is 1
+ if (myTarget.amount > 1)
+ myTarget.amount--;
+ else
+ myTarget.Delete();
}
return false;
}
From aaca08708857de57d0ab2f64bfd167ff9d24a295 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Tue, 12 Mar 2024 19:22:26 -0500
Subject: [PATCH 05/34] more refactoring
More Details on Each function
ToolTip Update to show full status of the plant when mouse over.
applypotion update
Update to PlantImage and PlantBowl
Stage 14 dirt added to all places
Cleanup of tags in some areas for easier managing
Fixed if the plant is not locked down it will not Grow.
---
data/js/item/plant_growing/plantsystem.js | 1326 +++++++++++----------
1 file changed, 676 insertions(+), 650 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index c5ff3704a..a8b6d2ccf 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -1,123 +1,140 @@
const scriptID = 19100;// this is the script id
const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
-function onUseChecked(pUser, iUsed)
+function onUseChecked( pUser, iUsed )
{
var gumpID = scriptID + 0xffff;
var socket = pUser.socket;
socket.tempObj = iUsed;
iUsed.tempObj = socket;
- socket.CloseGump(gumpID, 0);
+ socket.CloseGump( gumpID, 0 );
- PlantBowlGump(pUser, iUsed);
+ var itemPack = GetPackOwner( iUsed, 0 );
+ if(( !itemPack || itemPack != pUser ) && iUsed.movable != 3 )
+ {
+ socket.SysMessage( "You must have the item in your backpack or locked down in order to use it." );
+ return false;
+ }
+ else
+ {
+ PlantBowlGump( pUser, iUsed );
+ }
}
-function onCreateDFN(objMade, objType)
+function onCreateDFN( objMade, objType )
{
- if (objType == 0)
+ // 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 )
{
- var plantInfo = objMade.GetTag("PlantInfo")
+ // Retrieves plant information and stage tags from the object.
+ var plantInfo = objMade.GetTag( "PlantInfo" );
+ var plantStage = objMade.GetTag( "PlantStage" );
- if (!plantInfo)
+ // 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 (objMade.GetTag("PlantStage") != 14 || objMade.GetTag("PlantStage") == null)
+ if( plantStage != 14 || !plantStage )
{
- objMade.SetTag("PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0);
- objMade.SetTag("PlantStage", 14);//dirt bowl
+ // Sets the stage of the object to represent dirt.
+ objMade.SetTag( "PlantStage", 14 );
}
- objMade.SetTag("Potions", 0 + "," + 0 + "," + 0 + "," + 0);
- objMade.SetTag("Infections", 0 + "," + 0 + "," + 0 + "," + 0);
+ // 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)
+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 potionInfo = iUsed.GetTag( "Potions" )
+ var infection = iUsed.GetTag( "Infections" );
+ var waterLevel = iUsed.GetTag( "water" )
- if (!potionInfo || !infection)
+ if( !potionInfo || !infection )
return false;
- var potionLength = potionInfo.split(",");
- var infectionLevels = infection.split(",");
- if (potionLength.length != 4 || infectionLevels.length != 4)
+ var potionLength = potionInfo.split( "," );
+ var infectionLevels = infection.split( "," );
+ if( potionLength.length != 4 || infectionLevels.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(infectionLevels[0], 10);
- var fungusLevel = parseInt(infectionLevels[1], 10);
- var poisonLevel = parseInt(infectionLevels[2], 10);
- var diseaseLevel = parseInt(infectionLevels[3], 10);
+ var greaterPoison = parseInt( potionLength[0] );
+ var greaterCure = parseInt( potionLength[1] );
+ var greaterHeal = parseInt( potionLength[2] );
+ var greaterStrength = parseInt( potionLength[3] );
- DrawBackground(PlantGump);
+ var infestationLevel = parseInt( infectionLevels[0], 10 );
+ var fungusLevel = parseInt( infectionLevels[1], 10 );
+ var poisonLevel = parseInt( infectionLevels[2], 10 );
+ var diseaseLevel = parseInt( infectionLevels[3], 10 );
- DrawPlant(PlantGump, iUsed);
+ DrawBackground( PlantGump );
+ DrawPlant( PlantGump, iUsed );
- PlantGump.AddButton(71, 67, 0xD4, 0xD4, 1, 1, 1); // Reproduction menu
- PlantGump.AddPicture(59, 68, 0xD08);
+ 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, 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, 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, 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( 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, 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, 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, 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, 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.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 (iUsed.GetTag("PlantStage") >= 1)
+ PlantGump.AddGump( 48, 47, 0xD2 );
+ if( iUsed.GetTag( "PlantStage" ) >= 1 && iUsed.GetTag( "PlantStage") <= 9 )
{
- PlantGump.AddText(54, 47, 0x835, iUsed.GetTag("PlantStage").toString());
+ PlantGump.AddText( 54, 47, 0x835, iUsed.GetTag( "PlantStage" ).toString() );
}
- PlantGump.AddGump(232, 47, 0xD2);
- AddGrowthIndicator(PlantGump, iUsed);
+ 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.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();
}
@@ -131,12 +148,12 @@ function DrawBackground( PlantGump )
return;
}
-function AddPlus(PlantGump, x, y, Level)
+function AddPlus( PlantGump, x, y, Level )
{
- if (Level == 1)
- PlantGump.AddText(x, y, 0x35, "+");
- if (Level == 2)
- PlantGump.AddText(x, y, 0x21, "+");
+ if( Level == 1 )
+ PlantGump.AddText( x, y, 0x35, "+" );
+ if( Level == 2 )
+ PlantGump.AddText( x, y, 0x21, "+" );
return;
}
@@ -163,30 +180,30 @@ function AddWaterLevel( PlantGump, x, y, Level )
addPlusMinus = "+";
break;
}
- if ( addPlusMinus != 0 )
+ if( addPlusMinus != 0 )
{
PlantGump.AddText(x, y, addHue, addPlusMinus );
}
return;
}
-function HealthStatus(myPlant)
+function HealthStatus( myPlant )
{
- var status = myPlant.GetTag("PlantStage");
+ var status = myPlant.GetTag( "PlantStage" );
var maxhealth = myPlant.maxhp + status * 2 + 10;
- var health = (myPlant.health / maxhealth) * 100;
+ var health = ( myPlant.health / maxhealth ) * 100;
var plantHealth = 0;
- if (health < 33)
+ if( health < 33 )
{
plantHealth = 10; // Dying
}
- else if (health < 66)
+ else if( health < 66 )
{
plantHealth = 11; // Wilted
}
- else if (health < 100)
+ else if( health < 100 )
{
plantHealth = 12; // Healthy
}
@@ -195,200 +212,205 @@ function HealthStatus(myPlant)
plantHealth = 13; // Vibrant
}
- myPlant.SetTag("PlantHealth", plantHealth);
+ myPlant.SetTag( "PlantHealth", plantHealth );
}
-function PlantDamage(iUsed)
+function PlantDamage( iUsed )
{
- var infection = iUsed.GetTag("Infections");
+ var infection = iUsed.GetTag( "Infections" );
- if (!infection)
+ if( !infection )
return false;
- var infectionLevels = infection.split(",");
- if (infectionLevels.length != 4)
+ var infectionLevels = infection.split( "," );
+ if( infectionLevels.length != 4 )
return false;
var damage = 0;
- for (var i = 0; i < 4; i++)
+ for( var i = 0; i < 4; i++ )
{
- var level = parseInt(infectionLevels[i]);
- if (level > 0)
- damage += level * RandomNumber(3, 6);
+ var level = parseInt(infectionLevels[i] );
+ if( level > 0 )
+ damage += level * RandomNumber( 3, 6 );
}
- var waterLevel = iUsed.GetTag("water");
- if (waterLevel >= 3 || waterLevel <= 1)
+ var waterLevel = iUsed.GetTag( "water" );
+ if( waterLevel >= 3 || waterLevel <= 1 )
{
- damage += Math.abs(2 - waterLevel) * RandomNumber(3, 6);
+ damage += Math.abs( 2 - waterLevel ) * RandomNumber( 3, 6 );
}
// Ensure health doesn't go below 0
- iUsed.health = Math.max(0, iUsed.health - damage);
+ iUsed.health = Math.max( 0, iUsed.health - damage );
}
-function AddGrowthIndicator(PlantGump, iUsed )
+function AddGrowthIndicator( PlantGump, iUsed )
{
- var plantInfo = iUsed.GetTag("PlantInfo")
+ var plantInfo = iUsed.GetTag( "PlantInfo" )
+ var plantStage = iUsed.GetTag( "PlantStage" )
- if (!plantInfo)
+ if( !plantInfo )
{
return false;
}
- var infoLength = plantInfo.split(",");
- if (infoLength.length != 4)
+ var infoLength = plantInfo.split( "," );
+ if( infoLength.length != 4 )
return false;
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
- var fertialeDirt = parseInt(infoLength[3]);
+ var fertialeDirt = parseInt( infoLength[3] );
- if (iUsed.GetTag("PlantStage") >= 1 && iUsed.GetTag("PlantStage") <= 9)
+ if (plantStage >= 1 && plantStage <= 9)
{
- const gi = iUsed.GetTag("PlantHealth");
+ const gi = iUsed.GetTag( "PlantHealth" );
- if (!inValidLocation(iUsed))
+ if( iUsed.movable != 3 )
{
- PlantGump.AddText(239, 47, 0x21, "!");
+ PlantGump.AddText(239, 47, 0x21, "!" );
}
- else if (gi >= 10 && gi <= 11)
+ else if( gi >= 10 && gi <= 11 )
{
- PlantGump.AddText(239, 47, 0x21, "-"); //Not Healthy
+ PlantGump.AddText( 239, 47, 0x21, "-" ); //Not Healthy
}
- //else if(growthdelay)
+ //else if(growthdelay) this takes place on server restart.
//PlantGump.AddText(239, 47, 0x35, "-");// delay
- else if (iUsed.GetTag("PlantStage") == 9)
+ else if( plantStage == 9 )
{
- PlantGump.AddText(239, 47, 0x3, "+"); // Blue + : The plant successfully grew.
+ 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)
+ else if( fertialeDirt == 1 )
{
- PlantGump.AddText(239, 47, 0x3F, "+"); // Double Grown
+ PlantGump.AddText( 239, 47, 0x3F, "+" ); // Double Grown
}
return;
}
}
-function Die(myPlant)
+function Die( myPlant )
{
- if (myPlant.GetTag( "PlantStage" ) >= 9 )
+ // Check if the plant's stage is at its maximum value or beyond (representing a fully grown/dead plant)
+ if( myPlant.GetTag( "PlantStage") >= 9 )
{
- myPlant.SetTag("PlantStage", 20);//dead twigs
- myPlant.id = 0x1B9D;
- myPlant.colour = 0;
- myPlant.name = "twigs";
- ResetPlant(myPlant);
- }
- else
+ // 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
{
- myPlant.id = 0x1602;
- myPlant.colour = 0;
- myPlant.name = "a bowl of dirt";
- myPlant.health = 100;
- 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("Seeds", null);
+ // 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( "Seeds", 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;
+ return; // End the function
}
-function inValidLocation(myPlant)
+function GrowthCheck( myPlant )
{
- if (myPlant.movable != 2 && myPlant.movable != 3)
- {
- return true; // Plant can be placed here
- }
- else
- {
- return false; // Plant cannot be placed here
- }
-}
+ var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
+ var infection = myPlant.GetTag( "Infections" ) || "0,0,0,0";
+ var potionInfo = myPlant.GetTag( "Potions" ) || "0,0,0,0";
+ var plantInfo = myPlant.GetTag( "PlantInfo" ) || "0,0,0,0";
-function GrowthCheck(myPlant) {
- var waterLevel = parseInt(myPlant.GetTag("water"), 10) || 0;
- var infection = myPlant.GetTag("Infections") || "0,0,0,0";
- var potionInfo = myPlant.GetTag("Potions") || "0,0,0,0";
- var plantInfo = myPlant.GetTag("PlantInfo") || "0,0,0,0";
-
- var infoLength = plantInfo.split(",");
- var potionLength = potionInfo.split(",");
- var infectionLength = infection.split(",");
+ var infoLength = plantInfo.split( "," );
+ var potionLength = potionInfo.split( "," );
+ var infectionLength = infection.split( "," );
- if (infoLength.length !== 4 || potionLength.length !== 4 || infectionLength.length !== 4) {
+ if( infoLength.length !== 4 || potionLength.length !== 4 || infectionLength.length !== 4)
+ {
return;
}
- var greaterPoison = parseInt(potionLength[0], 10);
- var greaterCure = parseInt(potionLength[1], 10);
- var greaterHeal = parseInt(potionLength[2], 10);
- var greaterStrength = parseInt(potionLength[3], 10);
+ var greaterPoison = parseInt( potionLength[0], 10 );
+ var greaterCure = parseInt( potionLength[1], 10 );
+ var greaterHeal = parseInt( potionLength[2], 10 );
+ var greaterStrength = parseInt( potionLength[3], 10 );
- var infestationLevel = parseInt(infectionLength[0], 10);
- var fungusLevel = parseInt(infectionLength[1], 10);
- var poisonLevel = parseInt(infectionLength[2], 10);
- var diseaseLevel = parseInt(infectionLength[3], 10);
+ var infestationLevel = parseInt( infectionLength[0], 10 );
+ var fungusLevel = parseInt( infectionLength[1], 10 );
+ var poisonLevel = parseInt( infectionLength[2], 10 );
+ var diseaseLevel = parseInt( infectionLength[3], 10 );
- var plantType = parseInt(infoLength[0], 10);
- var plantColor = parseInt(infoLength[2], 10);
+ var plantType = parseInt( infoLength[0], 10 );
+ var plantColor = parseInt( infoLength[2], 10 );
- var infestationChance = 0.30 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10;
+ var infestationChance = 0.30 - greaterStrength * 0.075 + ( waterLevel - 2 ) * 0.10;
- if ([1, 27, 28, 30].indexOf(plantType) !== -1) {
+ if( [1, 27, 28, 30].indexOf( plantType) !== -1 )
+ {
infestationChance += 0.10;
}
- if ([21, 5, 38, 10, 42, 43].indexOf(plantColor) !== -1) {
+ if( [21, 5, 38, 10, 42, 43].indexOf( plantColor) !== -1 )
+ {
infestationChance += 0.10;
}
- if (infestationChance >= Math.random() && infestationLevel < 2) {
+ if( infestationChance >= Math.random() && infestationLevel < 2 )
+ {
infestationLevel++;
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
- var fungusChance = 0.15 - greaterStrength * 0.075 + (waterLevel - 2) * 0.10;
+ var fungusChance = 0.15 - greaterStrength * 0.075 + ( waterLevel - 2 ) * 0.10;
- if (fungusChance >= Math.random() && fungusLevel < 2) {
+ if( fungusChance >= Math.random() && fungusLevel < 2 )
+ {
fungusLevel++;
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
- if (waterLevel > 0 && (waterLevel >= 2 || 0.9 >= Math.random())) {
+ if( waterLevel > 0 && ( waterLevel >= 2 || 0.9 >= Math.random() ))
+ {
waterLevel--;
- myPlant.SetTag("water", waterLevel);
+ myPlant.SetTag( "water", waterLevel );
}
- if (greaterPoison > 0) {
+ if( greaterPoison > 0 )
+ {
greaterPoison--;
- myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
poisonLevel++;
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
- if (greaterCure > 0) {
+ if( greaterCure > 0 )
+ {
greaterCure--;
- myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
diseaseLevel++;
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
- if (greaterStrength > 0) {
+ if( greaterStrength > 0 )
+ {
greaterStrength--;
- myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
}
}
-
function ApplyPotions(myPlant)
{
var waterLevel = parseInt(myPlant.GetTag("water"), 10) || 0;
@@ -398,7 +420,7 @@ function ApplyPotions(myPlant)
var potionLength = potionInfo.split(",");
var infectionLength = infection.split(",");
- if (potionLength.length !== 4 || infectionLength.length !== 4)
+ if( potionLength.length !== 4 || infectionLength.length !== 4)
return false;
var greaterPoison = parseInt(potionLength[0], 10);
@@ -411,45 +433,58 @@ function ApplyPotions(myPlant)
var poisonLevel = parseInt(infectionLength[2], 10);
var diseaseLevel = parseInt(infectionLength[3], 10);
- if (greaterPoison >= infestationLevel) {
+ if( greaterPoison >= infestationLevel)
+ {
var poison = greaterPoison - infestationLevel;
myPlant.SetTag("Potions", [poison, greaterCure, greaterHeal, greaterStrength].join(","));
myPlant.SetTag("Infections", "0," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
- } else {
+ }
+ else
+ {
myPlant.SetTag("Potions", "0," + greaterCure + "," + greaterHeal + "," + greaterStrength);
var infestation = infestationLevel - greaterPoison;
myPlant.SetTag("Infections", [infestation, fungusLevel, poisonLevel, diseaseLevel].join(","));
}
- if (greaterCure >= fungusLevel) {
+ if( greaterCure >= fungusLevel)
+ {
var cure = greaterCure - fungusLevel;
myPlant.SetTag("Potions", [greaterPoison, cure, greaterHeal, greaterStrength].join(","));
myPlant.SetTag("Infections", infestationLevel + ",0," + poisonLevel + "," + diseaseLevel);
- } else {
+ }
+ else
+ {
myPlant.SetTag("Potions", greaterPoison + ",0," + greaterHeal + "," + greaterStrength);
var fungus = fungusLevel - greaterCure;
myPlant.SetTag("Infections", infestationLevel + "," + fungus + "," + poisonLevel + "," + diseaseLevel);
}
- if (greaterHeal >= poisonLevel) {
+ if( greaterHeal >= poisonLevel)
+ {
var heal = greaterHeal - poisonLevel;
myPlant.SetTag("Potions", [greaterPoison, greaterCure, heal, greaterStrength].join(","));
myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + ",0," + diseaseLevel);
- } else {
+ }
+ else
+ {
myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + ",0," + greaterStrength);
var poison = poisonLevel - greaterHeal;
myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poison + "," + diseaseLevel);
}
- if (infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2) {
- if (greaterHeal > 0) {
+ if( infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2)
+ {
+ if( greaterHeal > 0)
+ {
myPlant.health += greaterHeal * 7;
- } else {
+ } else
+ {
myPlant.health += 2;
}
}
- if (greaterHeal > 0) {
+ if( greaterHeal > 0)
+ {
greaterHeal--;
myPlant.SetTag("Potions", [greaterPoison, greaterCure, greaterHeal, greaterStrength].join(","));
}
@@ -458,7 +493,7 @@ function ApplyPotions(myPlant)
function onTimer( myPlant, timerID )
{
- if ( !ValidateObject( myPlant ))
+ if( !ValidateObject( myPlant ))
return;
var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
@@ -466,14 +501,14 @@ function onTimer( myPlant, timerID )
var CrossedPlants = myPlant.GetTag("PlantCross")
var plantInfo = myPlant.GetTag("PlantInfo")
- if (!CrossedPlants || !Seeds || !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)
+ if( Crossed.length != 3 || Seedlength.length != 3 || infoLength.length != 4)
return false;
var Pollinated = parseInt(Crossed[0]);
@@ -482,33 +517,31 @@ function onTimer( myPlant, timerID )
var availableSeeds = parseInt(Seedlength[0]);
var remainingSeeds = parseInt(Seedlength[1]);
var hueSeeds = parseInt(Seedlength[2]);
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
var fertialeDirt = parseInt(infoLength[3]);
- if (timerID == 1 )
+ if( timerID == 1 )
{
- if (myPlant.health <= 0)
+ if( myPlant.health <= 0)
{
Die(myPlant);
return false;
}
- if (!inValidLocation(myPlant)) // Checks make sure the plant is lockdown
- {
- return;
+ 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( myPlant.GetTag("PlantHealth") != 10 && myPlant.GetTag("PlantHealth") != 11)//wilted or dying
{
- if (fertialeDirt == 1 && stage <= 5)
+ if( fertialeDirt == 1 && stage <= 5)
{
//double growth to stage 5
myPlant.SetTag("PlantStage", stage + 2);
}
- else if (stage < 9)
+ else if( stage < 9)
{
// Continue to the next stage if it does not have fertial dirt
myPlant.SetTag("PlantStage", stage + 1);
@@ -516,7 +549,7 @@ function onTimer( myPlant, timerID )
else
{
//Produce Seeds
- if (remainingSeeds > 0 && Pollinated == 1)
+ if( remainingSeeds > 0 && Pollinated == 1)
{
var rseeds = remainingSeeds - 1;
var aseeds = availableSeeds + 1;
@@ -524,26 +557,26 @@ function onTimer( myPlant, timerID )
}
}
- if (stage >= 2 && stage <= 3)
+ if( stage >= 2 && stage <= 3)
{
myPlant.id = 0x1600;
}
- else if (stage == 9)
+ else if( stage == 9)
{
PlantBowl(myPlant);
}
}
- if (stage >= 9)
+ if( stage >= 9)
{
- if (Pollinated == 0)
+ if( Pollinated == 0)
{
myPlant.SetTag("PlantCross", 1 + "," + SeedBreed + "," + crossAble);
}
}
- ApplyPotions(myPlant)
+ ApplyPotions(myPlant)
HealthStatus(myPlant);
PlantDamage(myPlant);
GrowthCheck(myPlant);
@@ -555,16 +588,18 @@ function onTimer( myPlant, timerID )
function DrawPlant( PlantGump, iUsed )
{
- if( iUsed.GetTag( "PlantStage" ) >= 0 && iUsed.GetTag( "PlantStage") < 9 )
+ if( iUsed.GetTag("PlantStage") >= 0 && iUsed.GetTag("PlantStage") < 9 || iUsed.GetTag("PlantStage") == 14)
{
- PlantGump.AddGump( 110, 85, 0x589 );
-
- PlantGump.AddPicture( 122, 94, 0x914 );
- PlantGump.AddPicture( 135, 94, 0x914 );
- PlantGump.AddPicture( 120, 112, 0x914 );
- PlantGump.AddPicture( 135, 112, 0x914 );
+ PlantGump.AddGump(110, 85, 0x589);
+ if( iUsed.GetTag("PlantStage") <= 14)
+ {
+ PlantGump.AddPicture(122, 94, 0x914);
+ PlantGump.AddPicture(135, 94, 0x914);
+ PlantGump.AddPicture(120, 112, 0x914);
+ PlantGump.AddPicture(135, 112, 0x914);
+ }
- if( iUsed.GetTag( "PlantStage") >= 2 )
+ if( iUsed.GetTag("PlantStage") >= 2 && iUsed.GetTag("PlantStage") < 3)
{
PlantGump.AddPicture( 127, 112, 0xC62 );
}
@@ -572,19 +607,19 @@ function DrawPlant( PlantGump, iUsed )
{
PlantGump.AddPicture(129, 85, 0xC7E);
}
- if( iUsed.GetTag( "PlantStage" ) >= 4 )
+ if( iUsed.GetTag("PlantStage") >= 4 && iUsed.GetTag("PlantStage") < 9)
{
PlantGump.AddPicture( 121, 117, 0xC62 );
PlantGump.AddPicture( 133, 117, 0xC62 );
}
- if( iUsed.GetTag("PlantStage") >= 5)
+ if( iUsed.GetTag("PlantStage") >= 5 && iUsed.GetTag("PlantStage") < 9)
{
PlantGump.AddPicture( 110, 100, 0xC62 );
PlantGump.AddPicture( 140, 100, 0xC62 );
PlantGump.AddPicture( 110, 130, 0xC62 );
PlantGump.AddPicture( 140, 130, 0xC62 );
}
- if( iUsed.GetTag( "PlantStage" ) > 6 )
+ if( iUsed.GetTag("PlantStage") >= 6 && iUsed.GetTag("PlantStage") < 9)
{
PlantGump.AddPicture( 105, 115, 0xC62 );
PlantGump.AddPicture( 145, 115, 0xC62 );
@@ -630,12 +665,11 @@ function PlantImage( PlantGump, iUsed )
{
var plantInfo = iUsed.GetTag("PlantInfo")
- if (!plantInfo) {
+ if( !plantInfo)
return false;
- }
var infoLength = plantInfo.split(",");
- if (infoLength.length != 4)
+ if( infoLength.length != 4)
return false;
var plantType = parseInt(infoLength[0]);
@@ -732,179 +766,179 @@ function PlantImage( PlantGump, iUsed )
var SugarCanes = 9324;
var plantID = 0;
- var plantName = "";
+ var plantNewName = "";
switch (plantType)
{
case 1:
plantID = CampionFlowers;
- plantName = "Campion Flowers";
+ plantNewName = "Campion Flowers";
break;
case 2:
plantID = Poppies;
- plantName = "Poppies";
+ plantNewName = "Poppies";
break;
case 3:
plantID = Snowdrops;
- plantName = "Snowdrops";
+ plantNewName = "Snowdrops";
break;
case 4:
plantID = Bulrushes;
- plantName = "Bulrushes";
+ plantNewName = "Bulrushes";
break;
case 5:
plantID = Lilies;
- plantName = "Lilies";
+ plantNewName = "Lilies";
break;
case 6:
plantID = PampasGrass;
- plantName = "Pampas Grass";
+ plantNewName = "Pampas Grass";
break;
case 7:
plantID = Rushes;
- plantName = "Rushes";
+ plantNewName = "Rushes";
break;
case 8:
plantID = ElephantEarPlant;
- plantName = "Elephant Ear Plant";
+ plantNewName = "Elephant Ear Plant";
break;
case 9:
plantID = Fern;
- plantName = "Fern";
+ plantNewName = "Fern";
break;
case 10:
plantID = PonytailPalm;
- plantName = "Ponytail Palm";
+ plantNewName = "Ponytail Palm";
break;
case 11:
plantID = SmallPalm;
- plantName = "Small Palm";
+ plantNewName = "Small Palm";
break;
case 12:
plantID = CenturyPlant;
- plantName = "Century Plant";
+ plantNewName = "Century Plant";
break;
case 13:
plantID = WaterPlant;
- plantName = "Water Plant";
+ plantNewName = "Water Plant";
break;
case 14:
plantID = SnakePlant;
- plantName = "Snake Plant";
+ plantNewName = "Snake Plant";
break;
case 15:
plantID = PricklyPearCactus;
- plantName = "Prickly Pear Cactus";
+ plantNewName = "Prickly Pear Cactus";
break;
case 16:
plantID = BarrelCactus;
- plantName = "Barrel Cactus";
+ plantNewName = "Barrel Cactus";
break;
case 17:
plantID = TribarrelCactus;
- plantName = "Tribarrel Cactus";
+ plantNewName = "Tribarrel Cactus";
break;
case 18:
plantID = CommonGreenBonsai;
- plantName = "Common Green Bonsai";
+ plantNewName = "Common Green Bonsai";
break;
case 19:
plantID = CommonPinkBonsai;
- plantName = "Common Pink Bonsai";
+ plantNewName = "Common Pink Bonsai";
break;
case 20:
plantID = UncommonGreenBonsai;
- plantName = "Uncommon Green Bonsai";
+ plantNewName = "Uncommon Green Bonsai";
break;
case 21:
plantID = UncommonPinkBonsai;
- plantName = "Uncommon Pink Bonsai";
+ plantNewName = "Uncommon Pink Bonsai";
break;
case 22:
plantID = RareGreenBonsai;
- plantName = "Rare Green Bonsai";
+ plantNewName = "Rare Green Bonsai";
break;
case 23:
plantID = RarePinkBonsai;
- plantName = "Rare Pink Bonsai";
+ plantNewName = "Rare Pink Bonsai";
break;
case 24:
plantID = ExceptionalBonsai;
- plantName = "Exceptional Bonsai";
+ plantNewName = "Exceptional Bonsai";
break;
case 25:
plantID = ExoticBonsai;
- plantName = "Exotic Bonsai";
+ plantNewName = "Exotic Bonsai";
break;
case 26:
plantID = Cactus;
- plantName = "Cactus";
+ plantNewName = "Cactus";
break;
case 27:
plantID = FlaxFlowers;
- plantName = "Flax Flowers";
+ plantNewName = "Flax Flowers";
break;
case 28:
plantID = FoxgloveFlowers;
- plantName = "Foxglove Flowers";
+ plantNewName = "Foxglove Flowers";
break;
case 29:
plantID = HopsEast;
- plantName = "Hops East";
+ plantNewName = "Hops East";
break;
case 30:
plantID = OrfluerFlowers;
- plantName = "Orfluer Flowers";
+ plantNewName = "Orfluer Flowers";
break;
case 31:
plantID = CypressTwisted;
- plantName = "Cypress Twisted";
+ plantNewName = "Cypress Twisted";
break;
case 32:
plantID = HedgeShort;
- plantName = "Hedge Short";
+ plantNewName = "Hedge Short";
break;
case 33:
plantID = JuniperBush;
- plantName = "Juniper Bush";
+ plantNewName = "Juniper Bush";
break;
case 34:
plantID = SnowdropPatch;
- plantName = "Snowdrop Patch";
+ plantNewName = "Snowdrop Patch";
break;
case 35:
plantID = Cattails;
- plantName = "Cattails";
+ plantNewName = "Cattails";
break;
case 36:
plantID = PoppyPatch;
- plantName = "Poppy Patch";
+ plantNewName = "Poppy Patch";
break;
case 37:
plantID = SpiderTree;
- plantName = "Spider Tree";
+ plantNewName = "Spider Tree";
break;
case 38:
plantID = WaterLily;
- plantName = "Water Lily";
+ plantNewName = "Water Lily";
break;
case 39:
plantID = CypressStraight;
- plantName = "Cypress Straight";
+ plantNewName = "Cypress Straight";
break;
case 40:
plantID = HedgeTall;
- plantName = "Hedge Tall";
+ plantNewName = "Hedge Tall";
break;
case 41:
plantID = HopsSouth;
- plantName = "Hops South";
+ plantNewName = "Hops South";
break;
case 42:
plantID = SugarCanes;
- plantName = "Sugar Canes";
+ plantNewName = "Sugar Canes";
break;
}
- if ( plantID == CypressTwisted || plantID == CypressStraight)
+ 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 );
}
@@ -912,7 +946,7 @@ function PlantImage( PlantGump, iUsed )
{
PlantGump.AddPictureColor( 130 + plantArray[plantID][0], 96 + plantArray[plantID][1], plantID, plantColor );
}
- iUsed.Refresh();
+ iUsed.SetTag("PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt);
return;
}
@@ -920,12 +954,12 @@ function PlantBowl( iUsed )
{
var plantInfo = iUsed.GetTag("PlantInfo")
- if (!plantInfo) {
+ if( !plantInfo) {
return false;
}
var infoLength = plantInfo.split(",");
- if (infoLength.length != 4)
+ if( infoLength.length != 4)
return false;
var plantType = parseInt(infoLength[0]);
@@ -977,183 +1011,185 @@ function PlantBowl( iUsed )
var SugarCanes = 9324;
var plantID = 0;
- var plantName = "";
+ var plantNewName = "";
switch(plantType)
{
case 1:
plantID = CampionFlowers;
- plantName = "Campion Flowers";
+ plantNewName = "Campion Flowers";
break;
case 2:
plantID = Poppies;
- plantName = "Poppies";
+ plantNewName = "Poppies";
break;
case 3:
plantID = Snowdrops;
- plantName = "Snowdrops";
+ plantNewName = "Snowdrops";
break;
case 4:
plantID = Bulrushes;
- plantName = "Bulrushes";
+ plantNewName = "Bulrushes";
break;
case 5:
plantID = Lilies;
- plantName = "Lilies";
+ plantNewName = "Lilies";
break;
case 6:
plantID = PampasGrass;
- plantName = "Pampas Grass";
+ plantNewName = "Pampas Grass";
break;
case 7:
plantID = Rushes;
- plantName = "Rushes";
+ plantNewName = "Rushes";
break;
case 8:
plantID = ElephantEarPlant;
- plantName = "Elephant Ear Plant";
+ plantNewName = "Elephant Ear Plant";
break;
case 9:
plantID = Fern;
- plantName = "Fern";
+ plantNewName = "Fern";
break;
case 10:
plantID = PonytailPalm;
- plantName = "Ponytail Palm";
+ plantNewName = "Ponytail Palm";
break;
case 11:
plantID = SmallPalm;
- plantName = "Small Palm";
+ plantNewName = "Small Palm";
break;
case 12:
plantID = CenturyPlant;
- plantName = "Century Plant";
+ plantNewName = "Century Plant";
break;
case 13:
plantID = WaterPlant;
- plantName = "Water Plant";
+ plantNewName = "Water Plant";
break;
case 14:
plantID = SnakePlant;
- plantName = "Snake Plant";
+ plantNewName = "Snake Plant";
break;
case 15:
plantID = PricklyPearCactus;
- plantName = "Prickly Pear Cactus";
+ plantNewName = "Prickly Pear Cactus";
break;
case 16:
plantID = BarrelCactus;
- plantName = "Barrel Cactus";
+ plantNewName = "Barrel Cactus";
break;
case 17:
plantID = TribarrelCactus;
- plantName = "Tribarrel Cactus";
+ plantNewName = "Tribarrel Cactus";
break;
case 18:
plantID = CommonGreenBonsai;
- plantName = "Common Green Bonsai";
+ plantNewName = "Common Green Bonsai";
break;
case 19:
plantID = CommonPinkBonsai;
- plantName = "Common Pink Bonsai";
+ plantNewName = "Common Pink Bonsai";
break;
case 20:
plantID = UncommonGreenBonsai;
- plantName = "Uncommon Green Bonsai";
+ plantNewName = "Uncommon Green Bonsai";
break;
case 21:
plantID = UncommonPinkBonsai;
- plantName = "Uncommon Pink Bonsai";
+ plantNewName = "Uncommon Pink Bonsai";
break;
case 22:
plantID = RareGreenBonsai;
- plantName = "Rare Green Bonsai";
+ plantNewName = "Rare Green Bonsai";
break;
case 23:
plantID = RarePinkBonsai;
- plantName = "Rare Pink Bonsai";
+ plantNewName = "Rare Pink Bonsai";
break;
case 24:
plantID = ExceptionalBonsai;
- plantName = "Exceptional Bonsai";
+ plantNewName = "Exceptional Bonsai";
break;
case 25:
plantID = ExoticBonsai;
- plantName = "Exotic Bonsai";
+ plantNewName = "Exotic Bonsai";
break;
case 26:
plantID = Cactus;
- plantName = "Cactus";
+ plantNewName = "Cactus";
break;
case 27:
plantID = FlaxFlowers;
- plantName = "Flax Flowers";
+ plantNewName = "Flax Flowers";
break;
case 28:
plantID = FoxgloveFlowers;
- plantName = "Foxglove Flowers";
+ plantNewName = "Foxglove Flowers";
break;
case 29:
plantID = HopsEast;
- plantName = "Hops East";
+ plantNewName = "Hops East";
break;
case 30:
plantID = OrfluerFlowers;
- plantName = "Orfluer Flowers";
+ plantNewName = "Orfluer Flowers";
break;
case 31:
plantID = CypressTwisted;
- plantName = "Cypress Twisted";
+ plantNewName = "Cypress Twisted";
break;
case 32:
plantID = HedgeShort;
- plantName = "Hedge Short";
+ plantNewName = "Hedge Short";
break;
case 33:
plantID = JuniperBush;
- plantName = "Juniper Bush";
+ plantNewName = "Juniper Bush";
break;
case 34:
plantID = SnowdropPatch;
- plantName = "Snowdrop Patch";
+ plantNewName = "Snowdrop Patch";
break;
case 35:
plantID = Cattails;
- plantName = "Cattails";
+ plantNewName = "Cattails";
break;
case 36:
plantID = PoppyPatch;
- plantName = "Poppy Patch";
+ plantNewName = "Poppy Patch";
break;
case 37:
plantID = SpiderTree;
- plantName = "Spider Tree";
+ plantNewName = "Spider Tree";
break;
case 38:
plantID = WaterLily;
- plantName = "Water Lily";
+ plantNewName = "Water Lily";
break;
case 39:
plantID = CypressStraight;
- plantName = "Cypress Straight";
+ plantNewName = "Cypress Straight";
break;
case 40:
plantID = HedgeTall;
- plantName = "Hedge Tall";
+ plantNewName = "Hedge Tall";
break;
case 41:
plantID = HopsSouth;
- plantName = "Hops South";
+ plantNewName = "Hops South";
break;
case 42:
plantID = SugarCanes;
- plantName = "Sugar Canes";
+ plantNewName = "Sugar Canes";
break;
}
iUsed.id = plantID;
- iUsed.name = plantName;
+ iUsed.name = plantNewName;
iUsed.movable = 1;
iUsed.colour = plantColor;
+ iUsed.SetTag("PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt);
+ iUsed.Refresh();
}
function CodexOFWisdomPacket(socket, topicID)
@@ -1181,7 +1217,7 @@ function onGumpPress(socket, button, PlantGump)
socket.CloseGump( gumpID, 0 );
break;// abort and do nothing
case 1:// Reproduction menu
- if (iUsed.GetTag("PlantStage") >= 1)
+ if( iUsed.GetTag("PlantStage") >= 1)
{
ReproductionGump(pUser, iUsed);
}
@@ -1282,10 +1318,10 @@ function onGumpPress(socket, button, PlantGump)
CodexOFWisdomPacket(socket, 70);
break;
case 26:
- ResetPlant(iUsed);
iUsed.SetTag("PlantStage", 19);//DecorativePlant
socket.CloseGump(gumpID, 0);
socket.SysMessage("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;
@@ -1312,17 +1348,17 @@ function PollinatePlant(pUser, iUsed)
var status = iUsed.GetTag("PlantStage");
var CrossedPlants = iUsed.GetTag("PlantCross")
- if (!CrossedPlants)
+ if( !CrossedPlants)
{
pSock.SysMessage("You cannot gather pollen from a mutated plant!");
return false;
}
- else if (status < 7)
+ else if( status < 7)
{
socket.SysMessage("Too early to gather pollen");
return false;
}
- else if (iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
{
socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
return false;
@@ -1338,22 +1374,22 @@ function onCallback1(pSock, myTarget)
var status = iUsed.GetTag("PlantStage");
var iCrossedPlants = iUsed.GetTag("PlantCross")
- if (!iCrossedPlants)
+ if( !iCrossedPlants)
{
pSock.SysMessage("You cannot gather pollen from a mutated plant!");
return false;
}
- if (status < 7)
+ if( status < 7)
{
pSock.SysMessage("Too early to gather pollen");
return false;
}
- else if (iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
{
pSock.SysMessage("You cannot gather pollen from an unhealthy plant!");
return false;
}
- else if (status > 7 && status < 9)
+ else if( status > 7 && status < 9)
{
pSock.SysMessage("You can only pollinate other specially grown plants!");
return false;
@@ -1363,45 +1399,45 @@ function onCallback1(pSock, myTarget)
var tstatus = myTarget.GetTag("PlantStage");
var tCrossedPlants = myTarget.GetTag("PlantCross")
- if (!tCrossedPlants)
+ if( !tCrossedPlants)
{
pSock.SysMessage("You cannot gather pollen from a mutated plant!");
return false;
}
var Crossed = tCrossedPlants.split(",");
- if (Crossed.length != 3)
+ if( Crossed.length != 3)
return false;
var Pollinated = parseInt(Crossed[0]);
var SeedBreed = parseInt(Crossed[1]);
var crossAble = parseInt(Crossed[2]);
- if (tstatus < 7)
+ if( tstatus < 7)
{
pSock.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
return false;
}
- else if (myTarget.GetTag("PlantHealth") == 10 && myTarget.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( myTarget.GetTag("PlantHealth") == 10 && myTarget.GetTag("PlantHealth") == 11)//wilted or dying
{
pSock.SysMessage("You cannot pollinate an unhealthy plant!");
return false;
}
- else if (tstatus > 7 && tstatus < 9)
+ else if( tstatus > 7 && tstatus < 9)
{
pSock.SysMessage("You can only pollinate other specially grown plants!");
return false;
}
- else if (crossAble == 0)
+ else if( crossAble == 0)
{
pSock.SysMessage("You cannot cross-pollinate with a mutated plant!");
return false;
}
- else if (Pollinated == 1)
+ else if( Pollinated == 1)
{
pSock.SysMessage("This plant has already been pollinated!");
}
- else if (myTarget == iUsed)
+ else if( myTarget == iUsed)
{
CrossPollinateTable(myTarget, iUsed, pSock);
SeedColorsSet(myTarget, iUsed);
@@ -1421,14 +1457,14 @@ function CrossPollinateTable(myTarget, iUsed, pSock)
var iinfo = iUsed.GetTag("PlantInfo")
var tinfo = myTarget.GetTag("PlantInfo");
- if (!iinfo || !tinfo)
+ if( !iinfo || !tinfo)
{
return false;
}
var icrossLength = iinfo.split(",");
var tcrossLength = tinfo.split(",");
- if (icrossLength.length != 4 || tcrossLength.length != 4)
+ if( icrossLength.length != 4 || tcrossLength.length != 4)
return false;
var cross = parseInt(icrossLength[0]);
@@ -1436,247 +1472,247 @@ function CrossPollinateTable(myTarget, iUsed, pSock)
var setcross = 0;
- if (cross == 1 && cross2 == 1)
+ if( cross == 1 && cross2 == 1)
setcross = 1; // CampionFlowerSeed
- if (cross == 2 && cross2 == 2)//Poppies + Poppies
+ if( cross == 2 && cross2 == 2)//Poppies + Poppies
setcross = 2;// PoppieSeed
- if (cross == 1 && cross2 == 3)//Campion Flowers + Snowdrops
+ if( cross == 1 && cross2 == 3)//Campion Flowers + Snowdrops
setcross = 2;// PoppieSeed
- if (cross == 3 && cross2 == 3)//Snowdrops + Snowdrops
+ if( cross == 3 && cross2 == 3)//Snowdrops + Snowdrops
setcross = 3;//SnowdropSeed
- if (cross == 2 && cross2 == 4)//Poppies + Bulrushes
+ if( cross == 2 && cross2 == 4)//Poppies + Bulrushes
setcross = 3;//SnowdropSeed
- if (cross == 1 && cross2 == 5)//Campion Flowers + Lilies
+ if( cross == 1 && cross2 == 5)//Campion Flowers + Lilies
setcross = 3;//SnowdropSeed
- if (cross == 4 && cross2 == 4)//Bulrushes + Bulrushes
+ if( cross == 4 && cross2 == 4)//Bulrushes + Bulrushes
setcross = 4;//BulrusheSeed
- if (cross == 3 && cross2 == 5)//Snowdrops + Lilies
+ if( cross == 3 && cross2 == 5)//Snowdrops + Lilies
setcross = 4;//BulrusheSeed
- if (cross == 2 && cross2 == 6)//Poppies + Pampas Grass
+ if( cross == 2 && cross2 == 6)//Poppies + Pampas Grass
setcross = 4;//BulrusheSeed
- if (cross == 1 && cross2 == 7)//Campion Flowers + Rushes
+ if( cross == 1 && cross2 == 7)//Campion Flowers + Rushes
setcross = 4;//BulrusheSeed
- if (cross == 5 && cross2 == 5)//Lilies + Lilies
+ if( cross == 5 && cross2 == 5)//Lilies + Lilies
setcross = 5;//LilieSeed
- if (cross == 4 && cross2 == 6)//Bulrushes + Pampas Grass
+ if( cross == 4 && cross2 == 6)//Bulrushes + Pampas Grass
setcross = 5;//LilieSeed
- if (cross == 3 && cross2 == 7)//Snowdrops + Rushes
+ if( cross == 3 && cross2 == 7)//Snowdrops + Rushes
setcross = 5;//LilieSeed
- if (cross == 2 && cross2 == 8)//Poppies + Elephant Ear Plant
+ if( cross == 2 && cross2 == 8)//Poppies + Elephant Ear Plant
setcross = 5;//LilieSeed
- if (cross == 1 && cross2 == 9)//Campion Flowers + Fern
+ if( cross == 1 && cross2 == 9)//Campion Flowers + Fern
setcross = 5;//LilieSeed
- if (cross == 6 && cross2 == 6)//Pampas Grass + Pampas Grass
+ if( cross == 6 && cross2 == 6)//Pampas Grass + Pampas Grass
setcross = 6;//PampasGrassSeed
- if (cross == 5 && cross2 == 7)//Lilies + Rushes
+ if( cross == 5 && cross2 == 7)//Lilies + Rushes
setcross = 6;//PampasGrassSeed
- if (cross == 4 && cross2 == 8)//Bulrushes + Elephant Ear Plant
+ if( cross == 4 && cross2 == 8)//Bulrushes + Elephant Ear Plant
setcross = 6;//PampasGrassSeed
- if (cross == 3 && cross2 == 9)//Snowdrops + Fern
+ if( cross == 3 && cross2 == 9)//Snowdrops + Fern
setcross = 6;//PampasGrassSeed
- if (cross == 2 && cross2 == 10)//Poppies + Ponytail Palm
+ if( cross == 2 && cross2 == 10)//Poppies + Ponytail Palm
setcross = 6;//PampasGrassSeed
- if (cross == 1 && cross2 == 11)//Campion Flowers + Small Palm
+ if( cross == 1 && cross2 == 11)//Campion Flowers + Small Palm
setcross = 6;//PampasGrassSeed
- if (cross == 7 && cross2 == 7)//Rushes + Rushes
+ if( cross == 7 && cross2 == 7)//Rushes + Rushes
setcross = 7;//RusheSeed
- if (cross == 6 && cross2 == 8)//Pampas Grass + Elephant Ear Plant
+ if( cross == 6 && cross2 == 8)//Pampas Grass + Elephant Ear Plant
setcross = 7;//RusheSeed
- if (cross == 5 && cross2 == 9)//Lilies + Fern
+ if( cross == 5 && cross2 == 9)//Lilies + Fern
setcross = 7;//RusheSeed
- if (cross == 4 && cross2 == 10)//Bulrushes + Ponytail Palm
+ if( cross == 4 && cross2 == 10)//Bulrushes + Ponytail Palm
setcross = 7;//RusheSeed
- if (cross == 3 && cross2 == 11)//Snowdrops + Small Palm
+ if( cross == 3 && cross2 == 11)//Snowdrops + Small Palm
setcross = 7;//RusheSeed
- if (cross == 2 && cross2 == 12)//Poppies + Century Plant
+ if( cross == 2 && cross2 == 12)//Poppies + Century Plant
setcross = 7;//RusheSeed
- if (cross == 1 && cross2 == 13)//Campion Flowers + Water Plants
+ if( cross == 1 && cross2 == 13)//Campion Flowers + Water Plants
setcross = 7;//RusheSeed
- if (cross == 8 && cross2 == 8)//Elephant Ear Plant + Elephant Ear Plant
+ if( cross == 8 && cross2 == 8)//Elephant Ear Plant + Elephant Ear Plant
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 7 && cross2 == 9)//Rushes + Fern
+ if( cross == 7 && cross2 == 9)//Rushes + Fern
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 6 && cross2 == 10)//Pampas Grass + Ponytail Palm
+ if( cross == 6 && cross2 == 10)//Pampas Grass + Ponytail Palm
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 5 && cross2 == 11)//Lilies + Small Palm
+ if( cross == 5 && cross2 == 11)//Lilies + Small Palm
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 4 && cross2 == 12)//Bulrushes + Century Plant
+ if( cross == 4 && cross2 == 12)//Bulrushes + Century Plant
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 3 && cross2 == 13)//Snowdrops + Water Plants
+ if( cross == 3 && cross2 == 13)//Snowdrops + Water Plants
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 2 && cross2 == 14)//Poppies + Snake Plant
+ if( cross == 2 && cross2 == 14)//Poppies + Snake Plant
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 1 && cross2 == 15)//Campion Flowers + Prickly Pear Cactus
+ if( cross == 1 && cross2 == 15)//Campion Flowers + Prickly Pear Cactus
setcross = 8;//ElephantEarPlantrSeed
- if (cross == 9 && cross2 == 9)//Fern + Fern
+ if( cross == 9 && cross2 == 9)//Fern + Fern
setcross = 9;//FernSeed
- if (cross == 8 && cross2 == 10)//Elephant Ear Plant + Ponytail Palm
+ if( cross == 8 && cross2 == 10)//Elephant Ear Plant + Ponytail Palm
setcross = 9;//FernSeed
- if (cross == 7 && cross2 == 11)//Rushes + Small Palm
+ if( cross == 7 && cross2 == 11)//Rushes + Small Palm
setcross = 9;//FernSeed
- if (cross == 6 && cross2 == 12)//Pampas Grass + Century Plant
+ if( cross == 6 && cross2 == 12)//Pampas Grass + Century Plant
setcross = 9;//FernSeed
- if (cross == 5 && cross2 == 13)//Lilies + Water Plants
+ if( cross == 5 && cross2 == 13)//Lilies + Water Plants
setcross = 9;//FernSeed
- if (cross == 4 && cross2 == 14)//Bulrushes + Snake Plant
+ if( cross == 4 && cross2 == 14)//Bulrushes + Snake Plant
setcross = 9;//FernSeed
- if (cross == 3 && cross2 == 15)//Snowdrops + Prickly Pear Cactus
+ if( cross == 3 && cross2 == 15)//Snowdrops + Prickly Pear Cactus
setcross = 9;//FernSeed
- if (cross == 2 && cross2 == 16)//Poppies + Barrel Cactus
+ if( cross == 2 && cross2 == 16)//Poppies + Barrel Cactus
setcross = 9;//FernSeed
- if (cross == 1 && cross2 == 17)//Campion Flowers + Tribarrel Cactus
+ if( cross == 1 && cross2 == 17)//Campion Flowers + Tribarrel Cactus
setcross = 9;//FernSeed
- if (cross == 10 && cross2 == 10)//Ponytail Palm + Ponytail Palm
+ if( cross == 10 && cross2 == 10)//Ponytail Palm + Ponytail Palm
setcross = 10;//PonytailPalmSeed
- if (cross == 9 && cross2 == 11)//Fern + Small Palm
+ if( cross == 9 && cross2 == 11)//Fern + Small Palm
setcross = 10;//PonytailPalmSeed
- if (cross == 8 && cross2 == 12)//Elephant Ear Plant + Century Plant
+ if( cross == 8 && cross2 == 12)//Elephant Ear Plant + Century Plant
setcross = 10;//PonytailPalmSeed
- if (cross == 7 && cross2 == 13)//Rushes + Water Plants
+ if( cross == 7 && cross2 == 13)//Rushes + Water Plants
setcross = 10;//PonytailPalmSeed
- if (cross == 6 && cross2 == 14)//Pampas Grass + Snake Plant
+ if( cross == 6 && cross2 == 14)//Pampas Grass + Snake Plant
setcross = 10;//PonytailPalmSeed
- if (cross == 5 && cross2 == 15)//Lilies + Prickly Pear Cactus
+ if( cross == 5 && cross2 == 15)//Lilies + Prickly Pear Cactus
setcross = 10;//PonytailPalmSeed
- if (cross == 4 && cross2 == 16)//Bulrushes + Barrel Cactus
+ if( cross == 4 && cross2 == 16)//Bulrushes + Barrel Cactus
setcross = 10;//PonytailPalmSeed
- if (cross == 3 && cross2 == 17)//Snowdrops + Tribarrel Cactus
+ if( cross == 3 && cross2 == 17)//Snowdrops + Tribarrel Cactus
setcross = 10;//PonytailPalmSeed
- if (cross == 11 && cross2 == 11)//Small Palm + Small Palm
+ if( cross == 11 && cross2 == 11)//Small Palm + Small Palm
setcross = 11;//SmallPalmSeed
- if (cross == 10 && cross2 == 12)//Ponytail Palm + Century Plant
+ if( cross == 10 && cross2 == 12)//Ponytail Palm + Century Plant
setcross = 11;//SmallPalmSeed
- if (cross == 9 && cross2 == 13)//Fern + Water Plants
+ if( cross == 9 && cross2 == 13)//Fern + Water Plants
setcross = 11;//SmallPalmSeed
- if (cross == 8 && cross2 == 14)//Elephant Ear Plant + Snake Plant
+ if( cross == 8 && cross2 == 14)//Elephant Ear Plant + Snake Plant
setcross = 11;//SmallPalmSeed
- if (cross == 7 && cross2 == 15)//Rushes + Prickly Pear Cactus
+ if( cross == 7 && cross2 == 15)//Rushes + Prickly Pear Cactus
setcross = 11;//SmallPalmSeed
- if (cross == 6 && cross2 == 16)//Pampas Grass + Barrel Cactus
+ if( cross == 6 && cross2 == 16)//Pampas Grass + Barrel Cactus
setcross = 11;//SmallPalmSeed
- if (cross == 5 && cross2 == 17)//Lilies + Tribarrel Cactus
+ if( cross == 5 && cross2 == 17)//Lilies + Tribarrel Cactus
setcross = 11;//SmallPalmSeed
- if (cross == 12 && cross2 == 12)//Century Plant + Century Plant
+ if( cross == 12 && cross2 == 12)//Century Plant + Century Plant
setcross = 12;//CenturyPlantSeed
- if (cross == 11 && cross2 == 13)//Small Palm + Water Plants
+ if( cross == 11 && cross2 == 13)//Small Palm + Water Plants
setcross = 12;//CenturyPlantSeed
- if (cross == 10 && cross2 == 14)//Ponytail Palm + Snake Plant
+ if( cross == 10 && cross2 == 14)//Ponytail Palm + Snake Plant
setcross = 12;//CenturyPlantSeed
- if (cross == 9 && cross2 == 15)//Fern + Prickly Pear Cactus
+ if( cross == 9 && cross2 == 15)//Fern + Prickly Pear Cactus
setcross = 12;//CenturyPlantSeed
- if (cross == 8 && cross2 == 16)//Elephant Ear Plant + Barrel Cactus
+ if( cross == 8 && cross2 == 16)//Elephant Ear Plant + Barrel Cactus
setcross = 12;//CenturyPlantSeed
- if (cross == 7 && cross2 == 17)//Rushes + Tribarrel Cactus
+ if( cross == 7 && cross2 == 17)//Rushes + Tribarrel Cactus
setcross = 12;//CenturyPlantSeed
- if (cross == 13 && cross2 == 13)//Water Plants + Water Plants
+ if( cross == 13 && cross2 == 13)//Water Plants + Water Plants
setcross = 13;//WaterPlantSeed
- if (cross == 12 && cross2 == 14)//Century Plant + Snake Plant
+ if( cross == 12 && cross2 == 14)//Century Plant + Snake Plant
setcross = 13;//WaterPlantSeed
- if (cross == 11 && cross2 == 15)//Small Palm + Prickly Pear Cactus
+ if( cross == 11 && cross2 == 15)//Small Palm + Prickly Pear Cactus
setcross = 13;//WaterPlantSeed
- if (cross == 10 && cross2 == 16)//Ponytail Palm + Barrel Cactus
+ if( cross == 10 && cross2 == 16)//Ponytail Palm + Barrel Cactus
setcross = 13;//WaterPlantSeed
- if (cross == 9 && cross2 == 17)//Fern + Tribarrel Cactus
+ if( cross == 9 && cross2 == 17)//Fern + Tribarrel Cactus
setcross = 13;//WaterPlantSeed
- if (cross == 14 && cross2 == 14)//Snake Plant + Snake Plant
+ if( cross == 14 && cross2 == 14)//Snake Plant + Snake Plant
setcross = 14;//SnakePlantSeed
- if (cross == 13 && cross2 == 15)//Water Plants + Prickly Pear Cactus
+ if( cross == 13 && cross2 == 15)//Water Plants + Prickly Pear Cactus
setcross = 14;//SnakePlantSeed
- if (cross == 12 && cross2 == 16)//Century Plant + Barrel Cactus
+ if( cross == 12 && cross2 == 16)//Century Plant + Barrel Cactus
setcross = 14;//SnakePlantSeed
- if (cross == 11 && cross2 == 17)//Small Palm + Tribarrel Cactus
+ if( cross == 11 && cross2 == 17)//Small Palm + Tribarrel Cactus
setcross = 14;//SnakePlantSeed
- if (cross == 15 && cross2 == 15)//Prickly Pear Cactus + Prickly Pear Cactus
+ if( cross == 15 && cross2 == 15)//Prickly Pear Cactus + Prickly Pear Cactus
setcross = 15;//PricklyPearCactusSeed
- if (cross == 14 && cross2 == 16)//Snake Plant + Barrel Cactus
+ if( cross == 14 && cross2 == 16)//Snake Plant + Barrel Cactus
setcross = 15;//PricklyPearCactusSeed
- if (cross == 13 && cross2 == 17)//Water Plants + Tribarrel Cactus
+ if( cross == 13 && cross2 == 17)//Water Plants + Tribarrel Cactus
setcross = 15;//PricklyPearCactusSeed
- if (cross == 16 && cross2 == 16)//Barrel Cactus + Barrel Cactus
+ if( cross == 16 && cross2 == 16)//Barrel Cactus + Barrel Cactus
setcross = 16;//BarrelCactusSeed
- if (cross == 15 && cross2 == 17)//Prickly Pear Cactus + Tribarrel Cactus
+ if( cross == 15 && cross2 == 17)//Prickly Pear Cactus + Tribarrel Cactus
setcross = 16;//BarrelCactusSeed
- if (cross == 17 && cross2 == 17)//Tribarrel Cactus + Tribarrel Cactus
+ if( cross == 17 && cross2 == 17)//Tribarrel Cactus + Tribarrel Cactus
setcross = 17;//TribarrelCactusSeed
myTarget.SetTag("PlantCross", 1 + "," + setcross + "," + 1);
@@ -1688,14 +1724,14 @@ function SeedColorsSet(myTarget, iUsed)
var plantInfo = iUsed.GetTag("PlantInfo")
var tplantInfo = myTarget.GetTag("PlantInfo")
- if (!Seeds || !plantInfo || !tplantInfo)
+ 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)
+ if( Seedlength.length != 3 || infoLength.length != 4 || tinfoLength.length != 4)
return false;
var iplantColor = parseInt(infoLength[2]);
@@ -1792,13 +1828,13 @@ function GatherSeeds(pUser, iUsed)
var Seeds = iUsed.GetTag("Seeds")
- if (!Seeds)
+ if( !Seeds)
{
return false;
}
var Seedlength = Seeds.split(",");
- if (Seedlength.length != 3)
+ if( Seedlength.length != 3)
return false;
var availableSeeds = parseInt(Seedlength[0]);
@@ -1810,7 +1846,7 @@ function GatherSeeds(pUser, iUsed)
var SeedBreed = parseInt(CrossedPlants[1]);
var crossAble = parseInt(Crossed[2]);
- if (availableSeeds == 0)
+ if( availableSeeds == 0)
{
socket.SysMessage("This plant has no seeds to gather!");
}
@@ -1946,13 +1982,13 @@ function GatherSeeds(pUser, iUsed)
seedType = "SugarCanes";
break;
}
- if (seedType != null)
+ if( seedType != null)
{
CreateDFNItem(pUser.socket, pUser, seedType, 1, "ITEM", true, hueSeeds);
socket.SysMessage("You gather seeds from the plant.")
- if (availableSeeds > 0)
+ if( availableSeeds > 0)
{
var rseeds = availableSeeds - 1;
iUsed.SetTag("Seeds", rseeds + "," + remainingSeeds + "," + hueSeeds);
@@ -1983,7 +2019,7 @@ function EmptyBowlGump(pUser, iUsed)
EmptyBowlGump.AddGump(140, 102, 0x15E1);
EmptyBowlGump.AddPicture(160, 100, 0x15FD);
- if (iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantStage") < 2 ) //BowlOfDirt
+ if( iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantStage") < 2 ) //BowlOfDirt
EmptyBowlGump.AddPicture(156, 130, 0xDCF); // Seed
EmptyBowlGump.AddButton(98, 150, 0x47E, 0x480, 14, 14, 14); // Cancel
@@ -1996,350 +2032,332 @@ function EmptyBowlGump(pUser, iUsed)
EmptyBowlGump.Free();
}
-function addPotion(pUser, iUsed, button)
+function addPotion( pUser, iUsed, button )
{
- var itemOwner = GetPackOwner(iUsed, 0);
- if (itemOwner == null || itemOwner != pUser)
+ var itemOwner = GetPackOwner( iUsed, 0 );
+ if( itemOwner == null || itemOwner != pUser )
{
- pUser.SysMessage(GetDictionaryEntry(1763, pUser.socket.language)); //That item must be in your backpack before it can be used.
+ pUser.SysMessage(GetDictionaryEntry( 1763, pUser.socket.language )); //That item must be in your backpack before it can be used.
}
else
{
pUser.socket.tempObj = iUsed;
- pUser.SetTempTag("ButtonPushed", button);// 7 = poison, 8 = cure, 9 = heal, 10 = strength
+ pUser.SetTempTag( "ButtonPushed", button );// 7 = poison, 8 = cure, 9 = heal, 10 = strength
pUser.CustomTarget(0);
}
}
-function onCallback0(pSock, myTarget)
+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
+ 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)
+ if( !myTarget.isItem )
{
+ return false;
+ }
- var potionInfo = iUsed.GetTag("Potions")
-
- if (!potionInfo)
- return false;
+ var potionInfo = iUsed.GetTag( "Potions" );
+ if( !potionInfo )
+ {
+ return false;
+ }
- var potionLength = potionInfo.split(",");
- if (potionLength.length != 4)
- 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]);
+ var greaterPoison = parseInt( potionLength[0], 10 );
+ var greaterCure = parseInt( potionLength[1], 10 );
+ var greaterHeal = parseInt( potionLength[2], 10 );
+ var greaterStrength = parseInt( potionLength[3], 10 );
- // 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;
- }
+ // 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 poison = greaterPoison + 1;
- var cure = greaterCure + 1;
- var heal = greaterHeal + 1;
- var strength = greaterStrength + 1;
- if (buttonPushed == 7)// poison button
- {
- if (myTarget.sectionID == "greaterpoisonpotion" || myTarget.sectionID == "0x0F09-b")
- {
+ var potionTypeIDs = {
+ 7: ["greaterpoisonpotion", "0x0F09-b"],
+ 8: ["greatercurepotion", "0x0F07-c"],
+ 9: ["greaterhealpotion", "0x0F0C-c"],
+ 10: ["greaterstrengthpotion", "0x0F09-b"]
+ };
- if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
- {
- pSock.SysMessage("You should only pour potions on a plant or seed!");
- return false;
- }
- if (greaterPoison < maxPotionCount)
- {
- iUsed.SetTag("Potions", poison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength);
- }
- else
- {
- pUser.SysMessage("The plant is already soaked with this type of potion!");
- return false;
- }
- }
- else
- {
- pUser.SysMessage("You don't have any strong potions of that type in your pack.");
- return false;
- }
- }
- else if (buttonPushed == 8)// cure button
- {
- if (myTarget.sectionID == "greatercurepotion" || myTarget.sectionID == "0x0F07-c")
- {
- if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
- {
- pSock.SysMessage("You should only pour potions on a plant or seed!");
- return false;
- }
- if (greaterCure < maxPotionCount) {
- iUsed.SetTag("Potions", greaterPoison + "," + cure + "," + greaterHeal + "," + greaterStrength);
- }
- else {
- pUser.SysMessage("The plant is already soaked with this type of potion!");
- return false;
- }
- }
- else {
- pUser.SysMessage("You don't have any strong potions of that type in your pack.");
- return false;
- }
- }
- else if (buttonPushed == 9)// heal button
- {
- if (myTarget.sectionID == "greaterhealpotion" || myTarget.sectionID == "0x0F0C-c")
- {
- if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
- {
- pSock.SysMessage("You should only pour potions on a plant or seed!");
- return false;
- }
+ var potionType = potionTypeIDs[buttonPushed];
- if (greaterHeal < maxPotionCount) {
- iUsed.SetTag("Potions", greaterPoison + "," + greaterCure + "," + heal + "," + greaterStrength);
- }
- else {
- pUser.SysMessage("The plant is already soaked with this type of potion!");
- return false;
- }
- }
- else
- {
- pUser.SysMessage("You don't have any strong potions of that type in your pack.");
- return false;
- }
- }
- else if (buttonPushed == 10)// strength button
- {
- if (myTarget.sectionID == "greaterstrengthpotion" || myTarget.sectionID == "0x0F09-b")
- {
- if (iUsed.GetTag("PlantStage") == 14)//dirt bowl
- {
- pSock.SysMessage("You should only pour potions on a plant or seed!");
- return false;
- }
+ if( !potionType )
+ {
+ pUser.SysMessage( "You don't have any strong potions of that type in your pack." );
+ return false;
+ }
- if (greaterStrength < maxPotionCount) {
- iUsed.SetTag("Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + strength);
- }
- else {
- pUser.SysMessage("The plant is already soaked with this type of potion!");
- return false;
- }
- }
- else {
- pUser.SysMessage("You don't have any strong potions of that type in your pack.");
- return false;
- }
- }
- else
- {
- pUser.SysMessage("You don't have any strong potions of that type in your pack.");
- return false;
- }
+ if( myTarget.sectionID !== potionType[0] && myTarget.sectionID !== potionType[1] )
+ {
+ pUser.SysMessage( "You don't have any strong potions of that type in your pack." );
+ return false;
+ }
- // Call onUseChecked
- onUseChecked(pUser, iUsed);
+ if( iUsed.GetTag( "PlantStage" ) == 14 )
+ { //dirt bowl
+ pSock.SysMessage( "You should only pour potions on a plant or seed!" );
+ return false;
+ }
- // Decrease target amount or delete if amount is 1
- if (myTarget.amount > 1)
- myTarget.amount--;
- else
- myTarget.Delete();
+ var potionIndex = buttonPushed - 7;
+ var potionCount = [greaterPoison, greaterCure, greaterHeal, greaterStrength];
+ if( potionCount[potionIndex] >= maxPotionCount )
+ {
+ pUser.SysMessage( "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();
+
return false;
}
-function ReproductionGump(pUser, iUsed)
+
+function ReproductionGump( pUser, iUsed )
{
var socket = pUser.socket;
var ReproductionGump = new Gump;
socket.tempObj = iUsed;
- ReproductionGump.AddBackground(50, 50, 200, 150, 0xE10);
+ ReproductionGump.AddBackground( 50, 50, 200, 150, 0xE10 );
- ReproductionGump.AddGump(60, 90, 0xE17);
- ReproductionGump.AddGump(120, 90, 0xE17);
+ ReproductionGump.AddGump( 60, 90, 0xE17 );
+ ReproductionGump.AddGump( 120, 90, 0xE17 );
- ReproductionGump.AddGump(60, 145, 0xE17);
- ReproductionGump.AddGump(120, 145, 0xE17);
+ ReproductionGump.AddGump( 60, 145, 0xE17 );
+ ReproductionGump.AddGump( 120, 145, 0xE17 );
- ReproductionGump.AddPicture(45, 45, 0xCEF);
- ReproductionGump.AddPicture(45, 118, 0xCF0);
+ ReproductionGump.AddPicture( 45, 45, 0xCEF );
+ ReproductionGump.AddPicture(45, 118, 0xCF0 );
- ReproductionGump.AddPicture(211, 45, 0xCEB);
- ReproductionGump.AddPicture(211, 118, 0xCEC);
+ 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.AddButton( 70, 67, 0xD4, 0xD4, 16, 16, 16 ); // Main menu
+ ReproductionGump.AddPicture( 57, 65, 0x1600 );
- ReproductionGump.AddText(108, 67, 0x835, "Reproduction");
+ ReproductionGump.AddText( 108, 67, 0x835, "Reproduction" );
- if (iUsed.GetTag("PlantStage") == 9)
+ if( iUsed.GetTag( "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( 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( 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( 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( 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( 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( 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.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("Seeds")
+ var Seeds = iUsed.GetTag( "Seeds" )
- if (!Seeds)
+ if( !Seeds )
{
return false;
}
- var Seedlength = Seeds.split(",");
- if (Seedlength.length != 3)
+ 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]);
+ var availableSeeds = parseInt( Seedlength[0] );
+ var remainingSeeds = parseInt( Seedlength[1] );
+ var hueSeeds = parseInt( Seedlength[2] );
- if (availableSeeds == 0 && remainingSeeds == 0)
+ if( availableSeeds == 0 && remainingSeeds == 0 )
{
- ReproductionGump.AddText(x + 5, y, 0x21, "X");
+ ReproductionGump.AddText( x + 5, y, 0x21, "X" );
}
else
{
- ReproductionGump.AddText(x, y, plantColor, availableSeeds + "/" + remainingSeeds);
+ ReproductionGump.AddText( x, y, plantColor, availableSeeds + "/" + remainingSeeds );
}
return;
}
-function AddSeedsState(ReproductionGump, iUsed, x, y)
+function AddSeedsState( ReproductionGump, iUsed, x, y )
{
- var Seeds = iUsed.GetTag("Seeds")
+ var Seeds = iUsed.GetTag( "Seeds" )
- if (!Seeds)
+ if( !Seeds )
{
return false;
}
- var Seedlength = Seeds.split(",");
- if (Seedlength.length != 3)
+ 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]);
+ var availableSeeds = parseInt( Seedlength[0] );
+ var remainingSeeds = parseInt( Seedlength[1] );
+ var hueSeeds = parseInt( Seedlength[2] );
- var plantColor = iUsed.GetTag("PlantColor");
-
- if (availableSeeds == 0 && remainingSeeds == 0)
+ if( availableSeeds == 0 && remainingSeeds == 0 )
{
- ReproductionGump.AddText(x + 5, y, 0x21, "X");
+ ReproductionGump.AddText( x + 5, y, 0x21, "X" );
}
else
{
- ReproductionGump.AddText(x, y, hueSeeds, availableSeeds + "/" + remainingSeeds);
+ ReproductionGump.AddText( x, y, hueSeeds, availableSeeds + "/" + remainingSeeds );
}
}
function AddPollinationState(ReproductionGump, iUsed, x, y)
{
- var status = parseInt(iUsed.GetTag("PlantStage"));
+ var status = parseInt( iUsed.GetTag("PlantStage" ));
var tCrossedPlants = iUsed.GetTag("PlantCross")
- if (!tCrossedPlants)
+ if( !tCrossedPlants )
{
return false;
}
- var Crossed = tCrossedPlants.split(",");
- if (Crossed.length != 2)
+ var Crossed = tCrossedPlants.split( "," );
+ if( Crossed.length != 2)
return false;
- var Pollinated = parseInt(Crossed[0]);
- var SeedBreed = parseInt(Crossed[1]);
+ var Pollinated = parseInt( Crossed[0] );
- if (status < 7)
+ if( status < 7 )
{
- ReproductionGump.AddText(x, y, 0x35, "-");
+ ReproductionGump.AddText( x, y, 0x35, "-" );
}
- else if (status >= 7 && Pollinated == 0)
+ else if( status >= 7 && Pollinated == 0 )
{
- ReproductionGump.AddText(x, y, 0x21, "!");
+ ReproductionGump.AddText( x, y, 0x21, "!" );
}
else
{
- ReproductionGump.AddText(x, y, 0x3F, "+");
+ ReproductionGump.AddText( x, y, 0x3F, "+" );
}
}
-function SetToDecorativeGump(pUser, iUsed)
+function SetToDecorativeGump( pUser, iUsed )
{
var socket = pUser.socket;
var SetToDecorativeGump = new Gump;
socket.tempObj = iUsed;
- SetToDecorativeGump.AddBackground(50, 50, 200, 150, 0xE10);
+ SetToDecorativeGump.AddBackground( 50, 50, 200, 150, 0xE10 );
- SetToDecorativeGump.AddPicture(25, 45, 0xCEB);
- SetToDecorativeGump.AddPicture(25, 118, 0xCEC);
+ SetToDecorativeGump.AddPicture( 25, 45, 0xCEB );
+ SetToDecorativeGump.AddPicture( 25, 118, 0xCEC );
- SetToDecorativeGump.AddPicture(227, 45, 0xCEF);
- SetToDecorativeGump.AddPicture(227, 118, 0xCF0);
+ 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.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( 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( 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.AddButton( 168, 140, 0x481, 0x483, 26, 26, 26 ); // Ok
+ SetToDecorativeGump.Send( socket );
SetToDecorativeGump.Free();
}
-function onTooltip(myPlant)
+function onTooltip( myPlant )
{
var tooltipText = "";
- var status = parseInt(myPlant.GetTag("PlantStage"));
- var waterLevel = myPlant.GetTag("water");
+ 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",
@@ -2350,13 +2368,21 @@ function onTooltip(myPlant)
var water = waterStatus[waterLevel] || "Hard";
- if (status === 0)
+ if( status === 0 || status === 14 )
{
tooltipText = "A bowl of " + water + " dirt";
}
- else
+ 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 = "Plant Stage: " + status + " : " + myPlant.health;
+ tooltipText = "a " + health + " " + colorname + " " + PlantName.toString() + " Plant";
}
return tooltipText;
From e29b2d7ca3f5d79cb0d990471e9474f37a1dabc9 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Wed, 13 Mar 2024 16:29:19 -0500
Subject: [PATCH 06/34] Cleanup of PlantSystem.js
just code cleanup before submiting full pr to uox3
---
data/js/item/plant_growing/plantsystem.js | 509 +++++++++++-----------
1 file changed, 253 insertions(+), 256 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index a8b6d2ccf..7d9459f96 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -60,6 +60,7 @@ function PlantBowlGump( pUser, iUsed )
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;
@@ -122,9 +123,9 @@ function PlantBowlGump( pUser, iUsed )
PlantGump.AddText( 196, 163, 0x835, greaterStrength );
PlantGump.AddGump( 48, 47, 0xD2 );
- if( iUsed.GetTag( "PlantStage" ) >= 1 && iUsed.GetTag( "PlantStage") <= 9 )
+ if( plantStage >= 1 && plantStage <= 9 )
{
- PlantGump.AddText( 54, 47, 0x835, iUsed.GetTag( "PlantStage" ).toString() );
+ PlantGump.AddText(54, 47, 0x835, plantStage.toString() );
}
PlantGump.AddGump( 232, 47, 0xD2 );
@@ -230,7 +231,7 @@ function PlantDamage( iUsed )
for( var i = 0; i < 4; i++ )
{
- var level = parseInt(infectionLevels[i] );
+ var level = parseInt( infectionLevels[i] );
if( level > 0 )
damage += level * RandomNumber( 3, 6 );
}
@@ -261,7 +262,7 @@ function AddGrowthIndicator( PlantGump, iUsed )
var fertialeDirt = parseInt( infoLength[3] );
- if (plantStage >= 1 && plantStage <= 9)
+ if( plantStage >= 1 && plantStage <= 9)
{
const gi = iUsed.GetTag( "PlantHealth" );
@@ -411,215 +412,220 @@ function GrowthCheck( myPlant )
}
}
-function ApplyPotions(myPlant)
+function ApplyPotions( myPlant )
{
- var waterLevel = parseInt(myPlant.GetTag("water"), 10) || 0;
- var potionInfo = myPlant.GetTag("Potions") || "0,0,0,0";
- var infection = myPlant.GetTag("Infections") || "0,0,0,0";
+ var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
+ var potionInfo = myPlant.GetTag( "Potions" ) || "0,0,0,0";
+ var infection = myPlant.GetTag( "Infections" ) || "0,0,0,0";
- var potionLength = potionInfo.split(",");
- var infectionLength = infection.split(",");
+ var potionLength = potionInfo.split( "," );
+ var infectionLength = infection.split( "," );
- if( potionLength.length !== 4 || infectionLength.length !== 4)
+ if( potionLength.length !== 4 || infectionLength.length !== 4 )
return false;
- var greaterPoison = parseInt(potionLength[0], 10);
- var greaterCure = parseInt(potionLength[1], 10);
- var greaterHeal = parseInt(potionLength[2], 10);
- var greaterStrength = parseInt(potionLength[3], 10);
+ var greaterPoison = parseInt( potionLength[0], 10 );
+ var greaterCure = parseInt( potionLength[1], 10 );
+ var greaterHeal = parseInt( potionLength[2], 10 );
+ var greaterStrength = parseInt( potionLength[3], 10 );
- var infestationLevel = parseInt(infectionLength[0], 10);
- var fungusLevel = parseInt(infectionLength[1], 10);
- var poisonLevel = parseInt(infectionLength[2], 10);
- var diseaseLevel = parseInt(infectionLength[3], 10);
+ var infestationLevel = parseInt( infectionLength[0], 10 );
+ var fungusLevel = parseInt( infectionLength[1], 10 );
+ var poisonLevel = parseInt( infectionLength[2], 10 );
+ var diseaseLevel = parseInt( infectionLength[3], 10 );
- if( greaterPoison >= infestationLevel)
+ if( greaterPoison >= infestationLevel )
{
var poison = greaterPoison - infestationLevel;
- myPlant.SetTag("Potions", [poison, greaterCure, greaterHeal, greaterStrength].join(","));
- myPlant.SetTag("Infections", "0," + fungusLevel + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Potions", poison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
+ myPlant.SetTag( "Infections", 0 + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
else
{
- myPlant.SetTag("Potions", "0," + greaterCure + "," + greaterHeal + "," + greaterStrength);
+ myPlant.SetTag( "Potions", 0 + greaterCure + "," + greaterHeal + "," + greaterStrength );
var infestation = infestationLevel - greaterPoison;
- myPlant.SetTag("Infections", [infestation, fungusLevel, poisonLevel, diseaseLevel].join(","));
+ myPlant.SetTag( "Infections", infestation + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
- if( greaterCure >= fungusLevel)
+ if( greaterCure >= fungusLevel )
{
var cure = greaterCure - fungusLevel;
- myPlant.SetTag("Potions", [greaterPoison, cure, greaterHeal, greaterStrength].join(","));
- myPlant.SetTag("Infections", infestationLevel + ",0," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Potions", greaterPoison + "," + cure + "," + greaterHeal + "," + greaterStrength );
+ myPlant.SetTag( "Infections", infestationLevel + 0 + poisonLevel + "," + diseaseLevel );
}
else
{
- myPlant.SetTag("Potions", greaterPoison + ",0," + greaterHeal + "," + greaterStrength);
+ myPlant.SetTag( "Potions", greaterPoison + 0 + greaterHeal + "," + greaterStrength );
var fungus = fungusLevel - greaterCure;
- myPlant.SetTag("Infections", infestationLevel + "," + fungus + "," + poisonLevel + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungus + "," + poisonLevel + "," + diseaseLevel );
}
- if( greaterHeal >= poisonLevel)
+ if( greaterHeal >= poisonLevel )
{
var heal = greaterHeal - poisonLevel;
- myPlant.SetTag("Potions", [greaterPoison, greaterCure, heal, greaterStrength].join(","));
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + ",0," + diseaseLevel);
- }
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + heal + "," + greaterStrength );
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + ",0," + diseaseLevel );
+ }
else
{
- myPlant.SetTag("Potions", greaterPoison + "," + greaterCure + ",0," + greaterStrength);
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + ",0," + greaterStrength );
var poison = poisonLevel - greaterHeal;
- myPlant.SetTag("Infections", infestationLevel + "," + fungusLevel + "," + poison + "," + diseaseLevel);
+ myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poison + "," + diseaseLevel );
}
- if( infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2)
+ if( infestationLevel == 0 || fungusLevel == 0 || poisonLevel == 0 || diseaseLevel == 0 || waterLevel != 2 )
{
- if( greaterHeal > 0)
+ if( greaterHeal > 0 )
{
myPlant.health += greaterHeal * 7;
- } else
+ }
+ else
{
myPlant.health += 2;
}
}
- if( greaterHeal > 0)
+ if( greaterHeal > 0 )
{
greaterHeal--;
- myPlant.SetTag("Potions", [greaterPoison, greaterCure, greaterHeal, greaterStrength].join(","));
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
}
}
+
function onTimer( myPlant, timerID )
{
- if( !ValidateObject( myPlant ))
+ if( !ValidateObject( myPlant ))
return;
- var stage = myPlant.GetTag("PlantStage");//Starts at stage 1
- var Seeds = myPlant.GetTag("Seeds")
- var CrossedPlants = myPlant.GetTag("PlantCross")
- var plantInfo = myPlant.GetTag("PlantInfo")
+ var stage = myPlant.GetTag( "PlantStage" );//Starts at stage 1
+ var Seeds = myPlant.GetTag( "Seeds" )
+ var CrossedPlants = myPlant.GetTag( "PlantCross" )
+ var plantInfo = myPlant.GetTag( "PlantInfo" )
- if( !CrossedPlants || !Seeds || !plantInfo)
+ if( !CrossedPlants || !Seeds || !plantInfo )
return false;
- var Crossed = CrossedPlants.split(",");
- var Seedlength = Seeds.split(",");
- var infoLength = plantInfo.split(",");
+ var Crossed = CrossedPlants.split( "," );
+ var Seedlength = Seeds.split( "," );
+ var infoLength = plantInfo.split( "," );
- if( Crossed.length != 3 || Seedlength.length != 3 || infoLength.length != 4)
+ 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]);
+ 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)
+ if( myPlant.health <= 0 )
{
- Die(myPlant);
+ Die( myPlant );
return false;
}
- if (myPlant.movable != 3)
+ 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);
+ myPlant.StartTimer( PlantDelayTimer, 1, scriptID );
return false;
}
else
{
- if( myPlant.GetTag("PlantHealth") != 10 && myPlant.GetTag("PlantHealth") != 11)//wilted or dying
+ if( myPlant.GetTag( "PlantHealth" ) != 10 && myPlant.GetTag( "PlantHealth" ) != 11 )//wilted or dying
{
- if( fertialeDirt == 1 && stage <= 5)
+ if( fertialeDirt == 1 && stage <= 5 )
{
//double growth to stage 5
- myPlant.SetTag("PlantStage", stage + 2);
+ myPlant.SetTag( "PlantStage", stage + 2 );
}
- else if( stage < 9)
+ else if( stage < 9 )
{
// Continue to the next stage if it does not have fertial dirt
- myPlant.SetTag("PlantStage", stage + 1);
+ myPlant.SetTag( "PlantStage", stage + 1 );
}
else
{
//Produce Seeds
- if( remainingSeeds > 0 && Pollinated == 1)
+ if( remainingSeeds > 0 && Pollinated == 1 )
{
var rseeds = remainingSeeds - 1;
var aseeds = availableSeeds + 1;
- myPlant.SetTag("Seeds", aseeds + "," + rseeds + "," + hueSeeds);
+ myPlant.SetTag( "Seeds", aseeds + "," + rseeds + "," + hueSeeds );
}
}
- if( stage >= 2 && stage <= 3)
+ if( stage >= 2 && stage <= 3 )
{
myPlant.id = 0x1600;
}
- else if( stage == 9)
+ else if( stage == 9 )
{
- PlantBowl(myPlant);
+ PlantBowl( myPlant );
}
}
- if( stage >= 9)
+ if( stage >= 9 )
{
- if( Pollinated == 0)
+ if( Pollinated == 0 )
{
- myPlant.SetTag("PlantCross", 1 + "," + SeedBreed + "," + crossAble);
+ myPlant.SetTag( "PlantCross", 1 + "," + SeedBreed + "," + crossAble );
}
}
- ApplyPotions(myPlant)
- HealthStatus(myPlant);
- PlantDamage(myPlant);
- GrowthCheck(myPlant);
+ ApplyPotions( myPlant )
+ HealthStatus( myPlant );
+ PlantDamage( myPlant );
+ GrowthCheck( myPlant );
myPlant.Refresh();
}
}
- myPlant.StartTimer(PlantDelayTimer, 1, scriptID);
+ myPlant.StartTimer( PlantDelayTimer, 1, scriptID );
}
function DrawPlant( PlantGump, iUsed )
{
- if( iUsed.GetTag("PlantStage") >= 0 && iUsed.GetTag("PlantStage") < 9 || iUsed.GetTag("PlantStage") == 14)
+ var plantStage = iUsed.GetTag( "PlantStage" );
+ var plantHealth = iUsed.GetTag( "PlantHealth" )
+
+ if( plantStage >= 0 && plantStage < 9 || plantStage == 14 )
{
- PlantGump.AddGump(110, 85, 0x589);
- if( iUsed.GetTag("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);
+ PlantGump.AddPicture( 122, 94, 0x914 );
+ PlantGump.AddPicture( 135, 94, 0x914 );
+ PlantGump.AddPicture( 120, 112, 0x914 );
+ PlantGump.AddPicture( 135, 112, 0x914 );
}
- if( iUsed.GetTag("PlantStage") >= 2 && iUsed.GetTag("PlantStage") < 3)
+ if( plantStage >= 2 && plantStage < 3 )
{
PlantGump.AddPicture( 127, 112, 0xC62 );
}
- if( iUsed.GetTag( "PlantStage" ) == 3 || iUsed.GetTag( "PlantStage" ) == 4 )
+ if( plantStage == 3 || plantStage == 4 )
{
- PlantGump.AddPicture(129, 85, 0xC7E);
+ PlantGump.AddPicture( 129, 85, 0xC7E );
}
- if( iUsed.GetTag("PlantStage") >= 4 && iUsed.GetTag("PlantStage") < 9)
+ if( plantStage >= 4 && plantStage < 9 )
{
PlantGump.AddPicture( 121, 117, 0xC62 );
PlantGump.AddPicture( 133, 117, 0xC62 );
}
- if( iUsed.GetTag("PlantStage") >= 5 && iUsed.GetTag("PlantStage") < 9)
+ 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( iUsed.GetTag("PlantStage") >= 6 && iUsed.GetTag("PlantStage") < 9)
+ if( plantStage >= 6 && plantStage < 9 )
{
PlantGump.AddPicture( 105, 115, 0xC62 );
PlantGump.AddPicture( 145, 115, 0xC62 );
@@ -632,9 +638,9 @@ function DrawPlant( PlantGump, iUsed )
PlantImage( PlantGump, iUsed );
}
- if( iUsed.GetTag( "PlantStage" ) != 14 ) //BowlOfDirt
+ if( plantStage != 14 ) //BowlOfDirt
{
- switch( iUsed.GetTag( "PlantHealth" ))
+ switch( plantHealth )
{
case 10:
PlantGump.AddPicture( 92, 167, 0x1B9D );
@@ -663,19 +669,18 @@ function DrawPlant( PlantGump, iUsed )
function PlantImage( PlantGump, iUsed )
{
- var plantInfo = iUsed.GetTag("PlantInfo")
+ var plantInfo = iUsed.GetTag( "PlantInfo" )
- if( !plantInfo)
+ if( !plantInfo )
return false;
- var infoLength = plantInfo.split(",");
- if( infoLength.length != 4)
+ var infoLength = plantInfo.split( "," );
+ if( infoLength.length != 4 )
return false;
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
- var fertialeDirt = parseInt(infoLength[3]);
+ var plantType = parseInt( infoLength[0] );
+ var plantColor = parseInt( infoLength[2] );
+ var fertialeDirt = parseInt( infoLength[3] );
var plantArray = {
"3203": [0, 0], // 0x0c83
@@ -767,7 +772,7 @@ function PlantImage( PlantGump, iUsed )
var plantID = 0;
var plantNewName = "";
- switch (plantType)
+ switch( plantType )
{
case 1:
plantID = CampionFlowers;
@@ -938,7 +943,7 @@ function PlantImage( PlantGump, iUsed )
plantNewName = "Sugar Canes";
break;
}
- if( plantID == CypressTwisted || plantID == CypressStraight)
+ 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 );
}
@@ -946,26 +951,24 @@ function PlantImage( PlantGump, iUsed )
{
PlantGump.AddPictureColor( 130 + plantArray[plantID][0], 96 + plantArray[plantID][1], plantID, plantColor );
}
- iUsed.SetTag("PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt);
+ iUsed.SetTag( "PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt );
return;
}
function PlantBowl( iUsed )
{
- var plantInfo = iUsed.GetTag("PlantInfo")
+ var plantInfo = iUsed.GetTag( "PlantInfo" )
- if( !plantInfo) {
+ if( !plantInfo )
return false;
- }
- var infoLength = plantInfo.split(",");
- if( infoLength.length != 4)
+ var infoLength = plantInfo.split( "," );
+ if( infoLength.length != 4 )
return false;
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
- var fertialeDirt = parseInt(infoLength[3]);
+ var plantType = parseInt( infoLength[0] );
+ var plantColor = parseInt( infoLength[2] );
+ var fertialeDirt = parseInt( infoLength[3] );
var CampionFlowers = 3203;
var Poppies = 3206;
@@ -1012,7 +1015,7 @@ function PlantBowl( iUsed )
var plantID = 0;
var plantNewName = "";
- switch(plantType)
+ switch( plantType )
{
case 1:
plantID = CampionFlowers;
@@ -1188,11 +1191,11 @@ function PlantBowl( iUsed )
iUsed.name = plantNewName;
iUsed.movable = 1;
iUsed.colour = plantColor;
- iUsed.SetTag("PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt);
+ iUsed.SetTag( "PlantInfo", plantType + "," + plantNewName + "," + plantColor + "," + fertialeDirt );
iUsed.Refresh();
}
-function CodexOFWisdomPacket(socket, topicID)
+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
@@ -1206,7 +1209,7 @@ function CodexOFWisdomPacket(socket, topicID)
helpPacket.Free();
}
-function onGumpPress(socket, button, PlantGump)
+function onGumpPress( socket, button, PlantGump )
{
var pUser = socket.currentChar;
var iUsed = socket.tempObj;
@@ -1217,250 +1220,250 @@ function onGumpPress(socket, button, PlantGump)
socket.CloseGump( gumpID, 0 );
break;// abort and do nothing
case 1:// Reproduction menu
- if( iUsed.GetTag("PlantStage") >= 1)
+ if( iUsed.GetTag( "PlantStage" ) >= 1 )
{
- ReproductionGump(pUser, iUsed);
+ ReproductionGump( pUser, iUsed );
}
else
{
- pUser.SysMessage("You need to plant a seed in the bowl first");
- onUseChecked(pUser, iUsed);
+ socket.SysMessage( "You need to plant a seed in the bowl first" );
+ onUseChecked( pUser, iUsed );
}
break;
case 2:// infestation
- onUseChecked(pUser, iUsed);
- CodexOFWisdomPacket(socket, 54);
+ onUseChecked( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 54 );
break;
case 3:// fungus
- onUseChecked(pUser, iUsed);
- CodexOFWisdomPacket(socket, 56);
+ onUseChecked( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 56 );
break;
case 4:// poison
- onUseChecked(pUser, iUsed);
- CodexOFWisdomPacket(socket, 58);
+ onUseChecked( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 58 );
break;
case 5:// disease
- onUseChecked(pUser, iUsed);
- CodexOFWisdomPacket(socket, 60);
+ onUseChecked( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 60 );
break;
case 6:// water
- onUseChecked(pUser, iUsed);
+ onUseChecked( pUser, iUsed );
break;
case 7:// poison potion
- addPotion(pUser, iUsed, 7);
- onUseChecked(pUser, iUsed);
+ addPotion( pUser, iUsed, 7 );
+ onUseChecked( pUser, iUsed );
break;
case 8:// Cure potion
- addPotion(pUser, iUsed, 8);
- onUseChecked(pUser, iUsed);
+ addPotion( pUser, iUsed, 8 );
+ onUseChecked( pUser, iUsed );
break;
case 9:// Heal potion
- addPotion(pUser, iUsed, 9);
- onUseChecked(pUser, iUsed);
+ addPotion( pUser, iUsed, 9 );
+ onUseChecked( pUser, iUsed );
break;
case 10:// Strength potion
- addPotion(pUser, iUsed, 10);
- onUseChecked(pUser, iUsed);
+ addPotion( pUser, iUsed, 10 );
+ onUseChecked( pUser, iUsed );
break;
case 11:// Help
- onUseChecked(pUser, iUsed);
- CodexOFWisdomPacket(socket, 48);
+ onUseChecked( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 48 );
break;
case 12:// Empty the bowl
- socket.CloseGump(gumpID, 0);
- EmptyBowlGump(pUser, iUsed);
- //TriggerEvent( 5040, "EmptyBowl", pUser, iUsed );
+ socket.CloseGump( gumpID, 0 );
+ EmptyBowlGump( pUser, iUsed );
break;
case 13:// Empty Bowl Help
- EmptyBowlGump(pUser, iUsed);
- CodexOFWisdomPacket(socket, 71);
+ EmptyBowlGump( pUser, iUsed );
+ CodexOFWisdomPacket( socket, 71 );
break;
case 14:// Cancel Plant Bowl Gump
- onUseChecked(pUser, iUsed);
+ onUseChecked( pUser, iUsed );
break;
case 15:// Okay Empty Bowl
- if(iUsed.GetTag("PlantStage") == 1)
+ if( iUsed.GetTag( "PlantStage") == 1)
{
- GatherSeeds(pUser, iUsed);
+ GatherSeeds( pUser, iUsed );
}
- CreateDFNItem(pUser.socket, pUser, "emptyplantbowl", 1, "ITEM", true, 0);
- iUsed.Delete();
+ CreateDFNItem( pUser.socket, pUser, "emptyplantbowl", 1, "ITEM", true, 0 );
+ iUsed.Delete( );
break;
case 16:// Main Plant Gump
- onUseChecked(pUser, iUsed);
+ onUseChecked( pUser, iUsed );
break;
case 17:// Set to decorative
- SetToDecorativeGump(pUser, iUsed);
+ SetToDecorativeGump( pUser, iUsed );
break;
case 18:// Pollination
- CodexOFWisdomPacket(socket, 67);
+ CodexOFWisdomPacket( socket, 67 );
break;
case 19:// Resources
- CodexOFWisdomPacket(socket, 69);
+ CodexOFWisdomPacket( socket, 69 );
break;
case 20:// Seeds
- CodexOFWisdomPacket(socket, 68);
+ CodexOFWisdomPacket( socket, 68 );
break;
case 21:// Gather pollen
- PollinatePlant(pUser, iUsed);
- onUseChecked(pUser, iUsed);
+ PollinatePlant( pUser, iUsed );
+ onUseChecked( pUser, iUsed );
break;
case 22:// Gather Resources
- onUseChecked(pUser, iUsed);
+ onUseChecked( pUser, iUsed );
break;
case 23:// Gather seeds
- GatherSeeds(pUser, iUsed);
+ GatherSeeds( pUser, iUsed );
break;
case 24:// Cancel set decorative
- ReproductionGump(pUser, iUsed);
+ ReproductionGump( pUser, iUsed );
break;
case 25:
- CodexOFWisdomPacket(socket, 70);
+ CodexOFWisdomPacket( socket, 70 );
break;
case 26:
- iUsed.SetTag("PlantStage", 19);//DecorativePlant
- socket.CloseGump(gumpID, 0);
- socket.SysMessage("You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.");
- ResetPlant(iUsed);
+ iUsed.SetTag( "PlantStage", 19 );//DecorativePlant
+ socket.CloseGump( gumpID, 0 );
+ socket.SysMessage( "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)
+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("Seeds", null);
- iUsed.RemoveScriptTrigger(scriptID);
+ 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( "Seeds", null );
+ iUsed.RemoveScriptTrigger( scriptID );
iUsed.KillTimers();
}
-function PollinatePlant(pUser, iUsed)
+function PollinatePlant( pUser, iUsed )
{
pUser.socket.tempObj = iUsed;
var socket = pUser.socket;
- var status = iUsed.GetTag("PlantStage");
- var CrossedPlants = iUsed.GetTag("PlantCross")
+ var status = iUsed.GetTag( "PlantStage" );
+ var CrossedPlants = iUsed.GetTag( "PlantCross" )
+ var plantHealth = iUsed.GetTag("PlantHealth")
- if( !CrossedPlants)
+ if( !CrossedPlants )
{
- pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
return false;
}
- else if( status < 7)
+ else if( status < 7 )
{
- socket.SysMessage("Too early to gather pollen");
+ socket.SysMessage( "Too early to gather pollen" );
return false;
}
- else if( iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying
{
- socket.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ socket.SysMessage( "You cannot gather pollen from an unhealthy plant!" );
return false;
}
else
- pUser.CustomTarget(1, "Target the plant you wish to cross-pollinate to.");
+ pUser.CustomTarget( 1, "Target the plant you wish to cross-pollinate to." );
}
-function onCallback1(pSock, myTarget)
+function onCallback1( pSock, myTarget )
{
var iUsed = pSock.tempObj;
var pUser = pSock.currentChar;
- var status = iUsed.GetTag("PlantStage");
- var iCrossedPlants = iUsed.GetTag("PlantCross")
+ var status = iUsed.GetTag( "PlantStage" );
+ var iCrossedPlants = iUsed.GetTag( "PlantCross" )
+ var plantHealth = iUsed.GetTag( "PlantHealth" )
- if( !iCrossedPlants)
+ if( !iCrossedPlants )
{
- pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
return false;
}
- if( status < 7)
+ if( status < 7 )
{
- pSock.SysMessage("Too early to gather pollen");
+ pSock.SysMessage( "Too early to gather pollen" );
return false;
}
- else if( iUsed.GetTag("PlantHealth") == 10 && iUsed.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying
{
- pSock.SysMessage("You cannot gather pollen from an unhealthy plant!");
+ pSock.SysMessage( "You cannot gather pollen from an unhealthy plant!" );
return false;
}
else if( status > 7 && status < 9)
{
- pSock.SysMessage("You can only pollinate other specially grown plants!");
+ pSock.SysMessage( "You can only pollinate other specially grown plants!" );
return false;
}
else
{
- var tstatus = myTarget.GetTag("PlantStage");
- var tCrossedPlants = myTarget.GetTag("PlantCross")
+ var tstatus = myTarget.GetTag( "PlantStage" );
+ var tCrossedPlants = myTarget.GetTag( "PlantCross" )
+ var tplantHealth = myTarget.GetTag( "PlantHealth" )
- if( !tCrossedPlants)
+ if( !tCrossedPlants )
{
- pSock.SysMessage("You cannot gather pollen from a mutated plant!");
+ pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
return false;
}
- var Crossed = tCrossedPlants.split(",");
- if( Crossed.length != 3)
+ 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]);
+ var Pollinated = parseInt( Crossed[0] );
+ var SeedBreed = parseInt( Crossed[1] );
+ var crossAble = parseInt( Crossed[2] );
- if( tstatus < 7)
+ if( tstatus < 7 )
{
- pSock.SysMessage("This plant is not in the flowering stage. You cannot pollinate it!");
+ pSock.SysMessage( "This plant is not in the flowering stage. You cannot pollinate it!" );
return false;
}
- else if( myTarget.GetTag("PlantHealth") == 10 && myTarget.GetTag("PlantHealth") == 11)//wilted or dying
+ else if( tplantHealth == 10 && tplantHealth == 11 )//wilted or dying
{
- pSock.SysMessage("You cannot pollinate an unhealthy plant!");
+ pSock.SysMessage( "You cannot pollinate an unhealthy plant!" );
return false;
}
- else if( tstatus > 7 && tstatus < 9)
+ else if( tstatus > 7 && tstatus < 9 )
{
- pSock.SysMessage("You can only pollinate other specially grown plants!");
+ pSock.SysMessage( "You can only pollinate other specially grown plants!" );
return false;
}
- else if( crossAble == 0)
+ else if( crossAble == 0 )
{
- pSock.SysMessage("You cannot cross-pollinate with a mutated plant!");
+ pSock.SysMessage( "You cannot cross-pollinate with a mutated plant!" );
return false;
}
else if( Pollinated == 1)
{
- pSock.SysMessage("This plant has already been pollinated!");
+ pSock.SysMessage( "This plant has already been pollinated!" );
}
- else if( myTarget == iUsed)
+ else if( myTarget == iUsed )
{
- CrossPollinateTable(myTarget, iUsed, pSock);
- SeedColorsSet(myTarget, iUsed);
- pSock.SysMessage("You pollinate the plant with its own pollen.");
+ CrossPollinateTable( myTarget, iUsed, pSock );
+ SeedColorsSet( myTarget, iUsed );
+ pSock.SysMessage( "You pollinate the plant with its own pollen." );
}
else
{
- CrossPollinateTable(myTarget, iUsed, pSock);
- SeedColorsSet(myTarget, iUsed);
- pSock.SysMessage("You successfully cross - pollinate the plant.");
+ CrossPollinateTable( myTarget, iUsed, pSock );
+ SeedColorsSet( myTarget, iUsed );
+ pSock.SysMessage( "You successfully cross - pollinate the plant." );
}
}
}
-function CrossPollinateTable(myTarget, iUsed, pSock)
+function CrossPollinateTable( myTarget, iUsed, pSock )
{
- var iinfo = iUsed.GetTag("PlantInfo")
- var tinfo = myTarget.GetTag("PlantInfo");
+ var iinfo = iUsed.GetTag( "PlantInfo" )
+ var tinfo = myTarget.GetTag( "PlantInfo" );
- if( !iinfo || !tinfo)
- {
+ if( !iinfo || !tinfo )
return false;
- }
var icrossLength = iinfo.split(",");
var tcrossLength = tinfo.split(",");
@@ -1739,7 +1742,6 @@ function SeedColorsSet(myTarget, iUsed)
var availableSeeds = parseInt(Seedlength[0]);
var remainingSeeds = parseInt(Seedlength[1]);
- var hueSeeds = parseInt(Seedlength[2]);
// Define color combination object
var colorMap = {
@@ -1995,55 +1997,58 @@ function GatherSeeds(pUser, iUsed)
}
}
}
- onUseChecked(pUser, iUsed);
+ onUseChecked( pUser, iUsed );
}
-function EmptyBowlGump(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.AddBackground( 50, 50, 200, 150, 0xE10 );
- EmptyBowlGump.AddPicture(45, 45, 0xCEF);
- EmptyBowlGump.AddPicture(45, 118, 0xCF0);
+ EmptyBowlGump.AddPicture( 45, 45, 0xCEF );
+ EmptyBowlGump.AddPicture( 45, 118, 0xCF0 );
- EmptyBowlGump.AddPicture(211, 45, 0xCEB);
- EmptyBowlGump.AddPicture(211, 118, 0xCEC);
+ EmptyBowlGump.AddPicture( 211, 45, 0xCEB );
+ EmptyBowlGump.AddPicture( 211, 118, 0xCEC );
- EmptyBowlGump.AddText(90, 70, 0x44, "Empty the bowl?");
+ EmptyBowlGump.AddText( 90, 70, 0x44, "Empty the bowl?" );
- EmptyBowlGump.AddPicture(90, 100, 0x1602);
- EmptyBowlGump.AddGump(140, 102, 0x15E1);
- EmptyBowlGump.AddPicture(160, 100, 0x15FD);
+ EmptyBowlGump.AddPicture( 90, 100, 0x1602 );
+ EmptyBowlGump.AddGump( 140, 102, 0x15E1 );
+ EmptyBowlGump.AddPicture( 160, 100, 0x15FD );
- if( iUsed.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantStage") < 2 ) //BowlOfDirt
- EmptyBowlGump.AddPicture(156, 130, 0xDCF); // Seed
+ if( plantStage != 14 && plantStage < 2 ) //BowlOfDirt
+ EmptyBowlGump.AddPicture( 156, 130, 0xDCF ); // Seed
- EmptyBowlGump.AddButton(98, 150, 0x47E, 0x480, 14, 14, 14); // Cancel
+ 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( 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.AddButton( 168, 150, 0x481, 0x483, 15, 15, 15 ); // Ok
+ EmptyBowlGump.Send( socket );
EmptyBowlGump.Free();
}
function addPotion( pUser, iUsed, button )
{
+ var socket = pUser.socket;
+
var itemOwner = GetPackOwner( iUsed, 0 );
if( itemOwner == null || itemOwner != pUser )
{
- pUser.SysMessage(GetDictionaryEntry( 1763, pUser.socket.language )); //That item must be in your backpack before it can be used.
+ socket.SysMessage( GetDictionaryEntry( 1763, socket.language )); //That item must be in your backpack before it can be used.
}
else
{
pUser.socket.tempObj = iUsed;
pUser.SetTempTag( "ButtonPushed", button );// 7 = poison, 8 = cure, 9 = heal, 10 = strength
- pUser.CustomTarget(0);
+ pUser.CustomTarget( 0 );
}
}
@@ -2200,9 +2205,7 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
var Seeds = iUsed.GetTag( "Seeds" )
if( !Seeds )
- {
return false;
- }
var Seedlength = Seeds.split( "," );
if( Seedlength.length != 3 )
@@ -2228,9 +2231,7 @@ function AddSeedsState( ReproductionGump, iUsed, x, y )
var Seeds = iUsed.GetTag( "Seeds" )
if( !Seeds )
- {
return false;
- }
var Seedlength = Seeds.split( "," );
if( Seedlength.length != 3 )
@@ -2257,9 +2258,7 @@ function AddPollinationState(ReproductionGump, iUsed, x, y)
var tCrossedPlants = iUsed.GetTag("PlantCross")
if( !tCrossedPlants )
- {
return false;
- }
var Crossed = tCrossedPlants.split( "," );
if( Crossed.length != 2)
@@ -2316,9 +2315,7 @@ function onTooltip( myPlant )
var plantInfo = myPlant.GetTag( "PlantInfo" )
if( !plantInfo )
- {
return false;
- }
var infoLength = plantInfo.split( "," );
if( infoLength.length != 4 )
@@ -2330,7 +2327,7 @@ function onTooltip( myPlant )
var fertialeDirt = parseInt( infoLength[3] );
var colorname = "";
- switch(plantColor)
+ switch( plantColor )
{
case 0: colorname = "plain"; break;
case 1645: colorname = "red"; break;
From eb415db6b420aeef6ab23689bbc11321ba569107 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Wed, 13 Mar 2024 19:37:44 -0500
Subject: [PATCH 07/34] Cleanup
Cleanup code for plant bowl and seed.
---
data/js/item/plant_growing/plantbowl.js | 114 ++++++++++++------------
data/js/item/plant_growing/seed.js | 101 +++++++++++----------
2 files changed, 113 insertions(+), 102 deletions(-)
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index 3e61d8761..3e0385b86 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -1,6 +1,6 @@
// Valid map target IDs for dirt
-const validMapDirtIDs = [0x9 ,0x15 ,0x71 ,0x7C ,0x82 ,0xA7 ,0xDC ,0xE3 ,0xE8 ,0xEB ||
- tileID == tileID == 0x141 ,0x144 ,0x14C ,0x15C ,0x169 ,0x174 ,0x1DC ,0x1EF ,0x272 ,0x275
+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
@@ -9,98 +9,100 @@ const validMapDirtIDs = [0x9 ,0x15 ,0x71 ,0x7C ,0x82 ,0xA7 ,0xDC ,0xE3 ,0xE8 ,0x
,0x71FB ,0x72C9 ,0x72CA
];
-function onUseChecked(pUser, iBowl)
+function onUseChecked( pUser, iBowl )
{
- var bowlOwner = GetPackOwner(iBowl, 0);
- if (bowlOwner == null || bowlOwner != pUser)
+ var socket = pUser.socket;
+ if( socket && iBowl && iBowl.isItem )
{
- pUser.SysMessage("You must have the object in your backpack to use it."); //You must have the object in your backpack to use it.
- }
- else
- {
- pUser.socket.tempObj = iBowl;
- pUser.CustomTarget(1, "Choose a patch of dirt to scoop up.");//Choose a patch of dirt to scoop up.
+ var bowlOwner = GetPackOwner(iBowl, 0);
+ if( bowlOwner == null || bowlOwner != pUser )
+ {
+ pUser.SysMessage( "You must have the object in your backpack to use it." ); //You must have the object in your backpack to use it.
+ }
+ else
+ {
+ pUser.socket.tempObj = iBowl;
+ pUser.CustomTarget( 1, "Choose a patch of dirt to scoop up." );//Choose a patch of dirt to scoop up.
+ return false;
+ }
}
- return false;
+ return true;
}
-function onCallback1(socket, ourObj)
+function onCallback1( socket, myTarget )
{
- if (socket == null)
+ if( socket == null )
return;
var mChar = socket.currentChar;
- if (ValidateObject(mChar) && mChar.isChar)
+ if( ValidateObject(mChar) && mChar.isChar )
{
var iBowl = socket.tempObj;
var tileID = 0;
var staticTile = true;
- if (socket.GetByte(1))
+ if( socket.GetByte(1) )
{
- tileID = socket.GetWord(17);
- if (!tileID)
+ tileID = socket.GetWord( 17 );
+ if( !tileID )
{
- tileID = GetTileIDAtMapCoord(socket.GetWord(11), socket.GetWord(13), mChar.worldNumber);
+ tileID = GetTileIDAtMapCoord( socket.GetWord( 11 ), socket.GetWord( 13 ), mChar.worldNumber );
staticTile = false;
}
}
- else if (ValidateObject(ourObj) && ourObj.isItem)
+ else if( ValidateObject( myTarget ) && myTarget.isItem )
{
// Make sure targeted object is in same world & instance as player
- if (ourObj.worldnumber != mChar.worldnumber || ourObj.instanceID != mChar.instanceID)
+ if( myTarget.worldnumber != mChar.worldnumber || myTarget.instanceID != mChar.instanceID )
return;
- tileID = ourObj.id;
- if (ourObj.id == 0x0f81)// Fertile Dirt
- {
- if (ourObj.amount < 40) //amount needed
- {
- socket.SysMessage("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("You fill the bowl with fresh dirt.")
- iBowl.Delete();
-
- if (ourObj.amount == 40)
- ourObj.Delete();
- else if (ourObj.amount > 40)
- ourObj.amount -= 40;
- }
- }
- else
- socket.SysMessage("You'll want to gather fresh dirt in order to raise a healthy plant!"); // "You'll want to gather fresh dirt in order to raise a healthy plant!"
- return;
- }
+ tileID = myTarget.id;
+ }
var validTileIDFound = false;
- if (tileID != 0)
+ if( tileID != 0 )
{
- if (staticTile == true || (ourObj && ourObj.isItem)) // tileID is from a dynamic or static item
+ 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( "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( "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
+ else if( staticTile == false ) // tileID is from a map tile
{
- if (validMapDirtIDs.indexOf(tileID) != -1 ) // Dirt
+ 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("You fill the bowl with fresh 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("You fill the bowl with fresh dirt." )
validTileIDFound = true;
iBowl.Delete();
}
}
}
- if (!validTileIDFound)
+ if( !validTileIDFound )
{
- socket.SysMessage("You'll want to gather fresh dirt in order to raise a healthy plant!"); // "You'll want to gather fresh dirt in order to raise a healthy plant!"
+ socket.SysMessage( "You'll want to gather fresh dirt in order to raise a healthy plant!" ); // "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/seed.js b/data/js/item/plant_growing/seed.js
index 9ff4c6374..93c1b4f3a 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -1,64 +1,70 @@
function onUseChecked( pUser, iUsed )
{
- var itemOwner = GetPackOwner( iUsed, 0 );
- if( itemOwner == null || itemOwner != pUser )
+ var socket = pUser.socket;
+ if( socket && iUsed && iUsed.isItem )
{
- pUser.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, "Choose a bowl of dirt to plant this seed in." );
+ 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, "Choose a bowl of dirt to plant this seed in." );
+ return false;
+ }
}
- return false;
+ return true;
}
-function onCallback0(pSock, myTarget)
+function onCallback0( pSock, myTarget )
{
+ const PlantDelayTimer = 5000;//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)
+ if( !pSock.GetWord( 1 ) && myTarget.isItem )
{
- var plantInfo = myTarget.GetTag("PlantInfo")
+ var plantStage = myTarget.GetTag("PlantStage");
+ var plantInfo = myTarget.GetTag( "PlantInfo" );
+ var waterLevel = myTarget.GetTag("water");
- if (!plantInfo)
- {
+ if( !plantInfo )
return false;
- }
- var infoLength = plantInfo.split(",");
- if (infoLength.length != 4)
+ var infoLength = plantInfo.split( "," );
+ if( infoLength.length != 4 )
return false;
- var plantType = parseInt(infoLength[0]);
- var PlantName = parseInt(infoLength[1]);
- var plantColor = parseInt(infoLength[2]);
- var fertialeDirt = parseInt(infoLength[3]);
- var itemOwner = GetPackOwner(myTarget, 0);
+ var plantType = parseInt( infoLength[0] );
+ var PlantName = parseInt( infoLength[1] );
+ var plantColor = parseInt( infoLength[2] );
+ var fertialeDirt = parseInt( infoLength[3] );
+ var itemOwner = GetPackOwner( myTarget, 0 );
- if (itemOwner == null || itemOwner != pUser)
+ if( itemOwner == null || itemOwner != pUser )
{
- pUser.SysMessage(GetDictionaryEntry(1763, pSock.language)); //That item must be in your backpack before it can be used.
+ 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) //checking to make sure its a full bowl of dirt
+ if( ValidateObject( myTarget ) && myTarget.id == 0x1602 || myTarget.sectionID == "plantbowlOfdirt" ) //checking to make sure its a full bowl of dirt
{
- if (myTarget.GetTag("PlantStage") >= 18) // FullGrownPlant
+ if( plantStage >= 18 ) // FullGrownPlant
{
// You must use a seed on some prepared soil!
pSock.SysMessage("You must use a seed on some prepared soil!");
}
- else if (myTarget.GetTag("PlantStage") != 14 && iUsed.GetTag("PlantName")) // BowlOfDirt or PlantName
+ else if( plantStage != 14 && PlantName ) // BowlOfDirt or PlantName
{
- pUser.SysMessage("This bowl of dirt already has a seed " + myTarget.GetTag("PlantName") + " in it!");
+ pSock.SysMessage( "This bowl of dirt already has a seed " + PlantName + " in it!" );
// This bowl of dirt already has a seed of %s in it!
}
- else if (myTarget.GetTag("water") < 2) // not enough water
+ else if( waterLevel < 2 ) // not enough water
{
- pSock.SysMessage("The dirt needs to be softened first.");
+ pSock.SysMessage( "The dirt needs to be softened first." );
}
else
{
@@ -107,42 +113,45 @@ function onCallback0(pSock, myTarget)
"SugarCanes": { type: 42, crossable: 0 }
};
- // You plant the seed in the bowl of dirt.
- pUser.SysMessage("You plant the seed in the bowl of dirt.");
-
// Loop through the keys of seedToPlantType to find the matching tag
- for (var tagName in seedToPlantType) {
- if (parseInt(iUsed.GetTag(tagName)) === 1)
+ for( var tagName in seedToPlantType )
+ {
+ if( parseInt( iUsed.GetTag( tagName )) == 1 )
{
var tplantType = seedToPlantType[tagName];
- if (!isNaN(tplantType.type))
+ if( !isNaN( tplantType.type ))
{
- myTarget.SetTag("PlantInfo", tplantType.type + "," + iUsed.name + "," + iUsed.colour + "," + fertialeDirt);
- myTarget.SetTag("PlantCross", 0 + "," + tplantType.type + "," + tplantType.crossable);
+ 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
- pUser.SysMessage("Invalid plantType:", tplantType.type, "Page and GM");
+ pSock.SysMessage( "Invalid plantType:", tplantType.type, "Page and GM" );
+ break;
}
}
}
- const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
- myTarget.StartTimer(PlantDelayTimer, 1, 19100);
- myTarget.SetTag("PlantStage", 1);
- myTarget.SetTag("Seeds", 0 + "," + 8 + "," + iUsed.colour);
+ myTarget.StartTimer( PlantDelayTimer, 1, 19100 );
+ myTarget.SetTag( "PlantStage", 1 );//Seed
+ objMade.SetTag( "Seed", 0 + "," + 8 + "," + iUsed.colour );//Min/max/color
- if (iUsed.amount > 1)
+ // You plant the seed in the bowl of dirt.
+ pSock.SysMessage( "You plant the seed in the bowl of dirt." );
+
+ if( iUsed.amount > 1 )
iUsed.amount--;
else
iUsed.Delete();
}
}
else
- pUser.SysMessage("You must use a seed on a bowl of dirt!");//You must use a seed on a bowl of dirt!
- return false;
+ {
+ pUser.SysMessage( "You must use a seed on a bowl of dirt!" );//You must use a seed on a bowl of dirt!
+ return false;
+ }
}
return false;
}
From bf1e6b78ff9c80f6aee12969fbb4b47c1b5a93d1 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 01:49:48 -0500
Subject: [PATCH 08/34] Added water pouring
you can now add water to plant bowl by using the button on gump.
removed check for plantbowl being i pack when adding potions
---
data/js/item/plant_growing/plantsystem.js | 86 +++++++++++++++++++----
1 file changed, 73 insertions(+), 13 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 7d9459f96..7285119d0 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -1247,6 +1247,7 @@ function onGumpPress( socket, button, PlantGump )
CodexOFWisdomPacket( socket, 60 );
break;
case 6:// water
+ addWater( pUser, iUsed );
onUseChecked( pUser, iUsed );
break;
case 7:// poison potion
@@ -2035,21 +2036,78 @@ function EmptyBowlGump( pUser, iUsed )
EmptyBowlGump.Free();
}
-function addPotion( pUser, iUsed, button )
+function addWater( pUser, iUsed )
{
var socket = pUser.socket;
+ var waterLevel = iUsed.GetTag( "water" );
+ var pitcherofwater1 = pUser.FindItemSection( "0x1f9e" );
+ var pitcherofwater2 = pUser.FindItemSection( "0x1f9d" );
+
+ if (waterLevel >= 4)
+ {
+ socket.SysMessage("You can't add water to this plant.");
+ return;
+ }
+
+ if ( ValidateObject( pitcherofwater1 ))
+ {
+ // Set The Plant Bowl Water tag
+ iUsed.SetTag( "water", waterLevel + 1 );
- var itemOwner = GetPackOwner( iUsed, 0 );
- if( itemOwner == null || itemOwner != pUser )
+ // Reduce uses remaining in pitcher
+ if( pitcherofwater1.usesLeft == 1 )
+ {
+ // Pitcher is empty
+ pitcherofwater1.usesLeft = 0;
+ pitcherofwater1.SetTag( "ContentsName", "nothing" );
+ TriggerEvent( 2100, "switchPitcherID", socket, pitcherofwater1 )
+ }
+ else
+ {
+ // Reduce uses left in pitcher by 1
+ pitcherofwater1.usesLeft--;
+ pitcherofwater1.Refresh();
+ }
+ socket.SysMessage( "You soften the dirt with water." );
+ pUser.SoundEffect( 0x4e, 1 );
+ }
+ else if( ValidateObject( pitcherofwater2 ))
{
- socket.SysMessage( GetDictionaryEntry( 1763, socket.language )); //That item must be in your backpack before it can be used.
+ var waterLevel = iUsed.GetTag("water");
+ // Set The Plant Bowl Water tag
+ iUsed.SetTag("water", waterLevel + 1);
+
+ // Reduce uses remaining in pitcher
+ if( pitcherofwater2.usesLeft == 1 )
+ {
+ // Pitcher is empty
+ pitcherofwater2.usesLeft = 0;
+ pitcherofwater2.SetTag( "ContentsName", "nothing" );
+ TriggerEvent( 2100, "switchPitcherID", socket, pitcherofwater2 )
+ }
+ else
+ {
+ // Reduce uses left in pitcher by 1
+ pitcherofwater2.usesLeft--;
+ pitcherofwater2.Refresh();
+ }
+ socket.SysMessage( "You soften the dirt with water." );
+ pUser.SoundEffect(0x4e, 1 );
}
else
{
- pUser.socket.tempObj = iUsed;
- pUser.SetTempTag( "ButtonPushed", button );// 7 = poison, 8 = cure, 9 = heal, 10 = strength
- pUser.CustomTarget( 0 );
+ socket.SysMessage( "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 )
@@ -2063,9 +2121,7 @@ function onCallback0( pSock, myTarget )
// Check if the target is an item
if( !myTarget.isItem )
- {
return false;
- }
var potionInfo = iUsed.GetTag( "Potions" );
if( !potionInfo )
@@ -2103,13 +2159,13 @@ function onCallback0( pSock, myTarget )
if( !potionType )
{
- pUser.SysMessage( "You don't have any strong potions of that type in your pack." );
+ pSock.SysMessage( "You don't have any strong potions of that type in your pack." );
return false;
}
if( myTarget.sectionID !== potionType[0] && myTarget.sectionID !== potionType[1] )
{
- pUser.SysMessage( "You don't have any strong potions of that type in your pack." );
+ pSock.SysMessage( "You don't have any strong potions of that type in your pack." );
return false;
}
@@ -2123,7 +2179,7 @@ function onCallback0( pSock, myTarget )
var potionCount = [greaterPoison, greaterCure, greaterHeal, greaterStrength];
if( potionCount[potionIndex] >= maxPotionCount )
{
- pUser.SysMessage( "The plant is already soaked with this type of potion!" );
+ pSock.SysMessage( "The plant is already soaked with this type of potion!" );
return false;
}
@@ -2140,6 +2196,8 @@ function onCallback0( pSock, myTarget )
else
myTarget.Delete();
+ pUser.SoundEffect(0x240, 1);
+
return false;
}
@@ -2383,4 +2441,6 @@ function onTooltip( myPlant )
}
return tooltipText;
-}
\ No newline at end of file
+}
+
+function _restorecontext_() {}
\ No newline at end of file
From 867f2cdfa7f17daca7d124b6e247ad7f9fc09576 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 14:43:41 -0500
Subject: [PATCH 09/34] Added Dictionary msgs
---
data/dictionaries/dictionary.CSY | 23 +++++
data/dictionaries/dictionary.ENG | 23 +++++
data/dictionaries/dictionary.FRE | 23 +++++
data/dictionaries/dictionary.GER | 23 +++++
data/dictionaries/dictionary.ITA | 23 +++++
data/dictionaries/dictionary.POL | 23 +++++
data/dictionaries/dictionary.PTG | 23 +++++
data/dictionaries/dictionary.SPA | 23 +++++
data/dictionaries/dictionary.ZRO | 23 +++++
data/js/item/plant_growing/plantsystem.js | 113 +++++++++-------------
10 files changed, 255 insertions(+), 65 deletions(-)
diff --git a/data/dictionaries/dictionary.CSY b/data/dictionaries/dictionary.CSY
index 1cd4b5404..7251d7148 100644
--- a/data/dictionaries/dictionary.CSY
+++ b/data/dictionaries/dictionary.CSY
@@ -5308,5 +5308,28 @@
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á!
}
EOF
diff --git a/data/dictionaries/dictionary.ENG b/data/dictionaries/dictionary.ENG
index a754fda96..6bb73b963 100644
--- a/data/dictionaries/dictionary.ENG
+++ b/data/dictionaries/dictionary.ENG
@@ -5309,5 +5309,28 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.FRE b/data/dictionaries/dictionary.FRE
index 5b420711d..384e8b7a4 100644
--- a/data/dictionaries/dictionary.FRE
+++ b/data/dictionaries/dictionary.FRE
@@ -5464,5 +5464,28 @@
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 !
}
EOF
diff --git a/data/dictionaries/dictionary.GER b/data/dictionaries/dictionary.GER
index 376e4430d..1b2e78a99 100644
--- a/data/dictionaries/dictionary.GER
+++ b/data/dictionaries/dictionary.GER
@@ -5308,5 +5308,28 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.ITA b/data/dictionaries/dictionary.ITA
index bed904994..3fe15c6b7 100644
--- a/data/dictionaries/dictionary.ITA
+++ b/data/dictionaries/dictionary.ITA
@@ -5308,5 +5308,28 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.POL b/data/dictionaries/dictionary.POL
index 364e9af0e..46ee82fb4 100644
--- a/data/dictionaries/dictionary.POL
+++ b/data/dictionaries/dictionary.POL
@@ -5308,5 +5308,28 @@
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ą!
}
EOF
diff --git a/data/dictionaries/dictionary.PTG b/data/dictionaries/dictionary.PTG
index 8fdf547b7..dd39c25f0 100644
--- a/data/dictionaries/dictionary.PTG
+++ b/data/dictionaries/dictionary.PTG
@@ -5308,5 +5308,28 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.SPA b/data/dictionaries/dictionary.SPA
index c400c521d..4c627fa87 100644
--- a/data/dictionaries/dictionary.SPA
+++ b/data/dictionaries/dictionary.SPA
@@ -5308,5 +5308,28 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.ZRO b/data/dictionaries/dictionary.ZRO
index b0ad8a346..7d7df9b58 100644
--- a/data/dictionaries/dictionary.ZRO
+++ b/data/dictionaries/dictionary.ZRO
@@ -5303,5 +5303,28 @@
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!
}
EOF
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 7285119d0..4ce6d72a6 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -13,7 +13,7 @@ function onUseChecked( pUser, iUsed )
var itemPack = GetPackOwner( iUsed, 0 );
if(( !itemPack || itemPack != pUser ) && iUsed.movable != 3 )
{
- socket.SysMessage( "You must have the item in your backpack or locked down in order to use it." );
+ socket.SysMessage( GetDictionaryEntry( 19110, socket.language ));// You must have the item in your backpack or locked down in order to use it.
return false;
}
else
@@ -1226,7 +1226,7 @@ function onGumpPress( socket, button, PlantGump )
}
else
{
- socket.SysMessage( "You need to plant a seed in the bowl first" );
+ socket.SysMessage( GetDictionaryEntry( 19111, socket.language ));//You need to plant a seed in the bowl first
onUseChecked( pUser, iUsed );
}
break;
@@ -1323,7 +1323,7 @@ function onGumpPress( socket, button, PlantGump )
case 26:
iUsed.SetTag( "PlantStage", 19 );//DecorativePlant
socket.CloseGump( gumpID, 0 );
- socket.SysMessage( "You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep." );
+ 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;
@@ -1354,21 +1354,21 @@ function PollinatePlant( pUser, iUsed )
if( !CrossedPlants )
{
- pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19113, socket.language ));//You cannot gather pollen from a mutated plant!
return false;
}
else if( status < 7 )
{
- socket.SysMessage( "Too early to gather pollen" );
+ socket.SysMessage( GetDictionaryEntry( 19114, socket.language ));//Too early to gather pollen
return false;
}
else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying
{
- socket.SysMessage( "You cannot gather pollen from an unhealthy plant!" );
+ socket.SysMessage( GetDictionaryEntry( 19115, socket.language ));//You cannot gather pollen from an unhealthy plant!
return false;
}
else
- pUser.CustomTarget( 1, "Target the plant you wish to cross-pollinate to." );
+ pUser.CustomTarget( 1, GetDictionaryEntry( 19116, socket.language ));//Target the plant you wish to cross-pollinate to.
}
function onCallback1( pSock, myTarget )
@@ -1381,22 +1381,22 @@ function onCallback1( pSock, myTarget )
if( !iCrossedPlants )
{
- pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19113, pSock.language ));//You cannot gather pollen from a mutated plant!
return false;
}
if( status < 7 )
{
- pSock.SysMessage( "Too early to gather pollen" );
+ pSock.SysMessage( GetDictionaryEntry( 19114, pSock.language ));
return false;
}
else if( plantHealth == 10 && plantHealth == 11 )//wilted or dying
{
- pSock.SysMessage( "You cannot gather pollen from an unhealthy plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19115, pSock.language ));//You cannot gather pollen from an unhealthy plant!
return false;
}
else if( status > 7 && status < 9)
{
- pSock.SysMessage( "You can only pollinate other specially grown plants!" );
+ pSock.SysMessage( GetDictionaryEntry( 19117, pSock.language ));//You can only pollinate other specially grown plants!
return false;
}
else
@@ -1407,7 +1407,7 @@ function onCallback1( pSock, myTarget )
if( !tCrossedPlants )
{
- pSock.SysMessage( "You cannot gather pollen from a mutated plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19113, pSock.language ));//You cannot gather pollen from a mutated plant!
return false;
}
@@ -1421,39 +1421,39 @@ function onCallback1( pSock, myTarget )
if( tstatus < 7 )
{
- pSock.SysMessage( "This plant is not in the flowering stage. You cannot pollinate it!" );
+ 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( "You cannot pollinate an unhealthy plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19119, pSock.language ));//You cannot pollinate an unhealthy plant!
return false;
}
else if( tstatus > 7 && tstatus < 9 )
{
- pSock.SysMessage( "You can only pollinate other specially grown plants!" );
+ pSock.SysMessage( GetDictionaryEntry( 19117, pSock.language ));//You can only pollinate other specially grown plants!
return false;
}
else if( crossAble == 0 )
{
- pSock.SysMessage( "You cannot cross-pollinate with a mutated plant!" );
+ pSock.SysMessage( GetDictionaryEntry( 19120, pSock.language ));//You cannot cross-pollinate with a mutated plant!
return false;
}
else if( Pollinated == 1)
{
- pSock.SysMessage( "This plant has already been pollinated!" );
+ 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( "You pollinate the plant with its own pollen." );
+ pSock.SysMessage( GetDictionaryEntry( 19122, pSock.language ));//You pollinate the plant with its own pollen.
}
else
{
CrossPollinateTable( myTarget, iUsed, pSock );
SeedColorsSet( myTarget, iUsed );
- pSock.SysMessage( "You successfully cross - pollinate the plant." );
+ pSock.SysMessage( GetDictionaryEntry( 19123, pSock.language ));//You successfully cross - pollinate the plant.
}
}
}
@@ -1851,7 +1851,7 @@ function GatherSeeds(pUser, iUsed)
if( availableSeeds == 0)
{
- socket.SysMessage("This plant has no seeds to gather!");
+ socket.SysMessage( GetDictionaryEntry( 19124, socket.language ));//This plant has no seeds to gather!
}
else
{
@@ -1989,7 +1989,7 @@ function GatherSeeds(pUser, iUsed)
{
CreateDFNItem(pUser.socket, pUser, seedType, 1, "ITEM", true, hueSeeds);
- socket.SysMessage("You gather seeds from the plant.")
+ socket.SysMessage( GetDictionaryEntry( 19125, socket.language ));//You gather seeds from the plant.
if( availableSeeds > 0)
{
@@ -2036,71 +2036,53 @@ function EmptyBowlGump( pUser, iUsed )
EmptyBowlGump.Free();
}
-function addWater( pUser, iUsed )
+function addWater(pUser, iUsed)
{
var socket = pUser.socket;
var waterLevel = iUsed.GetTag( "water" );
var pitcherofwater1 = pUser.FindItemSection( "0x1f9e" );
var pitcherofwater2 = pUser.FindItemSection( "0x1f9d" );
-
- if (waterLevel >= 4)
+
+ // Check if water level is max
+ if( waterLevel >= 4 )
{
- socket.SysMessage("You can't add water to this plant.");
+ socket.SysMessage( GetDictionaryEntry( 19126, socket.language ));//You can't add water to this plant.
return;
}
- if ( ValidateObject( pitcherofwater1 ))
+ // Check if pitcher1 or pitcher2 is valid
+ if( ValidateObject( pitcherofwater1 ) || ValidateObject( pitcherofwater2 ))
{
- // Set The Plant Bowl Water tag
- iUsed.SetTag( "water", waterLevel + 1 );
-
- // Reduce uses remaining in pitcher
- if( pitcherofwater1.usesLeft == 1 )
- {
- // Pitcher is empty
- pitcherofwater1.usesLeft = 0;
- pitcherofwater1.SetTag( "ContentsName", "nothing" );
- TriggerEvent( 2100, "switchPitcherID", socket, pitcherofwater1 )
- }
- else
- {
- // Reduce uses left in pitcher by 1
- pitcherofwater1.usesLeft--;
- pitcherofwater1.Refresh();
- }
- socket.SysMessage( "You soften the dirt with water." );
- pUser.SoundEffect( 0x4e, 1 );
- }
- else if( ValidateObject( pitcherofwater2 ))
- {
- var waterLevel = iUsed.GetTag("water");
- // Set The Plant Bowl Water tag
+ // Increase water level
iUsed.SetTag("water", waterLevel + 1);
// Reduce uses remaining in pitcher
- if( pitcherofwater2.usesLeft == 1 )
+ var pitcher = ValidateObject( pitcherofwater1 ) ? pitcherofwater1 : pitcherofwater2;
+ if( pitcher.usesLeft == 1 )
{
// Pitcher is empty
- pitcherofwater2.usesLeft = 0;
- pitcherofwater2.SetTag( "ContentsName", "nothing" );
- TriggerEvent( 2100, "switchPitcherID", socket, pitcherofwater2 )
+ pitcher.usesLeft = 0;
+ pitcher.SetTag( "ContentsName", "nothing" );
+ TriggerEvent( 2100, "switchPitcherID", socket, pitcher );
}
else
{
// Reduce uses left in pitcher by 1
- pitcherofwater2.usesLeft--;
- pitcherofwater2.Refresh();
+ pitcher.usesLeft--;
+ pitcher.Refresh();
}
- socket.SysMessage( "You soften the dirt with water." );
- pUser.SoundEffect(0x4e, 1 );
+
+ // Inform user
+ socket.SysMessage( GetDictionaryEntry( 19127, socket.language ));//You soften the dirt with water.
+ pUser.SoundEffect( 0x4e, 1 );
}
else
{
- socket.SysMessage( "You can't use that on a plant!" );
+ socket.SysMessage( GetDictionaryEntry( 19128, socket.language ));//You can't use that on a plant!
}
-
}
+
function addPotion( pUser, iUsed, button )
{
var socket = pUser.socket;
@@ -2159,19 +2141,19 @@ function onCallback0( pSock, myTarget )
if( !potionType )
{
- pSock.SysMessage( "You don't have any strong potions of that type in your pack." );
+ pSock.SysMessage( GetDictionaryEntry( 19129, pSock.language ));//You don't have any strong potions of that type in your pack.
return false;
}
if( myTarget.sectionID !== potionType[0] && myTarget.sectionID !== potionType[1] )
{
- pSock.SysMessage( "You don't have any strong potions of that type in your pack." );
+ 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( "You should only pour potions on a plant or seed!" );
+ pSock.SysMessage( GetDictionaryEntry( 19130, pSock.language ));//You should only pour potions on a plant or seed!
return false;
}
@@ -2179,7 +2161,7 @@ function onCallback0( pSock, myTarget )
var potionCount = [greaterPoison, greaterCure, greaterHeal, greaterStrength];
if( potionCount[potionIndex] >= maxPotionCount )
{
- pSock.SysMessage( "The plant is already soaked with this type of potion!" );
+ pSock.SysMessage( GetDictionaryEntry( 19131, pSock.language ));//The plant is already soaked with this type of potion!
return false;
}
@@ -2207,6 +2189,7 @@ 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 );
@@ -2227,7 +2210,7 @@ function ReproductionGump( pUser, iUsed )
ReproductionGump.AddText( 108, 67, 0x835, "Reproduction" );
- if( iUsed.GetTag( "PlantStage" ) == 9 )
+ if( plantStage == 9 )
{
ReproductionGump.AddButton( 212, 67, 0xD4, 0xD4, 17, 17, 17 ); // Set to decorative
ReproductionGump.AddPicture( 202, 68, 0xC61 );
From fa4ee1f5e84f3dedd086aec448a7b3e57c4824ba Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 15:10:48 -0500
Subject: [PATCH 10/34] Final Update.
---
data/dictionaries/dictionary.CSY | 11 +++++++++++
data/dictionaries/dictionary.ENG | 11 +++++++++++
data/dictionaries/dictionary.FRE | 11 +++++++++++
data/dictionaries/dictionary.GER | 11 +++++++++++
data/dictionaries/dictionary.ITA | 11 +++++++++++
data/dictionaries/dictionary.POL | 11 +++++++++++
data/dictionaries/dictionary.PTG | 11 +++++++++++
data/dictionaries/dictionary.SPA | 11 +++++++++++
data/dictionaries/dictionary.ZRO | 11 +++++++++++
data/js/item/plant_growing/plantbowl.js | 12 ++++++------
data/js/item/plant_growing/plantsystem.js | 2 +-
data/js/item/plant_growing/seed.js | 17 ++++++++---------
12 files changed, 114 insertions(+), 16 deletions(-)
diff --git a/data/dictionaries/dictionary.CSY b/data/dictionaries/dictionary.CSY
index 7251d7148..729b2e5a5 100644
--- a/data/dictionaries/dictionary.CSY
+++ b/data/dictionaries/dictionary.CSY
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.ENG b/data/dictionaries/dictionary.ENG
index 6bb73b963..407aee323 100644
--- a/data/dictionaries/dictionary.ENG
+++ b/data/dictionaries/dictionary.ENG
@@ -5332,5 +5332,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.FRE b/data/dictionaries/dictionary.FRE
index 384e8b7a4..b48c86801 100644
--- a/data/dictionaries/dictionary.FRE
+++ b/data/dictionaries/dictionary.FRE
@@ -5487,5 +5487,16 @@
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 !
}
EOF
diff --git a/data/dictionaries/dictionary.GER b/data/dictionaries/dictionary.GER
index 1b2e78a99..e457b7a49 100644
--- a/data/dictionaries/dictionary.GER
+++ b/data/dictionaries/dictionary.GER
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.ITA b/data/dictionaries/dictionary.ITA
index 3fe15c6b7..4ac2a50e9 100644
--- a/data/dictionaries/dictionary.ITA
+++ b/data/dictionaries/dictionary.ITA
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.POL b/data/dictionaries/dictionary.POL
index 46ee82fb4..3d44b8f76 100644
--- a/data/dictionaries/dictionary.POL
+++ b/data/dictionaries/dictionary.POL
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.PTG b/data/dictionaries/dictionary.PTG
index dd39c25f0..c29055b0b 100644
--- a/data/dictionaries/dictionary.PTG
+++ b/data/dictionaries/dictionary.PTG
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.SPA b/data/dictionaries/dictionary.SPA
index 4c627fa87..10cf654d3 100644
--- a/data/dictionaries/dictionary.SPA
+++ b/data/dictionaries/dictionary.SPA
@@ -5331,5 +5331,16 @@
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!
}
EOF
diff --git a/data/dictionaries/dictionary.ZRO b/data/dictionaries/dictionary.ZRO
index 7d7df9b58..6dd9da638 100644
--- a/data/dictionaries/dictionary.ZRO
+++ b/data/dictionaries/dictionary.ZRO
@@ -5326,5 +5326,16 @@
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!
}
EOF
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index 3e0385b86..ec538edb1 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -17,12 +17,12 @@ function onUseChecked( pUser, iBowl )
var bowlOwner = GetPackOwner(iBowl, 0);
if( bowlOwner == null || bowlOwner != pUser )
{
- pUser.SysMessage( "You must have the object in your backpack to use it." ); //You must have the object in your backpack to use it.
+ 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, "Choose a patch of dirt to scoop up." );//Choose a patch of dirt to scoop up.
+ pUser.CustomTarget( 1, GetDictionaryEntry( 19133, socket.language ));//Choose a patch of dirt to scoop up.
return false;
}
}
@@ -68,14 +68,14 @@ function onCallback1( socket, myTarget )
{
if( myTarget.amount < 40 ) //amount needed
{
- socket.SysMessage( "You need more dirt to fill a plant bowl!" )
+ 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( "You fill the bowl with fresh dirt." )
+ socket.SysMessage( GetDictionaryEntry( 19135, socket.language ));//You fill the bowl with fresh dirt.
iBowl.Delete();
if( myTarget.amount == 40 )
@@ -93,7 +93,7 @@ function onCallback1( socket, myTarget )
var bowlofdirt = CreateDFNItem( mChar.socket, mChar, "plantbowlOfdirt", 1, "ITEM", true );
bowlofdirt.SetTag( "PlantInfo", 0 + "," + 0 + "," + 0 + "," + 0 );
bowlofdirt.SetTag( "PlantStage", 14 );//dirt
- socket.SysMessage("You fill the bowl with fresh dirt." )
+ socket.SysMessage( GetDictionaryEntry( 19135, socket.language ));//You fill the bowl with fresh dirt.
validTileIDFound = true;
iBowl.Delete();
}
@@ -102,7 +102,7 @@ function onCallback1( socket, myTarget )
if( !validTileIDFound )
{
- socket.SysMessage( "You'll want to gather fresh dirt in order to raise a healthy plant!" ); // "You'll want to gather fresh dirt in order to raise a healthy plant!"
+ 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
index 4ce6d72a6..91fa0e36a 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -1,5 +1,5 @@
const scriptID = 19100;// this is the script id
-const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
+const PlantDelayTimer = 82800000;//82800000 Every 23 hours plant grows
function onUseChecked( pUser, iUsed )
{
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index 93c1b4f3a..7513dfbdf 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -11,7 +11,7 @@ function onUseChecked( pUser, iUsed )
else
{
pUser.socket.tempObj = iUsed;
- pUser.CustomTarget( 0, "Choose a bowl of dirt to plant this seed in." );
+ pUser.CustomTarget( 0, GetDictionaryEntry( 19137, pSock.language ));//Choose a bowl of dirt to plant this seed in.
return false;
}
}
@@ -20,7 +20,7 @@ function onUseChecked( pUser, iUsed )
function onCallback0( pSock, myTarget )
{
- const PlantDelayTimer = 5000;//82800000 Every 23 hours plant grows
+ const PlantDelayTimer = 82800000;//82800000 Every 23 hours plant grows
var iUsed = pSock.tempObj;
var pUser = pSock.currentChar;
@@ -55,16 +55,17 @@ function onCallback0( pSock, myTarget )
if( plantStage >= 18 ) // FullGrownPlant
{
// You must use a seed on some prepared soil!
- pSock.SysMessage("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
{
- pSock.SysMessage( "This bowl of dirt already has a seed " + PlantName + " in it!" );
+ 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( "The dirt needs to be softened first." );
+ pSock.SysMessage( GetDictionaryEntry( 19140, pSock.language ));//The dirt needs to be softened first.
}
else
{
@@ -137,9 +138,7 @@ function onCallback0( pSock, myTarget )
myTarget.StartTimer( PlantDelayTimer, 1, 19100 );
myTarget.SetTag( "PlantStage", 1 );//Seed
objMade.SetTag( "Seed", 0 + "," + 8 + "," + iUsed.colour );//Min/max/color
-
- // You plant the seed in the bowl of dirt.
- pSock.SysMessage( "You plant the seed in the bowl of dirt." );
+ pSock.SysMessage( GetDictionaryEntry( 19141, pSock.language ));//You plant the seed in the bowl of dirt.
if( iUsed.amount > 1 )
iUsed.amount--;
@@ -149,7 +148,7 @@ function onCallback0( pSock, myTarget )
}
else
{
- pUser.SysMessage( "You must use a seed on a bowl of dirt!" );//You must use a seed on a bowl of dirt!
+ pUser.SysMessage( GetDictionaryEntry( 19142, pSock.language ));//You must use a seed on a bowl of dirt!
return false;
}
}
From e04b94744318d5d6d6bad670ddf16a262f3da7fd Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 15:31:55 -0500
Subject: [PATCH 11/34] Update plantsystem.js
---
data/js/item/plant_growing/plantsystem.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 91fa0e36a..4c231b706 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -2035,7 +2035,7 @@ function EmptyBowlGump( pUser, iUsed )
EmptyBowlGump.Send( socket );
EmptyBowlGump.Free();
}
-
+/*
function addWater(pUser, iUsed)
{
var socket = pUser.socket;
@@ -2081,7 +2081,7 @@ function addWater(pUser, iUsed)
socket.SysMessage( GetDictionaryEntry( 19128, socket.language ));//You can't use that on a plant!
}
}
-
+*/
function addPotion( pUser, iUsed, button )
{
From fc1a8b538ba1a557da37ee5ece7ccb879fd74294 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 15:35:36 -0500
Subject: [PATCH 12/34] Update plantsystem.js
---
data/js/item/plant_growing/plantsystem.js | 31 +++++++++++------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 4c231b706..a0422e7a7 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -57,10 +57,10 @@ function PlantBowlGump( pUser, iUsed )
var PlantGump = new Gump;
var socket = pUser.socket;
- var potionInfo = iUsed.GetTag( "Potions" )
+ var potionInfo = iUsed.GetTag( "Potions" );
var infection = iUsed.GetTag( "Infections" );
- var waterLevel = iUsed.GetTag( "water" )
- var plantStage = iUsed.GetTag( "PlantStage" )
+ var waterLevel = iUsed.GetTag( "water" );
+ var plantStage = iUsed.GetTag( "PlantStage" );
if( !potionInfo || !infection )
return false;
@@ -500,9 +500,9 @@ function onTimer( myPlant, timerID )
return;
var stage = myPlant.GetTag( "PlantStage" );//Starts at stage 1
- var Seeds = myPlant.GetTag( "Seeds" )
- var CrossedPlants = myPlant.GetTag( "PlantCross" )
- var plantInfo = myPlant.GetTag( "PlantInfo" )
+ var Seeds = myPlant.GetTag( "Seeds" );
+ var CrossedPlants = myPlant.GetTag( "PlantCross" );
+ var plantInfo = myPlant.GetTag( "PlantInfo" );
if( !CrossedPlants || !Seeds || !plantInfo )
return false;
@@ -1349,8 +1349,8 @@ 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")
+ var CrossedPlants = iUsed.GetTag( "PlantCross" );
+ var plantHealth = iUsed.GetTag( "PlantHealth" );
if( !CrossedPlants )
{
@@ -1402,8 +1402,8 @@ function onCallback1( pSock, myTarget )
else
{
var tstatus = myTarget.GetTag( "PlantStage" );
- var tCrossedPlants = myTarget.GetTag( "PlantCross" )
- var tplantHealth = myTarget.GetTag( "PlantHealth" )
+ var tCrossedPlants = myTarget.GetTag( "PlantCross" );
+ var tplantHealth = myTarget.GetTag( "PlantHealth" );
if( !tCrossedPlants )
{
@@ -2035,7 +2035,7 @@ function EmptyBowlGump( pUser, iUsed )
EmptyBowlGump.Send( socket );
EmptyBowlGump.Free();
}
-/*
+
function addWater(pUser, iUsed)
{
var socket = pUser.socket;
@@ -2081,7 +2081,6 @@ function addWater(pUser, iUsed)
socket.SysMessage( GetDictionaryEntry( 19128, socket.language ));//You can't use that on a plant!
}
}
-*/
function addPotion( pUser, iUsed, button )
{
@@ -2294,9 +2293,9 @@ function AddSeedsState( ReproductionGump, iUsed, x, y )
function AddPollinationState(ReproductionGump, iUsed, x, y)
{
- var status = parseInt( iUsed.GetTag("PlantStage" ));
+ var status = parseInt( iUsed.GetTag( "PlantStage" ));
- var tCrossedPlants = iUsed.GetTag("PlantCross")
+ var tCrossedPlants = iUsed.GetTag( "PlantCross" );
if( !tCrossedPlants )
return false;
@@ -2351,9 +2350,9 @@ function SetToDecorativeGump( pUser, iUsed )
function onTooltip( myPlant )
{
var tooltipText = "";
- var status = parseInt( myPlant.GetTag("PlantStage" ));
+ var status = parseInt( myPlant.GetTag( "PlantStage" ));
var plantHealth = myPlant.GetTag( "PlantHealth" );
- var plantInfo = myPlant.GetTag( "PlantInfo" )
+ var plantInfo = myPlant.GetTag( "PlantInfo" );
if( !plantInfo )
return false;
From 196db7f9d0ee2b550d9267a171319b9a05a17e49 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 22:42:34 -0500
Subject: [PATCH 13/34] Update UOX3Build.yml
---
.github/workflows/UOX3Build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/UOX3Build.yml b/.github/workflows/UOX3Build.yml
index d74d4d83f..5ac99081f 100644
--- a/.github/workflows/UOX3Build.yml
+++ b/.github/workflows/UOX3Build.yml
@@ -34,7 +34,7 @@ jobs:
build:
strategy:
matrix:
- os: [ubuntu-latest, windows-latest, macos-13]
+ os: [ubuntu-latest, windows-latest, macos-14]
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
From 6101aedeacc4dd07d1abfc24ace7f00c2bac3ef7 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 14 Mar 2024 22:47:03 -0500
Subject: [PATCH 14/34] Revert "Update UOX3Build.yml"
This reverts commit 196db7f9d0ee2b550d9267a171319b9a05a17e49.
---
.github/workflows/UOX3Build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/UOX3Build.yml b/.github/workflows/UOX3Build.yml
index 5ac99081f..d74d4d83f 100644
--- a/.github/workflows/UOX3Build.yml
+++ b/.github/workflows/UOX3Build.yml
@@ -34,7 +34,7 @@ jobs:
build:
strategy:
matrix:
- os: [ubuntu-latest, windows-latest, macos-14]
+ os: [ubuntu-latest, windows-latest, macos-13]
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
From 8edd6022a9579ef787e65dfe5e6038472556c53b Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 24 Mar 2024 19:40:58 -0500
Subject: [PATCH 15/34] Updates
changes to way tags are handled
---
data/js/item/plant_growing/plantbowl.js | 2 +-
data/js/item/plant_growing/plantsystem.js | 237 +++++++++++++---------
data/js/item/plant_growing/seed.js | 14 +-
3 files changed, 150 insertions(+), 103 deletions(-)
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index ec538edb1..fec5f24e1 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -14,7 +14,7 @@ function onUseChecked( pUser, iBowl )
var socket = pUser.socket;
if( socket && iBowl && iBowl.isItem )
{
- var bowlOwner = GetPackOwner(iBowl, 0);
+ 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.
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index a0422e7a7..f33c850ac 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -63,22 +63,26 @@ function PlantBowlGump( pUser, iUsed )
var plantStage = iUsed.GetTag( "PlantStage" );
if( !potionInfo || !infection )
+ {
return false;
+ }
var potionLength = potionInfo.split( "," );
var infectionLevels = infection.split( "," );
if( potionLength.length != 4 || infectionLevels.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 greaterPoison = potionLength[0];
+ var greaterCure = potionLength[1];
+ var greaterHeal = potionLength[2];
+ var greaterStrength = potionLength[3];
- var infestationLevel = parseInt( infectionLevels[0], 10 );
- var fungusLevel = parseInt( infectionLevels[1], 10 );
- var poisonLevel = parseInt( infectionLevels[2], 10 );
- var diseaseLevel = parseInt( infectionLevels[3], 10 );
+ var infestationLevel = infectionLevels[0];
+ var fungusLevel = infectionLevels[1];
+ var poisonLevel = infectionLevels[2];
+ var diseaseLevel = infectionLevels[3];
DrawBackground( PlantGump );
DrawPlant( PlantGump, iUsed );
@@ -331,9 +335,9 @@ function Die( myPlant )
function GrowthCheck( myPlant )
{
var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
- var infection = myPlant.GetTag( "Infections" ) || "0,0,0,0";
- var potionInfo = myPlant.GetTag( "Potions" ) || "0,0,0,0";
- var plantInfo = myPlant.GetTag( "PlantInfo" ) || "0,0,0,0";
+ var infection = myPlant.GetTag( "Infections" );
+ var potionInfo = myPlant.GetTag( "Potions" );
+ var plantInfo = myPlant.GetTag( "PlantInfo" );
var infoLength = plantInfo.split( "," );
var potionLength = potionInfo.split( "," );
@@ -344,18 +348,18 @@ function GrowthCheck( myPlant )
return;
}
- var greaterPoison = parseInt( potionLength[0], 10 );
- var greaterCure = parseInt( potionLength[1], 10 );
- var greaterHeal = parseInt( potionLength[2], 10 );
- var greaterStrength = parseInt( potionLength[3], 10 );
+ var greaterPoison = potionLength[0];
+ var greaterCure = potionLength[1];
+ var greaterHeal = potionLength[2];
+ var greaterStrength = potionLength[3];
- var infestationLevel = parseInt( infectionLength[0], 10 );
- var fungusLevel = parseInt( infectionLength[1], 10 );
- var poisonLevel = parseInt( infectionLength[2], 10 );
- var diseaseLevel = parseInt( infectionLength[3], 10 );
+ var infestationLevel = infectionLevels[0];
+ var fungusLevel = infectionLevels[1];
+ var poisonLevel = infectionLevels[2];
+ var diseaseLevel = infectionLevels[3];
- var plantType = parseInt( infoLength[0], 10 );
- var plantColor = parseInt( infoLength[2], 10 );
+ var plantType = infoLength[0];
+ var plantColor = infoLength[2];
var infestationChance = 0.30 - greaterStrength * 0.075 + ( waterLevel - 2 ) * 0.10;
@@ -415,64 +419,64 @@ function GrowthCheck( myPlant )
function ApplyPotions( myPlant )
{
var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
- var potionInfo = myPlant.GetTag( "Potions" ) || "0,0,0,0";
- var infection = myPlant.GetTag( "Infections" ) || "0,0,0,0";
+ 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], 10 );
- var greaterCure = parseInt( potionLength[1], 10 );
- var greaterHeal = parseInt( potionLength[2], 10 );
- var greaterStrength = parseInt( potionLength[3], 10 );
+ var greaterPoison = potionLength[0];
+ var greaterCure = potionLength[1];
+ var greaterHeal = potionLength[2];
+ var greaterStrength = potionLength[3];
- var infestationLevel = parseInt( infectionLength[0], 10 );
- var fungusLevel = parseInt( infectionLength[1], 10 );
- var poisonLevel = parseInt( infectionLength[2], 10 );
- var diseaseLevel = parseInt( infectionLength[3], 10 );
+ var infestationLevel = infectionLevels[0];
+ var fungusLevel = infectionLevels[1];
+ var poisonLevel = infectionLevels[2];
+ var diseaseLevel = infectionLevels[3];
+ var infestation = 0;
if( greaterPoison >= infestationLevel )
{
var poison = greaterPoison - infestationLevel;
myPlant.SetTag( "Potions", poison + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
- myPlant.SetTag( "Infections", 0 + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
}
else
{
myPlant.SetTag( "Potions", 0 + greaterCure + "," + greaterHeal + "," + greaterStrength );
- var infestation = infestationLevel - greaterPoison;
- myPlant.SetTag( "Infections", infestation + "," + fungusLevel + "," + poisonLevel + "," + diseaseLevel );
+ infestation = infestationLevel - greaterPoison;
}
+ var fungus = 0;
if( greaterCure >= fungusLevel )
{
var cure = greaterCure - fungusLevel;
myPlant.SetTag( "Potions", greaterPoison + "," + cure + "," + greaterHeal + "," + greaterStrength );
- myPlant.SetTag( "Infections", infestationLevel + 0 + poisonLevel + "," + diseaseLevel );
}
else
{
myPlant.SetTag( "Potions", greaterPoison + 0 + greaterHeal + "," + greaterStrength );
- var fungus = fungusLevel - greaterCure;
- myPlant.SetTag( "Infections", infestationLevel + "," + fungus + "," + poisonLevel + "," + diseaseLevel );
- }
+ fungus = fungusLevel - greaterCure; }
+ var poison = 0;
if( greaterHeal >= poisonLevel )
{
var heal = greaterHeal - poisonLevel;
myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + heal + "," + greaterStrength );
- myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + ",0," + diseaseLevel );
}
else
{
- myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + ",0," + greaterStrength );
- var poison = poisonLevel - greaterHeal;
- myPlant.SetTag( "Infections", infestationLevel + "," + fungusLevel + "," + poison + "," + diseaseLevel );
+ 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 )
@@ -492,8 +496,6 @@ function ApplyPotions( myPlant )
}
}
-
-
function onTimer( myPlant, timerID )
{
if( !ValidateObject( myPlant ))
@@ -505,22 +507,26 @@ function onTimer( myPlant, timerID )
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] );
+ var Pollinated = Crossed[0];
+ var SeedBreed = Crossed[1];
+ var crossAble = Crossed[2];
+ var availableSeeds = Seedlength[0];
+ var remainingSeeds = Seedlength[1];
+ var hueSeeds = Seedlength[2];
+ var fertialeDirt = infoLength[3];
if( timerID == 1 )
{
@@ -672,11 +678,15 @@ 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] );
@@ -960,15 +970,19 @@ function PlantBowl( 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 plantType = infoLength[0];
+ var plantColor = infoLength[2];
+ var fertialeDirt = infoLength[3];
var CampionFlowers = 3203;
var Poppies = 3206;
@@ -1413,11 +1427,13 @@ function onCallback1( pSock, myTarget )
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] );
+ var Pollinated = Crossed[0];
+ var SeedBreed = Crossed[1];
+ var crossAble = Crossed[2];
if( tstatus < 7 )
{
@@ -1464,15 +1480,19 @@ function CrossPollinateTable( myTarget, iUsed, pSock )
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)
+ var icrossLength = iinfo.split( "," );
+ var tcrossLength = tinfo.split( "," );
+ if( icrossLength.length != 4 || tcrossLength.length != 4 )
+ {
return false;
+ }
- var cross = parseInt(icrossLength[0]);
- var cross2 = parseInt(tcrossLength[0]);
+ var cross = icrossLength[0];
+ var cross2 = tcrossLength[0];
var setcross = 0;
@@ -1728,21 +1748,25 @@ function SeedColorsSet(myTarget, iUsed)
var plantInfo = iUsed.GetTag("PlantInfo")
var tplantInfo = myTarget.GetTag("PlantInfo")
- if( !Seeds || !plantInfo || !tplantInfo)
+ 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)
+ if( Seedlength.length != 3 || infoLength.length != 4 || tinfoLength.length != 4 )
+ {
return false;
+ }
- var iplantColor = parseInt(infoLength[2]);
- var tplantColor = parseInt(tinfoLength[2]);
+ var iplantColor = infoLength[2];
+ var tplantColor = tinfoLength[2];
- var availableSeeds = parseInt(Seedlength[0]);
- var remainingSeeds = parseInt(Seedlength[1]);
+ var availableSeeds = Seedlength[0];
+ var remainingSeeds = Seedlength[1];
// Define color combination object
var colorMap = {
@@ -1829,27 +1853,30 @@ function GatherSeeds(pUser, iUsed)
{
var socket = pUser.socket;
- var Seeds = iUsed.GetTag("Seeds")
+ var Seeds = iUsed.GetTag( "Seeds" )
+ var CrossedPlants = iUsed.GetTag( "PlantCross" );
- if( !Seeds)
+ if( !Seeds || !CrossedPlants )
{
return false;
}
- var Seedlength = Seeds.split(",");
- if( Seedlength.length != 3)
+ 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 availableSeeds = Seedlength[0];
+ var remainingSeeds = Seedlength[1];
+ var hueSeeds = Seedlength[2];
- var CrossedPlants = iUsed.GetTag("PlantCross").split( "," );
- var Pollinated = parseInt(CrossedPlants[0]);
- var SeedBreed = parseInt(CrossedPlants[1]);
+ var Pollinated = parseInt(Crossed[0]);
+ var SeedBreed = parseInt(Crossed[1]);
var crossAble = parseInt(Crossed[2]);
- if( availableSeeds == 0)
+ if( availableSeeds == 0 )
{
socket.SysMessage( GetDictionaryEntry( 19124, socket.language ));//This plant has no seeds to gather!
}
@@ -2116,10 +2143,10 @@ function onCallback0( pSock, myTarget )
return false;
}
- var greaterPoison = parseInt( potionLength[0], 10 );
- var greaterCure = parseInt( potionLength[1], 10 );
- var greaterHeal = parseInt( potionLength[2], 10 );
- var greaterStrength = parseInt( potionLength[3], 10 );
+ var greaterPoison = potionLength[0];
+ var greaterCure = potionLength[1];
+ var greaterHeal = potionLength[2];
+ var greaterStrength = potionLength[3];
// Check if the item is in the user's backpack
var itemOwner = GetPackOwner( myTarget, 0 );
@@ -2244,16 +2271,20 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
{
var Seeds = iUsed.GetTag( "Seeds" )
- if( !Seeds )
+ if( !Seeds )
+ {
return false;
+ }
var Seedlength = Seeds.split( "," );
- if( Seedlength.length != 3 )
+ if( Seedlength.length != 3 )
+ {
return false;
+ }
- var availableSeeds = parseInt( Seedlength[0] );
- var remainingSeeds = parseInt( Seedlength[1] );
- var hueSeeds = parseInt( Seedlength[2] );
+ var availableSeeds = Seedlength[0];
+ var remainingSeeds = Seedlength[1];
+ var hueSeeds = Seedlength[2];
if( availableSeeds == 0 && remainingSeeds == 0 )
{
@@ -2271,15 +2302,19 @@ function AddSeedsState( ReproductionGump, iUsed, x, y )
var Seeds = iUsed.GetTag( "Seeds" )
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] );
+ var availableSeeds = Seedlength[0];
+ var remainingSeeds = Seedlength[1];
+ var hueSeeds = Seedlength[2];
if( availableSeeds == 0 && remainingSeeds == 0 )
{
@@ -2297,14 +2332,18 @@ function AddPollinationState(ReproductionGump, iUsed, x, y)
var tCrossedPlants = iUsed.GetTag( "PlantCross" );
- if( !tCrossedPlants )
+ if( !tCrossedPlants )
+ {
return false;
+ }
var Crossed = tCrossedPlants.split( "," );
- if( Crossed.length != 2)
+ if( Crossed.length != 2 )
+ {
return false;
+ }
- var Pollinated = parseInt( Crossed[0] );
+ var Pollinated = Crossed[0];
if( status < 7 )
{
@@ -2355,16 +2394,20 @@ function onTooltip( myPlant )
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 plantType = infoLength[0];
var PlantName = infoLength[1];
- var plantColor = parseInt( infoLength[2] );
- var fertialeDirt = parseInt( infoLength[3] );
+ var plantColor = infoLength[2];
+ var fertialeDirt = infoLength[3];
var colorname = "";
switch( plantColor )
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index 7513dfbdf..e4973b9fe 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -29,19 +29,23 @@ function onCallback0( pSock, myTarget )
{
var plantStage = myTarget.GetTag("PlantStage");
var plantInfo = myTarget.GetTag( "PlantInfo" );
- var waterLevel = myTarget.GetTag("water");
+ 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 = parseInt( infoLength[1] );
- var plantColor = parseInt( infoLength[2] );
- var fertialeDirt = parseInt( infoLength[3] );
+ var plantType = infoLength[0];
+ var PlantName = infoLength[1];
+ var plantColor = infoLength[2];
+ var fertialeDirt = infoLength[3];
var itemOwner = GetPackOwner( myTarget, 0 );
if( itemOwner == null || itemOwner != pUser )
From 314866f0748f0cb5900cc0b575b5b94a820c4530 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Mon, 25 Mar 2024 19:23:42 -0500
Subject: [PATCH 16/34] Fixes
---
data/js/item/plant_growing/plantsystem.js | 119 +++++++++++-----------
data/js/item/plant_growing/seed.js | 8 +-
2 files changed, 64 insertions(+), 63 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index f33c850ac..918fe5bfe 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -74,15 +74,15 @@ function PlantBowlGump( pUser, iUsed )
return false;
}
- var greaterPoison = potionLength[0];
- var greaterCure = potionLength[1];
- var greaterHeal = potionLength[2];
- var greaterStrength = potionLength[3];
+ var greaterPoison = parseInt( potionLength[0] );
+ var greaterCure = parseInt( potionLength[1] );
+ var greaterHeal = parseInt( potionLength[2] );
+ var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = infectionLevels[0];
- var fungusLevel = infectionLevels[1];
- var poisonLevel = infectionLevels[2];
- var diseaseLevel = infectionLevels[3];
+ var infestationLevel = parseInt( infectionLevels[0] );
+ var fungusLevel = parseInt( infectionLevels[1] );
+ var poisonLevel = parseInt( infectionLevels[2] );
+ var diseaseLevel = parseInt( infectionLevels[3] );
DrawBackground( PlantGump );
DrawPlant( PlantGump, iUsed );
@@ -348,15 +348,15 @@ function GrowthCheck( myPlant )
return;
}
- var greaterPoison = potionLength[0];
- var greaterCure = potionLength[1];
- var greaterHeal = potionLength[2];
- var greaterStrength = potionLength[3];
+ var greaterPoison = parseInt( potionLength[0] );
+ var greaterCure = parseInt( potionLength[1] );
+ var greaterHeal = parseInt( potionLength[2] );
+ var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = infectionLevels[0];
- var fungusLevel = infectionLevels[1];
- var poisonLevel = infectionLevels[2];
- var diseaseLevel = infectionLevels[3];
+ var infestationLevel = parseInt( infectionLevels[0] );
+ var fungusLevel = parseInt( infectionLevels[1] );
+ var poisonLevel = parseInt( infectionLevels[2] );
+ var diseaseLevel = parseInt( infectionLevels[3] );
var plantType = infoLength[0];
var plantColor = infoLength[2];
@@ -430,15 +430,15 @@ function ApplyPotions( myPlant )
return false;
}
- var greaterPoison = potionLength[0];
- var greaterCure = potionLength[1];
- var greaterHeal = potionLength[2];
- var greaterStrength = potionLength[3];
+ var greaterPoison = parseInt( potionLength[0] );
+ var greaterCure = parseInt( potionLength[1] );
+ var greaterHeal = parseInt( potionLength[2] );
+ var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = infectionLevels[0];
- var fungusLevel = infectionLevels[1];
- var poisonLevel = infectionLevels[2];
- var diseaseLevel = infectionLevels[3];
+ var infestationLevel = parseInt( infectionLevels[0] );
+ var fungusLevel = parseInt( infectionLevels[1] );
+ var poisonLevel = parseInt( infectionLevels[2] );
+ var diseaseLevel = parseInt( infectionLevels[3] );
var infestation = 0;
if( greaterPoison >= infestationLevel )
@@ -520,13 +520,15 @@ function onTimer( myPlant, timerID )
return false;
}
- var Pollinated = Crossed[0];
- var SeedBreed = Crossed[1];
- var crossAble = Crossed[2];
- var availableSeeds = Seedlength[0];
- var remainingSeeds = Seedlength[1];
- var hueSeeds = Seedlength[2];
- var fertialeDirt = infoLength[3];
+ 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 )
{
@@ -1431,9 +1433,9 @@ function onCallback1( pSock, myTarget )
return false;
}
- var Pollinated = Crossed[0];
- var SeedBreed = Crossed[1];
- var crossAble = Crossed[2];
+ var Pollinated = parseInt( Crossed[0] );
+ var SeedBreed = parseInt( Crossed[1] );
+ var crossAble = parseInt( Crossed[2] );
if( tstatus < 7 )
{
@@ -1762,11 +1764,11 @@ function SeedColorsSet(myTarget, iUsed)
return false;
}
- var iplantColor = infoLength[2];
- var tplantColor = tinfoLength[2];
+ var iplantColor = parseInt( infoLength[2] );
+ var tplantColor = parseInt( tinfoLength[2] );
- var availableSeeds = Seedlength[0];
- var remainingSeeds = Seedlength[1];
+ var availableSeeds = parseInt( Seedlength[0] );
+ var remainingSeeds = parseInt( Seedlength[1] );
// Define color combination object
var colorMap = {
@@ -1868,13 +1870,13 @@ function GatherSeeds(pUser, iUsed)
return false;
}
- var availableSeeds = Seedlength[0];
- var remainingSeeds = Seedlength[1];
- var hueSeeds = Seedlength[2];
+ 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]);
+ var Pollinated = parseInt( Crossed[0] );
+ var SeedBreed = parseInt( Crossed[1] );
+ var crossAble = parseInt( Crossed[2] );
if( availableSeeds == 0 )
{
@@ -2143,10 +2145,10 @@ function onCallback0( pSock, myTarget )
return false;
}
- var greaterPoison = potionLength[0];
- var greaterCure = potionLength[1];
- var greaterHeal = potionLength[2];
- var greaterStrength = potionLength[3];
+ 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 );
@@ -2282,9 +2284,8 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
return false;
}
- var availableSeeds = Seedlength[0];
- var remainingSeeds = Seedlength[1];
- var hueSeeds = Seedlength[2];
+ var availableSeeds = parseInt( Seedlength[0] );
+ var remainingSeeds = parseInt( Seedlength[1] );
if( availableSeeds == 0 && remainingSeeds == 0 )
{
@@ -2312,9 +2313,9 @@ function AddSeedsState( ReproductionGump, iUsed, x, y )
return false;
}
- var availableSeeds = Seedlength[0];
- var remainingSeeds = Seedlength[1];
- var hueSeeds = Seedlength[2];
+ var availableSeeds = parseInt( Seedlength[0] );
+ var remainingSeeds = parseInt( Seedlength[1] );
+ var hueSeeds = parseInt( Seedlength[2] );
if( availableSeeds == 0 && remainingSeeds == 0 )
{
@@ -2343,7 +2344,7 @@ function AddPollinationState(ReproductionGump, iUsed, x, y)
return false;
}
- var Pollinated = Crossed[0];
+ var Pollinated = parseInt( Crossed[0] );
if( status < 7 )
{
@@ -2404,10 +2405,10 @@ function onTooltip( myPlant )
return false;
}
- var plantType = infoLength[0];
- var PlantName = infoLength[1];
- var plantColor = infoLength[2];
- var fertialeDirt = infoLength[3];
+ var plantType = parseInt( infoLength[0] );
+ var PlantName = parseInt( infoLength[1] );
+ var plantColor = parseInt( infoLength[2] );
+ var fertialeDirt = parseInt( infoLength[3] );
var colorname = "";
switch( plantColor )
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index e4973b9fe..a986bd52a 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -42,10 +42,10 @@ function onCallback0( pSock, myTarget )
return false;
}
- var plantType = infoLength[0];
- var PlantName = infoLength[1];
- var plantColor = infoLength[2];
- var fertialeDirt = infoLength[3];
+ var plantType = parseInt( infoLength[0] );
+ var PlantName = parseInt( infoLength[1] );
+ var plantColor = parseInt( infoLength[2] );
+ var fertialeDirt = parseInt( infoLength[3] );
var itemOwner = GetPackOwner( myTarget, 0 );
if( itemOwner == null || itemOwner != pUser )
From 7e04f2b2680c94ab59d519c1ce32d5d5d7521289 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 31 Mar 2024 12:39:05 -0500
Subject: [PATCH 17/34] Fixes
---
data/js/item/plant_growing/plantsystem.js | 29 +++++++++++++----------
data/js/item/plant_growing/seed.js | 4 ++--
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index 918fe5bfe..c24594c79 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -11,14 +11,16 @@ function onUseChecked( pUser, iUsed )
socket.CloseGump( gumpID, 0 );
var itemPack = GetPackOwner( iUsed, 0 );
- if(( !itemPack || itemPack != pUser ) && iUsed.movable != 3 )
+ var iMulti = pUser.multi;
+ if (ValidateObject(iMulti) && (iMulti.IsOnOwnerList(pUser)
+ || (GetServerSetting("COOWNHOUSESONSAMEACCOUNT") && iMulti.owner.accountNum == pUser.accountNum)) || ( itemPack || itemPack == pUser ) && !iUsed.movable != 3 )
{
- socket.SysMessage( GetDictionaryEntry( 19110, socket.language ));// You must have the item in your backpack or locked down in order to use it.
- return false;
+ PlantBowlGump(pUser, iUsed);
}
else
{
- PlantBowlGump( pUser, iUsed );
+ socket.SysMessage(GetDictionaryEntry(19110, socket.language));// You must have the item in your backpack or locked down in order to use it.
+ return false;
}
}
@@ -2069,8 +2071,8 @@ function addWater(pUser, iUsed)
{
var socket = pUser.socket;
var waterLevel = iUsed.GetTag( "water" );
- var pitcherofwater1 = pUser.FindItemSection( "0x1f9e" );
- var pitcherofwater2 = pUser.FindItemSection( "0x1f9d" );
+ var pitcherofwater1 = pUser.FindItemSection( "0X1F9E" );
+ var pitcherofwater2 = pUser.FindItemSection( "0X1F9D" );
// Check if water level is max
if( waterLevel >= 4 )
@@ -2130,7 +2132,7 @@ function onCallback0( pSock, myTarget )
var maxPotionCount = 4; // Change this value to the desired maximum potion count
// Check if the target is an item
- if( !myTarget.isItem )
+ if( !myTarget.isItem )
return false;
var potionInfo = iUsed.GetTag( "Potions" );
@@ -2159,10 +2161,10 @@ function onCallback0( pSock, myTarget )
}
var potionTypeIDs = {
- 7: ["greaterpoisonpotion", "0x0F09-b"],
- 8: ["greatercurepotion", "0x0F07-c"],
- 9: ["greaterhealpotion", "0x0F0C-c"],
- 10: ["greaterstrengthpotion", "0x0F09-b"]
+ 7: ["greaterpoisonpotion", "0X0F09-B"],
+ 8: ["greatercurepotion", "0X0F07-C"],
+ 9: ["greaterhealpotion", "0X0F0C-C"],
+ 10: ["greaterstrengthpotion", "0X0F09-B"]
};
var potionType = potionTypeIDs[buttonPushed];
@@ -2170,10 +2172,11 @@ function onCallback0( pSock, myTarget )
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] )
+ 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;
@@ -2406,7 +2409,7 @@ function onTooltip( myPlant )
}
var plantType = parseInt( infoLength[0] );
- var PlantName = parseInt( infoLength[1] );
+ var PlantName = infoLength[1];
var plantColor = parseInt( infoLength[2] );
var fertialeDirt = parseInt( infoLength[3] );
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index a986bd52a..541296d01 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -11,7 +11,7 @@ function onUseChecked( pUser, iUsed )
else
{
pUser.socket.tempObj = iUsed;
- pUser.CustomTarget( 0, GetDictionaryEntry( 19137, pSock.language ));//Choose a bowl of dirt to plant this seed in.
+ pUser.CustomTarget( 0, GetDictionaryEntry(19137, socket.language ));//Choose a bowl of dirt to plant this seed in.
return false;
}
}
@@ -141,7 +141,7 @@ function onCallback0( pSock, myTarget )
myTarget.StartTimer( PlantDelayTimer, 1, 19100 );
myTarget.SetTag( "PlantStage", 1 );//Seed
- objMade.SetTag( "Seed", 0 + "," + 8 + "," + iUsed.colour );//Min/max/color
+ 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 )
From 90aa6e18649f34ef1e2150e1353f0854eda25011 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 31 Mar 2024 12:41:37 -0500
Subject: [PATCH 18/34] Update plantgrowing.dfn
---
data/dfndata/items/misc/plantgrowing.dfn | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/data/dfndata/items/misc/plantgrowing.dfn b/data/dfndata/items/misc/plantgrowing.dfn
index c66994ecf..ab4b43432 100644
--- a/data/dfndata/items/misc/plantgrowing.dfn
+++ b/data/dfndata/items/misc/plantgrowing.dfn
@@ -10,6 +10,9 @@ get=base_item
name=a plant bowl
weight=10
id=0x15FD
+restock=20
+value=2 1
+decay=1
script=19101
}
@@ -20,6 +23,7 @@ name=a bowl of dirt
weight=10
id=0x1602
hp=100 100
+decay=1
script=19100
}
@@ -29,6 +33,7 @@ get=base_item
id=0xDCF
weight=10
amount=1
+decay=1
colourlist=10003
script=19102
}
@@ -44,7 +49,6 @@ custominttag=CampionFlowerSeed 1
{
get=base_seed
name=Poppie Seed
-colour=43
custominttag=PoppieSeed 1
}
@@ -59,7 +63,6 @@ custominttag=SnowdropSeed 1
{
get=base_seed
name=Bulrushe Seed
-color=0x2B
custominttag=BulrusheSeed 1
}
@@ -134,7 +137,6 @@ custominttag=WaterPlantSeed 1
{
get=base_seed
name=Snake Plant Seed
-color=0x42
custominttag=SnakePlantSeed 1
}
@@ -149,7 +151,6 @@ custominttag=PricklyPearCactusSeed 1
{
get=base_seed
name=Barrel Cactus Seed
-color=0x42
custominttag=BarrelCactusSeed 1
}
From 27461c908a7eb435f34712fb84922af55c2c8b53 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 9 May 2024 20:22:58 -0500
Subject: [PATCH 19/34] Added ArtifactRarity
-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.
---
source/CPacketSend.cpp | 8 ++++++++
source/Changelog.txt | 5 +++++
source/UOXJSPropertyEnums.h | 1 +
source/UOXJSPropertyFuncs.cpp | 2 ++
source/UOXJSPropertySpecs.h | 1 +
source/cBaseObject.cpp | 21 +++++++++++++++++++++
source/cBaseObject.h | 4 ++++
source/cItem.cpp | 9 ++++++++-
source/items.cpp | 1 +
source/ssection.cpp | 2 ++
source/ssection.h | 1 +
11 files changed, 54 insertions(+), 1 deletion(-)
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 1d779c15f..f6fda0b34 100644
--- a/source/Changelog.txt
+++ b/source/Changelog.txt
@@ -1,3 +1,8 @@
+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.
+
27/04/2024 - Dragon Slayer/Xuri
Fixed an issue where non-corpse containers - including treasure chests in dungeons - would decay and leave all their contents on the ground.
Converted LOOTDECAYSWITHCORPSE ini setting to two new settings, one for player corpses, one for NPC corpses:
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..c6b996860 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..498f414a2 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/cBaseObject.cpp b/source/cBaseObject.cpp
index 506c247ac..b38f4cdf4 100644
--- a/source/cBaseObject.cpp
+++ b/source/cBaseObject.cpp
@@ -1036,6 +1036,27 @@ void CBaseObject::IncHP( SI16 amtToChange )
SetHP( hitpoints + amtToChange );
}
+//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 CBaseObject::GetArtifactRarity( void ) const
+{
+ return artifactRarity;
+}
+void CBaseObject::SetArtifactRarity( SI16 newValue )
+{
+ artifactRarity = newValue;
+
+ if( CanBeObjType( OT_ITEM ))
+ {
+ ( static_cast( this ))->UpdateRegion();
+ }
+}
+
//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetDir()
//| CBaseObject::SetDir()
diff --git a/source/cBaseObject.h b/source/cBaseObject.h
index 638e826f7..41f5b6667 100644
--- a/source/cBaseObject.h
+++ b/source/cBaseObject.h
@@ -69,6 +69,7 @@ class CBaseObject
SI16 dexterity;
SI16 intelligence;
SI16 hitpoints;
+ SI16 artifactRarity;
VisibleTypes visible;
SI16 hiDamage;
SI16 loDamage;
@@ -223,6 +224,9 @@ class CBaseObject
virtual void SetHP( SI16 newValue );
void IncHP( SI16 amtToChange );
+ virtual SI16 GetArtifactRarity( void ) const;
+ virtual void SetArtifactRarity( SI16 newValue );
+
void SetDir( UI08 newDir, bool sendUpdate = true );
UI08 GetDir( void ) const;
diff --git a/source/cItem.cpp b/source/cItem.cpp
index 3c6523d5d..0ef6b763b 100644
--- a/source/cItem.cpp
+++ b/source/cItem.cpp
@@ -1638,6 +1638,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 +1738,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 +1775,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/items.cpp b/source/items.cpp
index 1cd4a2aaf..329502d74 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,
From 0c69a3a11be22d3a487265f8949d9e739e471d36 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sat, 11 May 2024 20:15:52 -0500
Subject: [PATCH 20/34] Fixed cast
---
source/UOXJSPropertyFuncs.cpp | 2 +-
source/cItem.cpp | 2 +-
source/items.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/source/UOXJSPropertyFuncs.cpp b/source/UOXJSPropertyFuncs.cpp
index c6b996860..5fc2a3a82 100644
--- a/source/UOXJSPropertyFuncs.cpp
+++ b/source/UOXJSPropertyFuncs.cpp
@@ -1322,7 +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_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/cItem.cpp b/source/cItem.cpp
index 0ef6b763b..0b569e08b 100644
--- a/source/cItem.cpp
+++ b/source/cItem.cpp
@@ -1777,7 +1777,7 @@ bool CItem::HandleLine( std::string &UTag, std::string &data )
case 'A':
if( UTag == "ARTIFACTRARITY" )
{
- SetArtifactRarity( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 )));
+ SetArtifactRarity( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 )));
rValue = true;
}
else if( UTag == "AMMO" )
diff --git a/source/items.cpp b/source/items.cpp
index 329502d74..a95e80f70 100644
--- a/source/items.cpp
+++ b/source/items.cpp
@@ -81,7 +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_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 )
From 231eed38c20cd976eda1f163222980fe53f8b151 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Mon, 13 May 2024 19:20:10 -0500
Subject: [PATCH 21/34] New Shield Type 107
Added New Shield Type 107
---
data/dfndata/items/gear/armor/base_armor.dfn | 17 +++++++++++++++++
source/Changelog.txt | 3 +++
source/cItem.cpp | 4 +---
source/cPlayerAction.cpp | 1 +
source/enums.h | 1 +
5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn
index e7fa16ffe..45196dc68 100644
--- a/data/dfndata/items/gear/armor/base_armor.dfn
+++ b/data/dfndata/items/gear/armor/base_armor.dfn
@@ -1944,6 +1944,7 @@ restock=10
get=base_item
name=bronze shield
id=0x1b72
+type=107
decay=1
good=16
layer=0x02
@@ -1957,6 +1958,7 @@ str=20
get=base_item
name=buckler
id=0x1b73
+type=107
decay=1
good=16
layer=0x02
@@ -1969,6 +1971,7 @@ restock=10
get=base_item
name=metal kite shield
id=0x1b74
+type=107
decay=1
dyeable=1
good=16
@@ -1982,6 +1985,7 @@ restock=10
get=base_item
name=heater shield
id=0x1b76
+type=107
decay=1
good=16
layer=0x02
@@ -1994,6 +1998,7 @@ restock=10
get=base_item
name=metal shield
id=0x1b7b
+type=107
decay=1
good=16
layer=0x02
@@ -2006,6 +2011,7 @@ restock=10
get=base_item
name=kite shield
id=0x1b78
+type=107
decay=1
good=16
layer=2
@@ -2019,6 +2025,7 @@ restock=10
get=base_item
name=wooden shield
id=0x1b7a
+type=107
decay=1
good=16
layer=2
@@ -2032,6 +2039,7 @@ restock=10
get=base_item
name=order shield
id=0x1bc4
+type=107
decay=1
good=16
layer=0x02
@@ -2043,6 +2051,7 @@ layer=0x02
get=base_item
name=chaos shield
id=0x1bc3
+type=107
decay=1
good=16
layer=0x02
@@ -2054,6 +2063,7 @@ layer=0x02
get=base_item
name=gargish chaos shield
id=0x4228
+type=107
decay=1
good=16
layer=0x02
@@ -2067,6 +2077,7 @@ restock=10
get=base_item
name=gargish kite shield
id=0x4201
+type=107
decay=1
good=16
layer=0x02
@@ -2080,6 +2091,7 @@ restock=10
get=base_item
name=gargish order shield
id=0x422a
+type=107
decay=1
good=16
layer=0x02
@@ -2093,6 +2105,7 @@ restock=10
get=base_item
name=large plate shield
id=0x4204
+type=107
decay=1
good=16
layer=0x02
@@ -2106,6 +2119,7 @@ restock=10
get=base_item
name=large stone shield
id=0x4205
+type=107
decay=1
good=16
layer=0x02
@@ -2119,6 +2133,7 @@ restock=10
get=base_item
name=medium plate shield
id=0x4203
+type=107
decay=1
good=16
layer=0x02
@@ -2132,6 +2147,7 @@ restock=10
get=base_item
name=small plate shield
id=0x4202
+type=107
decay=1
good=16
layer=0x02
@@ -2145,6 +2161,7 @@ restock=10
get=base_item
name=gargish wooden shield
id=0x4200
+type=107
decay=1
good=16
layer=0x02
diff --git a/source/Changelog.txt b/source/Changelog.txt
index 1d779c15f..48e1ea62f 100644
--- a/source/Changelog.txt
+++ b/source/Changelog.txt
@@ -1,3 +1,6 @@
+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
+
27/04/2024 - Dragon Slayer/Xuri
Fixed an issue where non-corpse containers - including treasure chests in dungeons - would decay and leave all their contents on the ground.
Converted LOOTDECAYSWITHCORPSE ini setting to two new settings, one for player corpses, one for NPC corpses:
diff --git a/source/cItem.cpp b/source/cItem.cpp
index 3c6523d5d..d18dad36f 100644
--- a/source/cItem.cpp
+++ b/source/cItem.cpp
@@ -1443,9 +1443,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
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,
From 8131f77fc1d63892952a99b27d4c0b368d7344d4 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Mon, 20 May 2024 09:29:28 -0500
Subject: [PATCH 22/34] Buff Bar System
Buffs are positive effects on your character, shown as a green icon.
Debuffs are a negative effect on your character shown as a red icon.
https://uo.com/wiki/ultima-online-wiki/technical/buff-and-debuff-icons/
---
data/js/jse_fileassociations.scp | 1 +
data/js/server/network/0xDF_buffBar.js | 91 ++++++++++++++++++++++++++
data/js/skill/healing.js | 21 ++++++
3 files changed, 113 insertions(+)
create mode 100644 data/js/server/network/0xDF_buffBar.js
diff --git a/data/js/jse_fileassociations.scp b/data/js/jse_fileassociations.scp
index 2cbb8e3d5..80c7ab899 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
// Server Data [2500-2749]
2500=server/data/weapontypes.js
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 6523eb4a7..78010b144 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
{
@@ -269,6 +278,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 );
}
}
From 747ce729b979d7920dbf90aab73794f8d7b684d3 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sat, 25 May 2024 17:42:52 -0500
Subject: [PATCH 23/34] Small Update
---
data/js/item/plant_growing/plantsystem.js | 65 ++++++++++++-----------
data/js/item/plant_growing/seed.js | 2 +-
2 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/data/js/item/plant_growing/plantsystem.js b/data/js/item/plant_growing/plantsystem.js
index c24594c79..cdbb51916 100644
--- a/data/js/item/plant_growing/plantsystem.js
+++ b/data/js/item/plant_growing/plantsystem.js
@@ -70,8 +70,8 @@ function PlantBowlGump( pUser, iUsed )
}
var potionLength = potionInfo.split( "," );
- var infectionLevels = infection.split( "," );
- if( potionLength.length != 4 || infectionLevels.length != 4 )
+ var infectionLength = infection.split( "," );
+ if( potionLength.length != 4 || infectionLength.length != 4 )
{
return false;
}
@@ -81,10 +81,10 @@ function PlantBowlGump( pUser, iUsed )
var greaterHeal = parseInt( potionLength[2] );
var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = parseInt( infectionLevels[0] );
- var fungusLevel = parseInt( infectionLevels[1] );
- var poisonLevel = parseInt( infectionLevels[2] );
- var diseaseLevel = parseInt( infectionLevels[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 );
@@ -206,7 +206,7 @@ function HealthStatus( myPlant )
{
plantHealth = 10; // Dying
}
- else if( health < 66 )
+ else if( health < 66 )
{
plantHealth = 11; // Wilted
}
@@ -297,7 +297,7 @@ function AddGrowthIndicator( PlantGump, iUsed )
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 )
+ if( myPlant.GetTag( "PlantStage" ) >= 9 )
{
// Set the plant's stage to represent dead twigs
myPlant.SetTag( "PlantStage", 20 ); //dead twigs
@@ -322,7 +322,7 @@ function Die( myPlant )
myPlant.SetTag( "Infections", 0 + "," + 0 + "," + 0 + "," + 0 );
myPlant.SetTag( "PlantCross", null );
myPlant.SetTag( "PlantHealth", null );
- myPlant.SetTag( "Seeds", 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)
@@ -336,7 +336,7 @@ function Die( myPlant )
function GrowthCheck( myPlant )
{
- var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
+ var waterLevel = parseInt( myPlant.GetTag( "water" ));
var infection = myPlant.GetTag( "Infections" );
var potionInfo = myPlant.GetTag( "Potions" );
var plantInfo = myPlant.GetTag( "PlantInfo" );
@@ -355,10 +355,10 @@ function GrowthCheck( myPlant )
var greaterHeal = parseInt( potionLength[2] );
var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = parseInt( infectionLevels[0] );
- var fungusLevel = parseInt( infectionLevels[1] );
- var poisonLevel = parseInt( infectionLevels[2] );
- var diseaseLevel = parseInt( infectionLevels[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];
@@ -420,7 +420,7 @@ function GrowthCheck( myPlant )
function ApplyPotions( myPlant )
{
- var waterLevel = parseInt( myPlant.GetTag( "water" ), 10 ) || 0;
+ var waterLevel = parseInt( myPlant.GetTag( "water" ));
var potionInfo = myPlant.GetTag( "Potions" );
var infection = myPlant.GetTag( "Infections" );
@@ -437,10 +437,10 @@ function ApplyPotions( myPlant )
var greaterHeal = parseInt( potionLength[2] );
var greaterStrength = parseInt( potionLength[3] );
- var infestationLevel = parseInt( infectionLevels[0] );
- var fungusLevel = parseInt( infectionLevels[1] );
- var poisonLevel = parseInt( infectionLevels[2] );
- var diseaseLevel = parseInt( infectionLevels[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 )
@@ -450,7 +450,7 @@ function ApplyPotions( myPlant )
}
else
{
- myPlant.SetTag( "Potions", 0 + greaterCure + "," + greaterHeal + "," + greaterStrength );
+ myPlant.SetTag( "Potions", 0 + "," + greaterCure + "," + greaterHeal + "," + greaterStrength );
infestation = infestationLevel - greaterPoison;
}
@@ -462,7 +462,7 @@ function ApplyPotions( myPlant )
}
else
{
- myPlant.SetTag( "Potions", greaterPoison + 0 + greaterHeal + "," + greaterStrength );
+ myPlant.SetTag( "Potions", greaterPoison + "," + 0 + "," + greaterHeal + "," + greaterStrength );
fungus = fungusLevel - greaterCure; }
var poison = 0;
@@ -473,7 +473,7 @@ function ApplyPotions( myPlant )
}
else
{
- myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + 0 + greaterStrength );
+ myPlant.SetTag( "Potions", greaterPoison + "," + greaterCure + "," + 0 + "," + greaterStrength );
poison = poisonLevel - greaterHeal;
}
@@ -504,7 +504,7 @@ function onTimer( myPlant, timerID )
return;
var stage = myPlant.GetTag( "PlantStage" );//Starts at stage 1
- var Seeds = myPlant.GetTag( "Seeds" );
+ var Seeds = myPlant.GetTag( "Seed" );
var CrossedPlants = myPlant.GetTag( "PlantCross" );
var plantInfo = myPlant.GetTag( "PlantInfo" );
@@ -566,7 +566,7 @@ function onTimer( myPlant, timerID )
{
var rseeds = remainingSeeds - 1;
var aseeds = availableSeeds + 1;
- myPlant.SetTag( "Seeds", aseeds + "," + rseeds + "," + hueSeeds );
+ myPlant.SetTag( "Seed", aseeds + "," + rseeds + "," + hueSeeds );
}
}
@@ -1357,7 +1357,7 @@ function ResetPlant( iUsed )
iUsed.SetTag( "Infections", null );
iUsed.SetTag( "PlantCross", null );
iUsed.SetTag( "PlantHealth", null );
- iUsed.SetTag( "Seeds", null );
+ iUsed.SetTag( "Seed", null );
iUsed.RemoveScriptTrigger( scriptID );
iUsed.KillTimers();
}
@@ -1748,7 +1748,7 @@ function CrossPollinateTable( myTarget, iUsed, pSock )
function SeedColorsSet(myTarget, iUsed)
{
- var Seeds = iUsed.GetTag("Seeds");
+ var Seeds = iUsed.GetTag("Seed");
var plantInfo = iUsed.GetTag("PlantInfo")
var tplantInfo = myTarget.GetTag("PlantInfo")
@@ -1849,7 +1849,7 @@ function SeedColorsSet(myTarget, iUsed)
// Get hue from the object
var sethue = colorMap[key] || 0;
- myTarget.SetTag("Seeds", availableSeeds + "," + remainingSeeds + "," + sethue);
+ myTarget.SetTag("Seed", availableSeeds + "," + remainingSeeds + "," + sethue);
}
@@ -1857,7 +1857,7 @@ function GatherSeeds(pUser, iUsed)
{
var socket = pUser.socket;
- var Seeds = iUsed.GetTag( "Seeds" )
+ var Seeds = iUsed.GetTag( "Seed" )
var CrossedPlants = iUsed.GetTag( "PlantCross" );
if( !Seeds || !CrossedPlants )
@@ -2025,7 +2025,7 @@ function GatherSeeds(pUser, iUsed)
if( availableSeeds > 0)
{
var rseeds = availableSeeds - 1;
- iUsed.SetTag("Seeds", rseeds + "," + remainingSeeds + "," + hueSeeds);
+ iUsed.SetTag("Seed", rseeds + "," + remainingSeeds + "," + hueSeeds);
}
}
}
@@ -2274,7 +2274,7 @@ function ReproductionGump( pUser, iUsed )
function AddResourcesState(ReproductionGump, iUsed, x, y)
{
- var Seeds = iUsed.GetTag( "Seeds" )
+ var Seeds = iUsed.GetTag( "Seed" )
if( !Seeds )
{
@@ -2289,6 +2289,7 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
var availableSeeds = parseInt( Seedlength[0] );
var remainingSeeds = parseInt( Seedlength[1] );
+ var hueSeeds = parseInt(Seedlength[2]);
if( availableSeeds == 0 && remainingSeeds == 0 )
{
@@ -2296,14 +2297,14 @@ function AddResourcesState(ReproductionGump, iUsed, x, y)
}
else
{
- ReproductionGump.AddText( x, y, plantColor, availableSeeds + "/" + remainingSeeds );
+ ReproductionGump.AddText( x, y, hueSeeds, availableSeeds + "/" + remainingSeeds );
}
return;
}
function AddSeedsState( ReproductionGump, iUsed, x, y )
{
- var Seeds = iUsed.GetTag( "Seeds" )
+ var Seeds = iUsed.GetTag( "Seed" )
if( !Seeds )
{
diff --git a/data/js/item/plant_growing/seed.js b/data/js/item/plant_growing/seed.js
index 541296d01..25b8a24ca 100644
--- a/data/js/item/plant_growing/seed.js
+++ b/data/js/item/plant_growing/seed.js
@@ -43,7 +43,7 @@ function onCallback0( pSock, myTarget )
}
var plantType = parseInt( infoLength[0] );
- var PlantName = parseInt( infoLength[1] );
+ var PlantName = infoLength[1];
var plantColor = parseInt( infoLength[2] );
var fertialeDirt = parseInt( infoLength[3] );
var itemOwner = GetPackOwner( myTarget, 0 );
From f50badf27eb740c302ee5de6ff85e8f02da33821 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Wed, 29 May 2024 16:39:21 -0500
Subject: [PATCH 24/34] Disguise kit buff
Added Disguise Kit Buff
---
data/js/item/disguisekit.js | 5 +++++
data/js/server/global.js | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/data/js/item/disguisekit.js b/data/js/item/disguisekit.js
index 0f7abeeeb..37f2be332 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(50104, "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(50104, "AddBuff", pUser, 1033, 1075821, 1075820, 7200, ""); // Add Disguise Buff
+
// Resend Disguise Kit Gump
ShowDisguiseKitMenu( pSock, pUser );
break;
diff --git a/data/js/server/global.js b/data/js/server/global.js
index aada1f443..9571e4349 100644
--- a/data/js/server/global.js
+++ b/data/js/server/global.js
@@ -36,6 +36,16 @@ function onLogin( socket, pChar )
// Check if "Young" player still meets requirement for being considered young
TriggerEvent( 8001, "CheckYoungStatus", socket, pChar, true );
}
+
+ // 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(50104, "RemoveBuff", pChar, 1033);
+ TriggerEvent(50104, "AddBuff", pChar, 1033, 1075821, 1075820, timeLeft, "");
+ }
}
function onLogout( pSock, pChar )
From dc928192998dda02d92ac26136b9411069557302 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Wed, 29 May 2024 16:41:53 -0500
Subject: [PATCH 25/34] fixes
---
data/js/item/disguisekit.js | 4 ++--
data/js/server/global.js | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/data/js/item/disguisekit.js b/data/js/item/disguisekit.js
index 37f2be332..c4767dbc3 100644
--- a/data/js/item/disguisekit.js
+++ b/data/js/item/disguisekit.js
@@ -339,13 +339,13 @@ function onGumpPress( pSock, buttonID, gumpData )
// Start Disguise timer
pUser.KillJSTimer( 1, 5023 );
- TriggerEvent(50104, "RemoveBuff", pUser, 1033);// Remove Current Disguise Buff
+ 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(50104, "AddBuff", pUser, 1033, 1075821, 1075820, 7200, ""); // Add Disguise Buff
+ TriggerEvent( 2204, "AddBuff", pUser, 1033, 1075821, 1075820, 7200, "" ); // Add Disguise Buff
// Resend Disguise Kit Gump
ShowDisguiseKitMenu( pSock, pUser );
diff --git a/data/js/server/global.js b/data/js/server/global.js
index 9571e4349..7da16deb8 100644
--- a/data/js/server/global.js
+++ b/data/js/server/global.js
@@ -39,12 +39,12 @@ function onLogin( socket, pChar )
// 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)
+ var disguiseKitTime = pChar.GetJSTimer( 1, 5023 );
+ var timeLeft = Math.round(( disguiseKitTime - currentTime ) / 1000 );
+ if( disguiseKitTime != 0 )
{
- TriggerEvent(50104, "RemoveBuff", pChar, 1033);
- TriggerEvent(50104, "AddBuff", pChar, 1033, 1075821, 1075820, timeLeft, "");
+ TriggerEvent( 2204, "RemoveBuff", pChar, 1033 );
+ TriggerEvent( 2204, "AddBuff", pChar, 1033, 1075821, 1075820, timeLeft, "" );
}
}
From e2fa5370062ceaaee5a36007a834c35052aaf290 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Sun, 16 Jun 2024 11:57:44 -0500
Subject: [PATCH 26/34] Update cBaseObject.cpp
---
source/cBaseObject.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source/cBaseObject.cpp b/source/cBaseObject.cpp
index b38f4cdf4..5a474d345 100644
--- a/source/cBaseObject.cpp
+++ b/source/cBaseObject.cpp
@@ -94,6 +94,7 @@ const SI16 DEFBASE_KILLS = 0;
const UI16 DEFBASE_RESIST = 0;
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
+const SI16 DEFBASE_ARTIFACTRARITY = 0;
//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject constructor
@@ -110,7 +111,8 @@ loDamage( DEFBASE_LODAMAGE ), weight( DEFBASE_WEIGHT ),
mana( DEFBASE_MANA ), stamina( DEFBASE_STAMINA ), scriptTrig( DEFBASE_SCPTRIG ), st2( DEFBASE_STR2 ), dx2( DEFBASE_DEX2 ),
in2( DEFBASE_INT2 ), FilePosition( DEFBASE_FP ),
poisoned( DEFBASE_POISONED ), carve( DEFBASE_CARVE ), oldLocX( 0 ), oldLocY( 0 ), oldLocZ( 0 ), oldTargLocX( 0 ), oldTargLocY( 0 ),
-fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN )
+fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN ),
+artifactRarity( DEFBASE_ARTIFACTRARITY )
{
multis = nullptr;
tempMulti = INVALIDSERIAL;
From 102791197e4b04009faf665c269c793a3e03ed79 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Tue, 14 Jan 2025 14:52:29 -0600
Subject: [PATCH 27/34] Update plantbowl.js
---
data/js/item/plant_growing/plantbowl.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/js/item/plant_growing/plantbowl.js b/data/js/item/plant_growing/plantbowl.js
index fec5f24e1..29b0ad88a 100644
--- a/data/js/item/plant_growing/plantbowl.js
+++ b/data/js/item/plant_growing/plantbowl.js
@@ -17,7 +17,7 @@ function onUseChecked( pUser, iBowl )
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.
+ socket.SysMessage( GetDictionaryEntry( 19132, socket.language )); //You must have the object in your backpack to use it.
}
else
{
From 0f49d28020b652a5f75b260567144bae485e41a9 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Tue, 14 Jan 2025 16:11:19 -0600
Subject: [PATCH 28/34] Moved from base to item
Moved from cbase to citem
---
source/UOXJSPropertySpecs.h | 2 +-
source/cBaseObject.cpp | 25 +------------------------
source/cBaseObject.h | 4 ----
source/cItem.cpp | 24 +++++++++++++++++++++++-
source/cItem.h | 4 ++++
5 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/source/UOXJSPropertySpecs.h b/source/UOXJSPropertySpecs.h
index 498f414a2..8607ffab5 100644
--- a/source/UOXJSPropertySpecs.h
+++ b/source/UOXJSPropertySpecs.h
@@ -535,7 +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 },
+ { "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/cBaseObject.cpp b/source/cBaseObject.cpp
index 5a474d345..506c247ac 100644
--- a/source/cBaseObject.cpp
+++ b/source/cBaseObject.cpp
@@ -94,7 +94,6 @@ const SI16 DEFBASE_KILLS = 0;
const UI16 DEFBASE_RESIST = 0;
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
-const SI16 DEFBASE_ARTIFACTRARITY = 0;
//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject constructor
@@ -111,8 +110,7 @@ loDamage( DEFBASE_LODAMAGE ), weight( DEFBASE_WEIGHT ),
mana( DEFBASE_MANA ), stamina( DEFBASE_STAMINA ), scriptTrig( DEFBASE_SCPTRIG ), st2( DEFBASE_STR2 ), dx2( DEFBASE_DEX2 ),
in2( DEFBASE_INT2 ), FilePosition( DEFBASE_FP ),
poisoned( DEFBASE_POISONED ), carve( DEFBASE_CARVE ), oldLocX( 0 ), oldLocY( 0 ), oldLocZ( 0 ), oldTargLocX( 0 ), oldTargLocY( 0 ),
-fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN ),
-artifactRarity( DEFBASE_ARTIFACTRARITY )
+fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN )
{
multis = nullptr;
tempMulti = INVALIDSERIAL;
@@ -1038,27 +1036,6 @@ void CBaseObject::IncHP( SI16 amtToChange )
SetHP( hitpoints + amtToChange );
}
-//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 CBaseObject::GetArtifactRarity( void ) const
-{
- return artifactRarity;
-}
-void CBaseObject::SetArtifactRarity( SI16 newValue )
-{
- artifactRarity = newValue;
-
- if( CanBeObjType( OT_ITEM ))
- {
- ( static_cast( this ))->UpdateRegion();
- }
-}
-
//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetDir()
//| CBaseObject::SetDir()
diff --git a/source/cBaseObject.h b/source/cBaseObject.h
index 41f5b6667..638e826f7 100644
--- a/source/cBaseObject.h
+++ b/source/cBaseObject.h
@@ -69,7 +69,6 @@ class CBaseObject
SI16 dexterity;
SI16 intelligence;
SI16 hitpoints;
- SI16 artifactRarity;
VisibleTypes visible;
SI16 hiDamage;
SI16 loDamage;
@@ -224,9 +223,6 @@ class CBaseObject
virtual void SetHP( SI16 newValue );
void IncHP( SI16 amtToChange );
- virtual SI16 GetArtifactRarity( void ) const;
- virtual void SetArtifactRarity( SI16 newValue );
-
void SetDir( UI08 newDir, bool sendUpdate = true );
UI08 GetDir( void ) const;
diff --git a/source/cItem.cpp b/source/cItem.cpp
index 0b569e08b..4d6e231f2 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,27 @@ 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;
+
+ if( CanBeObjType( OT_ITEM ))
+ {
+ ( static_cast( this ))->UpdateRegion();
+ }
+}
+
//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetName2()
//| CItem::SetName2()
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;
From a35dde1d4efb951b20011accc31f3d0097bfb79d Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Tue, 14 Jan 2025 18:20:42 -0600
Subject: [PATCH 29/34] fixed
fixed the timer so not looking for the future.
---
data/js/server/global.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/js/server/global.js b/data/js/server/global.js
index 7da16deb8..c68a778fc 100644
--- a/data/js/server/global.js
+++ b/data/js/server/global.js
@@ -41,7 +41,7 @@ function onLogin( socket, pChar )
var currentTime = GetCurrentClock();
var disguiseKitTime = pChar.GetJSTimer( 1, 5023 );
var timeLeft = Math.round(( disguiseKitTime - currentTime ) / 1000 );
- if( disguiseKitTime != 0 )
+ if( disguiseKitTime > 0 )
{
TriggerEvent( 2204, "RemoveBuff", pChar, 1033 );
TriggerEvent( 2204, "AddBuff", pChar, 1033, 1075821, 1075820, timeLeft, "" );
From 465e6e8dca860d9dc1ff6293023073c7cdf06711 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Wed, 15 Jan 2025 21:39:56 -0600
Subject: [PATCH 30/34] Update cItem.cpp
---
source/cItem.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/source/cItem.cpp b/source/cItem.cpp
index 4d6e231f2..38a6d5b15 100644
--- a/source/cItem.cpp
+++ b/source/cItem.cpp
@@ -557,11 +557,7 @@ SI16 CItem::GetArtifactRarity( void ) const
void CItem::SetArtifactRarity( SI16 newValue )
{
artifactRarity = newValue;
-
- if( CanBeObjType( OT_ITEM ))
- {
- ( static_cast( this ))->UpdateRegion();
- }
+ UpdateRegion();
}
//o------------------------------------------------------------------------------------------------o
From 060a3e0d993061b6d5eebfbd7850c681088fbb90 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 16 Jan 2025 17:44:07 -0600
Subject: [PATCH 31/34] update baseshields
---
data/dfndata/items/gear/armor/base_armor.dfn | 131 ++++---------------
1 file changed, 26 insertions(+), 105 deletions(-)
diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn
index 45196dc68..9bb295a0b 100644
--- a/data/dfndata/items/gear/armor/base_armor.dfn
+++ b/data/dfndata/items/gear/armor/base_armor.dfn
@@ -1936,14 +1936,9 @@ origin=tol
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
good=16
@@ -1952,219 +1947,145 @@ restock=10
str=20
}
+// Bronze Shield - Base item with shared DFN tags
+[base_bronze_shield]
+{
+get=base_shield
+name=bronze shield
+id=0x1b72
+}
+
// Buckler - Base item with shared DFN tags
[base_buckler]
{
-get=base_item
+get=base_shield
name=buckler
-id=0x1b73
-type=107
-decay=1
-good=16
-layer=0x02
-restock=10
}
// 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
-type=107
-decay=1
-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
-type=107
-decay=1
-good=16
-layer=0x02
-restock=10
}
// Metal Shield - Base item with shared DFN tags
[base_metal_shield]
{
-get=base_item
+get=base_shield
name=metal shield
id=0x1b7b
-type=107
-decay=1
-good=16
-layer=0x02
-restock=10
}
// Kite Shield (Wooden) - Base item with shared DFN tags
[base_wooden_kite_shield]
{
-get=base_item
+get=base_shield
name=kite shield
id=0x1b78
-type=107
-decay=1
-good=16
-layer=2
-movable=1
-restock=10
}
// Wooden Shield - Base item with shared DFN tags
[base_wooden_shield]
{
-get=base_item
+get=base_shield
name=wooden shield
id=0x1b7a
-type=107
-decay=1
-good=16
-layer=2
-movable=1
-restock=10
}
// Order Shield - Base item with shared DFN tags
[base_order_shield]
{
-get=base_item
+get=base_shield
name=order shield
id=0x1bc4
-type=107
-decay=1
-good=16
-layer=0x02
}
// Chaos Shield - Base item with shared DFN tags
[base_chaos_shield]
{
-get=base_item
+get=base_shield
name=chaos shield
id=0x1bc3
-type=107
-decay=1
-good=16
-layer=0x02
}
// 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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
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
-type=107
-decay=1
-good=16
-layer=0x02
origin=sa
-restock=10
-}
+}
\ No newline at end of file
From cbe6937a45599e2346c8e25a68ddbb736004da5e Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 16 Jan 2025 18:10:25 -0600
Subject: [PATCH 32/34] update
---
data/dfndata/items/gear/armor/base_armor.dfn | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn
index 9bb295a0b..44029cc40 100644
--- a/data/dfndata/items/gear/armor/base_armor.dfn
+++ b/data/dfndata/items/gear/armor/base_armor.dfn
@@ -1936,11 +1936,14 @@ origin=tol
restock=10
}
+// Shields
+
[base_shield]
{
get=base_item
type=107
decay=1
+movable=1
good=16
layer=0x02
restock=10
@@ -1960,6 +1963,7 @@ id=0x1b72
{
get=base_shield
name=buckler
+id=0x1b73
}
// Metal Kite Shield - Base item with shared DFN tags
From 7baaafbe4248c526b9bb5d342b400106387425f9 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 16 Jan 2025 18:21:33 -0600
Subject: [PATCH 33/34] Update base_armor.dfn
---
data/dfndata/items/gear/armor/base_armor.dfn | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn
index 44029cc40..df5bcaec4 100644
--- a/data/dfndata/items/gear/armor/base_armor.dfn
+++ b/data/dfndata/items/gear/armor/base_armor.dfn
@@ -1947,7 +1947,6 @@ movable=1
good=16
layer=0x02
restock=10
-str=20
}
// Bronze Shield - Base item with shared DFN tags
@@ -1956,6 +1955,7 @@ str=20
get=base_shield
name=bronze shield
id=0x1b72
+str=20
}
// Buckler - Base item with shared DFN tags
@@ -1964,6 +1964,7 @@ id=0x1b72
get=base_shield
name=buckler
id=0x1b73
+str=20
}
// Metal Kite Shield - Base item with shared DFN tags
@@ -1972,6 +1973,7 @@ id=0x1b73
get=base_shield
name=metal kite shield
id=0x1b74
+str=20
}
// Heater Shield - Base item with shared DFN tags
@@ -1980,6 +1982,7 @@ id=0x1b74
get=base_shield
name=heater shield
id=0x1b76
+str=20
}
// Metal Shield - Base item with shared DFN tags
@@ -1988,6 +1991,7 @@ id=0x1b76
get=base_shield
name=metal shield
id=0x1b7b
+str=20
}
// Kite Shield (Wooden) - Base item with shared DFN tags
@@ -1996,6 +2000,7 @@ id=0x1b7b
get=base_shield
name=kite shield
id=0x1b78
+str=20
}
// Wooden Shield - Base item with shared DFN tags
@@ -2004,6 +2009,7 @@ id=0x1b78
get=base_shield
name=wooden shield
id=0x1b7a
+str=20
}
// Order Shield - Base item with shared DFN tags
@@ -2012,6 +2018,7 @@ id=0x1b7a
get=base_shield
name=order shield
id=0x1bc4
+str=20
}
// Chaos Shield - Base item with shared DFN tags
@@ -2020,6 +2027,7 @@ id=0x1bc4
get=base_shield
name=chaos shield
id=0x1bc3
+str=20
}
// Gargish Chaos Shield - Base item with shared DFN tags
@@ -2028,6 +2036,7 @@ id=0x1bc3
get=base_shield
name=gargish chaos shield
id=0x4228
+str=20
origin=sa
}
@@ -2037,6 +2046,7 @@ origin=sa
get=base_shield
name=gargish kite shield
id=0x4201
+str=20
origin=sa
}
@@ -2046,6 +2056,7 @@ origin=sa
get=base_shield
name=gargish order shield
id=0x422a
+str=20
origin=sa
}
@@ -2055,6 +2066,7 @@ origin=sa
get=base_shield
name=large plate shield
id=0x4204
+str=20
origin=sa
}
@@ -2064,6 +2076,7 @@ origin=sa
get=base_shield
name=large stone shield
id=0x4205
+str=20
origin=sa
}
@@ -2073,6 +2086,7 @@ origin=sa
get=base_shield
name=medium plate shield
id=0x4203
+str=20
origin=sa
}
@@ -2082,6 +2096,7 @@ origin=sa
get=base_shield
name=small plate shield
id=0x4202
+str=20
origin=sa
}
@@ -2091,5 +2106,6 @@ origin=sa
get=base_shield
name=gargish wooden shield
id=0x4200
+str=20
origin=sa
}
\ No newline at end of file
From 8b398dcc22843678ad5d2916c318ce7d0d346021 Mon Sep 17 00:00:00 2001
From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com>
Date: Thu, 16 Jan 2025 19:12:23 -0600
Subject: [PATCH 34/34] Update base_armor.dfn
---
data/dfndata/items/gear/armor/base_armor.dfn | 1 +
1 file changed, 1 insertion(+)
diff --git a/data/dfndata/items/gear/armor/base_armor.dfn b/data/dfndata/items/gear/armor/base_armor.dfn
index df5bcaec4..0efbde7d8 100644
--- a/data/dfndata/items/gear/armor/base_armor.dfn
+++ b/data/dfndata/items/gear/armor/base_armor.dfn
@@ -1974,6 +1974,7 @@ get=base_shield
name=metal kite shield
id=0x1b74
str=20
+dyeable=1
}
// Heater Shield - Base item with shared DFN tags