From 9f161c9388a1469b18ee7b46e92c85f1cb67f004 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Wed, 19 Oct 2016 20:19:15 +0300 Subject: [PATCH 1/2] Replacing tooltip scanning in armory with shiny new api from 7.1 --- .../Armory/CharacterArmory/CharacterArmory.lua | 9 +++------ ElvUI_SLE/modules/Armory/Constants.lua | 2 -- .../modules/Armory/InspectArmory/InspectArmory.lua | 10 +++------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua index d4f0511..2f463a7 100644 --- a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua +++ b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua @@ -668,17 +668,14 @@ function CA:Update_Gear() end end - _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(ItemLink) + _, _, ItemRarity, _, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(ItemLink) + TrueItemLevel, _, BasicItemLevel = GetDetailedItemLevelInfo(ItemLink) R, G, B = T.GetItemQualityColor(ItemRarity) --<< Enchant Parts >>-- for i = 1, self.ScanTT:NumLines() do CurrentLineText = _G["Knight_CharacterArmory_ScanTTTextLeft"..i]:GetText() - if CurrentLineText:find(Info.Armory_Constants.ItemLevelKey_Alt) then - TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) - elseif CurrentLineText:find(Info.Armory_Constants.ItemLevelKey) then - TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) - elseif CurrentLineText:find(Info.Armory_Constants.EnchantKey) then + if CurrentLineText:find(Info.Armory_Constants.EnchantKey) then if E.db.sle.Armory.Character.Enchant.Display ~= 'Hide' then CurrentLineText = CurrentLineText:match(Info.Armory_Constants.EnchantKey) -- Get enchant string CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_AGILITY_SHORT, AGI) diff --git a/ElvUI_SLE/modules/Armory/Constants.lua b/ElvUI_SLE/modules/Armory/Constants.lua index bad80f8..a696850 100644 --- a/ElvUI_SLE/modules/Armory/Constants.lua +++ b/ElvUI_SLE/modules/Armory/Constants.lua @@ -5,8 +5,6 @@ local KF, Info, Timer = unpack(ElvUI_KnightFrame) local gsub = gsub Info.Armory_Constants = { - ItemLevelKey = ITEM_LEVEL:gsub('%%d', '(.+)'), - ItemLevelKey_Alt = ITEM_LEVEL_ALT:gsub('%%d', '.+'):gsub('%(.+%)', '%%((.+)%%)'), EnchantKey = ENCHANTED_TOOLTIP_LINE:gsub('%%s', '(.+)'), ItemSetBonusKey = ITEM_SET_BONUS:gsub('%%s', '(.+)'), --TransmogrifiedKey = TRANSMOGRIFIED:gsub('%%s', '(.+)'), diff --git a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua index e4c296a..4e109a0 100644 --- a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua +++ b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua @@ -1833,7 +1833,8 @@ function IA:InspectFrame_DataSetting(DataTable) end end - _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(Slot.Link) + _, _, ItemRarity, _, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(Slot.Link) + TrueItemLevel, _, BasicItemLevel = GetDetailedItemLevelInfo(Slot.Link) R, G, B = T.GetItemQualityColor(ItemRarity) ItemUpgradeID = Slot.Link:match(":(%d+)\124h%[") @@ -1841,12 +1842,7 @@ function IA:InspectFrame_DataSetting(DataTable) --<< Enchant Parts >>-- for i = 1, self.ScanTT:NumLines() do CurrentLineText = _G["InspectArmoryScanTTTextLeft"..i]:GetText() - - if CurrentLineText:find(Info.Armory_Constants.ItemLevelKey_Alt) then - TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) - elseif CurrentLineText:find(Info.Armory_Constants.ItemLevelKey) then - TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) - elseif CurrentLineText:find(Info.Armory_Constants.EnchantKey) then + if CurrentLineText:find(Info.Armory_Constants.EnchantKey) then if E.db.sle.Armory.Inspect.Enchant.Display ~= 'Hide' then CurrentLineText = CurrentLineText:match(Info.Armory_Constants.EnchantKey) -- Get enchant string CurrentLineText = gsub(CurrentLineText, ITEM_MOD_AGILITY_SHORT, AGI) -- 1.7.9.5 From 03f9619db5ecb1013e8b402cee9e27c3953a35d4 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Wed, 19 Oct 2016 20:21:22 +0300 Subject: [PATCH 2/2] Cache the thing --- ElvUI_SLE/core/toolkit.lua | 1 + .../Armory/CharacterArmory/CharacterArmory.lua | 3 ++- .../modules/Armory/InspectArmory/InspectArmory.lua | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua index 2049617..c6cd949 100644 --- a/ElvUI_SLE/core/toolkit.lua +++ b/ElvUI_SLE/core/toolkit.lua @@ -68,6 +68,7 @@ T.GetInventorySlotInfo = GetInventorySlotInfo T.GetInventoryItemDurability = GetInventoryItemDurability T.GetInventoryItemQuality = GetInventoryItemQuality T.GetItemInfo = GetItemInfo +T.GetDetailedItemLevelInfo = GetDetailedItemLevelInfo T.GetBuybackItemLink = GetBuybackItemLink T.GetItemIcon = GetItemIcon T.GetItemCooldown = GetItemCooldown diff --git a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua index 2f463a7..cfdce20 100644 --- a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua +++ b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua @@ -545,6 +545,7 @@ function CA:Update_Gear() for _, SlotName in T.pairs(T.type(self.GearUpdated) == 'table' and self.GearUpdated or Info.Armory_Constants.GearList) do Slot = self[SlotName] ItemLink = T.GetInventoryItemLink('player', Slot.ID) + -- if ItemLink then local DaName = GetItemInfo(ItemLink); print(DaName, GetDetailedItemLevelInfo(ItemLink)) end ErrorDetected = nil if not (SlotName == 'ShirtSlot' or SlotName == 'TabardSlot') then @@ -669,7 +670,7 @@ function CA:Update_Gear() end _, _, ItemRarity, _, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(ItemLink) - TrueItemLevel, _, BasicItemLevel = GetDetailedItemLevelInfo(ItemLink) + TrueItemLevel, _, BasicItemLevel = T.GetDetailedItemLevelInfo(ItemLink) R, G, B = T.GetItemQualityColor(ItemRarity) --<< Enchant Parts >>-- diff --git a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua index 4e109a0..6bf687f 100644 --- a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua +++ b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua @@ -1834,7 +1834,7 @@ function IA:InspectFrame_DataSetting(DataTable) end _, _, ItemRarity, _, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(Slot.Link) - TrueItemLevel, _, BasicItemLevel = GetDetailedItemLevelInfo(Slot.Link) + TrueItemLevel, _, BasicItemLevel = T.GetDetailedItemLevelInfo(Slot.Link) R, G, B = T.GetItemQualityColor(ItemRarity) ItemUpgradeID = Slot.Link:match(":(%d+)\124h%[") -- 1.7.9.5