本文整理匯總了C#中Server.Items.Gold.Consume方法的典型用法代碼示例。如果您正苦於以下問題:C# Gold.Consume方法的具體用法?C# Gold.Consume怎麽用?C# Gold.Consume使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Items.Gold
的用法示例。
在下文中一共展示了Gold.Consume方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnGoldGiven
public virtual bool OnGoldGiven( Mobile from, Gold dropped )
{
if ( CheckTeachingMatch( from ) )
{
int goldtaken = Teach( m_Teaching, from, dropped.Amount / TeachScalar, true ) * TeachScalar;
if ( goldtaken > 0 )
{
dropped.Consume( goldtaken );
return dropped == null || dropped.Deleted || dropped.Amount <= 0;
}
}
else if ( IsHumanInTown() )
{
Direction = GetDirectionTo( from );
int oldSpeechHue = this.SpeechHue;
this.SpeechHue = 0x23F;
SayTo( from, "Thou art giving me gold?" );
if ( dropped.Amount >= 400 )
SayTo( from, "'Tis a noble gift." );
else
SayTo( from, "Money is always welcome." );
from.Karma += Math.Max( dropped.Amount / 10, 100 );
this.SpeechHue = 0x3B2;
SayTo( from, 501548 ); // I thank thee.
this.SpeechHue = oldSpeechHue;
dropped.Delete();
return true;
}
return false;
}
示例2: AddGoldPile
public bool AddGoldPile(Gold gold)
{
if ( !GoldLedger )
return false;
gold.Amount = (int)AddGoldAmount((ulong)gold.Amount);
if (gold.Amount == 0)
{
gold.Consume();
return true;
}
return false;
}