public bool PackArmor( int minLevel, int maxLevel, double chance )
{
if ( chance <= Utility.RandomDouble() )
return false;
Cap( ref minLevel, 0, 5 );
Cap( ref maxLevel, 0, 5 );
if ( Core.AOS )
{
Item item = Loot.RandomArmorOrShieldOrJewelry();
if ( item == null )
return false;
int attributeCount, min, max;
GetRandomAOSStats( minLevel, maxLevel, out attributeCount, out min, out max );
if ( item is BaseArmor )
BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, attributeCount, min, max );
else if ( item is BaseJewel )
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
PackItem( item );
}
else
{
BaseArmor armor = Loot.RandomArmorOrShield();
if ( armor == null )
return false;
armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled( minLevel, maxLevel );
armor.Durability = (ArmorDurabilityLevel)RandomMinMaxScaled( minLevel, maxLevel );
PackItem( armor );
}
return true;
}