Ejemplo n.º 1
0
        /// <summary>
        /// Before you use this function, BuiltItemSearchCache() must have been called on this object.
        /// </summary>
        /// <param name="compareItem"></param>
        /// <returns></returns>
        public bool IsSurpassedBy(LeanMyWorldObject compareItem)
        {
            // Items must be of the same armor set
            if (compareItem.ItemSetId != ItemSetId)
            {
                return(false);
            }

            // This checks to see that the compare item covers at least all the slots that the passed item does
            if (compareItem.Coverage.IsBodyArmor() && Coverage.IsBodyArmor())
            {
                if ((compareItem.Coverage & Coverage) != Coverage)
                {
                    return(false);
                }
            }
            else if ((compareItem.EquippableSlots & EquippableSlots) != EquippableSlots)
            {
                return(false);
            }

            // Find the highest level spell on this item
            Spell.CantripLevels highestCantrip = Spell.CantripLevels.None;

            foreach (Spell itemSpell in ExtendedMyWorldObject.CachedSpells)
            {
                if (itemSpell.CantripLevel > highestCantrip)
                {
                    highestCantrip = itemSpell.CantripLevel;
                }
            }

            // Does this item have spells that equal or surpass this items at the highest cantrip level found?
            foreach (Spell itemSpell in ExtendedMyWorldObject.CachedSpells)
            {
                if (itemSpell.CantripLevel < highestCantrip)
                {
                    continue;
                }

                foreach (Spell compareSpell in compareItem.ExtendedMyWorldObject.CachedSpells)
                {
                    if (compareSpell.Surpasses(itemSpell))
                    {
                        return(true);
                    }

                    if (compareSpell.IsSameOrSurpasses(itemSpell))
                    {
                        goto next;
                    }
                }

                return(false);

                next :;
            }

            if (compareItem.CalcedStartingArmorLevel > CalcedStartingArmorLevel)
            {
                return(true);
            }

            if (compareItem.damRating > damRating && damRating > 0)
            {
                return(true);
            }
            if (compareItem.damResistRating > damResistRating && damResistRating > 0)
            {
                return(true);
            }
            if (compareItem.critRating > critRating && critRating > 0)
            {
                return(true);
            }
            if (compareItem.critResistRating > critResistRating && critResistRating > 0)
            {
                return(true);
            }
            if (compareItem.critDamRating > critDamRating && critDamRating > 0)
            {
                return(true);
            }
            if (compareItem.critDamResistRating > critDamResistRating && critDamResistRating > 0)
            {
                return(true);
            }
            if (compareItem.healBoostRating > healBoostRating && healBoostRating > 0)
            {
                return(true);
            }
            if (compareItem.vitalityRating > vitalityRating && vitalityRating > 0)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void SetEquipmentPiece(ExtendedMyWorldObject piece)
        {
            mwo = null;

            lblCharacter.Text = null;
            lblItemName.Text  = null;

            lblAL.Text       = null;
            lblRating.Text   = null;
            lblArmorSet.Text = null;

            lblSpell1.Text = null;
            lblSpell2.Text = null;
            lblSpell3.Text = null;
            lblSpell4.Text = null;
            lblSpell5.Text = null;
            lblSpell6.Text = null;

            chkLocked.Enabled  = false;
            chkLocked.Checked  = false;
            chkExclude.Enabled = false;
            chkExclude.Checked = false;

            mwo = piece;

            if (piece == null || !CanEquip(piece))
            {
                return;
            }

            lblCharacter.Text = piece.Owner;
            lblItemName.Text  = piece.Name;

            if (piece.CalcedStartingArmorLevel > 0)
            {
                lblAL.Text = piece.CalcedStartingArmorLevel.ToString(CultureInfo.InvariantCulture);
            }

            if (piece.TotalRating > 0)
            {
                lblRating.Text = "[" + piece.TotalRating + "]";
            }

            lblArmorSet.Text = piece.ItemSet;

            List <Spell> spellsInOrder = new List <Spell>();

            for (Spell.CantripLevels level = Spell.CantripLevels.Legendary; level > Spell.CantripLevels.None; level--)
            {
                foreach (Spell spell in piece.CachedSpells)
                {
                    if (spellsInOrder.Contains(spell))
                    {
                        continue;
                    }

                    if (spell.CantripLevel >= level)
                    {
                        spellsInOrder.Add(spell);
                    }
                }
            }

            for (Spell.BuffLevels level = Spell.BuffLevels.VIII; level >= Spell.BuffLevels.None; level--)
            {
                foreach (Spell spell in piece.CachedSpells)
                {
                    if (spellsInOrder.Contains(spell))
                    {
                        continue;
                    }

                    if (spell.BuffLevel >= level)
                    {
                        spellsInOrder.Add(spell);
                    }
                }
            }

            if (spellsInOrder.Count > 0)
            {
                lblSpell1.Text = spellsInOrder[0].ToString();
            }
            if (spellsInOrder.Count > 1)
            {
                lblSpell2.Text = spellsInOrder[1].ToString();
            }
            if (spellsInOrder.Count > 2)
            {
                lblSpell3.Text = spellsInOrder[2].ToString();
            }
            if (spellsInOrder.Count > 3)
            {
                lblSpell4.Text = spellsInOrder[3].ToString();
            }
            if (spellsInOrder.Count > 4)
            {
                lblSpell5.Text = spellsInOrder[4].ToString();
            }
            if (spellsInOrder.Count > 5)
            {
                lblSpell6.Text = spellsInOrder[5].ToString();
            }

            chkLocked.Enabled  = true;
            chkLocked.Checked  = piece.Locked;
            chkExclude.Enabled = true;
            chkExclude.Checked = piece.Exclude;
        }