public bool ItemPassesRules(SuitBuildableMyWorldObject item)
		{
			if (CantripsToLookFor.Count > 0)
			{
				foreach (Spell cantrip in CantripsToLookFor)
				{
					foreach (Spell itemSpell in item.CachedSpells)
					{
						if (itemSpell.IsSameOrSurpasses(cantrip))
							goto end;
					}
				}

				end: ;
			}

			// If we're don't want to use any set pieces, remove them
			if (PrimaryArmorSet == 0 && SecondaryArmorSet == 0 && item.EquippableSlots.IsBodyArmor() && item.ItemSetId != 0)
				return false;

			// If we're building a two set armor suit, and we don't want any blanks or fillers, remove any pieces of armor of other sets
			if (PrimaryArmorSet != 0 && SecondaryArmorSet != 0 && PrimaryArmorSet != 255 && SecondaryArmorSet != 255 &&
				item.EquippableSlots.IsBodyArmor() && item.ItemSetId != PrimaryArmorSet && item.ItemSetId != SecondaryArmorSet)
				return false;

			return true;
		}
Beispiel #2
0
		public void Push(SuitBuildableMyWorldObject item, EquippableSlotFlags slot)
		{
			cache[nextOpenCacheIndex].Piece = item;
			cache[nextOpenCacheIndex].Slot = slot;
			cache[nextOpenCacheIndex].SpellCount = item.SpellsToUseInSearch.Count;

			occupiedSlots |= slot;

			for (int i = 0; i < item.SpellsToUseInSearch.Count; i++)
			{
				spells[nextOpenSpellIndex] = item.SpellsToUseInSearch[i];
				nextOpenSpellIndex++;
			}

			nextOpenCacheIndex++;

			if (item.ItemSetId != -1)
				armorSetCountById[item.ItemSetId]++;

			if (item.CalcedStartingArmorLevel > 0)
				TotalBaseArmorLevel += (item.CalcedStartingArmorLevel * slot.GetTotalBitsSet());

			if (slot.IsBodyArmor())
				TotalBodyArmorPieces++;
		}
		public void SetEquipmentPiece(SuitBuildableMyWorldObject 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;
		}
		public bool CanEquip(SuitBuildableMyWorldObject piece)
		{
			return (piece.EquippableSlots & EquippableSlots) == EquippableSlots;
		}
