예제 #1
0
        public override void AddNameProperties(ObjectPropertyList list)
        {
            base.AddNameProperties(list);

            if (!Empty)
            {
                BaseFish fish = Fish;

                if (fish != null)
                {
                    list.Add(1074494, "#{0}", fish.LabelNumber); // Contains: ~1_CREATURE~
                }
            }
        }
        private void FinishEffect(Point3D p)
        {
            BaseFish fish = GiveFish(m_Player.Skills.Fishing.Base / 100);

            if (fish != null)
            {
                Item[] items = m_Player.Backpack.FindItemsByType(typeof(FishBowl));

                foreach (FishBowl bowl in items)
                {
                    if (!bowl.Deleted && bowl.Empty)
                    {
                        bowl.AddItem(fish);
                        bowl.InvalidateProperties();
                        m_Player.SendLocalizedMessage(1074489); // A live creature jumps into the fish bowl in your pack!
                        fish.StopTimer();
                        Delete();
                        return;
                    }
                }

                if (!m_Player.PlaceInBackpack(fish))
                {
                    m_Player.SendLocalizedMessage(500720);                       // You don't have enough room in your backpack!
                    fish.MoveToWorld(m_Player.Location, m_Player.Map);
                }
                else
                {
                    m_Player.SendLocalizedMessage(1074490);                       // A live creature flops around in your pack before running out of air.
                }
                fish.Kill();
                Delete();
            }
            else
            {
                Movable = true;

                if (!m_Player.PlaceInBackpack(this))
                {
                    MoveToWorld(m_Player.Location, m_Player.Map);
                }

                m_Player.SendLocalizedMessage(1074487);                   // The creatures are too quick for you!
            }
        }
예제 #3
0
        public override void DropItemsToGround()
        {
            Point3D loc = GetWorldLocation();

            for (int i = Items.Count - 1; i >= 0; i--)
            {
                Item item = Items[i];

                item.MoveToWorld(loc, Map);

                if (item is BaseFish)
                {
                    BaseFish fish = (BaseFish)item;

                    if (!fish.Dead)
                    {
                        fish.StartTimer();
                    }
                }
            }
        }
예제 #4
0
        public virtual bool AddFish(Mobile from, BaseFish fish)
        {
            if (fish == null)
            {
                return(false);
            }

            if ((m_LiveCreatures == MaxLiveCreatures && !IsFull) || fish.Dead)
            {
                from.SendLocalizedMessage(1073633);                   // The aquarium can not hold the creature.
                return(false);
            }

            AddItem(fish);
            fish.StopTimer();

            m_LiveCreatures += 1;

            from.SendLocalizedMessage(1073632, "#" + fish.LabelNumber);               // You add the following creature to your aquarium: ~1_FISH~
            return(true);
        }
예제 #5
0
        public override void OnChop(Mobile from)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                Item item = Items[i];

                item.MoveToWorld(Location, Map);

                if (item is BaseFish)
                {
                    BaseFish fish = (BaseFish)item;

                    if (!fish.Dead)
                    {
                        fish.StartTimer();
                    }
                }
            }

            base.OnChop(from);
        }
예제 #6
0
            public override void OnClick()
            {
                if (m_Bowl == null || m_Bowl.Deleted)
                {
                    return;
                }

                BaseFish fish = m_Bowl.Fish;

                if (fish != null)
                {
                    if (!Owner.From.PlaceInBackpack(fish))
                    {
                        Owner.From.SendLocalizedMessage(1074496);                           // There is no room in your pack for the creature.
                    }
                    else
                    {
                        Owner.From.SendLocalizedMessage(1074495);                           // The creature has been removed from the fish bowl.
                        fish.StartTimer();
                        m_Bowl.InvalidateProperties();
                    }
                }
            }
예제 #7
0
        public virtual void KillFish(int amount)
        {
            List <BaseFish> toKill = new List <BaseFish>();

            for (int i = 0; i < Items.Count; i++)
            {
                if (Items[i] is BaseFish)
                {
                    BaseFish fish = (BaseFish)Items[i];

                    if (!fish.Dead)
                    {
                        toKill.Add(fish);
                    }
                }
            }

            while (amount > 0 && toKill.Count > 0)
            {
                int kill = Utility.Random(toKill.Count);

                toKill[kill].Kill();

                toKill.RemoveAt(kill);

                amount          -= 1;
                m_LiveCreatures -= 1;

                if (m_LiveCreatures < 0)
                {
                    m_LiveCreatures = 0;
                }

                m_Events.Add(1074366); // An unfortunate accident has left a creature floating upside-down.  It is starting to smell.
            }
        }
