コード例 #1
0
            public override void OnClick()
            {
                if (m_Bowl == null || m_Bowl.Deleted || !m_Bowl.IsAccessibleTo(Owner.From))
                {
                    return;
                }

                BaseFish fish = m_Bowl.Fish;

                if (fish != null)
                {
                    if (fish.IsLockedDown)                        // for legacy fish bowls
                    {
                        Owner.From.SendLocalizedMessage(1010449); // You may not use this object while it is locked down.
                    }
                    else 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();
                    }
                }
            }
コード例 #2
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);
        }