protected override void OnTick()
{
Container theirPack = m_Target.Backpack;
double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);
if ( theirPack == null )
{
m_From.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money.
}
else if ( m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble() )
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500406 ); // Thou dost not look trustworthy... no gold for thee today!
}
else if ( m_From.CheckTargetSkill( SkillName.Begging, m_Target, 0.0, 100.0 ) )
{
int toConsume = theirPack.GetAmount( typeof( Gold ) ) / 10;
int max = 10 + (m_From.Fame / 2500);
if ( max > 14 )
max = 14;
else if ( max < 10 )
max = 10;
if ( toConsume > max )
toConsume = max;
if ( toConsume > 0 )
{
int consumed = theirPack.ConsumeUpTo( typeof( Gold ), toConsume );
if ( consumed > 0 )
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500405 ); // I feel sorry for thee...
Gold gold = new Gold( consumed );
m_From.AddToBackpack( gold );
m_From.PlaySound( gold.GetDropSound() );
if ( m_From.Karma > -3000 )
{
int toLose = m_From.Karma + 3000;
if ( toLose > 40 )
toLose = 40;
Titles.AwardKarma( m_From, -toLose, true );
}
}
else
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any!
}
}
else
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any!
}
}
else
{
m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money.
}
m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
}
}