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

RemoveItem() public méthode

public RemoveItem ( Server.Mobile from, int at ) : bool
from Server.Mobile
at int
Résultat bool
        public virtual bool RemoveItem( Mobile from, int at )
        {
            if ( at < 0 && at >= Items.Count )
                return false;

            Item item = Items[ at ];

            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;
        }

Usage Example

Exemple #1
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (m_Aquarium == null || m_Aquarium.Deleted)
            {
                return;
            }

            if (info.ButtonID > 0 && info.ButtonID <= m_Aquarium.Items.Count && m_Edit)
            {
                m_Aquarium.RemoveItem(sender.Mobile, info.ButtonID - 1);
            }

            if (info.ButtonID > 0)
            {
                sender.Mobile.SendGump(new AquariumGump(m_Aquarium, m_Edit));
            }
        }
All Usage Examples Of Server.Items.Aquarium::RemoveItem