RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

OSI Plant Growing (Updated 12/20)

Status
Not open for further replies.

UOT

Knight
I can see how you might get confused thanks to an oversight on OSI's part when writing the plant section in the codex of wisdom. If you click on the insect (left of the gump) in the codex page it opens it says you need to use a poison potion to kill the insects. What it forgets to mention is that plants on use Greater Potions. Even though silverwolfe already answered your question, I'll go in a bit more detail of what liquids can be used and what they are for.

Valid liquids for plant use are:
Greater Poison Potion: pros: Kills insects cons: If you add too many you risk poisoning the plant.

Greater Cure Potion: pros: Kills fungi cons: If you add too many you risk giving the plant disease.

Greater Heal Potion: Only pros for these. Cures a plant from poison or heals hitpoints of the plant when it's not poisoned.

Greater Strength Potion: Only pros no cons. Cures plant from disease, if not diseased adds to the plants max hit points.

Water: A healthy plant needs to be watered regularly. A dry plant will lose hitpoints, but don't over water them or you risk attracting more fungi and insects. Some types of plants (fat plants) may not need water every day. All the other types need watering every day.


You can also use kegs of the same types. When you click on the potion (right of gump) first it looks for a keg with that type of potion in your backpack. If you don't have any kegs of that potion, it'll look for potion bottles of that type in your backpack. If none are found, then you will get a targeting cursor with that message "Target the container......". With this cursor you can target any valid liquid to add to the plant, it doesn't have to be of the same type as the button you clicked.

So for example if you have insects and wanted to add greater poison, you click the green potion on the right of the menu. If you don't have any in your pack you get the cursor. Now lets say you don't have any greater poison around, but the plant also needed water. With that cursor you can select a pitcher of water to add water to the plant or just hit escape to cancel.

Hope this clarifies things a bit more.[/b]
 

UOT

Knight
A bug dealing with diseased and poisoned plants was found. Please download the new zip always located in the post. The only file that has been changed is PlantBowls.cs.
 

UOT

Knight
The site that's hosting the file is currently down. I'll just post the scripts that need changing here.

