private void item_Clicked(object sender, MouseButtonEventArgs e) { if (!_buildingListItems && IsEnchantList) { FrameworkElement fe = sender as FrameworkElement; ItemListItem listItem = fe.DataContext as ItemListItem; int selectedEnchantId = -1; Enchant selectedEnchant = Character.GetEnchantBySlot(Slot); if (selectedEnchant != null) { selectedEnchantId = selectedEnchant.Id; } if (listItem.EnchantId == selectedEnchantId) { this.Close(); } } if (!_buildingListItems && IsTinkeringList) { FrameworkElement fe = sender as FrameworkElement; ItemListItem listItem = fe.DataContext as ItemListItem; int selectedTinkeringId = -1; Tinkering selectedTinkering = Character.GetTinkeringBySlot(Slot); if (selectedTinkering != null) { selectedTinkeringId = selectedTinkering.Id; } if (listItem.TinkeringId == selectedTinkeringId) { this.Close(); } } if (!_buildingListItems && IsReforgeList) { FrameworkElement fe = sender as FrameworkElement; ItemListItem listItem = fe.DataContext as ItemListItem; int selectedReforgeId = -1; Reforging selectedReforging = Character.GetReforgingBySlot(Slot); if (selectedReforging != null) { selectedReforgeId = selectedReforging.Id; } if (listItem.ReforgeId == selectedReforgeId) { this.Close(); } } }
private void iq_Closed(object sender, EventArgs e) { IncreaseQuota iq = sender as IncreaseQuota; if (iq == null || iq.DialogResult.GetValueOrDefault(false)) { Calculations.RegisterModel(typeof(Rawr.Bear.CalculationsBear)); Calculations.RegisterModel(typeof(Rawr.Cat.CalculationsCat)); Calculations.RegisterModel(typeof(Rawr.DPSDK.CalculationsDPSDK)); Calculations.RegisterModel(typeof(Rawr.DPSWarr.CalculationsDPSWarr)); Calculations.RegisterModel(typeof(Rawr.Elemental.CalculationsElemental)); Calculations.RegisterModel(typeof(Rawr.Enhance.CalculationsEnhance)); Calculations.RegisterModel(typeof(Rawr.Healadin.CalculationsHealadin)); Calculations.RegisterModel(typeof(Rawr.HealPriest.CalculationsHealPriest)); Calculations.RegisterModel(typeof(Rawr.Hunter.CalculationsHunter)); Calculations.RegisterModel(typeof(Rawr.Mage.CalculationsMage)); Calculations.RegisterModel(typeof(Rawr.Moonkin.CalculationsMoonkin)); Calculations.RegisterModel(typeof(Rawr.ProtPaladin.CalculationsProtPaladin)); Calculations.RegisterModel(typeof(Rawr.ProtWarr.CalculationsProtWarr)); Calculations.RegisterModel(typeof(Rawr.RestoSham.CalculationsRestoSham)); Calculations.RegisterModel(typeof(Rawr.Retribution.CalculationsRetribution)); Calculations.RegisterModel(typeof(Rawr.Rogue.CalculationsRogue)); Calculations.RegisterModel(typeof(Rawr.ShadowPriest.CalculationsShadowPriest)); Calculations.RegisterModel(typeof(Rawr.TankDK.CalculationsTankDK)); Calculations.RegisterModel(typeof(Rawr.Tree.CalculationsTree)); Calculations.RegisterModel(typeof(Rawr.Warlock.CalculationsWarlock)); string[] files = new List <string>(Classes.Keys).ToArray(); Buff.LoadDefaultBuffs(null, 85); Enchant.LoadDefaultEnchants(); Tinkering.LoadDefaultTinkerings(); FileUtils f = new FileUtils(files, progressUpdated); f.DownloadIfNotExists(new EventHandler(filesLoaded)); } else { new Base.ErrorBox("Not Enough Storage Space", "Rawr will not work if you do not allow it to increase its available " + "storage size. Please refresh this page and accept to continue.").Show(); } }
public void SetTinkeringBySlot(CharacterSlot slot, Tinkering tinkering) { int i = (int)slot; if (i < 0 || i >= SlotCount) return; ItemInstance item = this[slot]; if ((object)item != null) item.Tinkering = tinkering; OnCalculationsInvalidated(); }
public void SetTinkeringBySlot(ItemSlot slot, Tinkering tinkering) { switch (slot) { case Rawr.ItemSlot.Back: BackTinkering = tinkering; break; case Rawr.ItemSlot.Hands: HandsTinkering = tinkering; break; case Rawr.ItemSlot.Waist: WaistTinkering = tinkering; break; default: break; } }
public void ToggleItemAvailability(Tinkering tinkering) { string id = (-1 * (tinkering.Id + ((int)AvailableItemIDModifiers.Tinkerings * (int)tinkering.Slot))).ToString(System.Globalization.CultureInfo.InvariantCulture); ItemAvailability newItemAvailability = ItemAvailability.NotAvailable; // all enabled toggle if (_availableItems.Contains(id)) { while (_availableItems.Contains(id)) { _availableItems.Remove(id); } newItemAvailability = ItemAvailability.NotAvailable; } else { _availableItems.Add(id); newItemAvailability = ItemAvailability.Available; } OnAvailableItemsChanged(id, newItemAvailability); }
public ItemAvailability GetItemAvailability(Tinkering tinkering) { string id = (-1 * (tinkering.Id + ((int)AvailableItemIDModifiers.Tinkerings * (int)tinkering.Slot))).ToString(System.Globalization.CultureInfo.InvariantCulture); return GetItemAvailability(id, string.Format("{0}.0", tinkering.Id), id); }
public ItemInstance GetItemInstance(Item item, int randomSuffixId, Enchant enchant, Reforging reforging, Tinkering tinkering, bool blacksmithingSocket) { if (item == null) return null; Item gem1 = null; Item gem2 = null; Item gem3 = null; bool cog1used = false; switch (item.SocketColor1) { case ItemSlot.Meta: gem1 = MetaGem; break; case ItemSlot.Red: gem1 = RedGem; break; case ItemSlot.Yellow: gem1 = YellowGem; break; case ItemSlot.Blue: gem1 = BlueGem; break; case ItemSlot.Prismatic: gem1 = PrismaticGem; break; case ItemSlot.Cogwheel: gem1 = Cogwheel; cog1used = true; break; case ItemSlot.Hydraulic: gem1 = Hydraulic; break; case ItemSlot.None: if (blacksmithingSocket) { gem1 = PrismaticGem; blacksmithingSocket = false; } break; } switch (item.SocketColor2) { case ItemSlot.Meta: gem2 = MetaGem; break; case ItemSlot.Red: gem2 = RedGem; break; case ItemSlot.Yellow: gem2 = YellowGem; break; case ItemSlot.Blue: gem2 = BlueGem; break; case ItemSlot.Prismatic: gem2 = PrismaticGem; break; case ItemSlot.Cogwheel: if (cog1used) { gem2 = Cogwheel2; } else { gem2 = Cogwheel; cog1used = true; } break; case ItemSlot.Hydraulic: gem2 = Hydraulic; break; case ItemSlot.None: if (blacksmithingSocket) { gem2 = PrismaticGem; blacksmithingSocket = false; } break; } switch (item.SocketColor3) { case ItemSlot.Meta: gem3 = MetaGem; break; case ItemSlot.Red: gem3 = RedGem; break; case ItemSlot.Yellow: gem3 = YellowGem; break; case ItemSlot.Blue: gem3 = BlueGem; break; case ItemSlot.Prismatic: gem3 = PrismaticGem; break; case ItemSlot.Cogwheel: if (cog1used) { gem3 = Cogwheel2; } else { gem3 = Cogwheel; cog1used = true; } break; case ItemSlot.Hydraulic: gem3 = Hydraulic; break; case ItemSlot.None: if (blacksmithingSocket) { gem3 = PrismaticGem; blacksmithingSocket = false; } break; } return new ItemInstance(item, randomSuffixId, gem1, gem2, gem3, enchant, reforging, tinkering); }
public ItemInstance GetItemInstance(Item item, int randomSuffixId, Tinkering tinkering, bool blacksmithingSocket) { return GetItemInstance(item, randomSuffixId, null, null, tinkering, blacksmithingSocket); }
public static bool TinkeringFitsInSlot(Tinkering item, Character character, ItemSlot slot) { if (Instance != null) return Instance.TinkeringFitsInSlot(item, character, slot); return false; }
public static bool IsTinkeringRelevant(Tinkering tinkering, Character character) { if (Instance != null) return Instance.IsTinkeringRelevant(tinkering, character); return false; }
public virtual bool TinkeringFitsInSlot(Tinkering tinkering, Character character, ItemSlot slot) { return tinkering.FitsInSlot(slot); }
/// <summary> /// Checks if the tinkering has relevant stats as defined by the model. If not, it will hide the tinkering as unnecessary. /// <para>If you have the option set to Hide Enchants based on Professions, it will also make that check.</para> /// </summary> /// <param name="enchant">The Tinkering to check</param> /// <returns>Whether the Tinkering should be hidden, based on Stats. If the option is set, also Professions.</returns> public virtual bool IsTinkeringRelevant(Tinkering tinkering, Character character) { try { return IsTinkeringAllowedForClass(tinkering, character.Class) && IsProfTinkeringRelevant(tinkering, character) && HasRelevantStats(tinkering.Stats); } catch { return false; } }
/// <summary> /// Hide a tinkering that is tied to a profession when: /// <para>- You have the Option active in the General Settings</para> /// <para>- You do not have the profession</para> /// <para>Otherwise, this function returns true so that non-profession tinkerings are not affected.</para> /// <para>NOTE: There is no reason to override this function</para> /// </summary> /// <param name="enchant">The Tinkering to check</param> /// <returns>Whether the Tinkering should be hidden, defaults to true unless specific conditions are met.</returns> public virtual bool IsProfTinkeringRelevant(Tinkering tinkering, Character character) { try { #region Tinkerings related to Professions to Hide/Show if (Rawr.Properties.GeneralSettings.Default.HideProfEnchants) { if (!character.HasProfession(Profession.Engineering)) { return false; } } #endregion return true; } catch (Exception) { return true; } }
public virtual bool IsItemEligibleForTinkering(Tinkering tinkering, Item item) { // Several of these don't actually apply bool eligibleForTinkering = false; if (tinkering.Slot == ItemSlot.OneHand) { eligibleForTinkering = (item.Slot == ItemSlot.OneHand || (item.Slot == ItemSlot.OffHand && item.Type != ItemType.Shield && item.Type != ItemType.None) || item.Slot == ItemSlot.MainHand || item.Slot == ItemSlot.TwoHand); } else if (tinkering.Slot == ItemSlot.OffHand) { eligibleForTinkering = (item.Type == ItemType.Shield || (item.Type == ItemType.None && tinkering.Id == 4091)); } else { eligibleForTinkering = (tinkering.Slot == item.Slot); } return eligibleForTinkering; }
public bool IsTinkeringAllowedForClass(Tinkering tinkering, CharacterClass characterClass) { // There are presently no class restrictions on these return true; }
private void BuildListItems() { try { _buildingListItems = true; if (Character == null) { return; } bool seenEquippedItem = (Character[Slot] == null); List <ComparisonCalculationBase> itemCalculations = new List <ComparisonCalculationBase>(); if (IsEnchantList) { CharacterCalculationsBase current = Calculations.GetCharacterCalculations(Character); if (Character != null && current != null) { itemCalculations = Calculations.GetEnchantCalculations(Item.GetItemSlotByCharacterSlot(Slot), Character, current, false); } } else if (IsTinkeringList) { CharacterCalculationsBase current = Calculations.GetCharacterCalculations(Character); if (Character != null && current != null) { itemCalculations = Calculations.GetTinkeringCalculations(Item.GetItemSlotByCharacterSlot(Slot), Character, current, false); } } else if (IsReforgeList) { CharacterCalculationsBase current = Calculations.GetCharacterCalculations(Character); if (Character != null && current != null) { itemCalculations = Calculations.GetReforgeCalculations(Slot, Character, current, false); } } else if (IsCogwheelList) { Calculations.ClearCache(); List <Item> relevantItems = Character.GetRelevantItems(GemSlot); foreach (Item item in relevantItems) { ComparisonCalculationBase itemCalc = Calculations.GetItemGemCalculations(item, Character, Slot, GemIndex); if (SelectedItem != null && SelectedItem.Id == item.Id) { itemCalc.Equipped = true; seenEquippedItem = true; } itemCalculations.Add(itemCalc); } if (!seenEquippedItem) { itemCalculations.Add(Calculations.GetItemGemCalculations(SelectedItem, Character, Slot, GemIndex)); } } else if (IsHydraulicList) { Calculations.ClearCache(); List <Item> relevantItems = Character.GetRelevantItems(GemSlot); foreach (Item item in relevantItems) { ComparisonCalculationBase itemCalc = Calculations.GetItemGemCalculations(item, Character, Slot, GemIndex); if (SelectedItem != null && SelectedItem.Id == item.Id) { itemCalc.Equipped = true; seenEquippedItem = true; } itemCalculations.Add(itemCalc); } if (!seenEquippedItem) { itemCalculations.Add(Calculations.GetItemGemCalculations(SelectedItem, Character, Slot, GemIndex)); } } else if (IsGemList) { Calculations.ClearCache(); List <Item> relevantItems = Character.GetRelevantItems(GemSlot); foreach (Item item in relevantItems) { ComparisonCalculationBase itemCalc = Calculations.GetItemGemCalculations(item, Character, Slot, GemIndex); if (SelectedItem != null && SelectedItem.Id == item.Id) { itemCalc.Equipped = true; seenEquippedItem = true; } itemCalculations.Add(itemCalc); } if (!seenEquippedItem) { itemCalculations.Add(Calculations.GetItemGemCalculations(SelectedItem, Character, Slot, GemIndex)); } } else { Calculations.ClearCache(); List <ItemInstance> relevantItemInstances = Character.GetRelevantItemInstances(Slot); if (relevantItemInstances.Count > 0) { foreach (ItemInstance item in relevantItemInstances) { if (!seenEquippedItem && Character[Slot].Equals(item)) { seenEquippedItem = true; } itemCalculations.Add(Calculations.GetItemCalculations((ItemInstance)item, Character, Slot)); } } if (!seenEquippedItem) { itemCalculations.Add(Calculations.GetItemCalculations(Character[Slot], Character, Slot)); } } float maxValue = itemCalculations.Count == 0 ? 100f : itemCalculations.Max(c => c.OverallPoints); Items.Clear(); List <ItemListItem> itemListItems = new List <ItemListItem>(); ItemListItem selectedListItem = null; int selectedEnchantId = 0, selectedReforgingId = 0, selectedTinkeringId = 0; if (IsEnchantList) { Enchant selectedEnchant = Character.GetEnchantBySlot(Slot); if (selectedEnchant != null) { selectedEnchantId = selectedEnchant.Id; } } else if (IsTinkeringList) { Tinkering selectedTinkering = Character.GetTinkeringBySlot(Slot); if (selectedTinkering != null) { selectedTinkeringId = selectedTinkering.Id; } } else if (IsReforgeList) { Reforging selectedReforging = Character.GetReforgingBySlot(Slot); if (selectedReforging != null) { selectedReforgingId = selectedReforging.Id; } } else if (IsGemList) { ComparisonCalculationBase emptyCalcs = Calculations.CreateNewComparisonCalculation(); emptyCalcs.Name = "Empty"; emptyCalcs.Item = new Item(); emptyCalcs.Item.Name = "Empty"; emptyCalcs.Item.Id = -1; emptyCalcs.Equipped = SelectedItem == null; itemCalculations.Add(emptyCalcs); } else { ComparisonCalculationBase emptyCalcs = Calculations.CreateNewComparisonCalculation(); emptyCalcs.Name = "Empty"; emptyCalcs.Item = new Item(); emptyCalcs.Item.Name = "Empty"; emptyCalcs.ItemInstance = new ItemInstance(); emptyCalcs.ItemInstance.Id = -1; emptyCalcs.Equipped = Character[Slot] == null; itemCalculations.Add(emptyCalcs); } foreach (ComparisonCalculationBase calc in itemCalculations) { ItemListItem itemListItem = new ItemListItem(calc, maxValue, 344d); itemListItems.Add(itemListItem); if (IsEnchantList) { if (itemListItem.EnchantId == selectedEnchantId) { selectedListItem = itemListItem; } } else if (IsTinkeringList) { if (itemListItem.TinkeringId == selectedTinkeringId) { selectedListItem = itemListItem; } } else if (IsReforgeList) { if (itemListItem.ReforgeId == selectedReforgingId) { selectedListItem = itemListItem; } } else if (IsGemList || IsHydraulicList || IsCogwheelList) { if (calc.Item == null) { if (SelectedItem == null) { selectedListItem = itemListItem; } } else { if ((SelectedItem != null && calc.Item.Id == SelectedItem.Id) || (calc.Item.Id == -1 && SelectedItem == null)) { selectedListItem = itemListItem; } } } else { if (calc.ItemInstance == Character[Slot] || (calc.ItemInstance.Id == -1 && Character[Slot] == null)) { selectedListItem = itemListItem; } } } Items.AddRange(itemListItems); listBoxItems.SelectedItem = selectedListItem; listBoxItems.Focus(); IsPopulated = true; } finally { _buildingListItems = false; } }
public static bool IsItemEligibleForTinkering(Tinkering Tinkering, Item item) { if (Instance != null) return Instance.IsItemEligibleForTinkering(Tinkering, item); return false; }
public void CheckChanges() { var context = BulkOrderSystem.GetContext(Player, false); if (context != null) { foreach (var kvp in context.Entries) { switch (kvp.Key) { case BODType.Smith: if (Smithy == null) { Smithy = new BODData(kvp.Key, kvp.Value); } else { Smithy.CheckChanges(kvp.Value); } break; case BODType.Tailor: if (Tailor == null) { Tailor = new BODData(kvp.Key, kvp.Value); } else { Tailor.CheckChanges(kvp.Value); } break; case BODType.Alchemy: if (Alchemy == null) { Alchemy = new BODData(kvp.Key, kvp.Value); } else { Alchemy.CheckChanges(kvp.Value); } break; case BODType.Inscription: if (Inscription == null) { Inscription = new BODData(kvp.Key, kvp.Value); } else { Inscription.CheckChanges(kvp.Value); } break; case BODType.Tinkering: if (Tinkering == null) { Tinkering = new BODData(kvp.Key, kvp.Value); } else { Tinkering.CheckChanges(kvp.Value); } break; case BODType.Cooking: if (Cooking == null) { Cooking = new BODData(kvp.Key, kvp.Value); } else { Cooking.CheckChanges(kvp.Value); } break; case BODType.Fletching: if (Fletching == null) { Fletching = new BODData(kvp.Key, kvp.Value); } else { Fletching.CheckChanges(kvp.Value); } break; case BODType.Carpentry: if (Carpentry == null) { Carpentry = new BODData(kvp.Key, kvp.Value); } else { Carpentry.CheckChanges(kvp.Value); } break; } } } }