Server.Items.Food.FillHunger C# (CSharp) Méthode

FillHunger() public static méthode

public static FillHunger ( Mobile from, int fillFactor ) : bool
from Mobile
fillFactor int
Résultat bool
		public static bool FillHunger( Mobile from, int fillFactor )
		{
			if ( from.Hunger >= 20 )
			{
				from.SendLocalizedMessage( 500867 ); // You are simply too full to eat any more!
				return false;
			}

			int iHunger = from.Hunger + fillFactor;

			if ( from.Stam < from.StamMax )
				from.Stam += Utility.Random( 6, 3 ) + fillFactor / 5;

			if ( iHunger >= 20 )
			{
				from.Hunger = 20;
				from.SendLocalizedMessage( 500872 ); // You manage to eat the food, but you are stuffed!
			}
			else
			{
				from.Hunger = iHunger;

				if ( iHunger < 5 )
					from.SendLocalizedMessage( 500868 ); // You eat the food, but are still extremely hungry.
				else if ( iHunger < 10 )
					from.SendLocalizedMessage( 500869 ); // You eat the food, and begin to feel more satiated.
				else if ( iHunger < 15 )
					from.SendLocalizedMessage( 500870 ); // After eating the food, you feel much less hungry.
				else
					from.SendLocalizedMessage( 500871 ); // You feel quite full after consuming the food.
			}

			return true;
		}

Usage Example

Exemple #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
            {
                from.SendAsciiMessage("You cannot eat this head");
                return;
            }

            // Fill the Mobile with FillFactor
            if (Food.FillHunger(from, 4))
            {
                // Play a random "eat" sound
                from.PlaySound(Utility.Random(0x3A, 3));

                if (from.Body.IsHuman && !from.Mounted)
                {
                    from.Animate(34, 5, 1, true, false, 0);
                }

                if (PlayerName != null)
                {
                    from.PublicOverheadMessage(Network.MessageType.Emote, 0x22, true, string.Format("*You see {0} eat the head of {1}*", from.Name, m_PlayerName));
                }

                Consume();
            }
        }
All Usage Examples Of Server.Items.Food::FillHunger