/Tukui/modules/skins/inspect.lua
Lua | 138 lines | 117 code | 17 blank | 4 comment | 10 complexity | 74fd83e71c36ec3cd1110fd2c56e81d1 MD5 | raw file
1local T, C, L = unpack(select(2, ...)) 2 3local function LoadSkin() 4 InspectFrame:StripTextures(true) 5 InspectFrameInset:StripTextures(true) 6 InspectTalentFramePointsBar:StripTextures() 7 InspectFrame:CreateBackdrop("Transparent") 8 InspectFrame.backdrop:SetAllPoints() 9 T.SkinCloseButton(InspectFrameCloseButton) 10 11 for i=1, 4 do 12 T.SkinTab(_G["InspectFrameTab"..i]) 13 end 14 15 InspectModelFrameBorderTopLeft:Kill() 16 InspectModelFrameBorderTopRight:Kill() 17 InspectModelFrameBorderTop:Kill() 18 InspectModelFrameBorderLeft:Kill() 19 InspectModelFrameBorderRight:Kill() 20 InspectModelFrameBorderBottomLeft:Kill() 21 InspectModelFrameBorderBottomRight:Kill() 22 InspectModelFrameBorderBottom:Kill() 23 InspectModelFrameBorderBottom2:Kill() 24 InspectModelFrameBackgroundOverlay:Kill() 25 InspectModelFrame:CreateBackdrop("Transparent") 26 27 local slots = { 28 "HeadSlot", 29 "NeckSlot", 30 "ShoulderSlot", 31 "BackSlot", 32 "ChestSlot", 33 "ShirtSlot", 34 "TabardSlot", 35 "WristSlot", 36 "HandsSlot", 37 "WaistSlot", 38 "LegsSlot", 39 "FeetSlot", 40 "Finger0Slot", 41 "Finger1Slot", 42 "Trinket0Slot", 43 "Trinket1Slot", 44 "MainHandSlot", 45 "SecondaryHandSlot", 46 "RangedSlot", 47 } 48 for _, slot in pairs(slots) do 49 local icon = _G["Inspect"..slot.."IconTexture"] 50 local slot = _G["Inspect"..slot] 51 slot:StripTextures() 52 slot:StyleButton(false) 53 icon:SetTexCoord(.08, .92, .08, .92) 54 icon:ClearAllPoints() 55 icon:Point("TOPLEFT", 2, -2) 56 icon:Point("BOTTOMRIGHT", -2, 2) 57 58 slot:SetFrameLevel(slot:GetFrameLevel() + 2) 59 slot:CreateBackdrop("Transparent") 60 slot.backdrop:SetAllPoints() 61 end 62 63 T.SkinRotateButton(InspectModelFrameRotateLeftButton) 64 T.SkinRotateButton(InspectModelFrameRotateRightButton) 65 InspectModelFrameRotateRightButton:Point("TOPLEFT", InspectModelFrameRotateLeftButton, "TOPRIGHT", 3, 0) 66 67 InspectPVPFrameBottom:Kill() 68 InspectGuildFrameBG:Kill() 69 InspectPVPFrame:HookScript("OnShow", function() InspectPVPFrameBG:Kill() end) 70 71 for i=1, 3 do 72 _G["InspectPVPTeam"..i]:StripTextures() 73 _G["InspectTalentFrameTab"..i]:StripTextures() 74 end 75 76 InspectTalentFrame.bg = CreateFrame("Frame", nil, InspectTalentFrame) 77 InspectTalentFrame.bg:SetTemplate("Transparent") 78 InspectTalentFrame.bg:Point("TOPLEFT", InspectTalentFrameBackgroundTopLeft, "TOPLEFT", -2, 2) 79 InspectTalentFrame.bg:Point("BOTTOMRIGHT", InspectTalentFrameBackgroundBottomRight, "BOTTOMRIGHT", -20, 52) 80 InspectTalentFrame.bg:SetFrameLevel(InspectTalentFrame.bg:GetFrameLevel() - 2) 81 82 for i = 1, MAX_NUM_TALENTS do 83 local button = _G["InspectTalentFrameTalent"..i] 84 local icon = _G["InspectTalentFrameTalent"..i.."IconTexture"] 85 if button then 86 button:StripTextures() 87 button:StyleButton() 88 button:SetTemplate("Transparent") 89 button.SetHighlightTexture = T.dummy 90 button.SetPushedTexture = T.dummy 91 button:GetNormalTexture():SetTexCoord(.08, .92, .08, .92) 92 button:GetPushedTexture():SetTexCoord(.08, .92, .08, .92) 93 button:GetHighlightTexture():SetAllPoints(icon) 94 button:GetPushedTexture():SetAllPoints(icon) 95 96 if button.Rank then 97 button.Rank:SetFont(C.media.font, 12, "THINOUTLINE") 98 button.Rank:ClearAllPoints() 99 button.Rank:SetPoint("BOTTOMRIGHT") 100 end 101 102 icon:ClearAllPoints() 103 icon:Point("TOPLEFT", 2, -2) 104 icon:Point("BOTTOMRIGHT", -2, 2) 105 icon:SetTexCoord(.08, .92, .08, .92) 106 end 107 end 108 109 -- color item by rarity on inspect frame. 110 local function ColorItemBorder() 111 if(not InspectFrame:IsShown()) then return end 112 for _, slot in pairs(slots) do 113 -- Color the equipment slots by rarity 114 local target = _G["Inspect"..slot] 115 local slotId, _, _ = GetInventorySlotInfo(slot) 116 local itemId = GetInventoryItemID("target", slotId) 117 118 if itemId then 119 local _, _, rarity, _, _, _, _, _, _, _, _ = GetItemInfo(itemId) 120 if rarity then 121 target.backdrop:SetBackdropBorderColor(GetItemQualityColor(rarity)) 122 end 123 else 124 target.backdrop:SetBackdropBorderColor(unpack(C.media.bordercolor)) 125 end 126 end 127 end 128 129 -- execute item coloring everytime we open character frame 130 InspectFrame:HookScript("OnShow", ColorItemBorder) 131 132 -- execute item coloring everytime an item is changed 133 local CheckItemBorderColor = CreateFrame("Frame") 134 CheckItemBorderColor:RegisterEvent("PLAYER_TARGET_CHANGED") 135 CheckItemBorderColor:SetScript("OnEvent", ColorItemBorder) 136end 137 138T.SkinFuncs["Blizzard_InspectUI"] = LoadSkin