public virtual void GiveReward( Mobile to )
{
if ( !m_RewardAvailable )
return;
int max = (int) ( ( (double) m_LiveCreatures / 30 ) * m_Decorations.Length );
int random = ( max <= 0 ) ? 0 : Utility.Random( max );
if ( random >= m_Decorations.Length )
random = m_Decorations.Length - 1;
Item item;
try
{
item = Activator.CreateInstance( m_Decorations[ random ] ) as Item;
}
catch
{
return;
}
if ( item == null )
return;
if ( !to.PlaceInBackpack( item ) )
{
item.Delete();
to.SendLocalizedMessage( 1074361 ); // The reward could not be given. Make sure you have room in your pack.
return;
}
to.SendLocalizedMessage( 1074360, String.Format( "#{0}", item.LabelNumber ) ); // You receive a reward: ~1_REWARD~
to.PlaySound( 0x5A3 );
m_RewardAvailable = false;
InvalidateProperties();
}