예제 #8
0
파일: Aquarium.cs 프로젝트: m309/ForkUO
        public virtual bool AddFish(Mobile from, BaseFish fish)
        {
            if (fish == null)
                return false;

            if (this.IsFull || this.m_LiveCreatures >= this.MaxLiveCreatures || fish.Dead)
            {
                if (from != null)
                    from.SendLocalizedMessage(1073633); // The aquarium can not hold the creature.

                return false;
            }

            this.AddItem(fish);
            fish.StopTimer();

            this.m_LiveCreatures += 1;

            if (from != null)
                from.SendLocalizedMessage(1073632, String.Format("#{0}", fish.LabelNumber)); // You add the following creature to your aquarium: ~1_FISH~

            this.InvalidateProperties();
            return true;
        }
예제 #9
0
파일: Aquarium.cs 프로젝트: m309/ForkUO
 public virtual bool AddFish(BaseFish fish)
 {
     return this.AddFish(null, fish);
 }
예제 #10
0
        public virtual void DisplayPage(int page)
        {
            AddPage(page);

            Item item = (Item)m_Aquarium.Items[page - 1];

            // item name
            if (item.LabelNumber != 0)
            {
                AddHtmlLocalized(20, 217, 250, 20, item.LabelNumber, 0xFFFFFF, false, false);                   // Name
            }
            // item details
            if (item is BaseFish)
            {
                BaseFish fish = (BaseFish)item;

                if (!fish.Dead && fish.ItemID > 0x3B0F)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1074422, 0xFFFFFF, false, false);                       // A very unusual live aquarium creature
                }
                else if (!fish.Dead && fish.Hue > 0)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1074423, 0xFFFFFF, false, false);                       // A live aquarium creature of unusual color
                }
                else if (!fish.Dead)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1073622, 0xFFFFFF, false, false);                       // A live aquarium creature
                }
                else if (fish.Dead && fish.ItemID > 0x3B0F)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1074424, 0xFFFFFF, false, false);                       // A very unusual dead aquarium creature
                }
                else if (fish.Dead && fish.Hue > 0)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1074425, 0xFFFFFF, false, false);                       // A dead aquarium creature of unusual color
                }
                else if (fish.Dead)
                {
                    AddHtmlLocalized(20, 239, 315, 20, 1073623, 0xFFFFFF, false, false);                       // A dead aquarium creature
                }
            }
            else
            {
                AddHtmlLocalized(20, 239, 315, 20, 1073634, 0xFFFFFF, false, false);                   // An aquarium decoration
            }

            // item image
            AddItem(150, 80, item.ItemID, item.Hue);

            // item number / all items
            AddHtml(20, 195, 250, 20, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", 0xFFFFFF, page + "/" + (m_Aquarium.Items.Count)), false, false);

            // remove item
            if (m_Edit)
            {
                AddBackground(230, 195, 100, 26, 0x13BE);
                AddButton(235, 200, 0x845, 0x846, page, GumpButtonType.Reply, 0);
                AddHtmlLocalized(260, 198, 60, 26, 1073838, 0x0, false, false);                   // Remove
            }

            // next page
            if (page < m_Aquarium.Items.Count)
            {
                AddButton(195, 280, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page + 1);
                AddHtmlLocalized(230, 283, 100, 18, 1044045, 0xFFFFFF, false, false);                   // NEXT PAGE
            }

            // previous page
            if (page > 1)
            {
                AddButton(45, 280, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page - 1);
                AddHtmlLocalized(80, 283, 100, 18, 1044044, 0xFFFFFF, false, false);                   // PREV PAGE
            }
        }
예제 #11
0
 public virtual bool AddFish(BaseFish fish)
 {
     return(AddFish(null, fish));
 }