Beispiel #5
0
        public bool IsSurpassedBy(SuitBuildableMyWorldObject compareItem)
        {
            BuiltItemSearchCache();
            compareItem.BuiltItemSearchCache();

            if (compareItem.Exclude)
            {
                return(false);
            }

            // 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 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 cachedSpells)
            {
                if (itemSpell.CantripLevel < highestCantrip)
                {
                    continue;
                }

                foreach (Spell compareSpell in compareItem.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);
        }
Beispiel #6
0
		public bool ItemPassesFilters(SuitBuildableMyWorldObject mwo)
		{
			if (checkRemoveEquipped.Checked && mwo.EquippedSlot != EquippableSlotFlags.None)
				return false;

			if (chkRemoveUnequipped.Checked && mwo.EquippedSlot == EquippableSlotFlags.None)
				return false;


			int value;
			int.TryParse(txtMinimumBaseArmorLevel.Text, out value);
			if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel < value && mwo.EquippableSlots.IsCoreBodyArmor())
				return false;

			int.TryParse(txtMaximumBaseArmorLevel.Text, out value);
			if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel > value && mwo.EquippableSlots.IsCoreBodyArmor())
				return false;

			int.TryParse(txtMinimumExtremityArmorLevel.Text, out value);
			if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel < value && mwo.EquippableSlots.IsExtremityBodyArmor())
				return false;

			int.TryParse(txtMaximumExtremityArmorLevel.Text, out value);
			if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel > value && mwo.EquippableSlots.IsExtremityBodyArmor())
				return false;


			if (mwo.EquippableSlots.IsBodyArmor())
			{
				if (!chkBodyArmorClothing.Checked) return false;
			}
			else if (mwo.EquippableSlots.IsUnderwear())
			{
				if (!chkShirtPants.Checked) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.Jewelry)
			{
				if (!chkJewelry.Checked) return false;

				if (!chkJewelryNecklace.Checked && mwo.EquippableSlots == EquippableSlotFlags.Necklace) return false;
				if (!chkJewelryTrinket.Checked && mwo.EquippableSlots == EquippableSlotFlags.Trinket) return false;
				if (!chkJewelryBracelet.Checked && mwo.EquippableSlots == (EquippableSlotFlags.LeftBracelet | EquippableSlotFlags.RightBracelet)) return false;
				if (!chkJewelryRing.Checked && mwo.EquippableSlots == (EquippableSlotFlags.LeftRing | EquippableSlotFlags.RightRing)) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.MeleeWeapon)
			{
				if (!chkMeleeWeapon.Checked) return false;

				if (!chkMeleeHeavy.Checked && mwo.EquipSkill == "Heavy Weapons") return false;
				if (!chkMeleeLight.Checked && mwo.EquipSkill == "Light Weapons") return false;
				if (!chkMeleeFinesse.Checked && mwo.EquipSkill == "Finesse Weapons") return false;
				if (!chkMelee2H.Checked && mwo.EquipSkill == "Two Handed Combat") return false;

				if (!chkMasteryUA.Checked && mwo.Mastery == "Unarmed Weapon") return false;
				if (!chkMasterySword.Checked && mwo.Mastery == "Sword") return false;
				if (!chkMasteryAxe.Checked && mwo.Mastery == "Axe") return false;
				if (!chkMasteryMace.Checked && mwo.Mastery == "Mace") return false;
				if (!chkMasterySpear.Checked && mwo.Mastery == "Spear") return false;
				if (!chkMasteryDagger.Checked && mwo.Mastery == "Dagger") return false;
				if (!chkMasteryStaff.Checked && mwo.Mastery == "Staff") return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.MissileWeapon)
			{
				if (!chkMissileWeapon.Checked) return false;

				if (!chkMasteryBow.Checked && mwo.Mastery == "Bow") return false;
				if (!chkMasteryCrossbow.Checked && mwo.Mastery == "Crossbow") return false;
				if (!chkMasteryThrown.Checked && mwo.Mastery == "Thrown") return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.WandStaffOrb)
			{
				if (!chkWandStaffOrb.Checked) return false;

				if (!chkWandStaffOrbWar.Checked && mwo.IntValues.ContainsKey(158) && mwo.IntValues[158] == 2 && mwo.IntValues.ContainsKey(159) && mwo.IntValues[159] == 0x22) return false;
				if (!chkWandStaffOrbVoid.Checked && mwo.IntValues.ContainsKey(158) && mwo.IntValues[158] == 2 && mwo.IntValues.ContainsKey(159) && mwo.IntValues[159] == 0x2B) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.Salvage)
			{
				if (!chkSalvage.Checked) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.Container || mwo.ObjectClass == (int)ObjectClass.Foci)
			{
				if (!chkContainersFoci.Checked) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.Money || mwo.ObjectClass == (int)ObjectClass.TradeNote || mwo.ObjectClass == (int)ObjectClass.Key)
			{
				if (!chkMoneyNotesKeys.Checked) return false;
			}
			else if (mwo.ObjectClass == (int)ObjectClass.SpellComponent || mwo.ObjectClass == (int)ObjectClass.HealingKit || mwo.ObjectClass == (int)ObjectClass.Food || mwo.ObjectClass == (int)ObjectClass.ManaStone)
			{
				if (!chkCompsKitsFoodManaStones.Checked) return false;
			}
			else if (mwo.ObjectClass != 0) // All Else
			{
				if (!chkAllElseObjectClasses.Checked) return false;
			}


			if (mwo.EquippableSlots.IsBodyArmor())
			{
				// Both are No Armor Set and the item has a set
				if (PrimaryArmorSetId == 0 && SecondaryArmorSetId == 0 && mwo.ItemSetId != 0)
					return false;

				if (PrimaryArmorSetId != 255 && SecondaryArmorSetId != 255)
				{
					if (PrimaryArmorSetId != mwo.ItemSetId && SecondaryArmorSetId != mwo.ItemSetId)
						return false;
				}
			}


			// Spell Quantities
			int minLegendaries;
			int.TryParse(txtMinLegendaries.Text, out minLegendaries);

			int maxLegendaries;
			int.TryParse(txtMaxLegendaries.Text, out maxLegendaries);

			int minEpics;
			int.TryParse(txtMinEpics.Text, out minEpics);

			int maxEpics;
			int.TryParse(txtMaxEpics.Text, out maxEpics);
			
			int legendaries = 0;
			int epics = 0;

			foreach (Spell spell in mwo.CachedSpells)
			{
				if (spell.CantripLevel >= Spell.CantripLevels.Legendary) legendaries++;
				if (spell.CantripLevel >= Spell.CantripLevels.Epic) epics++;
			}

			if (legendaries < minLegendaries || legendaries > maxLegendaries || epics < minEpics || epics > maxEpics)
				return false;


			// Ratings
			if (mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing || mwo.ObjectClass == (int)ObjectClass.Jewelry)
			{
				if (mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing)
				{
					if (int.TryParse(txtMinOffensiveRating.Text, out value))
					{
						if (Math.Max(mwo.CritDamRating, 0) + Math.Max(mwo.CritRating, 0) + Math.Max(mwo.DamRating, 0) < value)
							return false;
					}

					if (int.TryParse(txtMaxOffensiveRating.Text, out value))
					{
						if (Math.Max(mwo.CritDamRating, 0) + Math.Max(mwo.CritRating, 0) + Math.Max(mwo.DamRating, 0) > value)
							return false;
					}

					if (int.TryParse(txtMinDefensiveRating.Text, out value))
					{
						if (Math.Max(mwo.CritDamResistRating, 0) + Math.Max(mwo.CritResistRating, 0) + Math.Max(mwo.DamResistRating, 0) < value)
							return false;
					}

					if (int.TryParse(txtMaxDefensiveRating.Text, out value))
					{
						if (Math.Max(mwo.CritDamResistRating, 0) + Math.Max(mwo.CritResistRating, 0) + Math.Max(mwo.DamResistRating, 0) > value)
							return false;
					}
				}

				if (mwo.ObjectClass == (int)ObjectClass.Jewelry)
				{
					if (int.TryParse(txtMinOtherRating.Text, out value))
					{
						if (Math.Max(mwo.HealBoostRating, 0) + Math.Max(mwo.VitalityRating, 0) < value)
							return false;
					}

					if (int.TryParse(txtMaxOtherRating.Text, out value))
					{
						if (Math.Max(mwo.HealBoostRating, 0) + Math.Max(mwo.VitalityRating, 0) > value)
							return false;
					}
				}

				if (int.TryParse(txtMinTotalRating.Text, out value))
				{
					if (Math.Max(mwo.TotalRating, 0) < value)
						return false;
				}

				if (int.TryParse(txtMaxTotalRating.Text, out value))
				{
					if (Math.Max(mwo.TotalRating, 0) > value)
						return false;
				}
			}


			// Wield Requirements
			if (int.TryParse(txtWieldRequirementLevelMin.Text, out value))
			{
				if (Math.Max(mwo.WieldLevel, 0) < value)
					return false;
			}

			if (int.TryParse(txtWieldRequirementLevelMax.Text, out value))
			{
				if (Math.Max(mwo.WieldLevel, 0) > value)
					return false;
			}

			if (int.TryParse(txtWieldRequirementSkillMin.Text, out value))
			{
				if (Math.Max(mwo.SkillLevel, 0) < value)
					return false;
			}

			if (int.TryParse(txtWieldRequirementSkillMax.Text, out value))
			{
				if (Math.Max(mwo.SkillLevel, 0) > value)
					return false;
			}


			// Spell Selector
			if (cantripSelectorControl1.Count > 0)
			{
				foreach (var spell in mwo.CachedSpells)
				{
					foreach (Spell desiredSpell in cantripSelectorControl1)
					{
						if (spell.IsSameOrSurpasses(desiredSpell))
							goto end;
					}
				}
				return false;
				end: ;
			}

			return true;
		}
