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(); } } } }
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. } }
public virtual bool AddFish(BaseFish fish) { return(AddFish(null, fish)); }
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); }
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(); }
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); }