GetBonusProperties() public méthode

public GetBonusProperties ( ) : int
Résultat int
Exemple #1
0
        public void Generate(Mobile from, Container cont, bool spawning, int luckChance)
        {
            if (cont == null)
            {
                return;
            }

            bool checkLuck = Core.AOS;

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                LootPackEntry entry = m_Entries[i];

                bool shouldAdd = (entry.Chance > Utility.Random(10000));

                if (!shouldAdd && checkLuck)
                {
                    checkLuck = false;

                    if (LootPack.CheckLuck(luckChance))
                    {
                        shouldAdd = (entry.Chance > Utility.Random(10000));
                    }
                }

                if (!shouldAdd)
                {
                    continue;
                }

                Item item = entry.Construct(from, luckChance, spawning);

                // Plume begin check Identification
                if (item is BaseWeapon || item is BaseArmor || item is BaseClothing || item is BaseJewel)
                {
                    bool IsID = true;

                    int    bonusProps = entry.GetBonusProperties();
                    double min        = (double)entry.MinIntensity;
                    double max        = (double)entry.MaxIntensity;

                    if (bonusProps < entry.MaxProps && LootPack.CheckLuck(luckChance))
                    {
                        ++bonusProps;
                    }

                    int props = 1 + bonusProps;

                    double dblID = (((min / max) + (min / 5.0) + (max / 10.0)) * (props + props / 10.0)) / 100.0;

                    if (props >= 5 && Utility.Random(0, 100) > 1)
                    {
                        IsID = false;
                    }
                    else if (dblID > Utility.RandomDouble())
                    {
                        IsID = false;
                    }

                    if (!IsID)
                    {
                        if (item is BaseWeapon)
                        {
                            ((BaseWeapon)item).Identified = false;
                        }
                        else if (item is BaseArmor)
                        {
                            ((BaseArmor)item).Identified = false;
                        }
                        else if (item is BaseClothing)
                        {
                            ((BaseClothing)item).Identified = false;
                        }
                        else if (item is BaseJewel)
                        {
                            ((BaseJewel)item).Identified = false;
                        }
                    }
                }
                // End
                if (item != null)
                {
                    if (!item.Stackable || !cont.TryDropItem(from, item, false))
                    {
                        cont.DropItem(item);
                    }
                }
            }
        }