/// <summary> /// Creates a new Enchant, representing an enchant to a single slot. /// /// EXAMPLE: /// new Enchant(2564, "Superior Agility", Item.ItemSlot.Hands, new Stats() { Agility = 15 }) /// </summary> /// <param name="id">The Enchant ID for the enchant. See the Id property for details of how to find this.</param> /// <param name="name">The name of the enchant.</param> /// <param name="slot">The slot that this instance of the enchant applies to. (Create multiple Enchant /// objects for enchants which may be applied to multiple slots)</param> /// <param name="stats">The stats that the enchant gives the character.</param> public Enchant(int id, string name, Item.ItemSlot slot, Stats stats) { Id = id; Name = name; Slot = slot; Stats = stats; }
public Sockets(Item.ItemSlot color1, Item.ItemSlot color2, Item.ItemSlot color3, Stats stats) { _color1 = color1; _color2 = color2; _color3 = color3; _stats = stats; }
public static List <Enchant> FindEnchants(Item.ItemSlot slot, CalculationsBase model) { List <Item.ItemSlot> validSlots = new List <Item.ItemSlot>(); if (slot != Item.ItemSlot.MainHand) { validSlots.Add(slot); } if (slot == Item.ItemSlot.OffHand || slot == Item.ItemSlot.MainHand || slot == Item.ItemSlot.TwoHand) { validSlots.Add(Item.ItemSlot.OneHand); } if (slot == Item.ItemSlot.MainHand) { validSlots.Add(Item.ItemSlot.TwoHand); } return(AllEnchants.FindAll(new Predicate <Enchant>( delegate(Enchant enchant) { return model.HasRelevantStats(enchant.Stats) && (validSlots.Contains(enchant.Slot) || slot == Item.ItemSlot.None) || enchant.Slot == Item.ItemSlot.None; } ))); }
public static List <Enchant> FindEnchants(Item.ItemSlot slot, List <string> availableIds, CalculationsBase model) { List <Item.ItemSlot> validSlots = new List <Item.ItemSlot>(); if (slot != Item.ItemSlot.MainHand) { validSlots.Add(slot); } if (slot == Item.ItemSlot.OffHand || slot == Item.ItemSlot.MainHand) { validSlots.Add(Item.ItemSlot.OneHand); } if (slot == Item.ItemSlot.MainHand) { validSlots.Add(Item.ItemSlot.TwoHand); } return(AllEnchants.FindAll(new Predicate <Enchant>( delegate(Enchant enchant) { return ((model.HasRelevantStats(enchant.Stats) && (validSlots.Contains(enchant.Slot) || slot == Item.ItemSlot.None) || enchant.Slot == Item.ItemSlot.None) && availableIds.Contains((-1 * (enchant.Id + (10000 * (int)enchant.Slot))).ToString())) || enchant.Id == 0; } ))); }
void Foo(Item.ItemSlot i) { object oo = this [null]; switch (i) { case Item.ItemSlot.ItemM1: break; } }
public void LoadEnchantsBySlot(Item.ItemSlot slot, CharacterCalculationsBase currentCalculations) { if (Items != null && Character != null) { comparisonGraph1.RoundValues = true; comparisonGraph1.CustomRendered = false; comparisonGraph1.ItemCalculations = Calculations.GetEnchantCalculations(slot, Character, currentCalculations).ToArray(); comparisonGraph1.EquipSlot = Character.CharacterSlot.None; } }
public ItemData(Item item) { itemName = item.itemName; description = item.description; itemClass = item.itemClass; slot = item.slot; damage = item.damage; defence = item.defence; strength = item.strength; agility = item.agility; intel = item.intel; }
public virtual List <ComparisonCalculationBase> GetEnchantCalculations(Item.ItemSlot slot, Character character, CharacterCalculationsBase currentCalcs) { ClearCache(); List <ComparisonCalculationBase> enchantCalcs = new List <ComparisonCalculationBase>(); CharacterCalculationsBase calcsEquipped = null; CharacterCalculationsBase calcsUnequipped = null; foreach (Enchant enchant in Enchant.FindEnchants(slot)) { //if (enchantCalcs.ContainsKey(enchant.Id)) continue; bool isEquipped = character.GetEnchantBySlot(enchant.Slot) == enchant; if (isEquipped) { calcsEquipped = currentCalcs; Character charUnequipped = character.Clone(); charUnequipped.SetEnchantBySlot(enchant.Slot, null); calcsUnequipped = GetCharacterCalculations(charUnequipped); } else { Character charUnequipped = character.Clone(); Character charEquipped = character.Clone(); charUnequipped.SetEnchantBySlot(enchant.Slot, null); charEquipped.SetEnchantBySlot(enchant.Slot, enchant); calcsUnequipped = GetCharacterCalculations(charUnequipped); calcsEquipped = GetCharacterCalculations(charEquipped); } ComparisonCalculationBase enchantCalc = CreateNewComparisonCalculation(); enchantCalc.Name = enchant.Name; enchantCalc.Item = new Item(enchant.Name, Item.ItemQuality.Temp, Item.ItemType.None, -1 * (enchant.Id + (10000 * (int)enchant.Slot)), null, Item.ItemSlot.None, null, false, enchant.Stats, new Sockets(), 0, 0, 0, 0, 0, Item.ItemDamageType.Physical, 0, null); enchantCalc.Item.Name = enchant.Name; enchantCalc.Item.Stats = enchant.Stats; enchantCalc.Equipped = isEquipped; enchantCalc.OverallPoints = calcsEquipped.OverallPoints - calcsUnequipped.OverallPoints; float[] subPoints = new float[calcsEquipped.SubPoints.Length]; for (int i = 0; i < calcsEquipped.SubPoints.Length; i++) { subPoints[i] = calcsEquipped.SubPoints[i] - calcsUnequipped.SubPoints[i]; } enchantCalc.SubPoints = subPoints; enchantCalcs.Add(enchantCalc); } return(enchantCalcs); }
public static Enchant FindEnchant(int id, Item.ItemSlot slot) { List <Item.ItemSlot> validSlots = new List <Item.ItemSlot>(); if (slot != Item.ItemSlot.MainHand) { validSlots.Add(slot); } if (slot == Item.ItemSlot.OffHand || slot == Item.ItemSlot.MainHand || slot == Item.ItemSlot.TwoHand) { validSlots.Add(Item.ItemSlot.OneHand); } if (slot == Item.ItemSlot.MainHand) { validSlots.Add(Item.ItemSlot.TwoHand); } return(AllEnchants.Find(new Predicate <Enchant>(delegate(Enchant enchant) { return (enchant.Id == id) && (validSlots.Contains(enchant.Slot)); })) ?? AllEnchants[0]); }
public static List <Enchant> FindEnchants(Item.ItemSlot slot, List <string> availableIds) { return(FindEnchants(slot, availableIds, Calculations.Instance)); }
public static List <Enchant> FindEnchants(Item.ItemSlot slot) { return(FindEnchants(slot, Calculations.Instance)); }
public void LoadAvailableGear(CharacterCalculationsBase currentCalculations) { List <ComparisonCalculationBase> itemCalculations = new List <ComparisonCalculationBase>(); SortedList <Item.ItemSlot, Character.CharacterSlot> slotMap = new SortedList <Item.ItemSlot, Character.CharacterSlot>(); if (Items != null && Character != null) { SortedList <string, Item> items = new SortedList <string, Item>(); float Finger1 = (Character[Character.CharacterSlot.Finger1] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.Finger1], Character, Character.CharacterSlot.Finger1).OverallPoints); float Finger2 = (Character[Character.CharacterSlot.Finger2] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.Finger2], Character, Character.CharacterSlot.Finger2).OverallPoints); float Trinket1 = (Character[Character.CharacterSlot.Trinket1] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.Trinket1], Character, Character.CharacterSlot.Trinket1).OverallPoints); float Trinket2 = (Character[Character.CharacterSlot.Trinket2] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.Trinket2], Character, Character.CharacterSlot.Trinket2).OverallPoints); if (Finger2 < Finger1) { slotMap[Item.ItemSlot.Finger] = Character.CharacterSlot.Finger2; } if (Trinket2 < Trinket1) { slotMap[Item.ItemSlot.Trinket] = Character.CharacterSlot.Trinket2; } float MainHand = (Character[Character.CharacterSlot.MainHand] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.MainHand], Character, Character.CharacterSlot.MainHand).OverallPoints); float OffHand = (Character[Character.CharacterSlot.OffHand] == null ? 0 : Calculations.GetItemCalculations( Character[Character.CharacterSlot.OffHand], Character, Character.CharacterSlot.OffHand).OverallPoints); if (MainHand > OffHand) { slotMap[Item.ItemSlot.OneHand] = Character.CharacterSlot.OffHand; } foreach (Item relevantItem in ItemCache.RelevantItems) { try { Item.ItemSlot iSlot = relevantItem.Slot; Character.CharacterSlot slot; if (slotMap.ContainsKey(iSlot)) { slot = slotMap[iSlot]; } else { slot = Item.DefaultSlotMap[iSlot]; } if (slot != Character.CharacterSlot.None) { ComparisonCalculationBase slotCalc; Item currentItem = Character[slot]; if (currentItem == null) { slotCalc = Calculations.CreateNewComparisonCalculation(); } else { slotCalc = Calculations.GetItemCalculations(currentItem, Character, slot); } foreach (Item item in ItemCache.Instance.FindAllItemsById(relevantItem.Id)) { if (!items.ContainsKey(item.GemmedId) && (currentItem == null || currentItem.GemmedId != item.GemmedId)) { if (currentItem != null && currentItem.Unique) { Character.CharacterSlot otherSlot = Character.CharacterSlot.None; switch (slot) { case Character.CharacterSlot.Finger1: otherSlot = Character.CharacterSlot.Finger2; break; case Character.CharacterSlot.Finger2: otherSlot = Character.CharacterSlot.Finger1; break; case Character.CharacterSlot.Trinket1: otherSlot = Character.CharacterSlot.Trinket2; break; case Character.CharacterSlot.Trinket2: otherSlot = Character.CharacterSlot.Trinket1; break; case Character.CharacterSlot.MainHand: otherSlot = Character.CharacterSlot.OffHand; break; case Character.CharacterSlot.OffHand: otherSlot = Character.CharacterSlot.MainHand; break; } if (otherSlot != Character.CharacterSlot.None && Character[otherSlot] != null && Character[otherSlot].Id == item.Id) { continue; } } ComparisonCalculationBase itemCalc = Calculations.GetItemCalculations(item, Character, slot); bool include = false; for (int i = 0; i < itemCalc.SubPoints.Length; i++) { itemCalc.SubPoints[i] -= slotCalc.SubPoints[i]; include |= itemCalc.SubPoints[i] > 0; } itemCalc.OverallPoints -= slotCalc.OverallPoints; if (itemCalc.OverallPoints > 0) { itemCalculations.Add(itemCalc); } items[item.GemmedId] = item; } } } } catch (Exception) { } } } comparisonGraph1.RoundValues = true; comparisonGraph1.CustomRendered = false; comparisonGraph1.DisplayMode = ComparisonGraph.GraphDisplayMode.Overall; comparisonGraph1.ItemCalculations = itemCalculations.ToArray(); comparisonGraph1.EquipSlot = Character.CharacterSlot.AutoSelect; comparisonGraph1.SlotMap = slotMap; }
public static List <ComparisonCalculationBase> GetEnchantCalculations(Item.ItemSlot slot, Character character, CharacterCalculationsBase currentCalcs) { return(Instance.GetEnchantCalculations(slot, character, currentCalcs)); }