예제 #12
0
        public virtual bool RemoveItem(Mobile from, int at)
        {
            if (at < 0 || at >= Items.Count)
            {
                return(false);
            }

            Item item = Items[at];

            if (item.IsLockedDown)                  // for legacy aquariums
            {
                from.SendLocalizedMessage(1010449); // You may not use this object while it is locked down.
                return(false);
            }

            if (item is BaseFish)
            {
                BaseFish fish = (BaseFish)item;

                FishBowl bowl;

                if ((bowl = GetEmptyBowl(from)) != null)
                {
                    bowl.AddItem(fish);

                    from.SendLocalizedMessage(1074511); // You put the creature into a fish bowl.
                }
                else
                {
                    if (!from.PlaceInBackpack(fish))
                    {
                        from.SendLocalizedMessage(1074514); // You have no place to put it.
                        return(false);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1074512); // You put the gasping creature into your pack.
                    }
                }

                if (!fish.Dead)
                {
                    m_LiveCreatures -= 1;
                }
            }
            else
            {
                if (!from.PlaceInBackpack(item))
                {
                    from.SendLocalizedMessage(1074514); // You have no place to put it.
                    return(false);
                }
                else
                {
                    from.SendLocalizedMessage(1074513); // You put the item into your pack.
                }
            }

            InvalidateProperties();
            return(true);
        }
예제 #13
0
        public virtual void Evaluate()
        {
            if (m_VacationLeft > 0)
            {
                m_VacationLeft -= 1;
            }
            else if (m_EvaluateDay)
            {
                // reset events
                m_Events = new List <int>();

                // food events
                if (
                    (m_Food.Added < m_Food.Maintain && m_Food.State != (int)FoodState.Overfed && m_Food.State != (int)FoodState.Dead) ||
                    (m_Food.Added >= m_Food.Improve && m_Food.State == (int)FoodState.Full)
                    )
                {
                    m_Events.Add(1074368); // The tank looks worse than it did yesterday.
                }
                if (
                    (m_Food.Added >= m_Food.Improve && m_Food.State != (int)FoodState.Full && m_Food.State != (int)FoodState.Overfed) ||
                    (m_Food.Added < m_Food.Maintain && m_Food.State == (int)FoodState.Overfed)
                    )
                {
                    m_Events.Add(1074367); // The tank looks healthier today.
                }
                // water events
                if (m_Water.Added < m_Water.Maintain && m_Water.State != (int)WaterState.Dead)
                {
                    m_Events.Add(1074370); // This tank can use more water.
                }
                if (m_Water.Added >= m_Water.Improve && m_Water.State != (int)WaterState.Strong)
                {
                    m_Events.Add(1074369); // The water looks clearer today.
                }
                UpdateFoodState();
                UpdateWaterState();

                // reward
                if (m_LiveCreatures > 0)
                {
                    m_RewardAvailable = true;
                }
            }
            else
            {
                // new fish
                if (OptimalState && m_LiveCreatures < MaxLiveCreatures)
                {
                    if (Utility.RandomDouble() < 0.005 * m_LiveCreatures)
                    {
                        BaseFish fish    = null;
                        int      message = 0;

                        switch (Utility.Random(6))
                        {
                        case 0:
                        {
                            message = 1074371;         // Brine shrimp have hatched overnight in the tank.
                            fish    = new BrineShrimp();
                            break;
                        }

                        case 1:
                        {
                            message = 1074365;         // A new creature has hatched overnight in the tank.
                            fish    = new Coral();
                            break;
                        }

                        case 2:
                        {
                            message = 1074365;         // A new creature has hatched overnight in the tank.
                            fish    = new FullMoonFish();
                            break;
                        }

                        case 3:
                        {
                            message = 1074373;         // A sea horse has hatched overnight in the tank.
                            fish    = new SeaHorseFish();
                            break;
                        }

                        case 4:
                        {
                            message = 1074365;         // A new creature has hatched overnight in the tank.
                            fish    = new StrippedFlakeFish();
                            break;
                        }

                        case 5:
                        {
                            message = 1074365;         // A new creature has hatched overnight in the tank.
                            fish    = new StrippedSosarianSwill();
                            break;
                        }
                        }

                        if (Utility.RandomDouble() < 0.05)
                        {
                            fish.Hue = m_FishHues[Utility.Random(m_FishHues.Length)];
                        }
                        else if (Utility.RandomDouble() < 0.5)
                        {
                            fish.Hue = Utility.RandomMinMax(0x100, 0x3E5);
                        }

                        if (AddFish(fish))
                        {
                            m_Events.Add(message);
                        }
                        else
                        {
                            fish.Delete();
                        }
                    }
                }

                // kill fish *grins*
                if (m_LiveCreatures < MaxLiveCreatures)
                {
                    if (Utility.RandomDouble() < 0.01)
                    {
                        KillFish(1);
                    }
                }
                else
                {
                    KillFish(m_LiveCreatures - MaxLiveCreatures);
                }
            }

            m_EvaluateDay = !m_EvaluateDay;
            InvalidateProperties();
        }