PlantGump.cs
[code:1]using System;
using Server;
using Server.Items;
using Server.Targeting;
using Server.Network;
namespace Server.Gumps
{
public class PlantStatMenu : Gump
{
private FullPlantBowl pot;
public PlantStatMenu( Mobile from ) : this( from, null )
{
}
public PlantStatMenu( Mobile from, Item item ) : base( 20, 20 )
{
if (from == null || item == null)
return;
pot = item as FullPlantBowl;
//Code for determining labels

string insect = " ";
int ihue = 0;
if ( pot.Insect > 0 )
{
insect = "+";
if ( pot.Insect == 1 )
{
ihue = 0x35;
}
else
{
ihue = 0x21;
}
}

string funghi = " ";
int fhue = 0;
if ( pot.Funghi > 0 )
{
funghi = "+";
if ( pot.Funghi == 1 )
{
fhue = 0x35;
}
else
{
fhue = 0x21;
}
}

string Poison = " ";
int phue = 0;
if ( pot.Poison == 1 )
{
Poison = "+";
phue = 0x35;
}
else if ( pot.Poison == 2 )
{
Poison = "+";
phue = 0x21;
}

string Disease = " ";
int dhue = 0;
if ( pot.Disease == 1 )
{
Disease = "+";
dhue = 0x35;
}
else if ( pot.Disease == 2 )
{
Disease = "+";
dhue = 0x21;
}



AddBackground( 50, 50, 200, 150, 0xE10 );
AddItem( 45, 45, 0xCEF );
AddItem( 45, 118, 0xCF0 );
AddItem( 211, 45, 0xCEB );
AddItem( 211, 118, 0xCEC );

AddButton( 71, 67, 0xD4, 0xD4, 1, GumpButtonType.Reply, 0 );
AddItem( 59, 68, 0xD08 );
AddButton( 71, 91, 0xD4, 0xD4, 0x2, GumpButtonType.Reply, 0 );
AddItem( 8, 96, 0x372 );
AddButton( 71, 115, 0xD4, 0xD4, 0x3, GumpButtonType.Reply, 0 );
AddItem( 58, 115, 0xD16 );
AddButton( 71, 139, 0xD4, 0xD4, 0x4, GumpButtonType.Reply, 0 );
AddItem( 59, 143, 0x1AE4 );
AddButton( 71, 163, 0xD4, 0xD4, 0x5, GumpButtonType.Reply, 0 );
AddItem( 55, 167, 0x1727 );
AddImage( 209, 67, 0xD2 );
AddButton( 209, 67, 0xD4, 0xD4, 0x6, GumpButtonType.Reply, 0 );
AddItem( 193, 67, 0x1F9D );
AddButton( 209, 91, 0xD4, 0xD4, 0x7, GumpButtonType.Reply, 0 );
AddItem( 197, 91, 0xF0A );
AddLabel( 196, 91, 0x835, pot.GPP.ToString() );
AddButton( 209, 115, 0xD4, 0xD4, 0x8, GumpButtonType.Reply, 0 );
AddItem( 192, 115, 0xF07 );
AddLabel( 196, 115, 0x835, pot.GCP.ToString() );
AddButton( 209, 139, 0xD4, 0xD4, 0x9, GumpButtonType.Reply, 0 );
AddItem( 190, 139, 0xF0C );
AddLabel( 196, 139, 0x835, pot.GHP.ToString() );
AddButton( 209, 163, 0xD4, 0xD4, 0xA, GumpButtonType.Reply, 0 );
AddItem( 193, 163, 0xF09 );
AddLabel( 196, 163, 0x835, pot.GSP.ToString() );
AddImage( 48, 183, 0xD2 );
AddButton( 48, 183, 0xD4, 0xD4, 0xB, GumpButtonType.Reply, 0 );
AddLabel( 54, 183, 0x835, "?" );
AddButton( 232, 183, 0xD4, 0xD4, 0xC, GumpButtonType.Reply, 0 );
AddItem( 219, 180, 0x15FD );
AddImage( 48, 47, 0xD2 );
AddLabel( 54, 47, 0x835, pot.Stage.ToString() );
AddImage( 232, 47, 0xD2 );

string grown = " ";
int grownhue = 0;
switch (pot.Grown)
{
case 0:
{
grown = "-";
grownhue = 0x35;
break;
}
case 1:
{
grown = "-";
grownhue = 0x21;
pot.Grown = 0;
break;
}
case 2:
{
grown = "+";
grownhue = 0x3;
pot.Grown = 0;
break;
}
case 3:
{
grown = "+";
grownhue = 0x3F;
break;
}
case 4:
{
grown = "!";
grownhue = 0x21;
pot.Grown = 0;
break;
}

}
AddLabel( 239, 47, grownhue, grown );

//Gump construction based on plant growth stage
if ( pot.Stage < 7 ) //If before stage 6 we need to draw the pot with dirt gump
{
AddImage( 110, 85, 0x589 );
AddItem( 122, 94, 0x914 );
AddItem( 135, 94, 0x914 );
AddItem( 120, 112, 0x914 );
AddItem( 135, 112, 0x914 );
}
switch (pot.Stage)
{
case 6:
{
AddItem( 127, 112, 0xC62 );
AddItem( 121, 117, 0xC62 );
AddItem( 133, 117, 0xC62 );
AddItem( 110, 100, 0xC62 );
AddItem( 140, 100, 0xC62 );
AddItem( 110, 130, 0xC62 );
AddItem( 140, 130, 0xC62 );
AddItem( 105, 115, 0xC62 );
AddItem( 145, 115, 0xC62 );
AddItem( 125, 90, 0xC62 );
AddItem( 125, 135, 0xC62 );
break;
}
case 5:
{
AddItem( 127, 112, 0xC62 );
AddItem( 121, 117, 0xC62 );
AddItem( 133, 117, 0xC62 );
AddItem( 110, 100, 0xC62 );
AddItem( 140, 100, 0xC62 );
AddItem( 110, 130, 0xC62 );
AddItem( 140, 130, 0xC62 );
break;
}
case 4:
{
AddItem( 127, 112, 0xC62 );
AddItem( 129, 85, 0xC7E );
AddItem( 121, 117, 0xC62 );
AddItem( 133, 117, 0xC62 );
break;
}
case 3:
{
AddItem( 127, 112, 0xC62 );
AddItem( 129, 85, 0xC7E );
break;
}
case 2:
{
AddItem( 127, 112, 0xC62 );
break;
}
case 1: break;
case 0: break;
default:
{
int x = 0; int y = 0;
switch ( pot.SeedType )
{
case -8: x = 130; y = 96; break; // Campion Flower
case -7: x = 130; y = 96; break; // Poppies
case -6: x = 130; y = 106; break; // Snow Drops
case -5: x = 115; y = 96; break; // Bulrushes
case -4: x = 130; y = 96; break; // Lilies
case -3: x = 122; y = 96; break; // Pampas Grass
case -2: x = 120; y = 96; break; // Rushes
case -1: x = 110; y = 96; break; // Elephant Ear Plant
case 0: x = 110; y = 96; break; // Fern
case 1: x = 114; y = 91; break; // Ponytail Palm-
case 2: x = 125; y = 86; break; // Small Palm
case 3: x = 130; y = 69; break; // Century Plant
case 4: x = 130; y = 106; break; // Water Plant
case 5: x = 130; y = 96; break; // Snake Plant
case 6: x = 130; y = 106; break; // Prickly Pear Cactus
case 7: x = 130; y = 106; break; // Barrel Cactus
case 8: x = 130; y = 106; break; // Tribarrel Cactus
}
AddItem( x, y, pot.ItemID ); // Plant pic
break;
}
}

AddLabel( 95, 92, ihue, insect );
AddLabel( 95, 116, fhue, funghi );
AddLabel( 95, 140, phue, Poison );
AddLabel( 95, 164, dhue, Disease );

if ( pot.Water == 1 )
AddLabel( 196, 67, 0x35, "+" );
else if ( pot.Water == -1 )
AddLabel( 196, 67, 0x35, "-" );
else if ( pot.Water > 1 )
AddLabel( 196, 67, 0x21, "+" );
else if ( pot.Water < -1 )
AddLabel( 196, 67, 0x21, "-" );


double health = (double) pot.Hits / pot.Max ;
if ( pot.Hits > 0 && pot.Stage > 0)
{
if ( health >= 0.75 )
{
AddItem( 93, 162, 0x1A99 );
AddItem( 162, 162, 0x1A99 );
AddHtmlLocalized( 129, 167, 42, 20, 1060822, 0x83E0, false, false ); // vibrant
}
else if ( health >= 0.5 )
{
AddItem( 96, 168, 0xC61 );
AddItem( 162, 168, 0xC61 );
AddHtmlLocalized( 129, 167, 42, 20, 1060823, 0x8200, false, false ); // healthy
}
else if ( health >= 0.25 )
{
AddItem( 91, 164, 0x18E6 );
AddItem( 161, 164, 0x18E6 );
AddHtmlLocalized( 132, 167, 42, 20, 1060824, 0xC207, false, false ); // wilted
}
else
{
AddItem( 92, 167, 0x1B9D );
AddItem( 161, 167, 0x1B9D );
AddHtmlLocalized( 136, 167, 42, 20, 1060825, 0xFC00, false, false ); // dying
}
}

}

public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if (!pot.CheckItemUse(from, pot))
return;
Item[] Kegs = from.Backpack.FindItemsByType(typeof(PotionKeg));
PotionKeg GPKeg = null;
PotionKeg GCKeg = null;
PotionKeg GHKeg = null;
PotionKeg GSKeg = null;
if (Kegs != null)
{
for (int i=0; i < Kegs.Length; i++)
{
switch ( ((PotionKeg)Kegs).Type )
{
case PotionEffect.CureGreater: GCKeg = ((PotionKeg)Kegs); break;
case PotionEffect.StrengthGreater: GSKeg = ((PotionKeg)Kegs); break;
case PotionEffect.PoisonGreater: GPKeg = ((PotionKeg)Kegs); break;
case PotionEffect.HealGreater: GHKeg = ((PotionKeg)Kegs); break;
}
}
}
switch ( info.ButtonID )
{
case 1: // resource menu
{
if ( pot.SeedType != -9 )
from.SendGump( new PlantRepMenu( from, pot ) );
else
{
from.SendGump( new PlantStatMenu( from, pot ) );
from.SendLocalizedMessage( 1061885 ); // You need to plant a seed in the bowl first.
}
break;
}
case 2:
{
sender.Send(new CodexOfWisdom(53));//Opens Codex to Infestation Level
from.SendGump(new PlantStatMenu( from, pot ) ); break;
}
case 3:
{
sender.Send(new CodexOfWisdom(55));//Opens Codex to Fungus Level
from.SendGump(new PlantStatMenu( from, pot ) ); break;
}
case 4:
{
sender.Send(new CodexOfWisdom(57));//Opens Codex to Poison Level
from.SendGump(new PlantStatMenu( from, pot ) ); break;
}
case 5:
{
sender.Send(new CodexOfWisdom(59));//Opens Codex to Disease Level
from.SendGump(new PlantStatMenu( from, pot ) ); break;
}
case 6: // Add Water button
{
if ( BaseBeverage.ConsumeTotal( from.Backpack, BeverageType.Water, 1 ) )
{
from.PlaySound( 0x4e );
pot.Water = pot.Water + 1;
pot.SendLocalizedMessageTo( from, 1053048 ); // You soften the dirt with water.
from.SendGump( new PlantStatMenu( from, pot ) );
}
else
{
from.SendLocalizedMessage( 1060808, PlantProps.Stages(pot.Stage) ); // Target the container you wish to use to water the ~1_val~.
from.Target = new LuiquidTarget(pot);
}
break;
}
case 7: // Add Greater Poison button
{
if ( pot.GPP < 2 && pot.Stage != 0)
{
if ( GPKeg != null && GPKeg.Held > 0)
{
from.PlaySound( 0x240 );
pot.GPP = pot.GPP + 1;
--GPKeg.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else if ( from.Backpack.ConsumeTotal( typeof( GreaterPoisonPotion ), 1 ))
{
from.PlaySound( 0x240 );
pot.GPP = pot.GPP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else
{
from.SendLocalizedMessage( 1061884 ); // You don't have any strong potions of that type in your pack.
from.SendLocalizedMessage( 1060808, PlantProps.Stages(pot.Stage) ); // Target the container you wish to use to water the ~1_val~.
from.Target = new LuiquidTarget(pot);break;
}
}
else if ( pot.Stage == 0 )
from.SendLocalizedMessage( 1061875 ); // You should only pour potions on a plant or seed!
else
{
pot.SendLocalizedMessageTo( from, 1053065 ); // The plant is already soaked with this type of potion!
}
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 8: // Add Greater Cure button
{
if ( pot.GCP < 2 && pot.Stage != 0)
{
if ( GCKeg != null && GCKeg.Held > 0 )
{
from.PlaySound( 0x240 );
pot.GCP = pot.GCP + 1;
--GCKeg.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else if ( from.Backpack.ConsumeTotal( typeof( GreaterCurePotion ), 1 ))
{
from.PlaySound( 0x240 );
pot.GCP = pot.GCP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else
{
from.SendLocalizedMessage( 1061884 ); // You don't have any strong potions of that type in your pack.
from.SendLocalizedMessage( 1060808, PlantProps.Stages(pot.Stage) ); // Target the container you wish to use to water the ~1_val~.
from.Target = new LuiquidTarget(pot);break;
}
}
else if ( pot.Stage == 0 )
from.SendLocalizedMessage( 1061875 ); // You should only pour potions on a plant or seed!
else
{
pot.SendLocalizedMessageTo( from, 1053065 ); // The plant is already soaked with this type of potion!
}
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 9: // Add Greater Heal button
{
if ( pot.GHP < 2 && pot.Stage != 0)
{
if ( GHKeg != null && GHKeg.Held > 0 )
{
from.PlaySound( 0x240 );
pot.GHP = pot.GHP + 1;
--GHKeg.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else if ( from.Backpack.ConsumeTotal( typeof( GreaterHealPotion ), 1 ))
{
from.PlaySound( 0x240 );
pot.GHP = pot.GHP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else
{
from.SendLocalizedMessage( 1061884 ); // You don't have any strong potions of that type in your pack.
from.SendLocalizedMessage( 1060808, PlantProps.Stages(pot.Stage) ); // Target the container you wish to use to water the ~1_val~.
from.Target = new LuiquidTarget(pot);break;
}
}
else if ( pot.Stage == 0 )
from.SendLocalizedMessage( 1061875 ); // You should only pour potions on a plant or seed!
else
pot.SendLocalizedMessageTo( from, 1053065 ); // The plant is already soaked with this type of potion!
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 10: // Add Greater Stregnth button
{
if ( pot.GSP < 2 && pot.Stage != 0)
{
if ( GSKeg != null && GSKeg.Held > 0 )
{
from.PlaySound( 0x240 );
pot.GSP = pot.GSP + 1;
--GSKeg.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else if ( from.Backpack.ConsumeTotal( typeof( GreaterStrengthPotion ), 1 ))
{
from.PlaySound( 0x240 );
pot.GSP = pot.GSP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
}
else
{
from.SendLocalizedMessage( 1061884 ); // You don't have any strong potions of that type in your pack.
from.SendLocalizedMessage( 1060808, PlantProps.Stages(pot.Stage) ); // Target the container you wish to use to water the ~1_val~.
from.Target = new LuiquidTarget(pot);break;
}
}
else if ( pot.Stage == 0 )
from.SendLocalizedMessage( 1061875 ); // You should only pour potions on a plant or seed!
else
pot.SendLocalizedMessageTo( from, 1053065 ); // The plant is already soaked with this type of potion!
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 11: // Codex Plant Growing
{
from.SendGump( new PlantStatMenu( from, pot ) );
sender.Send(new CodexOfWisdom(48));//Opens Codex to Plant Growing section
break;
}
case 12: // empty pot
{
from.SendGump( new PlantConfirmMenu( from, pot ) ); break;
}
}
}

private class LuiquidTarget : Target
{
private FullPlantBowl pot;
public LuiquidTarget(FullPlantBowl m_pot) : base( 4, true, TargetFlags.None )
{
pot = m_pot;
}

protected override void OnTarget( Mobile from, object o )
{
bool full = false;
if ( o is BaseBeverage)
{
BaseBeverage bb = o as BaseBeverage;
if (bb.Content == BeverageType.Water && !bb.IsEmpty)
{
from.PlaySound( 0x4e );
pot.Water = pot.Water + 1;
pot.SendLocalizedMessageTo( from, 1053048 ); // You soften the dirt with water.
from.SendGump( new PlantStatMenu( from, pot ) );
return;
}
}

if ( o is PotionKeg )
{
PotionKeg pk = o as PotionKeg;
if ( pk.Held > 0 )
{
switch (pk.Type)
{
case PotionEffect.CureGreater:
{
if (pot.GCP == 2)
{
full = true;
break;
}
from.PlaySound( 0x240 );
pot.GCP++;
--pk.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}

case PotionEffect.StrengthGreater:
{
if (pot.GSP == 2)
{
full = true;
break;
}
from.PlaySound( 0x240 );
pot.GSP++;
--pk.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}

case PotionEffect.PoisonGreater:
{
if (pot.GPP == 2)
{
full = true;
break;
}
from.PlaySound( 0x240 );
pot.GPP++;
--pk.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}

case PotionEffect.HealGreater:
{
if (pot.GHP == 2)
{
full = true;
break;
}
from.PlaySound( 0x240 );
pot.GHP++;
--pk.Held;
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
}
if (!full)
return;
}
}
if ( o is GreaterPoisonPotion )
{
if (pot.GPP ==2)
full = true;
else
{
Item p = o as Item;
p.Consume();
from.PlaySound( 0x240 );
pot.GPP = pot.GPP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
return;
}
}
if ( o is GreaterCurePotion )
{
if (pot.GCP ==2)
full = true;
else
{
Item p = o as Item;
p.Consume();
from.PlaySound( 0x240 );
pot.GCP = pot.GCP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
return;
}
}
if ( o is GreaterHealPotion )
{
if (pot.GHP ==2)
full = true;
else
{
Item p = o as Item;
p.Consume();
from.PlaySound( 0x240 );
pot.GHP = pot.GHP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
return;
}
}
if ( o is GreaterStrengthPotion )
{
if (pot.GSP ==2)
full = true;
else
{
Item p = o as Item;
p.Consume();
from.PlaySound( 0x240 );
pot.GSP = pot.GSP + 1;
from.AddToBackpack( new Bottle() );
pot.SendLocalizedMessageTo( from, 1053067 ); // You pour the potion over the plant.
from.SendGump( new PlantStatMenu( from, pot ) );
return;
}
}
if ( full )
pot.SendLocalizedMessageTo( from, 1053065 ); // The plant is already soaked with this type of potion!
else
from.SendLocalizedMessage( 1053069 ); // You can't use that on a plant!
from.SendGump( new PlantStatMenu( from, pot ) );
}
}
}

public class PlantConfirmMenu : Gump
{

private FullPlantBowl pot;
public PlantConfirmMenu( Mobile from, FullPlantBowl item ) : base( 20, 20 )
{
pot = item;
AddBackground( 50, 50, 200, 150, 0xE10 );
AddItem( 45, 45, 0xCEF );
AddItem( 45, 118, 0xCF0 );
AddItem( 211, 45, 0xCEB );
AddItem( 211, 118, 0xCEC );
AddItem( 90, 100, 0x1602 );
AddImage( 140, 102, 0x15E1 );
AddItem( 160, 100, 0x15FD );
AddLabel( 90, 70, 0x44, "Empty the bowl?" );
AddImage( 138, 151, 0xD2 );
AddButton( 138, 151, 0xD4, 0xD4, 0x3, GumpButtonType.Reply, 0 );
AddLabel( 143, 151, 0x835, "?" );
AddButton( 98, 150, 0x47E, 0x480, 0x2, GumpButtonType.Reply, 0 );
AddButton( 168, 150, 0x481, 0x483, 0x1, GumpButtonType.Reply, 0 );
if (pot.Stage > 0 && pot.Stage < 4)
AddItem( 156, 130, 0xDCF );
}

public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if (!pot.CheckItemUse(from, pot))
return;
switch ( info.ButtonID )
{
case 1: // Empty bowl
{
if ( pot.Stage < 4 && pot.SeedType != -9 )
{
from.AddToBackpack( new baseSeed( pot.SeedColor, pot.SeedType ) );
from.AddToBackpack( new EmptyPlantBowl() );
pot.Delete();
}
else if ( pot.Stage < 7 )
{
from.AddToBackpack( new EmptyPlantBowl() );
pot.Delete();
}
else
{
pot.Delete();
}
break;
}
case 2: // Back to Status screen
{
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 3: // Codex
{
from.SendGump( new PlantConfirmMenu( from, pot ) );
sender.Send(new CodexOfWisdom(71));//Opens Codex to Emptying Bowl section
break;
}
}
}
}

public class PlantRepMenu : Gump
{

private FullPlantBowl pot;
public PlantRepMenu( Mobile from, FullPlantBowl item ) : base( 20, 20 )
{
pot = item;
AddBackground( 50, 50, 200, 150, 0xE10 );
AddImage( 60, 90, 0xE17 );
AddImage( 120, 90, 0xE17 );
AddImage( 60, 145, 0xE17 );
AddImage( 120, 145, 0xE17 );
AddItem( 45, 45, 0xCEF );
AddItem( 45, 118, 0xCF0 );
AddItem( 211, 45, 0xCEB );
AddItem( 211, 118, 0xCEC );
AddButton( 70, 67, 0xD4, 0xD4, 1, GumpButtonType.Reply, 0 );
AddItem( 57, 65, 0x1600 );
AddLabel( 108, 67, 0x835, "Reproduction" );
AddButton( 80, 116, 0xD4, 0xD4, 3, GumpButtonType.Reply, 0 );
AddItem( 66, 117, 0x1AA2 );
AddButton( 128, 116, 0xD4, 0xD4, 7, GumpButtonType.Reply, 0 );
AddItem( 113, 120, 0x1021 );
AddButton( 177, 116, 0xD4, 0xD4, 4, GumpButtonType.Reply, 0 );
AddItem( 160, 121, 0xDCF );
AddImage( 70, 163, 0xD2 );
AddButton( 70, 163, 0xD4, 0xD4, 5, GumpButtonType.Reply, 0 );
AddItem( 56, 164, 0x1AA2 );
AddImage( 138, 163, 0xD2 );
AddButton( 138, 163, 0xD4, 0xD4, 8, GumpButtonType.Reply, 0 );
AddItem( 123, 167, 0x1021 );
AddImage( 212, 163, 0xD2 );
AddButton( 212, 163, 0xD4, 0xD4, 6, GumpButtonType.Reply, 0 );
AddItem( 195, 168, 0xDCF );
if (pot.Stage > 8)
{
AddButton( 212, 67, 0xD4, 0xD4, 2, GumpButtonType.Reply, 0 );
AddItem( 202, 68, 0xC61 );
AddLabel( 216, 66, 0x21, "/" );
}
int cc = 0;
switch (pot.ChildColor)
{
case (int)PlantColors.Plain: cc = 0x835; break;
case (int)PlantColors.Red: cc = 0x24; break;
case (int)PlantColors.BrightRed: cc = 0x21; break;
case (int)PlantColors.Blue: cc = 0x6; break;
case (int)PlantColors.BrightBlue: cc = 0x3; break;
case (int)PlantColors.Purple: cc = 0x10; break;
case (int)PlantColors.BrightPurple: cc = 0xD; break;
case (int)PlantColors.Orange: cc = 0x2E; break;
case (int)PlantColors.BrightOrange: cc = 0x2B; break;
case (int)PlantColors.Yellow: cc = 0x38; break;
case (int)PlantColors.BrightYellow: cc = 0x35; break;
case (int)PlantColors.Green: cc = 0x42; break;
case (int)PlantColors.BrightGreen: cc = 0x3F; break;
case (int)PlantColors.Black: cc = 0x0; break;
//case (int)PlantColors.White: cc = 0x835; break;
default: cc = pot.ChildColor; break;
}
if ( pot.SMax > 0 )
AddLabel( 199, 116, cc, pot.SeedCounter + "/" + pot.SMax );
else
AddLabel( 204, 116, 0x21, "X");
if (pot.ResourceType == 0)
AddLabel( 154, 116, 0x21, "X" );
else
AddLabel( 149, 116, cc, pot.ResourceCounter + "/" + pot.RMax );
if (pot.Stage < 7)
AddLabel( 106, 116, 0x35, "-" );
else if (!pot.Pollenated)
AddLabel( 106, 116, 0x21, "!" );
else
AddLabel( 106, 116, 0x3F, "+" );//change to green

}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if (!pot.CheckItemUse(from, pot))
return;
switch ( info.ButtonID )
{
case 1: // Status screen
{
from.SendGump( new PlantStatMenu( from, pot ) );
break;
}
case 2: // Set to Decorative mode
{
from.SendGump( new ConfirmDecoMode ( from, pot ) );
break;
}
case 3: // Codex Pollenation
{
from.SendGump( new PlantRepMenu( from, pot ) );
sender.Send(new CodexOfWisdom(67));//Opens Codex to Pollenation
break;
}
case 4: // Codex Seeds
{
from.SendGump( new PlantRepMenu( from, pot ) );
sender.Send(new CodexOfWisdom(50));//Opens Codex to Seeds
break;
}
case 5: // Pollenation
{
if ( pot.Hue == (int)PlantColors.White || pot.Hue == (int)PlantColors.Black || pot.Hue == (int)PlantColors.RareMagenta || pot.Hue == (int)PlantColors.RarePink || pot.Hue == (int)PlantColors.RareAqua || pot.Hue == (int)PlantColors.RareFireRed )
pot.SendLocalizedMessageTo( from, 1053050 ); // You cannot gather pollen from a mutated plant!
else if ( pot.Stage < 7 )
pot.SendLocalizedMessageTo( from, 1053051 ); // You cannot gather pollen from a plant in this stage of development!
else if ( pot.Hits < ( pot.Max / 2 ) )
pot.SendLocalizedMessageTo( from, 1053052 ); // You cannot gather pollen from an unhealthy plant!
else
{
pot.SendLocalizedMessageTo( from, 1053054 ); // Target the plant you wish to cross-pollinate to.
from.Target = new InternalTarget( pot );
}
from.SendGump( new PlantRepMenu( from, pot ) );
break;
}
case 6: // Gather Seeds
{
if ( pot.SeedCounter > 0 )
{
bool sc = false;
if (pot.FiftyFifty)
{
if (from.PlaceInBackpack( new baseSeed( pot.ChildColor, pot.ChildType ) ))
sc = true;
}
else
{
if (from.PlaceInBackpack( new NamedSeed( pot.ChildColor, pot.ChildType ) ))
sc = true;
}
if (sc)
{
pot.SendLocalizedMessageTo( from, 1053063 ); // You gather seeds from the plant.
pot.SeedCounter--;
}
else
pot.SendLocalizedMessageTo( from, 1053062 ); // You attempt to gather as many seeds as you can hold, but your backpack is full.
}
else if ( pot.Hue == (int)PlantColors.White || pot.Hue == (int)PlantColors.Black )
pot.SendLocalizedMessageTo( from, 1053060 ); // Mutated plants do not produce seeds!
else
pot.SendLocalizedMessageTo( from, 1053061 ); // This plant has no seeds to gather!
from.SendGump( new PlantRepMenu( from, pot ) );
break;
}
case 7: // Codex resources
{
from.SendGump( new PlantRepMenu( from, pot ) );
sender.Send(new CodexOfWisdom(69));//Opens Codex to resources
break;
}
case 8: // Gather resources
{
if ( pot.Hue == (int)PlantColors.White || pot.Hue == (int)PlantColors.Black )
pot.SendLocalizedMessageTo( from, 1053055 ); // Mutated plants do not produce resources!
else if ( pot.ResourceCounter == 0 )
pot.SendLocalizedMessageTo( from, 1053056 ); // This plant has no resources to gather!
else
{
bool rc = false;
switch ( pot.ResourceType )
{
case 1:
{
if (from.PlaceInBackpack( new RedLeaf() ))
rc = true;
break;
}
case 2:
{
if (from.PlaceInBackpack( new OrangePetals() ))
rc = true;
break;
}
case 3:
{
if (from.PlaceInBackpack( new GreenThorn() ))
rc = true;
break;
}
}
if (rc)
{
pot.SendLocalizedMessageTo( from, 1053059 ); // You gather resources from the plant.
pot.ResourceCounter--;
}
else
pot.SendLocalizedMessageTo( from, 1053058 ); // You attempt to gather as many resources as you can hold, but your backpack is full.
}
from.SendGump( new PlantRepMenu( from, pot ) );
break;
}
}
}
}
class InternalTarget : Target
{
private FullPlantBowl pot;
public InternalTarget(FullPlantBowl m_pot) : base( 6, true, TargetFlags.None )
{
pot = m_pot;
}

protected override void OnTarget( Mobile from, object o )
{

if ( o is FullPlantBowl )
{
FullPlantBowl pot2 = o as FullPlantBowl;
if ( pot2.Pollenated )
pot.SendLocalizedMessageTo( from, 1053072 ); // This plant has already been pollinated!
else if ( pot2.Hue == (int)PlantColors.Black || pot2.Hue == (int)PlantColors.White || pot2.Hue == (int)PlantColors.RareMagenta || pot2.Hue == (int)PlantColors.RareAqua || pot2.Hue == (int)PlantColors.RarePink || pot2.Hue == (int)PlantColors.RareFireRed )
pot.SendLocalizedMessageTo( from, 1053073 ); // You cannot cross-pollinate with a mutated plant!
else if ( pot2.Stage < 7 )
pot.SendLocalizedMessageTo( from, 1053074 ); // This plant is not in the flowering stage. You cannot pollinate it!
else if ( pot.Hits < ( pot.Max / 2 ) )
pot.SendLocalizedMessageTo( from, 1053075 ); // You cannot pollinate an unhealthy plant!
else
{
if ( pot2 == pot )
{
pot.SendLocalizedMessageTo( from, 1053071 ); // You pollinate the plant with its own pollen.
pot.ChildType = pot.SeedType;
pot.ChildColor = pot.SeedColor;
pot2.Pollenated = true;
return;
}
int ct = ( pot2.SeedType + pot.SeedType ) / 2 ;
double ctd = (double)( pot2.SeedType + pot.SeedType ) / 2 ;
if (ct != ctd)
{
pot2.ChildType = ct + (Utility.Random(2) * (ct < 0 ? -1 : 1));
pot.FiftyFifty = true;
}
else
pot2.ChildType = ct;
// Red or bright red
if ( pot.SeedColor == (int)PlantColors.Red || pot.SeedColor == (int)PlantColors.BrightRed )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.BrightRed;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.Purple;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.Orange;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else
pot2.ChildColor = (int)PlantColors.Red;
}
// Blue or bright blue
if ( pot.SeedColor == (int)PlantColors.Blue || pot.SeedColor == (int)PlantColors.BrightBlue )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.Purple;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.BrightBlue;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.Green;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else
pot2.ChildColor = (int)PlantColors.Blue;
}
//Yellow or bright yellow
if ( pot.SeedColor == (int)PlantColors.Yellow || pot.SeedColor == (int)PlantColors.BrightYellow )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.Orange;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.Green;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.BrightYellow;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else
pot2.ChildColor = (int)PlantColors.Yellow;
}
// Purple and bright purple
if ( pot.SeedColor == (int)PlantColors.Purple || pot.SeedColor == (int)PlantColors.BrightPurple )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.Red;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.Blue;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.Yellow;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else if ( pot2.SeedColor == (int)PlantColors.Purple || pot2.SeedColor == (int)PlantColors.BrightPurple )
pot2.ChildColor = (int)PlantColors.BrightPurple;
else if ( pot2.SeedColor == (int)PlantColors.Green || pot2.SeedColor == (int)PlantColors.BrightGreen )
pot2.ChildColor = (int)PlantColors.Blue;
else if ( pot2.SeedColor == (int)PlantColors.Orange || pot2.SeedColor == (int)PlantColors.BrightOrange )
pot2.ChildColor = (int)PlantColors.Red;
}
// Green and bright green
if ( pot.SeedColor == (int)PlantColors.Green || pot.SeedColor == (int)PlantColors.BrightGreen )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.Red;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.Blue;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.Yellow;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else if ( pot2.SeedColor == (int)PlantColors.Purple || pot2.SeedColor == (int)PlantColors.BrightPurple )
pot2.ChildColor = (int)PlantColors.Blue;
else if ( pot2.SeedColor == (int)PlantColors.Green || pot2.SeedColor == (int)PlantColors.BrightGreen )
pot2.ChildColor = (int)PlantColors.BrightGreen;
else if ( pot2.SeedColor == (int)PlantColors.Orange || pot2.SeedColor == (int)PlantColors.BrightOrange )
pot2.ChildColor = (int)PlantColors.Yellow;
}
// Orange and bright Orange
if ( pot.SeedColor == (int)PlantColors.Orange || pot.SeedColor == (int)PlantColors.BrightOrange )
{
if ( pot2.SeedColor == (int)PlantColors.Red || pot2.SeedColor == (int)PlantColors.BrightRed )
pot2.ChildColor = (int)PlantColors.Red;
else if ( pot2.SeedColor == (int)PlantColors.Blue || pot2.SeedColor == (int)PlantColors.BrightBlue )
pot2.ChildColor = (int)PlantColors.Blue;
else if ( pot2.SeedColor == (int)PlantColors.Yellow || pot2.SeedColor == (int)PlantColors.BrightYellow )
pot2.ChildColor = (int)PlantColors.Yellow;
else if ( pot2.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
else if ( pot2.SeedColor == (int)PlantColors.Purple || pot2.SeedColor == (int)PlantColors.BrightPurple )
pot2.ChildColor = (int)PlantColors.Red;
else if ( pot2.SeedColor == (int)PlantColors.Green || pot2.SeedColor == (int)PlantColors.BrightGreen )
pot2.ChildColor = (int)PlantColors.Yellow;
else if ( pot2.SeedColor == (int)PlantColors.Orange || pot2.SeedColor == (int)PlantColors.BrightOrange )
pot2.ChildColor = (int)PlantColors.BrightOrange;
}
// Plain
if ( pot.SeedColor == (int)PlantColors.Plain )
pot2.ChildColor = (int)PlantColors.Plain;
pot2.Pollenated = true;
// 1 in 100 chance of a mutant
if ( Utility.Random(100) == 1)
pot2.ChildColor = Utility.RandomBool() ? (int)PlantColors.Black : (int)PlantColors.White;
pot2.SendLocalizedMessageTo( from, 1053076 ); // You successfully cross-pollinate the plant.
}

}
else
{
from.SendLocalizedMessage( 1053070 ); // You can only pollinate other specially grown plants!
}
}
}

public class ConfirmDecoMode : Gump
{
private FullPlantBowl pot;

public ConfirmDecoMode( Mobile from, FullPlantBowl item ) : base( 20, 20 )
{
pot = item;
AddBackground( 50, 50, 200, 150, 0xE10 );
AddItem( 25, 45, 0xCEB );
AddItem( 25, 118, 0xCEC );
AddItem( 227, 45, 0xCEF );
AddItem( 227, 118, 0xCF0 );
AddLabel( 115, 85, 0x44, "Set plant" );
AddLabel( 82, 105, 0x44, "to decorative mode?" );
AddImage( 138, 141, 0xD2 );
AddButton( 138, 141, 0xD4, 0xD4, 3, GumpButtonType.Reply, 0 );
AddLabel( 143, 141, 0x835, "?" );
AddButton( 98, 140, 0x47E, 0x480, 2, GumpButtonType.Reply, 0 );
AddButton( 168, 140, 0x481, 0x483, 1, GumpButtonType.Reply, 0 );
}

public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if (!pot.CheckItemUse(from, pot))
return;
switch ( info.ButtonID )
{
case 1: // Set to Deco Mode
{
if ( pot.Hits > 0 )
{
pot.SendLocalizedMessageTo( from, 1053077 ); // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.
from.AddToBackpack( new DecorativePlant(pot.ItemID, pot.Hue) );
pot.Delete();
}
break;
}
case 2: // Back to Reproduction gump
{
from.SendGump( new PlantRepMenu( from, pot ) );
break;
}
case 3: // Codex
{
from.SendGump( new ConfirmDecoMode( from, pot ) );
sender.Send(new CodexOfWisdom(70));//Opens Codex to Decorative Mode
break;
}
}
}
}
}[/code:1]
 

UOT

Knight
And
PlantBowls.cs
[code:1]using System;
using Server.Targeting;
using Server.Gumps;
using Server.Mobiles;

using Server.Network;

namespace Server.Items
{
public class EmptyPlantBowl : Item
{
private int m_Dirt;

private static int[] m_DirtIDs = new int[]
{
0x9, 0x15,
0x71, 0xa7,
0xdc, 0xeb,
0x141, 0x15c,
0x169, 0x174,
0x1dc, 0x1ef,
0x272, 0x275,
0x27e, 0x281,
0x2d0, 0x31f,
0x32c, 0x32f,
0x355, 0x358,
0x367, 0x36e,
0x3a5, 0x3a8,
0x547, 0x556,
0x597, 0x59e,
0x623, 0x63a,
0x777, 0x791
};

public override int LabelNumber{ get{return 1060834;} } // a plant bowl
[Constructable]
public EmptyPlantBowl() : base(0x15fd)
{
Weight = 5;
}

public override void OnDoubleClick( Mobile from )
{
from.SendLocalizedMessage( 1053084 );//Choose a patch of dirt to scoop up.
from.Target = new InternalTarget(this);
}

private class InternalTarget : Target
{
private EmptyPlantBowl m_pot;
public InternalTarget(EmptyPlantBowl Pot) : base( 6, true, TargetFlags.None )
{
m_pot = Pot;
}

protected override void OnTarget( Mobile from, object o )
{
int itemID;

if ( o is LandTarget )
{
itemID = from.Map.Tiles.GetLandTile( ((LandTarget)o).X, ((LandTarget)o).Y ).ID & 0x3FFF;

for ( int i = 0; i < m_DirtIDs.Length; i += 2 )
{
if ( itemID >= m_DirtIDs && itemID <= m_DirtIDs[i + 1] )
{
from.SendLocalizedMessage( 1053082 ); // You fill the bowl with fresh dirt.
FullPlantBowl pf = new FullPlantBowl();
pf.Owner = from;
from.AddToBackpack( pf );
m_pot.Delete();
}
}
}
else if ( o is FertileDirt )
{
Item ft = o as Item;
if ( from.Backpack.GetAmount( typeof( FertileDirt )) >= 40 )
{
ft.Consume(40);
FullPlantBowl fpot = new FullPlantBowl();
fpot.Fertile = true;
fpot.Owner = from;
from.AddToBackpack( fpot );
from.SendLocalizedMessage( 1053082 ); // You fill the bowl with fresh dirt.
m_pot.Delete();
}
else if (ft.RootParent != from)
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
else
from.SendLocalizedMessage( 1053083 ); // You need more dirt to fill a plant bowl!

}
else
{
from.SendLocalizedMessage( 1053080 );// You'll want to gather fresh dirt in order to raise a healthy plant!
}

}

}

public EmptyPlantBowl(Serial serial) : base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int) 0);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();
}
}

public class FullPlantBowl : Item
{
private int m_SeedType, m_SeedColor, m_Stage, m_Water, m_Funghi, m_Insect, m_Poison, m_Disease, m_Hits, m_Max, m_GSP, m_GPP, m_GCP, m_GHP, m_Grown;
private int m_ChildColor, m_SeedCounter, m_ChildType, m_ResourceType, m_ResourceCounter, m_RMax, m_SMax, m_SStage;
private bool m_Pollenated, m_FiftyFifty, m_Named, m_Fertile;
private Mobile m_Owner;
private DateTime m_NextCheck;

[CommandProperty( AccessLevel.GameMaster )]
public DateTime NextCheck{ get{ return m_NextCheck; } set{ m_NextCheck = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner{ get{ return m_Owner; } set{ m_Owner = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int SMax{ get{ return m_SMax; } set{ m_SMax = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int RMax{ get{ return m_RMax; } set{ m_RMax = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int ResourceCounter{ get{ return m_ResourceCounter; } set{ m_ResourceCounter = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int ResourceType{ get{ return m_ResourceType; } set{ m_ResourceType = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int ChildType{ get{ return m_ChildType; } set{ m_ChildType = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int SeedCounter{ get{ return m_SeedCounter; } set{ m_SeedCounter = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int ChildColor{ get{ return m_ChildColor; } set{ m_ChildColor = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int SeedType{ get{ return m_SeedType; } set{ m_SeedType = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int SeedColor{ get{ return m_SeedColor; } set{ m_SeedColor = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int SStage{ get{ return m_SStage; } set{ m_SStage = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Stage{ get{ return m_Stage; } set{ m_Stage = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Water{ get{ return m_Water; } set{ m_Water = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Funghi{ get{ return m_Funghi; } set{ m_Funghi = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Insect{ get{ return m_Insect; } set{ m_Insect = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Poison{ get{ return m_Poison; } set{ m_Poison = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Disease{ get{ return m_Disease; } set{ m_Disease = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Hits{ get{ return m_Hits; } set{ m_Hits = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Max{ get{ return m_Max; } set{ m_Max = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int GSP{ get{ return m_GSP; } set{ m_GSP = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int GPP{ get{ return m_GPP; } set{ m_GPP = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int GCP{ get{ return m_GCP; } set{ m_GCP = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int GHP{ get{ return m_GHP; } set{ m_GHP = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Grown{ get{ return m_Grown; } set{ m_Grown = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public bool Pollenated{ get{ return m_Pollenated; } set{ m_Pollenated = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public bool FiftyFifty{ get{ return m_FiftyFifty; } set{ m_FiftyFifty = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public bool Named{ get{ return m_Named; } set{ m_Named = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public bool Fertile{ get{ return m_Fertile; } set{ m_Fertile = value; } }

public FullPlantBowl() : base(0x1602)
{
if (!Core.AOS)
Name = "a bowl of hard dirt";
Weight = 1;
SeedType = -9;
Water = -2;
Hits = 10;
Max = 10;
ChildType = -9;
Fertile = false;
SMax = 8;
FiftyFifty = false;
}


private string Waterlvl
{
get{
if (Water < 0)
return "#1060826";
else if (Water == 0)
return "#1060827";
else if (Water == 1)
return "#1060828";
else
return "#1060829";}
}


private string Health
{
get{
double health = (double) Hits / Max ;
if ( health >= 0.75 )
return "#1060822" ; // vibrant
else if ( health >= 0.5 )
return "#1060823" ; // healthy
else if ( health >= 0.25 )
return "#1060824" ; // wilted
else
return "#1060825" ; // dying
}
}


public override void AddNameProperty( ObjectPropertyList list )
{
if (m_SeedType == -9)
list.Add(1060830, Waterlvl);
else if (Stage < 7 && !Named)
{
string plantname = Waterlvl + "\t" + Health + "\t" + PlantProps.Color(SeedColor) + "\t" + PlantProps.Stages(Stage);
if (PlantProps.Bright(SeedColor))
list.Add(1060832, plantname);
else
list.Add(1060831, plantname);
}
else if (Stage < 7 && Named)
{
string plantname = Waterlvl + "\t" + Health + "\t" + PlantProps.Color(SeedColor) + "\t" + PlantProps.PlantName(SeedType) + "\t" + PlantProps.Stages(Stage);
if (PlantProps.Bright(SeedColor))
list.Add(1061887, plantname);
else
list.Add(1061888, plantname);
}
else
{
if (PlantProps.Bright(SeedColor))
list.Add(1061892, Health + "\t" + PlantProps.Color(SeedColor) + "\t" + PlantProps.PlantName(SeedType));
else
list.Add(1061890, Health + "\t" + PlantProps.Color(SeedColor) + "\t" + PlantProps.PlantName(SeedType));
}
}

public override bool IsAccessibleTo( Mobile check )
{
if (check == Owner)
return true;
return base.IsAccessibleTo(check);
}

public override void OnDoubleClick( Mobile from )
{
from.SendGump( new PlantStatMenu( from, this ) );
}

public override bool CheckItemUse( Mobile from, Item item )
{
if (item != this)
return base.CheckItemUse(from, item);
bool access = false;
if (from == Owner || from == this.RootParent)
access = true;
else if ( this.Movable && from != this.RootParent )
from.SendLocalizedMessage( 1053046 ); // You must have the item in your backpack or locked down in order to use it.
else
from.SendLocalizedMessage( 501652 ); // You cannot use this unless you are the owner.
return access;
}

public override void OnSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
{
if (accepted)
Owner = newOwner;
base.OnSecureTrade( from, to, newOwner, accepted );
}

public virtual void Start( Mobile from, FullPlantBowl item, TimeSpan time )
{
new PlantTimer(from, item, time).Start();
}

private class PlantTimer : Timer
{
private Mobile from;
private FullPlantBowl pot;

public PlantTimer( Mobile m_from, FullPlantBowl item, TimeSpan time) : base( time, PlantProps.GrowthCheck )
{
from = m_from;
pot = item;
}

protected override void OnTick()
{
pot.NextCheck = DateTime.Now + PlantProps.GrowthCheck;
if (pot.Deleted)
Stop();
if (from == null)
{
pot.Delete();
Stop();
}
PlayerMobile pm = null;
bool contcheck = false;
if (pot.RootParent is PlayerMobile)
pm = (PlayerMobile)pot.RootParent;
if (pm != null)
contcheck = ( pot.IsChildOf(pm.Backpack) || pot.IsChildOf(pm.BankBox));
else
contcheck = (!pot.Movable && pot.Parent == null);
if ( !contcheck )
pot.Grown = 4; // Invalid Location for growth
else
{
if ( pot.CheckHealth( pot ) )
{
if ( pot.Hits > ( pot.Max / 2 ) )
{
pot.Grown = 2;
if ( pot.Fertile && pot.Stage < 6 )
{
if ( Utility.RandomDouble() < 0.10 )
{
pot.Grown = 3;
pot.Stage++;
pot.Max = pot.Max + 10;
pot.Hits = pot.Hits + 10;
}
}

if ( pot.Stage < 9 )
{
pot.Stage++;
pot.Max = pot.Max + 10;
pot.Hits = pot.Hits + 10;
if ( pot.Hits > pot.Max )
pot.Hits = pot.Max;
}
}
else
{
pot.Grown = 1;
return;
}
}
else
{
if (pot.Stage > 6)
{
Item twigs = new Item(7069);
twigs.Name = "dead twigs";
twigs.Hue = pot.Hue;
if (pot.Parent == null)
twigs.MoveToWorld ( pot.Location, pot.Map );
else
from.AddToBackpack(twigs);
pot.Delete();
Stop();
}
else
{
Item epot = new EmptyPlantBowl();
if (pot.Parent == null)
epot.MoveToWorld ( pot.Location, pot.Map );
else
from.AddToBackpack(epot);
pot.Delete();
Stop();
}
}

if ( pot.Stage == 4 )
pot.ItemID = 0x1600;//Bowl of Lettuce
if ( pot.Stage == 7 )
{
switch ( pot.SeedType )
{
case -8: pot.Hue = pot.SeedColor; pot.ItemID = 0xC83; break;
case -7: pot.Hue = pot.SeedColor; pot.ItemID = 0xC86; break;
case -6: pot.Hue = pot.SeedColor; pot.ItemID = 0xC88; break;
case -5: pot.Hue = pot.SeedColor; pot.ItemID = 0xC94; break;
case -4: pot.Hue = pot.SeedColor; pot.ItemID = 0xC8B; break;
case -3: pot.Hue = pot.SeedColor; pot.ItemID = 0xCA5; break;
case -2: pot.Hue = pot.SeedColor; pot.ItemID = 0xCA7; break;
case -1: pot.Hue = pot.SeedColor; pot.ItemID = 0xC97; break;
case 0: pot.Hue = pot.SeedColor; pot.ItemID = 0xC9F; break;
case 1: pot.Hue = pot.SeedColor; pot.ItemID = 0xCA6; break;
case 2: pot.Hue = pot.SeedColor; pot.ItemID = 0xC9C; break;
case 3: pot.Hue = pot.SeedColor; pot.ItemID = 0xD31; break;
case 4: pot.Hue = pot.SeedColor; pot.ItemID = 0xD04; break;
case 5: pot.Hue = pot.SeedColor; pot.ItemID = 0xCA9; break;
case 6: pot.Hue = pot.SeedColor; pot.ItemID = 0xD2C; break;
case 7: pot.Hue = pot.SeedColor; pot.ItemID = 0xD26; break;
case 8: pot.Hue = pot.SeedColor; pot.ItemID = 0xD27; break;
}
}
if ( pot.SStage == 9 )
{
Item twigs = new Item(7069);
twigs.Name = "dead twigs";
twigs.Hue = pot.Hue;
if (pot.Parent == null)
twigs.MoveToWorld ( pot.Location, pot.Map );
else
from.AddToBackpack(twigs);
pot.Delete();
Stop();
}

if ( pot.Stage == 9 )
{
if (!pot.Pollenated)
pot.Pollenated = true;
if (pot.SStage > 0)
{
if ( pot.ChildType == -9 )
{
pot.ChildType = pot.SeedType;
pot.ChildColor = pot.SeedColor;
}
if ( pot.SMax > 0 )
{
pot.SMax--;
if ( pot.RMax > 0 )
pot.RMax--;
if ( pot.Hits > ( pot.Max / 2 ) )
{
pot.SeedCounter++;
if ( pot.ResourceType > 0 )
pot.ResourceCounter++;
}
}
}
pot.SStage++;
}
}
}
}

public virtual bool CheckHealth(FullPlantBowl pot)
{
bool healthy = true;
if ( pot.Hits > 0 )
{
//--------Check for cure against insects and for posion--------
if ( (pot.GPP - pot.Insect) == 0 )
{
pot.GPP = 0;
pot.Insect = 0;
}
else if ( (pot.GPP - pot.Insect) < 0 )
{
pot.Insect = pot.Insect - pot.GPP;
pot.GPP = 0;
healthy = false;
}
else
{
pot.Poison = pot.Poison + ( pot.GPP - pot.Insect );
pot.GPP = 0;
pot.Insect = 0;
}
//--------Check for cure against fungi and for disease--------
if ( (pot.GCP - pot.Funghi) == 0 )
{
pot.GCP = 0;
pot.Funghi = 0;
}
else if ( (pot.GCP - pot.Funghi) < 0)
{
pot.Funghi= pot.Funghi - pot.GCP;
pot.GCP = 0;
healthy = false;
}
else
{
pot.Disease = pot.Disease + ( pot.GCP - pot.Funghi );
pot.GCP = 0;
pot.Funghi = 0;
}
//--------Check for cure against disease and poison with heal potions-----
if ( (pot.GHP - pot.Disease ) == 0 )
{
pot.GHP = 0;
pot.Disease = pot.Disease;
}
else if ( (pot.GHP - pot.Disease ) < 0 )
{
pot.Disease = pot.Disease - pot.GHP;
if ( pot.Disease > 2 )
pot.Disease = 2;
pot.GHP = 0;
healthy = false;
}
else
{
pot.GHP = pot.GHP - pot.Disease;
pot.Disease = 0;
}
if ( ( pot.GHP - pot.Poison ) == 0 )
{
pot.GHP = 0;
pot.Poison = pot.Poison;
}
else if ( ( pot.GHP - pot.Poison ) < 0 )
{
pot.Poison = pot.Poison - pot.GHP ;
if ( pot.Poison > 2 )
pot.Poison = 2;
pot.GHP = 0;
healthy = false;
}
else
{
pot.GHP = pot.GHP - pot.Poison;
pot.Poison = 0;
}
//--------Check for healthy plant and add strength potions and heal------
if ( healthy )
{
pot.Max = pot.Max + ( pot.GSP * 2 );
pot.Hits = pot.Hits + ( pot.GHP * 5 );
pot.GSP = 0;
pot.GHP = 0;
}
else
{
pot.Max = pot.Max + ( pot.GSP * 1 );
pot.Hits = pot.Hits + ( pot.GHP * 3 );
pot.GSP = 0;
pot.GHP = 0;
}

if ( pot.Funghi > 0 )
pot.Hits = pot.Hits - ( 5 * pot.Funghi );// Lose 5 hitpoints per level of funghi
if ( pot.Insect > 0 )
pot.Hits = pot.Hits - ( 5 * pot.Insect );// Lose 5 hitpoints per level of insect infestation
if ( pot.Poison > 0 )
pot.Hits = pot.Hits - ( 7 * pot.Poison );// Lose 7 hitpoints per level of poison
if ( pot.Disease > 0 )
pot.Hits = pot.Hits - ( 15 * pot.Disease );// Lose 15 hitpoints per level of disease
if ( pot.Water < 0 )
pot.Hits = pot.Hits - ( pot.Water * -5 );// Lose 5 hitpoints per level of dihydration
if ( pot.Hits < 1 )
{
pot.Grown = 1;
return false;
}

if ( pot.Funghi == 0)
{
if ( Utility.RandomMinMax( (pot.Water * 3), 20 ) > 13 ) // 35% chance of fungi. Chances of fungi are greater if water level is high
pot.Funghi++; //Plant get a fungi infestation
}
else
pot.Funghi = 2;

if ( pot.Insect == 0 )
{
if ( Utility.RandomMinMax( (pot.Water * 3), 20 ) > (PlantProps.Bright(pot.SeedColor) ? 12 : 14) ) //30% Chance non bright colors, 40% bright colors. Chances of insects are greater if water level is high
pot.Insect++; //Plant get an insect infestation
}
else
pot.Insect = 2;
if (PlantProps.FatPlant(pot.SeedType))
{
if (Utility.RandomDouble() > 0.30)
pot.Water--;
}
else
pot.Water--;
return true;
}
else
{
pot.Grown = 1;
return false;
}

}

public FullPlantBowl(Serial serial) : base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int) 4);

writer.Write( m_Fertile );
writer.Write( m_Named );
writer.Write( m_NextCheck );
writer.Write( m_SStage );
writer.Write( m_Owner );
writer.Write( m_ChildType );
writer.Write( m_ResourceType );
writer.Write( m_ResourceCounter );
writer.Write( m_RMax );
writer.Write( m_SMax );
writer.Write( m_ChildColor );
writer.Write( m_SeedCounter );
writer.Write( m_SeedColor );
writer.Write( m_SeedType );
writer.Write( m_Stage );
writer.Write( m_Water );
writer.Write( m_Funghi );
writer.Write( m_Insect );
writer.Write( m_Poison );
writer.Write( m_Disease );
writer.Write( m_Hits );
writer.Write( m_Max );
writer.Write( m_GSP );
writer.Write( m_GPP );
writer.Write( m_GCP );
writer.Write( m_GHP );
writer.Write( m_Grown );
writer.Write( m_Pollenated );
writer.Write( m_FiftyFifty );
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();

switch ( version )
{
case 4:
{
m_Fertile = reader.ReadBool();
goto case 3;
}
case 3:
{
m_Named = reader.ReadBool();
goto case 2;
}
case 2:
{
m_NextCheck = reader.ReadDateTime();
goto case 1;
}
case 1:
{
m_SStage = (int)reader.ReadInt();
goto case 0;
}
case 0:
{
m_Owner = reader.ReadMobile();
m_ChildType = (int)reader.ReadInt();
m_ResourceType = (int)reader.ReadInt();
m_ResourceCounter = (int)reader.ReadInt();
m_RMax = (int)reader.ReadInt();
m_SMax = (int)reader.ReadInt();
m_ChildColor = (int)reader.ReadInt();
m_SeedCounter = (int)reader.ReadInt();
m_SeedColor = (int)reader.ReadInt();
m_SeedType = (int)reader.ReadInt();
m_Stage = (int)reader.ReadInt();
m_Water = (int)reader.ReadInt();
m_Funghi = (int)reader.ReadInt();
m_Insect = (int)reader.ReadInt();
m_Poison = (int)reader.ReadInt();
m_Disease = (int)reader.ReadInt();
m_Hits = (int)reader.ReadInt();
m_Max = (int)reader.ReadInt();
m_GSP = (int)reader.ReadInt();
m_GPP = (int)reader.ReadInt();
m_GCP = (int)reader.ReadInt();
m_GHP = (int)reader.ReadInt();
m_Grown = (int)reader.ReadInt();
m_Pollenated = reader.ReadBool();
m_FiftyFifty = reader.ReadBool();
break;
}
}
if (m_Owner == null)
Delete();
else
{
if ( m_SeedType > -9 && m_Hits > 0 )
{
TimeSpan time = (TimeSpan)(NextCheck - DateTime.Now);
if ( time < TimeSpan.Zero )
Start(m_Owner, this, TimeSpan.Zero);
else
Start(m_Owner, this, time);
}
}
}
}

public class DecorativePlant : Item
{
public override int LabelNumber{ get{ return 1061924; } } // a decorative plant
[Constructable]
public DecorativePlant(int id, int hue) : base( id )
{
Weight = 5;
Hue = hue;
Name = "a decorative plant";
Movable = true;
Stackable = false;
}


public DecorativePlant(Serial serial) : base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int) 0);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();
}
}
}[/code:1]
 

Urk

Wanderer
Nice script, but...
I've decided to place these seeds to the Herbalist sell list and...
It sells the seeds, but in the Buy menu it is called fishing weight.
How can I change it to the correct name?
 

UOT

Knight
Urk said:
Nice script, but...
I've decided to place these seeds to the Herbalist sell list and...
It sells the seeds, but in the Buy menu it is called fishing weight.
How can I change it to the correct name?

To get the seeds to display the correct name you need to use the string override of genericbuyinfo and you'd also have to make a class for each color seed you want to sell. For example red seed[code:1]public class RedSeed : baseSeed
{
[Constructable]
public RedSeed() : base( (int)PlantColors.Red, -9 ) //Creates a random red seed
{
}

public RedSeed(Serial serial) : base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
}
}[/code:1]then in your herbalist sbinfo you add [code:1]Add( new GenericBuyInfo( "Red Seed", typeof( RedSeed ), 5, 100, 0x0dcd, (int)PlantColors.Red ) );[/code:1]Hope this helps :)
 
no this is a system to grow plants, most are only decorative in the end. but by cross breeding you can atain one of 6 types that produce special resources orange petals make you imune to all but deadly poison for 5 minutes per use. red leaf can be used to make a book non editable. and the green thorn can be used to enter the hidden solen hive, summon a vorpal bunny, ice serpent, and whipping vine, and finaly planting the thorn on the road will produce between 100 an 150 random regs.
 

UOT

Knight
the green thorn can be used to enter the hidden solen hive, summon a vorpal bunny, ice serpent, and whipping vine

Small correction to avoid confusion. ;) Giant ice worm, tamable when subdued.
 

UOT

Knight
What stage is it at? What color is it? Next to the resource button does it have a red X or a number if it has a number what is it? Same for seeds. What is the current health of your plant?
 

SonnyJim

Wanderer
snake plant
stage 9
vibrant

u cannot gather pollen from a mutated plant

this plant has no resources to gather

this plant has no seeds to gather


next to seeds and resources there are two red X's

and next to pollen i its either yellow or green i cant tell am colour blind to some colours :(
 

UOT

Knight
By that message you either have a black or a white or a rare colored (rare pink, rare aqua, rare magenta, rare fire red) plant. And those colors listed above do not produce seeds or resources. This is per OSI to keep those colors rare. You shouldn't be able to pollenate from or to it either. If it isn't one of those colors listed above tell me what color it has in the name. The name should be a Vibrant <color> Snake Plant
 

Caesar

Wanderer
u are correct but i was told that these rare plants like snake plant produces thorns which wen u put in ground summoned vorpal bunny etc...but if the snake plant dont produce thorns how am i gonna get a vorpral bunny if i cant plant a thorn??????
 

UOT

Knight
Only certain colors of certain plants produce resources. These are the resource producing plant/color list
// Resource producing plants:
// Red Leaf: Bright Red Elephant Ear Plants(-1), Bright Red Ponytail Palms(1) and Bright Red Century Plants(3)
// Orange Petals: Bright Orange Poppies(-7), Bright Orange Bulrushes(-5) and Bright Orange Pampas Grass(-3)
// Green Thorn: Bright Green Barrel Cacti(7) and Bright Green Snake Plants(5)


Ignore those numbers next to them those are the plant type numbers for the seeds. That list can also be found is you look on stratics which also has a chart of which plant/color combos you can breed to get to one of those plants.
 

Caesar

Wanderer
ok im lost....i just wanan grow a plant that makes thorns, the rseed makes a snake plant the other plain seeds dnt,,,wat must i do 2 get a plant 2 grow thorn seeds...this is 2 confusing.......so wat r rseeds for if they dnt give seeds or resources? rare my butt they dnt do anything......
 

Voran

Wanderer
Which is the OSI definition of rare.
They have to be bright green snake plant or elephent ears plants to get the thorn - I think they're 3rd generation.
 

UOT

Knight
All the resource producing plants are 4th generation. Again to make green thorns you have to grow Bright Green Barrel Cacti or Bright Green Snake Plants.

Rare plants are rare because of the color. Those color seeds can only be acquired by doing the naturalist quest. And to keep those plants rarer then the other colors OSI made them not produce seeds. If you don't feel like going to uo.stratics.com to get the info on how to breed a Bright Green Barrel Cactus or Bright Green Snake Plant just type

[Add namedseed 0x42 7
[Add namedseed 0x42 5
[Add baseseed 0x42 7
[Add baseseed 0x42 5

Either one of those 4 will give you a seed to a plant that produces green thorns as resources.
 

Caesar

Wanderer
so wat ur saying is for me 2 get those seeds in game i would have 2 cross pollinate like to get a bright green seed...so that would b yellow and green seed???man thats confusing well i will fiddle around wif all the seeds till i get the right combination....thanx
 

Fury

Wanderer
i think i noticed one bug here... if i hit the water plant icon and target a pitcher of water within a secured container or on the ground, the water does not get used up.
 
Status
Not open for further replies.
Top