From e868c50b601bae4fcc0cf871d7cd100d43c467d5 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 21 Feb 2018 12:58:44 -0600 Subject: [PATCH] update ItemPrice --- ElvUI/Modules/Tooltip/ItemPrice.lua | 45 ++++++++++++----------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/ElvUI/Modules/Tooltip/ItemPrice.lua b/ElvUI/Modules/Tooltip/ItemPrice.lua index d5fbe20..7b9cca1 100644 --- a/ElvUI/Modules/Tooltip/ItemPrice.lua +++ b/ElvUI/Modules/Tooltip/ItemPrice.lua @@ -29,27 +29,21 @@ local tooltips = { } function IP:SetAction(tt, id) - local item - for i = 1, tt:NumLines() do - if i == 1 then - local tiptext = _G["GameTooltipTextLeft"..i] - local linetext = tiptext:GetText() + local itemName = GameTooltipTextLeft1:GetText() + if not itemName then return end - item = linetext + local item = GetItemInfoByName(itemName) + if item then + local count = 1 + if IsConsumableAction(id) then + local actionCount = GetActionCount(id) + if actionCount and actionCount == GetItemCount(item) then + count = actionCount + end end + + self:SetPrice(tt, count, item) end - - if not item then return end - - local count = 1 - if IsConsumableAction(id) then - local actionCount = GetActionCount(id) - if actionCount and actionCount == GetItemCount(item) then - count = actionCount - end - end - - self:SetPrice(tt, count, item) end function IP:SetAuctionItem(tt, type, index) @@ -157,15 +151,14 @@ end function IP:SetPrice(tt, count) if MerchantFrame:IsShown() then return end - local bag, slot = this:GetParent():GetID(), this:GetID() - local itemLink = GetContainerItemLink(bag, slot) - local item, itemID - if itemLink then - itemID = match(itemLink, "item:(%d+)") - item = GetItemInfo(itemID) - end + local itemName = GameTooltipTextLeft1:GetText() + if not itemName then return end - if not item then return end + local _, itemString = GetItemInfoByName(itemName) + if not itemString then return end + + local itemID = match(itemString, "item:(%d+)") + if not itemID then return end local price = LIP:GetSellValue(itemID)