From 2e020e07197459cd1eea1b80c1b0ff8d7539c63e Mon Sep 17 00:00:00 2001 From: Artur Morozov Date: Mon, 4 Mar 2019 20:22:41 +0300 Subject: [PATCH] skin: restore items after tab for long distance --- skins/blizzard/inspect.lua | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/skins/blizzard/inspect.lua b/skins/blizzard/inspect.lua index 47c0d8a1..32d21c47 100644 --- a/skins/blizzard/inspect.lua +++ b/skins/blizzard/inspect.lua @@ -66,7 +66,7 @@ pfUI:RegisterSkin("InspectFrame", function () frame:SetScript("OnEnter", function() if not GetInventoryItemLink(InspectFrame.unit, this:GetID()) and this.hasItem then GameTooltip:SetOwner(this, "ANCHOR_TOPRIGHT") - GameTooltip:SetHyperlink("item:"..cache[this:GetID()]) + GameTooltip:SetHyperlink("item:"..cache[this:GetID()]["id"]) GameTooltip:Show() else funce() @@ -137,15 +137,23 @@ pfUI:RegisterSkin("InspectFrame", function () end hooksecurefunc("InspectPaperDollItemSlotButton_Update", function(button) - UpdateSlots() - QueueFunction(UpdateSlots) - local link = GetInventoryItemLink(InspectFrame.unit, button:GetID()) if link then local _,_,itemID = string.find(link, 'item:(%d+)') - cache[button:GetID()] = itemID - end - end) + cache[button:GetID()] = {} + cache[button:GetID()]["id"] = itemID + cache[button:GetID()]["tex"] = GetInventoryItemTexture(InspectFrame.unit, button:GetID()) + cache[button:GetID()]["count"] = GetInventoryItemCount(InspectFrame.unit, button:GetID()) + elseif cache[button:GetID()] then + -- restore cache information + SetItemButtonTexture(button, cache[button:GetID()]["tex"]) + SetItemButtonCount(button, cache[button:GetID()]["count"]); + button.hasItem = 1; + end + + UpdateSlots() + QueueFunction(UpdateSlots) + end, 1) end do -- Honor Tab