PHP код:
do
local f = CreateFrame("button",nil,nil,"UIPanelButtonTemplate")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent",function(_,_,_)
if _ == "Blizzard_InspectUI" then
for _,v in ipairs{"Head", "Neck", "Shoulder", "Back", "Chest", "Tabard",
"Wrist", "Hands", "Waist", "Legs", "Feet", "Finger0", "Finger1",
"Trinket0", "Trinket1", "MainHand", "SecondaryHand", "Ranged"} do
_G[ "Inspect" .. v .. "Slot" ]:SetScript("OnClick", function(self)
local l = GetInventoryItemLink( InspectFrame.unit, self:GetID() )
if IsModifiedClick("CHATLINK") then ChatEdit_InsertLink(l)
elseif IsModifiedClick("DRESSUP") then DressUpItemLink(l)
else
l = GetInventoryItemID( InspectFrame.unit, self:GetID() )
if l then print( (select(2, GetItemInfo(l))) ) end
end
end)
end
local x,z,t
t=function(a)
if a then x = true f:GetNormalTexture():SetVertexColor(1,0,0)
else x = false f:GetNormalTexture():SetVertexColor(0,0,0)
end z=true InspectPaperDollFrame_OnShow() z=false
end
hooksecurefunc("InspectPaperDollItemSlotButton_Update",function(b)
if x then
local u = InspectFrame.unit
local l,_ = GetInventoryItemLink(u, b:GetID())
if l then
_,_,_,_,_,_,_,_,_,l = GetItemInfo(l)
if l then
SetItemButtonTexture(b, l);
SetItemButtonCount(b, GetInventoryItemCount(u, b:GetID()));
b.hasItem = 1;
else
l = b.backgroundTextureName
if b.checkRelic and UnitHasRelicSlot(u) then
l = "Interface\\Paperdoll\\UI-PaperDoll-Slot-Relic.blp";
end
SetItemButtonTexture(b, l);
SetItemButtonCount(b, 0);
b.hasItem = nil;
end
end
end
end)
f:SetParent(InspectPaperDollFrame)
f:SetPoint("TOPRIGHT", InspectPaperDollFrame, "TOPRIGHT",-75,-20)
f:SetSize(60,26) f:SetScale(.75) f:SetText("HTrans") f:GetNormalTexture():SetVertexColor( 0, 0, 0)
f:SetScript("OnClick", function() t( not x ) end)
hooksecurefunc( "InspectPaperDollFrame_OnShow", function() if not z then t() end end)
hooksecurefunc( InspectPaperDollFrame,"Show", function() t() end)
end
end)
end