Ejemplo n.º 1
0
            protected override void OnTick()
            {
                if (m_Aquarium == null)
                {
                    Stop();
                    return;
                }

                if (m_Aquarium.Deleted)
                {
                    Stop();
                    return;
                }

                if (m_Aquarium.m_FishItems.Count > 0)
                {
                    AquariumItem item = m_Aquarium.m_FishItems[Utility.RandomMinMax(0, m_Aquarium.m_FishItems.Count - 1)];

                    if (Utility.RandomDouble() < .1)
                    {
                        Blood creature = new Blood();
                        creature.ItemID = item.ItemID;
                        creature.Name   = item.Name;
                        creature.MoveToWorld(m_Aquarium.Location, m_Aquarium.Map);
                        creature.Z += 10;

                        m_Aquarium.PublicOverheadMessage(MessageType.Emote, 0, false, item.Name + " comes to the surface and takes a look around");
                        m_Aquarium.Splash();
                    }

                    else if (Utility.RandomDouble() < .9)
                    {
                        m_Aquarium.PublicOverheadMessage(MessageType.Emote, 0, false, item.Name + " splashes around");

                        int splashes = Utility.RandomMinMax(2, 4);

                        for (int a = 0; a < splashes; a++)
                        {
                            m_Aquarium.Splash();
                        }
                    }

                    else
                    {
                        m_Aquarium.PublicOverheadMessage(MessageType.Emote, 0, false, item.Name + " thrashes about wildly");

                        int splashes = Utility.RandomMinMax(6, 8);

                        for (int a = 0; a < splashes; a++)
                        {
                            m_Aquarium.Splash();
                        }
                    }
                }
            }
Ejemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from == null)
            {
                return;
            }
            if (from.Deleted)
            {
                return;
            }
            if (m_Aquarium == null)
            {
                return;
            }
            if (m_Aquarium.Deleted)
            {
                return;
            }

            //Aquarium Was Modified By Other Player
            if (m_FishItemCount != m_Aquarium.m_FishItems.Count || m_DecorationItemCount != m_Aquarium.m_DecorationItems.Count)
            {
                from.SendMessage("The contents of the aquarium have changed.");

                from.CloseGump(typeof(AquariumGump));
                from.SendGump(new AquariumGump(m_Aquarium, from, 0));
            }

            //Previous
            if (info.ButtonID == 1)
            {
                from.SendSound(0x5AF);

                m_ItemIndex--;

                from.CloseGump(typeof(AquariumGump));
                from.SendGump(new AquariumGump(m_Aquarium, from, m_ItemIndex));

                return;
            }

            //Next
            if (info.ButtonID == 2)
            {
                from.SendSound(0x5AF);

                m_ItemIndex++;

                from.CloseGump(typeof(AquariumGump));
                from.SendGump(new AquariumGump(m_Aquarium, from, m_ItemIndex));

                return;
            }

            //Remove
            if (info.ButtonID == 3)
            {
                AquariumItem item;

                bool itemRemoved = false;

                //Fish
                if (m_ItemIndex < m_FishItemCount)
                {
                    item = m_Aquarium.m_FishItems[m_ItemIndex];

                    if (from.AddToBackpack(item))
                    {
                        m_Aquarium.m_FishItems.RemoveAt(m_ItemIndex);

                        from.SendSound(0x5A4);
                        m_Aquarium.Splash();

                        from.SendMessage("You remove the item from the aquarium and place it in your backpack.");

                        itemRemoved = true;
                    }

                    else
                    {
                        from.SendMessage("Your backpack does not have enough space to hold that item.");
                    }
                }

                else
                {
                    int decorationIndex = m_ItemIndex - m_Aquarium.m_FishItems.Count;
                    item = m_Aquarium.m_DecorationItems[decorationIndex];

                    if (from.AddToBackpack(item))
                    {
                        m_Aquarium.m_DecorationItems.RemoveAt(decorationIndex);

                        from.SendSound(0x5A4);
                        m_Aquarium.Splash();

                        from.SendMessage("You remove the item from the aquarium and place it in your backpack.");

                        itemRemoved = true;
                    }

                    else
                    {
                        from.SendMessage("Your backpack does not have enough space to hold that item.");
                    }
                }

                if (itemRemoved)
                {
                    m_FishItemCount       = m_Aquarium.m_FishItems.Count;
                    m_DecorationItemCount = m_Aquarium.m_DecorationItems.Count;
                    m_TotalItemCount      = m_FishItemCount + m_DecorationItemCount;

                    if (m_ItemIndex > m_TotalItemCount - 1 && m_TotalItemCount > 0)
                    {
                        m_ItemIndex--;
                    }
                }

                from.CloseGump(typeof(AquariumGump));
                from.SendGump(new AquariumGump(m_Aquarium, from, m_ItemIndex));

                return;
            }
        }