end |
|
oInspectPaperDollItemSlotButton_Update = InspectPaperDollItemSlotButton_Update |
InspectPaperDollItemSlotButton_Update = function(button, ...) |
oInspectPaperDollItemSlotButton_Update(button, ...) |
local unit = InspectFrame.unit |
if CheckInteractDistance(unit, 1) then |
cache[strsub(button:GetName(), 8)] = GetInventoryItemLink(unit, button:GetID()) |
InspectPaperDollItemSlotButton_Update = function(self, ...) |
oInspectPaperDollItemSlotButton_Update(self, ...) |
if CheckInteractDistance(InspectFrame.unit, 1) then |
local id = self:GetID() |
cache[id] = GetInventoryItemLink(InspectFrame.unit, id) |
end |
end |
|
InspectPaperDollItemSlotButton_OnEnter = function(self) |
self = self or this |
local name = strsub(self:GetName(), 8) |
local unit = InspectFrame.unit |
local unit, id = InspectFrame.unit, self:GetID() |
GameTooltip:SetOwner(self, "ANCHOR_RIGHT") |
if UnitExists(unit) and CheckInteractDistance(unit, 1) and GameTooltip:SetInventoryItem(unit, self:GetID()) then |
if UnitExists(unit) and CheckInteractDistance(unit, 1) and GameTooltip:SetInventoryItem(unit, id) then |
|
elseif cache[name] then -- retrieved from cache |
GameTooltip:SetHyperlink(cache[name]) |
elseif cache[id] then -- retrieved from cache |
GameTooltip:SetHyperlink(cache[id]) |
else -- empty slot |
GameTooltip:SetText((self.checkRelic and UnitHasRelicSlot(unit) and _G.RELICSLOT) or _G[strupper(name)]) |
GameTooltip:SetText((self.checkRelic and UnitHasRelicSlot(unit) and _G.RELICSLOT) or _G[strupper(strsub(self:GetName(), 8))]) |
end |
CursorUpdate(self) |
end |
|
local function onclick(self, button) |
local unit, id = InspectFrame.unit, self:GetID() |
if UnitExists(unit) and CheckInteractDistance(unit, 1) then |
HandleModifiedItemClick(GetInventoryItemLink(unit, id)) |
elseif cache[id] then -- retrieved from cache |
HandleModifiedItemClick(cache[id]) |
end |
end |
for _, frame in ipairs({ InspectPaperDollFrame:GetChildren() }) do |
if frame:GetFrameType() == "Button" and strmatch(frame:GetName(), "Inspect(.+)Slot") then |
frame:SetScript("OnClick", onclick) |
end |
end |
|
oInspectPaperDollFrame_OnShow = InspectPaperDollFrame_OnShow |
InspectPaperDollFrame_OnShow = function(...) |
if not UnitIsPlayer(InspectFrame.unit) then return end |