Server.Items.Aquarium.OnDragDrop C# (CSharp) Méthode

OnDragDrop() public méthode

public OnDragDrop ( Server.Mobile from, Item dropped ) : bool
from Server.Mobile
dropped Item
Résultat bool
        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;
        }