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

GetEmptyBowl() public static méthode

public static GetEmptyBowl ( Server.Mobile from ) : FishBowl
from Server.Mobile
Résultat FishBowl
        public static FishBowl GetEmptyBowl( Mobile from )
        {
            if ( from == null || from.Backpack == null )
                return null;

            Item[] items = from.Backpack.FindItemsByType( typeof( FishBowl ) );

            for ( int i = 0; i < items.Length; i ++ )
            {
                if ( items[ i ] is FishBowl )
                {
                    FishBowl bowl = (FishBowl) items[ i ];

                    if ( bowl.Empty )
                        return bowl;
                }
            }

            return null;
        }

Usage Example

Exemple #1
0
        protected override void FinishEffect(Point3D p, Map map, Mobile from)
        {
            if (from.Skills.Fishing.Value < 10)
            {
                from.SendLocalizedMessage(1074487); // The creatures are too quick for you!
            }
            else
            {
                BaseFish fish = this.GiveFish(from);
                FishBowl bowl = Aquarium.GetEmptyBowl(from);

                if (bowl != null)
                {
                    fish.StopTimer();
                    bowl.AddItem(fish);
                    from.SendLocalizedMessage(1074489); // A live creature jumps into the fish bowl in your pack!
                    this.Delete();
                    return;
                }
                else
                {
                    if (from.PlaceInBackpack(fish))
                    {
                        from.PlaySound(0x5A2);
                        from.SendLocalizedMessage(1074490); // A live creature flops around in your pack before running out of air.

                        fish.Kill();
                        this.Delete();
                        return;
                    }
                    else
                    {
                        fish.Delete();

                        from.SendLocalizedMessage(1074488); // You could not hold the creature.
                    }
                }
            }

            this.InUse   = false;
            this.Movable = true;

            if (!from.PlaceInBackpack(this))
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    this.Delete();
                }
                else
                {
                    this.MoveToWorld(from.Location, from.Map);
                }
            }
        }