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++;
                    }
                }
            }
示例#2
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!
                }
            }