Beispiel #7
0
		public bool CanGetBeneficialSpellFrom(SuitBuildableMyWorldObject item)
		{
			// This whole approach needs to be optimized.
			// This is the biggest time waster in the entire search process.

			foreach (Spell itemSpell in item.SpellsToUseInSearch)
			//for (int i = 0 ; i < item.Spells.Count ; i++) // This is actually slower
			{
				for (int j = 0; j < nextOpenSpellIndex; j++) // For here is faster than foreach
				{
					if (spells[j].IsSameOrSurpasses(itemSpell))
						goto end;
				}

				return true;

				end: ;
			}

			return false;
		}
		public bool IsSurpassedBy(SuitBuildableMyWorldObject compareItem)
		{
			BuiltItemSearchCache();
			compareItem.BuiltItemSearchCache();

			if (compareItem.Exclude)
				return false;

			// 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 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 cachedSpells)
			{
				if (itemSpell.CantripLevel < highestCantrip)
					continue;

				foreach (Spell compareSpell in compareItem.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;
		}
        public bool ItemPassesFilters(SuitBuildableMyWorldObject mwo)
        {
            if (checkRemoveEquipped.Checked && mwo.EquippedSlot != EquippableSlotFlags.None)
            {
                return(false);
            }

            if (chkRemoveUnequipped.Checked && mwo.EquippedSlot == EquippableSlotFlags.None)
            {
                return(false);
            }


            int value;

            int.TryParse(txtMinimumBaseArmorLevel.Text, out value);
            if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel < value && mwo.EquippableSlots.IsCoreBodyArmor())
            {
                return(false);
            }

            int.TryParse(txtMaximumBaseArmorLevel.Text, out value);
            if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel > value && mwo.EquippableSlots.IsCoreBodyArmor())
            {
                return(false);
            }

            int.TryParse(txtMinimumExtremityArmorLevel.Text, out value);
            if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel < value && mwo.EquippableSlots.IsExtremityBodyArmor())
            {
                return(false);
            }

            int.TryParse(txtMaximumExtremityArmorLevel.Text, out value);
            if ((mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing) && mwo.CalcedStartingArmorLevel > value && mwo.EquippableSlots.IsExtremityBodyArmor())
            {
                return(false);
            }


            if (mwo.EquippableSlots.IsBodyArmor())
            {
                if (!chkBodyArmorClothing.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.EquippableSlots.IsUnderwear())
            {
                if (!chkShirtPants.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.Jewelry)
            {
                if (!chkJewelry.Checked)
                {
                    return(false);
                }

                if (!chkJewelryNecklace.Checked && mwo.EquippableSlots == EquippableSlotFlags.Necklace)
                {
                    return(false);
                }
                if (!chkJewelryTrinket.Checked && mwo.EquippableSlots == EquippableSlotFlags.Trinket)
                {
                    return(false);
                }
                if (!chkJewelryBracelet.Checked && mwo.EquippableSlots == (EquippableSlotFlags.LeftBracelet | EquippableSlotFlags.RightBracelet))
                {
                    return(false);
                }
                if (!chkJewelryRing.Checked && mwo.EquippableSlots == (EquippableSlotFlags.LeftRing | EquippableSlotFlags.RightRing))
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.MeleeWeapon)
            {
                if (!chkMeleeWeapon.Checked)
                {
                    return(false);
                }

                if (!chkMeleeHeavy.Checked && mwo.EquipSkill == "Heavy Weapons")
                {
                    return(false);
                }
                if (!chkMeleeLight.Checked && mwo.EquipSkill == "Light Weapons")
                {
                    return(false);
                }
                if (!chkMeleeFinesse.Checked && mwo.EquipSkill == "Finesse Weapons")
                {
                    return(false);
                }
                if (!chkMelee2H.Checked && mwo.EquipSkill == "Two Handed Combat")
                {
                    return(false);
                }

                if (!chkMasteryUA.Checked && mwo.Mastery == "Unarmed Weapon")
                {
                    return(false);
                }
                if (!chkMasterySword.Checked && mwo.Mastery == "Sword")
                {
                    return(false);
                }
                if (!chkMasteryAxe.Checked && mwo.Mastery == "Axe")
                {
                    return(false);
                }
                if (!chkMasteryMace.Checked && mwo.Mastery == "Mace")
                {
                    return(false);
                }
                if (!chkMasterySpear.Checked && mwo.Mastery == "Spear")
                {
                    return(false);
                }
                if (!chkMasteryDagger.Checked && mwo.Mastery == "Dagger")
                {
                    return(false);
                }
                if (!chkMasteryStaff.Checked && mwo.Mastery == "Staff")
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.MissileWeapon)
            {
                if (!chkMissileWeapon.Checked)
                {
                    return(false);
                }

                if (!chkMasteryBow.Checked && mwo.Mastery == "Bow")
                {
                    return(false);
                }
                if (!chkMasteryCrossbow.Checked && mwo.Mastery == "Crossbow")
                {
                    return(false);
                }
                if (!chkMasteryThrown.Checked && mwo.Mastery == "Thrown")
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.WandStaffOrb)
            {
                if (!chkWandStaffOrb.Checked)
                {
                    return(false);
                }

                if (!chkWandStaffOrbWar.Checked && mwo.IntValues.ContainsKey(158) && mwo.IntValues[158] == 2 && mwo.IntValues.ContainsKey(159) && mwo.IntValues[159] == 0x22)
                {
                    return(false);
                }
                if (!chkWandStaffOrbVoid.Checked && mwo.IntValues.ContainsKey(158) && mwo.IntValues[158] == 2 && mwo.IntValues.ContainsKey(159) && mwo.IntValues[159] == 0x2B)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.Salvage)
            {
                if (!chkSalvage.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.Container || mwo.ObjectClass == (int)ObjectClass.Foci)
            {
                if (!chkContainersFoci.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.Money || mwo.ObjectClass == (int)ObjectClass.TradeNote || mwo.ObjectClass == (int)ObjectClass.Key)
            {
                if (!chkMoneyNotesKeys.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass == (int)ObjectClass.SpellComponent || mwo.ObjectClass == (int)ObjectClass.HealingKit || mwo.ObjectClass == (int)ObjectClass.Food || mwo.ObjectClass == (int)ObjectClass.ManaStone)
            {
                if (!chkCompsKitsFoodManaStones.Checked)
                {
                    return(false);
                }
            }
            else if (mwo.ObjectClass != 0)             // All Else
            {
                if (!chkAllElseObjectClasses.Checked)
                {
                    return(false);
                }
            }


            if (mwo.EquippableSlots.IsBodyArmor())
            {
                // Both are No Armor Set and the item has a set
                if (PrimaryArmorSetId == 0 && SecondaryArmorSetId == 0 && mwo.ItemSetId != 0)
                {
                    return(false);
                }

                if (PrimaryArmorSetId != 255 && SecondaryArmorSetId != 255)
                {
                    if (PrimaryArmorSetId != mwo.ItemSetId && SecondaryArmorSetId != mwo.ItemSetId)
                    {
                        return(false);
                    }
                }
            }


            // Spell Quantities
            int minLegendaries;

            int.TryParse(txtMinLegendaries.Text, out minLegendaries);

            int maxLegendaries;

            int.TryParse(txtMaxLegendaries.Text, out maxLegendaries);

            int minEpics;

            int.TryParse(txtMinEpics.Text, out minEpics);

            int maxEpics;

            int.TryParse(txtMaxEpics.Text, out maxEpics);

            int legendaries = 0;
            int epics       = 0;

            foreach (Spell spell in mwo.CachedSpells)
            {
                if (spell.CantripLevel >= Spell.CantripLevels.Legendary)
                {
                    legendaries++;
                }
                if (spell.CantripLevel >= Spell.CantripLevels.Epic)
                {
                    epics++;
                }
            }

            if (legendaries < minLegendaries || legendaries > maxLegendaries || epics < minEpics || epics > maxEpics)
            {
                return(false);
            }


            // Ratings
            if (mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing || mwo.ObjectClass == (int)ObjectClass.Jewelry)
            {
                if (mwo.ObjectClass == (int)ObjectClass.Armor || mwo.ObjectClass == (int)ObjectClass.Clothing)
                {
                    if (int.TryParse(txtMinOffensiveRating.Text, out value))
                    {
                        if (Math.Max(mwo.CritDamRating, 0) + Math.Max(mwo.CritRating, 0) + Math.Max(mwo.DamRating, 0) < value)
                        {
                            return(false);
                        }
                    }

                    if (int.TryParse(txtMaxOffensiveRating.Text, out value))
                    {
                        if (Math.Max(mwo.CritDamRating, 0) + Math.Max(mwo.CritRating, 0) + Math.Max(mwo.DamRating, 0) > value)
                        {
                            return(false);
                        }
                    }

                    if (int.TryParse(txtMinDefensiveRating.Text, out value))
                    {
                        if (Math.Max(mwo.CritDamResistRating, 0) + Math.Max(mwo.CritResistRating, 0) + Math.Max(mwo.DamResistRating, 0) < value)
                        {
                            return(false);
                        }
                    }

                    if (int.TryParse(txtMaxDefensiveRating.Text, out value))
                    {
                        if (Math.Max(mwo.CritDamResistRating, 0) + Math.Max(mwo.CritResistRating, 0) + Math.Max(mwo.DamResistRating, 0) > value)
                        {
                            return(false);
                        }
                    }
                }

                if (mwo.ObjectClass == (int)ObjectClass.Jewelry)
                {
                    if (int.TryParse(txtMinOtherRating.Text, out value))
                    {
                        if (Math.Max(mwo.HealBoostRating, 0) + Math.Max(mwo.VitalityRating, 0) < value)
                        {
                            return(false);
                        }
                    }

                    if (int.TryParse(txtMaxOtherRating.Text, out value))
                    {
                        if (Math.Max(mwo.HealBoostRating, 0) + Math.Max(mwo.VitalityRating, 0) > value)
                        {
                            return(false);
                        }
                    }
                }

                if (int.TryParse(txtMinTotalRating.Text, out value))
                {
                    if (Math.Max(mwo.TotalRating, 0) < value)
                    {
                        return(false);
                    }
                }

                if (int.TryParse(txtMaxTotalRating.Text, out value))
                {
                    if (Math.Max(mwo.TotalRating, 0) > value)
                    {
                        return(false);
                    }
                }
            }


            // Wield Requirements
            if (int.TryParse(txtWieldRequirementLevelMin.Text, out value))
            {
                if (Math.Max(mwo.WieldLevel, 0) < value)
                {
                    return(false);
                }
            }

            if (int.TryParse(txtWieldRequirementLevelMax.Text, out value))
            {
                if (Math.Max(mwo.WieldLevel, 0) > value)
                {
                    return(false);
                }
            }

            if (int.TryParse(txtWieldRequirementSkillMin.Text, out value))
            {
                if (Math.Max(mwo.SkillLevel, 0) < value)
                {
                    return(false);
                }
            }

            if (int.TryParse(txtWieldRequirementSkillMax.Text, out value))
            {
                if (Math.Max(mwo.SkillLevel, 0) > value)
                {
                    return(false);
                }
            }


            // Spell Selector
            if (cantripSelectorControl1.Count > 0)
            {
                foreach (var spell in mwo.CachedSpells)
                {
                    foreach (Spell desiredSpell in cantripSelectorControl1)
                    {
                        if (spell.IsSameOrSurpasses(desiredSpell))
                        {
                            goto end;
                        }
                    }
                }
                return(false);

                end :;
            }

            return(true);
        }
Beispiel #10
0
        public void SetEquipmentPiece(SuitBuildableMyWorldObject 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;
        }
Beispiel #11
0
 public bool CanEquip(SuitBuildableMyWorldObject piece)
 {
     return((piece.EquippableSlots & EquippableSlots) == EquippableSlots);
 }