Exemplo n.º 1
0
            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[i] && 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!
                }
            }
Exemplo n.º 2
0
			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[i] && 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!
					}

			}
Exemplo n.º 3
0
        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.GPP;
                    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 = pot.Disease;
                }
                if ((pot.GHP - pot.Poison) == 0)
                {
                    pot.GHP    = 0;
                    pot.Poison = pot.Poison;
                }
                else if ((pot.GCP - 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 = pot.Poison;
                }
                //--------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);
            }
        }
Exemplo n.º 4
0
 public PlantTimer(Mobile m_from, FullPlantBowl item, TimeSpan time) : base(time, PlantProps.GrowthCheck)
 {
     from = m_from;
     pot  = item;
 }
Exemplo n.º 5
0
 public virtual void Start(Mobile from, FullPlantBowl item, TimeSpan time)
 {
     new PlantTimer(from, item, time).Start();
 }
Exemplo n.º 6
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is FullPlantBowl)
                {
                    FullPlantBowl pot = o as FullPlantBowl;
                    if (pot.Owner == from)
                    {
                        if (pot.Water >= 0 && pot.Stage == 0 && ((!pot.Movable && pot.Parent == null) || (pot.Movable && pot.IsChildOf(from.Backpack)) || (pot.Movable && pot.IsChildOf(from.BankBox))))                    //Makes sure it's soft dirt and it's in bank, backpack or lockeddown
                        {
                            // 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)

                            if ((m_seed.Hue == (int)PlantColors.BrightRed && m_seed.SeedType == -1) || (m_seed.Hue == (int)PlantColors.BrightRed && m_seed.SeedType == 1) || (m_seed.Hue == (int)PlantColors.BrightRed && m_seed.SeedType == 3))
                            {
                                pot.ResourceType = 1;                // Red Leaf
                            }
                            if ((m_seed.Hue == (int)PlantColors.BrightOrange && m_seed.SeedType == -7) || (m_seed.Hue == (int)PlantColors.BrightOrange && m_seed.SeedType == -5) || (m_seed.Hue == (int)PlantColors.BrightOrange && m_seed.SeedType == -3))
                            {
                                pot.ResourceType = 2;                // Orange Petals
                            }
                            if ((m_seed.Hue == (int)PlantColors.BrightGreen && m_seed.SeedType == 5) || (m_seed.Hue == (int)PlantColors.BrightGreen && m_seed.SeedType == 7))
                            {
                                pot.ResourceType = 3;                // Green Thorn
                            }
                            if (pot.ResourceType != 0)
                            {
                                pot.RMax = 8;
                            }
                            if (m_seed.Hue == (int)PlantColors.Black || m_seed.Hue == (int)PlantColors.White || m_seed.Hue == (int)PlantColors.RareMagenta || m_seed.Hue == (int)PlantColors.RareFireRed || m_seed.Hue == (int)PlantColors.RareAqua || m_seed.Hue == (int)PlantColors.RarePink)
                            {
                                pot.SMax       = 0;
                                pot.Pollenated = true;
                            }
                            pot.SeedType  = m_seed.SeedType;
                            pot.SeedColor = pot.ChildColor = m_seed.Hue;
                            if (m_seed is NamedSeed)
                            {
                                pot.Named = true;
                            }
                            pot.Stage = 1;
                            pot.Start(from, pot, PlantProps.GrowthCheck);
                            m_seed.Delete();
                            pot.SendLocalizedMessageTo(from, 1053041);             // You plant the seed in the bowl of dirt
                        }
                        else if ((!pot.Movable && pot.Parent != null) || (pot.Movable && !pot.IsChildOf(from.Backpack) && !pot.IsChildOf(from.BankBox)))
                        {
                            from.SendLocalizedMessage(1053039);              // The bowl of dirt must be in your pack, or you must lock it down.
                        }
                        else if (pot.Stage > 0 && pot.Stage < 7)
                        {
                            pot.SendLocalizedMessageTo(from, 1041522, "This bowl of dirt already has a " + "\t" + PlantProps.Stages(pot.Stage) + "\t" + " in it!");               // ~1~~2~~3~
                        }
                        else if (pot.Stage > 7)
                        {
                            from.SendLocalizedMessage(1053038);              // You must use a seed on a bowl of dirt!
                        }
                        else
                        {
                            from.SendLocalizedMessage(1053040);              // The dirt in this bowl needs to be softened first.
                            return;
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1053038);              // You must use a seed on a bowl of dirt!
                }
            }
Exemplo n.º 7
0
		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.GPP;
				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 = pot.Disease;
				}
			if ( ( pot.GHP - pot.Poison ) == 0 )
				{
				pot.GHP = 0;
				pot.Poison = pot.Poison;
				}
			else if ( ( pot.GCP - 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 = pot.Poison;
				}
			//--------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;
			}

		}
Exemplo n.º 8
0
			public PlantTimer( Mobile m_from, FullPlantBowl item, TimeSpan time) : base( time, PlantProps.GrowthCheck )
			{
				from = m_from;
				pot = item;
			}
Exemplo n.º 9
0
		public virtual void Start( Mobile from, FullPlantBowl item, TimeSpan time )
		{
		new PlantTimer(from, item, time).Start();
		}