public TaskPlant(GameObject go, PlantItem plantItem) : base(go)
 {
     this.plantItem = plantItem;
     pfc            = go.GetComponent <PlowedFieldController>();
 }
示例#2
0
        public override void OnDoubleClick(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (house == null)
            {
                from.SendLocalizedMessage(1005525);                  //That is not in your house
            }
            else if (this.Movable)
            {
                from.SendMessage("This must be locked down to use!");
            }
            else
            {
                /*SecureAccessResult access = house.CheckSecureAccess( from, this );
                 * if ( house.HasSecureAccess( from, access ) )*/
                if (this.IsAccessibleTo(from))
                {
                    if (m_fill != 6)
                    {
                        from.SendMessage("You must completely fill this before you can use it!");
                    }
                    else
                    {
                        Point3D           p     = new Point3D(this.Location);
                        Map               map   = this.Map;
                        IPooledEnumerable eable = map.GetItemsInRange(p, 18);
                        bool              found = false;


                        foreach (Item item in eable)
                        {
                            if (house.IsInside(item) && item is PlantItem && item.IsLockedDown)
                            {
                                PlantItem plant = (PlantItem)item;
                                if (CanBeWatered(plant))
                                {
                                    if (plant.PlantSystem.Water <= 1)
                                    {
                                        plant.PlantSystem.Water++;
                                        found = true;
                                    }
                                }
                            }
                        }
                        if (found)
                        {
                            from.SendMessage("Your dry plants have been watered.");
                            from.PlaySound(0x12);
                            m_fill = 0;
                        }
                        else
                        {
                            from.SendMessage("You have no plants that need watering!");
                        }
                    }
                }
                else
                {
                    from.SendMessage("You may not access this!");
                }
            }
        }
 public void Init(PlantItem plantItem)
 {
     PlantItem = plantItem;
     ResetGrowthTime(PlantItem.GetItemTime().x, PlantItem.GetItemTime().y, PlantItem.GetItemTime().z);
 }
示例#4
0
        public override void OnDoubleClick(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (house == null)
            {
                from.SendLocalizedMessage(1005525);//That is not in your house
            }
            else if (this.Movable)
            {
                from.SendMessage("This must be locked down to use!");
            }
            else
            {
                if (this.IsAccessibleTo(from))
                {
                    if (m_UsesRemaining < 1)
                    {
                        from.SendMessage("You must add heal potions to this before you can use it!");
                    }
                    else
                    {
                        Point3D           p     = new Point3D(this.Location);
                        Map               map   = this.Map;
                        IPooledEnumerable eable = map.GetItemsInRange(p, 18);
                        bool              found = false;


                        foreach (Item item in eable)
                        {
                            if (house.IsInside(item) && item is PlantItem && item.IsLockedDown)
                            {
                                PlantItem plant = (PlantItem)item;
                                if (CanBeHealed(plant))
                                {
                                    if (plant.PlantSystem.Poison == 1 && plant.PlantSystem.HealPotion == 0 && m_UsesRemaining > 0)
                                    {
                                        plant.PlantSystem.HealPotion = 1;
                                        found = true;
                                        m_UsesRemaining--;
                                    }
                                    if (plant.PlantSystem.Poison == 2 && plant.PlantSystem.HealPotion == 0 && m_UsesRemaining > 1)
                                    {
                                        plant.PlantSystem.HealPotion = 2;
                                        found            = true;
                                        m_UsesRemaining -= 2;
                                    }
                                    if (plant.PlantSystem.Poison == 2 && plant.PlantSystem.HealPotion == 1 && m_UsesRemaining > 0)
                                    {
                                        plant.PlantSystem.HealPotion = 2;
                                        found = true;
                                        m_UsesRemaining--;
                                    }
                                }
                            }
                        }
                        if (found)
                        {
                            from.SendMessage("The poison on your plants has been treated.");
                            from.PlaySound(0x12);
                        }
                        else
                        {
                            from.SendMessage("You have no plants that need healing!");
                        }
                    }
                }
                else
                {
                    from.SendMessage("You may not access this!");
                }
            }
        }
示例#5
0
 public bool CanBeWatered(PlantItem plant)
 {
     return(plant.PlantStatus < PlantStatus.DecorativePlant && plant.PlantSystem.Water <= 1);
 }