public uint GetArmor(uint itemLevel) { ItemQuality quality = GetQuality() != ItemQuality.Heirloom ? GetQuality() : ItemQuality.Rare; if (quality > ItemQuality.Artifact) { return(0); } // all items but shields if (GetClass() != ItemClass.Armor || GetSubClass() != (uint)ItemSubClassArmor.Shield) { ItemArmorQualityRecord armorQuality = CliDB.ItemArmorQualityStorage.LookupByKey(itemLevel); ItemArmorTotalRecord armorTotal = CliDB.ItemArmorTotalStorage.LookupByKey(itemLevel); if (armorQuality == null || armorTotal == null) { return(0); } InventoryType inventoryType = GetInventoryType(); if (inventoryType == InventoryType.Robe) { inventoryType = InventoryType.Chest; } ArmorLocationRecord location = CliDB.ArmorLocationStorage.LookupByKey(inventoryType); if (location == null) { return(0); } if (GetSubClass() < (uint)ItemSubClassArmor.Cloth || GetSubClass() > (uint)ItemSubClassArmor.Plate) { return(0); } return((uint)(armorQuality.QualityMod[(int)quality] * armorTotal.Value[GetSubClass() - 1] * location.Modifier[GetSubClass() - 1] + 0.5f)); } // shields ItemArmorShieldRecord shield = CliDB.ItemArmorShieldStorage.LookupByKey(itemLevel); if (shield == null) { return(0); } return((uint)(shield.Quality[(int)quality] + 0.5f)); }
public uint GetArmor(uint itemLevel) { ItemQuality quality = GetQuality() != ItemQuality.Heirloom ? GetQuality() : ItemQuality.Rare; if (quality > ItemQuality.Artifact) { return(0); } // all items but shields if (GetClass() != ItemClass.Armor || GetSubClass() != (uint)ItemSubClassArmor.Shield) { ItemArmorQualityRecord armorQuality = CliDB.ItemArmorQualityStorage.LookupByKey(itemLevel); ItemArmorTotalRecord armorTotal = CliDB.ItemArmorTotalStorage.LookupByKey(itemLevel); if (armorQuality == null || armorTotal == null) { return(0); } InventoryType inventoryType = GetInventoryType(); if (inventoryType == InventoryType.Robe) { inventoryType = InventoryType.Chest; } ArmorLocationRecord location = CliDB.ArmorLocationStorage.LookupByKey(inventoryType); if (location == null) { return(0); } if (GetSubClass() < (uint)ItemSubClassArmor.Cloth || GetSubClass() > (uint)ItemSubClassArmor.Plate) { return(0); } float total = 1.0f; float locationModifier = 1.0f; switch ((ItemSubClassArmor)GetSubClass()) { case ItemSubClassArmor.Cloth: total = armorTotal.Cloth; locationModifier = location.Clothmodifier; break; case ItemSubClassArmor.Leather: total = armorTotal.Leather; locationModifier = location.Leathermodifier; break; case ItemSubClassArmor.Mail: total = armorTotal.Mail; locationModifier = location.Chainmodifier; break; case ItemSubClassArmor.Plate: total = armorTotal.Plate; locationModifier = location.Platemodifier; break; default: break; } return((uint)(armorQuality.QualityMod[(int)quality] * total * locationModifier + 0.5f)); } // shields ItemArmorShieldRecord shield = CliDB.ItemArmorShieldStorage.LookupByKey(itemLevel); if (shield == null) { return(0); } return((uint)(shield.Quality[(int)quality] + 0.5f)); }