예제 #14
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!HasAccess(from))
            {
                from.SendLocalizedMessage(1073821); // You do not have access to that item for use with the aquarium.
                return(false);
            }

            if (m_VacationLeft > 0)
            {
                from.SendLocalizedMessage(1074427); // The aquarium is in vacation mode.
                return(false);
            }

            bool takeItem = true;

            if (dropped is FishBowl)
            {
                FishBowl bowl = (FishBowl)dropped;

                if (bowl.Empty || !AddFish(from, bowl.Fish))
                {
                    return(false);
                }

                bowl.InvalidateProperties();

                takeItem = false;
            }
            else if (dropped is BaseFish)
            {
                BaseFish fish = (BaseFish)dropped;

                if (!AddFish(from, fish))
                {
                    return(false);
                }
            }
            else if (dropped is VacationWafer)
            {
                m_VacationLeft = VacationWafer.VacationDays;
                dropped.Delete();

                from.SendLocalizedMessage(1074428, m_VacationLeft.ToString()); // The aquarium will be in vacation mode for ~1_DAYS~ days
            }
            else if (dropped is AquariumFood)
            {
                m_Food.Added += 1;
                dropped.Delete();

                from.SendLocalizedMessage(1074259, "1"); // ~1_NUM~ unit(s) of food have been added to the aquarium.
            }
            else if (dropped is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)dropped;

                if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500840); // Can't pour that in there.
                    return(false);
                }

                m_Water.Added     += 1;
                beverage.Quantity -= 1;

                from.PlaySound(0x4E);
                from.SendLocalizedMessage(1074260, "1"); // ~1_NUM~ unit(s) of water have been added to the aquarium.

                takeItem = false;
            }
            else if (!AddDecoration(from, dropped))
            {
                takeItem = false;
            }

            from.CloseGump(typeof(AquariumGump));

            InvalidateProperties();

            if (takeItem)
            {
                from.PlaySound(0x42);
            }

            return(takeItem);
        }
예제 #15
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house == null || !house.IsCoOwner(from))
            {
                from.SendLocalizedMessage(1073821);                   // You do not have access to that item for use with the aquarium.
                return(false);
            }

            if (m_VacationLeft > 0)
            {
                from.SendLocalizedMessage(1074427);                   // The aquarium is in vacation mode.
                return(false);
            }

            if (dropped is FishBowl)
            {
                FishBowl bowl = (FishBowl)dropped;

                if (bowl.Empty)
                {
                    return(false);
                }

                if (AddFish(from, bowl.Fish))
                {
                    bowl.InvalidateProperties();
                }

                return(false);
            }
            else if (dropped is BaseFish)
            {
                BaseFish fish = (BaseFish)dropped;

                if (!AddFish(from, fish))
                {
                    return(false);
                }
            }
            else if (dropped is VacationWafer)
            {
                m_VacationLeft += 7;
                ((Item)dropped).Delete();

                from.SendLocalizedMessage(1074428, "" + m_VacationLeft);                   // The aquarium will be in vacation mode for ~1_DAYS~ days
            }
            else if (dropped is AquariumFood)
            {
                m_Food.Added += 1;
                ((Item)dropped).Delete();

                from.SendLocalizedMessage(1074259, "" + 1);                   // ~1_NUM~ unit(s) of food have been added to the aquarium.
            }
            else if (dropped is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)dropped;

                if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500840);                       // Can't pour that in there.
                    return(false);
                }

                m_Water.Added     += 1;
                beverage.Quantity -= 1;

                from.PlaySound(0x4E);
                from.SendLocalizedMessage(1074260, "" + 1);                   // ~1_NUM~ unit(s) of water have been added to the aquarium.
                return(false);
            }
            else if (!AddDecoration(from, dropped))
            {
                return(false);
            }

            InvalidateProperties();

            from.CloseGump(typeof(AquariumGump));

            return(true);
        }
예제 #16
0
		public virtual bool AddFish( Mobile from, BaseFish fish )
		{
			if ( fish == null )
				return false;
				
			if ( ( m_LiveCreatures == MaxLiveCreatures && !IsFull ) || fish.Dead )
			{
				from.SendLocalizedMessage( 1073633 ); // The aquarium can not hold the creature.
				return false;
			}
			
			AddItem( fish );
			fish.StopTimer();
			
			m_LiveCreatures += 1;
			
			from.SendLocalizedMessage( 1073632, "#" + fish.LabelNumber ); // You add the following creature to your aquarium: ~1_FISH~		
			return true;	
		}