Server.Mobiles.BaseCreature.PackWeapon C# (CSharp) Method

PackWeapon() public method

public PackWeapon ( int minLevel, int maxLevel, double chance ) : bool
minLevel int
maxLevel int
chance double
return bool
        public bool PackWeapon( 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.RandomWeaponOrJewelry();

                if ( item == null )
                    return false;

                int attributeCount, min, max;
                GetRandomAOSStats( minLevel, maxLevel, out attributeCount, out min, out max );

                if ( item is BaseWeapon )
                    BaseRunicTool.ApplyAttributesTo( (BaseWeapon)item, attributeCount, min, max );
                else if ( item is BaseJewel )
                    BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

                PackItem( item );
            }
            else
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if ( weapon == null )
                    return false;

                if ( 0.05 > Utility.RandomDouble() )
                    weapon.Slayer = SlayerName.Silver;

                weapon.DamageLevel = (WeaponDamageLevel)RandomMinMaxScaled( minLevel, maxLevel );
                weapon.AccuracyLevel = (WeaponAccuracyLevel)RandomMinMaxScaled( minLevel, maxLevel );
                weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled( minLevel, maxLevel );

                PackItem( weapon );
            }

            return true;
        }

Same methods

BaseCreature::PackWeapon ( int minLevel, int maxLevel ) : bool
BaseCreature