Skip to content

Commit

Permalink
Small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonSlayer62 committed May 25, 2024
1 parent c1b2cc7 commit 747ce72
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
65 changes: 33 additions & 32 deletions data/js/item/plant_growing/plantsystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 );
Expand Down Expand Up @@ -206,7 +206,7 @@ function HealthStatus( myPlant )
{
plantHealth = 10; // Dying
}
else if( health < 66 )
else if( health < 66 )
{
plantHealth = 11; // Wilted
}
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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" );
Expand All @@ -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];
Expand Down Expand Up @@ -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" );

Expand All @@ -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 )
Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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" );

Expand Down Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -1849,15 +1849,15 @@ 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);
}


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 )
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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 )
{
Expand All @@ -2289,21 +2289,22 @@ 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 )
{
ReproductionGump.AddText( x + 5, y, 0x21, "X" );
}
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 )
{
Expand Down
2 changes: 1 addition & 1 deletion data/js/item/plant_growing/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 747ce72

Please sign in to comment.