Пример #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_PlantBowl.Deleted)
                {
                    return;
                }

                if (!m_PlantBowl.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
                    return;
                }

                if (targeted is FertileDirt)
                {
                    int _dirtNeeded = Core.ML ? 20 : 40;

                    FertileDirt dirt = (FertileDirt)targeted;

                    if (!dirt.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
                    }
                    else if (dirt.Amount < _dirtNeeded)
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061896); // You need more dirt to fill a plant bowl!
                    }
                    else
                    {
                        PlantItem fullBowl = new PlantItem(true);

                        if (from.PlaceInBackpack(fullBowl))
                        {
                            dirt.Consume(_dirtNeeded);
                            m_PlantBowl.Delete();

                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895); // You fill the bowl with fresh dirt.
                        }
                        else
                        {
                            fullBowl.Delete();

                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894); // There is no room in your backpack for a bowl full of dirt!
                        }
                    }
                }
                else if (PlantBowl.IsDirtPatch(targeted))
                {
                    PlantItem fullBowl = new PlantItem(false);

                    if (from.PlaceInBackpack(fullBowl))
                    {
                        m_PlantBowl.Delete();

                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895); // You fill the bowl with fresh dirt.
                    }
                    else
                    {
                        fullBowl.Delete();

                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894); // There is no room in your backpack for a bowl full of dirt!
                    }
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061893); // You'll want to gather fresh dirt in order to raise a healthy plant!
                }
            }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant)
            {
                return;
            }

            if (info.ButtonID == 3 && !from.InRange(m_Plant.GetWorldLocation(), 3))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446); // That is too far away.
                return;
            }

            if (!m_Plant.IsUsableBy(from))
            {
                m_Plant.LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Cancel
            {
                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 2:                                        // Help
            {
                from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL

                from.SendGump(new EmptyTheBowlGump(m_Plant));

                break;
            }

            case 3:     // Ok
            {
                PlantBowl bowl = new PlantBowl();

                if (!from.PlaceInBackpack(bowl))
                {
                    bowl.Delete();

                    m_Plant.LabelTo(from, 1053047);         // You cannot empty a bowl with a full pack!
                    from.SendGump(new MainPlantGump(m_Plant));

                    break;
                }

                if (m_Plant.PlantStatus != PlantStatus.BowlOfDirt && m_Plant.PlantStatus < PlantStatus.Plant)
                {
                    Seed seed = new Seed(m_Plant.PlantType, m_Plant.PlantHue, m_Plant.ShowType);

                    if (!from.PlaceInBackpack(seed))
                    {
                        bowl.Delete();
                        seed.Delete();

                        m_Plant.LabelTo(from, 1053047);         // You cannot empty a bowl with a full pack!
                        from.SendGump(new MainPlantGump(m_Plant));

                        break;
                    }
                }

                m_Plant.Delete();

                break;
            }
            }
        }
Пример #3
0
 public InternalTarget(PlantBowl plantBowl) : base(3, true, TargetFlags.None)
 {
     m_PlantBowl = plantBowl;
 }