private void backgroundWorkerLoading_DoWork(object sender, DoWorkEventArgs e) { FormMain parent = (FormMain)this.Owner; DataTable dataTable; dataTable = sqliteDatabase.GetDataTable("SELECT * FROM characterHistory WHERE id = " + e.Argument.ToString() + ";"); DataRow row = dataTable.Rows[0]; if (Convert.ToInt32(row["duplicate_last"]) == 0) // if this history set contains data { List<ListViewItem> lvisGeneral = new List<ListViewItem>(); List<ListViewItem> lvisItems = new List<ListViewItem>(); List<ListViewItem> lvisEnchants = new List<ListViewItem>(); List<ListViewItem> lvisGems = new List<ListViewItem>(); List<ListViewItem> lvisReforge = new List<ListViewItem>(); List<ListViewItem> lvisGlyphs = new List<ListViewItem>(); List<ListViewItem> lvisTests = new List<ListViewItem>(); List<ListViewItem> lvisTalents = new List<ListViewItem>(); Dictionary<int, int> gemQualities = new Dictionary<int, int>(); Character character = (Character)parentForm.UnserializeObject(row["serializedCharacter"].ToString(), typeof(Character)); if (character != null) { #region General and Stats int currentGroupIndex = 0; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Updated on", Value = row["date"].ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Level", Value = character.Level.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Class", Value = ReformatString(character.Class.ToString()), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); foreach (CharacterTalent talents in character.Talents) { if (talents.Selected) { lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Selected Spec", Value = talents.Spec.Name + " (" + talents.Spec.Role + ")", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); } else { lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Available Spec", Value = talents.Spec.Name + " (" + talents.Spec.Role + ")", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); } } lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Guild", Value = character.Guild.Name + " (Level " + character.Guild.Level + ", " + character.Guild.Members + " Members)", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 1; foreach (CharacterProfession currentProfession in character.Professions.Primary) { lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Primary", Value = currentProfession.Name + " (" + currentProfession.Rank.ToString() + ")", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); } foreach (CharacterProfession currentProfession in character.Professions.Secondary) { lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Secondary", Value = currentProfession.Name + " (" + currentProfession.Rank.ToString() + ")", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); } currentGroupIndex = 2; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Health", Value = (character.Stats.Health / 1000).ToString() + "k", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Power", Value = (character.Stats.Power < 1000) ? character.Stats.Power.ToString() : (character.Stats.Power / 1000).ToString() + "k", Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Power Type", Value = ReformatString(character.Stats.PowerType.ToString()), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 3; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Strength", Value = character.Stats.Str.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Agility", Value = character.Stats.Agi.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Stamina", Value = character.Stats.Sta.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Intellect", Value = character.Stats.Int.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spirit", Value = character.Stats.Spr.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Mastery", Value = character.Stats.Mastery.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Mastery Rating", Value = character.Stats.MasteryRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 4; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Main Hand DPS", Value = character.Stats.MainHandDps.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Off Hand DPS", Value = character.Stats.OffHandDps.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Main Hand Damage Max", Value = character.Stats.MainHandDmgMax.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Off Hand Damage Max", Value = character.Stats.OffHandDmgMax.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Main Hand Damage Min", Value = character.Stats.MainHandDmgMin.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Off Hand Damage Min", Value = character.Stats.OffHandDmgMin.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Main Hand Expertise", Value = character.Stats.MainHandExpertise.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Off Hand Expertise", Value = character.Stats.OffHandExpertise.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Main Hand Speed", Value = character.Stats.MainHandSpeed.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Off Hand Speed", Value = character.Stats.OffHandSpeed.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Attack Power", Value = character.Stats.AttackPower.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Haste Rating", Value = character.Stats.HasteRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Hit Percent", Value = character.Stats.HitPercent.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Hit Rating", Value = character.Stats.HitRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Crit Percent", Value = character.Stats.Crit.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Crit Rating", Value = character.Stats.CritRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Expertise Rating", Value = character.Stats.ExpertiseRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 5; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged DPS", Value = character.Stats.RangedDps.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Damage Max", Value = character.Stats.RangedDmgMax.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Damage Min", Value = character.Stats.RangedDmgMin.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Speed", Value = character.Stats.RangedSpeed.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Attack Power", Value = character.Stats.RangedAttackPower.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Hit Percent", Value = character.Stats.RangedHitPercent.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Hit Rating", Value = character.Stats.RangedHitRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Crit Percent", Value = character.Stats.RangedCrit.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Ranged Crit Rating", Value = character.Stats.RangedCritRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 6; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spell Power", Value = character.Stats.SpellPower.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spell Hit Percent", Value = character.Stats.SpellHitPercent.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spell Hit Rating", Value = character.Stats.SpellHitRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spell Crit Percent", Value = character.Stats.SpellCrit.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Spell Crit Rating", Value = character.Stats.SpellCritRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Mana Regen", Value = character.Stats.Mana5.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Combat Mana Regen", Value = character.Stats.Mana5Combat.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 7; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Armor", Value = character.Stats.Armor.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Dodge Percent", Value = character.Stats.Dodge.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Dodge Rating", Value = character.Stats.DodgeRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Parry Percent", Value = character.Stats.Parry.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Parry Rating", Value = character.Stats.ParryRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Block Percent", Value = character.Stats.Block.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "Block Rating", Value = character.Stats.BlockRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); currentGroupIndex = 8; lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "PVP Resilience", Value = character.Stats.PvpResilience.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "PVP Resilience Rating", Value = character.Stats.PvpResilienceRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "PVP Power", Value = character.Stats.PvpPower.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); lvisGeneral.Add(new SetListViewItem(new SetDataSimple() { Title = "PVP Power Rating", Value = character.Stats.PvpPowerRating.ToString(), Group = listViewDetailsGeneral.Groups[currentGroupIndex] })); #endregion #region Items lvisItems.Add(new SetListViewItem(new SetDataSimple() { Title = "Average Itemlevel", Value = character.Items.AverageItemLevel.ToString(), Group = listViewDetailsItems.Groups[0] })); lvisItems.Add(new SetListViewItem(new SetDataSimple() { Title = "Average Equipped Itemlevel", Value = character.Items.AverageItemLevelEquipped.ToString(), Group = listViewDetailsItems.Groups[0] })); CharacterEquipment thisEquipment = character.Items; PropertyInfo[] equipmentProperties = thisEquipment.GetType().GetProperties(); foreach (PropertyInfo property in equipmentProperties) { if (property.GetValue(thisEquipment, null) != null && property.GetValue(thisEquipment, null).GetType() == typeof(CharacterItem)) { CharacterItem currentItem = (CharacterItem)property.GetValue(thisEquipment, null); lvisItems.Add(new SetListViewItem(new SetDataDirect() { Title = property.Name, subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentItem.Name, ForeColor = parent.ItemQualityColorTranslation[currentItem.Quality], Font = new Font(this.Font, FontStyle.Bold) }, new SetDataDirectInfo() { Text = currentItem.Id.ToString() }, }, Group = listViewDetailsItems.Groups[1] })); } } #endregion #region Enchants foreach (PropertyInfo property in equipmentProperties) { if (property.GetValue(thisEquipment, null) != null && property.GetValue(thisEquipment, null).GetType() == typeof(CharacterItem)) { CharacterItem currentItem = (CharacterItem)property.GetValue(thisEquipment, null); if (currentItem.TooltipParams.Enchant != 0) { lvisEnchants.Add(new SetListViewItem(new SetDataSimple() { Title = property.Name, Value = currentItem.TooltipParams.Enchant.ToString(), SecondValue = parentForm.GetItemOrSpellName(getEnchantTranslation(currentItem.TooltipParams.Enchant).Value, getEnchantTranslation(currentItem.TooltipParams.Enchant).Key), Group = listViewDetailsItems.Groups[1] })); } } } #endregion #region Gems Dictionary<string, int> slotGroupTranslation = new Dictionary<string, int>() { {"Back", 18}, {"Chest", 3}, {"Feet", 9}, {"Finger1", 10}, {"Finger2", 11}, {"Hands", 6}, {"Head", 17}, {"Legs", 8}, {"MainHand", 14}, {"Neck", 2}, {"OffHand", 15}, {"Ranged", 16}, {"Shirt", 4}, {"Shoulder", 1}, {"Trinket1", 12}, {"Trinket2", 13}, {"Waist", 7}, {"Wrist", 5}, }; foreach (PropertyInfo property in equipmentProperties) { if (property.GetValue(thisEquipment, null) != null && property.GetValue(thisEquipment, null).GetType() == typeof(CharacterItem)) { CharacterItem currentItem = (CharacterItem)property.GetValue(thisEquipment, null); if (currentItem.TooltipParams.Gem0 != 0) { lvisGems.Add(new SetListViewItem(new SetDataDirect() { Title = "Gem 1", subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentItem.TooltipParams.Gem0.ToString() }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem0).GemInfo.Bonus.Name }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem0).Name, ForeColor = parent.ItemQualityColorTranslation[parent.GetItem(currentItem.TooltipParams.Gem0).Quality], Font = new Font(this.Font, FontStyle.Bold) }, }, Group = listViewDetailsGems.Groups[slotGroupTranslation[property.Name]] })); IncrementGemStatisticsCounter(ref gemQualities, parent.GetItem(currentItem.TooltipParams.Gem0).Quality); } if (currentItem.TooltipParams.Gem1 != 0) { lvisGems.Add(new SetListViewItem(new SetDataDirect() { Title = "Gem 2", subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentItem.TooltipParams.Gem0.ToString() }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem1).GemInfo.Bonus.Name }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem1).Name, ForeColor = parent.ItemQualityColorTranslation[parent.GetItem(currentItem.TooltipParams.Gem1).Quality], Font = new Font(this.Font, FontStyle.Bold) }, }, Group = listViewDetailsGems.Groups[slotGroupTranslation[property.Name]] })); IncrementGemStatisticsCounter(ref gemQualities, parent.GetItem(currentItem.TooltipParams.Gem1).Quality); } if (currentItem.TooltipParams.Gem2 != 0) { lvisGems.Add(new SetListViewItem(new SetDataDirect() { Title = "Gem 3", subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentItem.TooltipParams.Gem0.ToString() }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem2).GemInfo.Bonus.Name }, new SetDataDirectInfo() { Text = parent.GetItem(currentItem.TooltipParams.Gem2).Name, ForeColor = parent.ItemQualityColorTranslation[parent.GetItem(currentItem.TooltipParams.Gem2).Quality], Font = new Font(this.Font, FontStyle.Bold) }, }, Group = listViewDetailsGems.Groups[slotGroupTranslation[property.Name]] })); IncrementGemStatisticsCounter(ref gemQualities, parent.GetItem(currentItem.TooltipParams.Gem2).Quality); } } } #endregion #region Reforge Dictionary<int, int> reforgeSummary = new Dictionary<int, int>(); foreach (PropertyInfo property in equipmentProperties) { if (property.GetValue(thisEquipment, null) != null && property.GetValue(thisEquipment, null).GetType() == typeof(CharacterItem)) { CharacterItem currentItem = (CharacterItem)property.GetValue(thisEquipment, null); if (currentItem.TooltipParams.Reforge != 0) { lvisReforge.Add(new SetListViewItem(new SetDataSimple() { Title = property.Name, Value = currentItem.TooltipParams.Reforge.ToString(), SecondValue = getReforgeTranslation(currentItem.TooltipParams.Reforge), Group = listViewDetailsReforge.Groups[0] })); if (reforgeSummary.ContainsKey(currentItem.TooltipParams.Reforge)) { reforgeSummary[currentItem.TooltipParams.Reforge]++; } else { reforgeSummary.Add(currentItem.TooltipParams.Reforge, 1); } } } } foreach (KeyValuePair<int, int> kvp in reforgeSummary) { lvisReforge.Add(new SetListViewItem(new SetDataSimple() { Title = getReforgeTranslation(kvp.Key), Value = kvp.Value.ToString(), Group = listViewDetailsReforge.Groups[1] })); } #endregion; #region Glyphs int specCounter = 0; foreach (CharacterTalent currentTalentSpec in character.Talents) { CharacterTalentGlyphs currentGlyphs = currentTalentSpec.Glyphs; foreach (CharacterTalentGlyph currentMajorGlyph in currentGlyphs.Major) { lvisGlyphs.Add(new SetListViewItem(new SetDataSimple() { Title = "Major", Value = currentMajorGlyph.Item.ToString(), SecondValue = currentMajorGlyph.Name, Group = listViewDetailsGlyphs.Groups[specCounter] })); } foreach (CharacterTalentGlyph currentMinorGlyph in currentGlyphs.Minor) { lvisGlyphs.Add(new SetListViewItem(new SetDataSimple() { Title = "Minor", Value = currentMinorGlyph.Item.ToString(), SecondValue = currentMinorGlyph.Name, Group = listViewDetailsGlyphs.Groups[specCounter] })); } specCounter++; } #endregion; #region Talents foreach (CharacterTalentInfo currentTalent in character.Talents.ToArray()[0].Talents) { lvisTalents.Add(new SetListViewItem(new SetDataDirect() { Title = character.Talents.ToArray()[0].Spec.Name, subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentTalent.Tier.ToString() }, new SetDataDirectInfo() { Text = currentTalent.Spell.Name }, new SetDataDirectInfo() { Text = currentTalent.Spell.Description }, }, Group = listViewDetailsTalents.Groups[0] })); } foreach (CharacterTalentInfo currentTalent in character.Talents.ToArray()[1].Talents) { lvisTalents.Add(new SetListViewItem(new SetDataDirect() { Title = character.Talents.ToArray()[1].Spec.Name, subItemsInfo = new List<SetDataDirectInfo>() { new SetDataDirectInfo() { Text = currentTalent.Tier.ToString() }, new SetDataDirectInfo() { Text = currentTalent.Spell.Name }, new SetDataDirectInfo() { Text = currentTalent.Spell.Description }, }, Group = listViewDetailsTalents.Groups[1] })); } #endregion #region Tests Tests tests = new Tests(ref listViewDetailsTests); // Hit Caps if (!Warcraft.IsHealer(character)) { if (Warcraft.NeedsMeleeHit(character.Class.ToString())) { lvisTests.Add(tests.InRange(7.5, Convert.ToDouble(character.Stats.HitPercent), 1, "Melee Hit Cap", false, 0)); lvisTests.Add(tests.InRange(7.5, Convert.ToDouble(character.Stats.MainHandDmgMax), 1, "Expertise Cap", false, 0)); } if (Warcraft.NeedsSpellHit(character.Class.ToString())) { lvisTests.Add(tests.InRange(17, Convert.ToDouble(character.Stats.HitPercent), 2, "Spell Hit Cap", false, 0)); } } else { lvisTests.Add(tests.AreEqual(Convert.ToDouble(0), Convert.ToDouble(character.Stats.HitPercent), "No Hit", false, 0)); } // Gems lvisTests.Add(tests.AreEqual(1, gemQualities.ContainsKey(3) ? gemQualities[3] : 0, "Only 1 Rare Gem (Meta)", false, 1)); lvisTests.Add(tests.AreEqual(0, gemQualities.ContainsKey(2) ? gemQualities[2] : 0, "Uncommon (Green) Gems", true, 1)); lvisTests.Add(tests.AreEqual(0, gemQualities.ContainsKey(1) ? gemQualities[1] : 0, "Common (White) Gems", true, 1)); // Sockets foreach (PropertyInfo property in equipmentProperties) { if (property.GetValue(thisEquipment, null) != null && property.GetValue(thisEquipment, null).GetType() == typeof(CharacterItem)) { CharacterItem currentItem = (CharacterItem)property.GetValue(thisEquipment, null); lvisTests.Add(tests.AreEqual(true, parent.ItemAllSocketsFilled(currentItem), property.Name + ": No empty socket", false, 5)); } } // Glyphs specCounter = 0; foreach (CharacterTalent currentTalent in character.Talents) { lvisTests.Add(tests.AreEqual(3, currentTalent.Glyphs.Major.Count(), "Spec " + specCounter.ToString() + " Major Glyphs", true, 3)); lvisTests.Add(tests.AreEqual(3, currentTalent.Glyphs.Minor.Count(), "Spec " + specCounter.ToString() + " Minor Glyphs", false, 3)); specCounter++; } // Enchants if (character.Items.Back.Id != 0) { lvisTests.Add(tests.AreEqual(true, (character.Items.Back.TooltipParams.Enchant != 0), "Back enchanted", false, 4)); } if (character.Items.Chest != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Chest.TooltipParams.Enchant != 0), "Chest enchanted", false, 4)); } if (character.Items.Feet != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Feet.TooltipParams.Enchant != 0), "Feet enchanted", false, 4)); } if (parent.ProfessionHasEnchanting(character)) { if (character.Items.Finger1 != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Finger1.TooltipParams.Enchant != 0), "Finger 1 enchanted", true, 4)); } if (character.Items.Finger2 != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Finger2.TooltipParams.Enchant != 0), "Finger 2 enchanted", true, 4)); } } if (character.Items.Hands != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Hands.TooltipParams.Enchant != 0), "Hands enchanted", false, 4)); } if (character.Items.Head != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Head.TooltipParams.Enchant != 0), "Head enchanted", false, 4)); } if (character.Items.Legs != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Legs.TooltipParams.Enchant != 0), "Legs enchanted", false, 4)); } if (character.Items.MainHand != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.MainHand.TooltipParams.Enchant != 0), "Main Hand enchanted", false, 4)); } if (character.Items.OffHand != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.OffHand.TooltipParams.Enchant != 0), "Off Hand enchanted", false, 4)); } if (character.Items.Shoulder != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Shoulder.TooltipParams.Enchant != 0), "Shoulder enchanted", false, 4)); } if (character.Items.Wrist != null) { lvisTests.Add(tests.AreEqual(true, (character.Items.Wrist.TooltipParams.Enchant != 0), "Wrist enchanted", false, 4)); } // Professions lvisTests.Add(tests.AreEqual(2, character.Professions.Primary.Count(), "Primary Professions Count", true, 6)); if (character.Professions.Primary.ToArray()[0] != null) { lvisTests.Add(tests.EqualOrGreater(525, character.Professions.Primary.ToArray()[0].Rank, "Primary Profession 1 Cataclysm", false, 6)); if (character.Level >= 90) { lvisTests.Add(tests.EqualOrGreater(600, character.Professions.Primary.ToArray()[0].Rank, "Primary Profession 1 Pandaria", false, 6)); } } if (character.Professions.Primary.ToArray()[1] != null) { lvisTests.Add(tests.EqualOrGreater(525, character.Professions.Primary.ToArray()[1].Rank, "Primary Profession 2 Cataclysm", false, 6)); if (character.Level >= 90) { lvisTests.Add(tests.EqualOrGreater(600, character.Professions.Primary.ToArray()[1].Rank, "Primary Profession 2 Pandaria", false, 6)); } } if (Warcraft.NeedsInt(character)) { lvisTests.Add(tests.LessOrEqual(80, character.Stats.Str, "No strength", true, 7)); } else { lvisTests.Add(tests.LessOrEqual(80, character.Stats.Int, "No intellect", true, 7)); } #endregion Dictionary<string, List<ListViewItem>> resultLists = new Dictionary<string, List<ListViewItem>>(); resultLists.Add("general", lvisGeneral); resultLists.Add("items", lvisItems); resultLists.Add("enchants", lvisEnchants); resultLists.Add("reforge", lvisReforge); resultLists.Add("gems", lvisGems); resultLists.Add("glyphs", lvisGlyphs); resultLists.Add("talents", lvisTalents); resultLists.Add("tests", lvisTests); e.Result = resultLists; } else { if (MessageBox.Show("Unable to display the selected history set because it contains invalid character data. Would you like to delete this set?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.Yes) { parentForm.HistoryDeleteSet(Convert.ToInt32(e.Argument)); } } } }