/Tukui/modules/skins/inspect.lua
Lua | 138 lines | 117 code | 17 blank | 4 comment | 10 complexity | 74fd83e71c36ec3cd1110fd2c56e81d1 MD5 | raw file
- local T, C, L = unpack(select(2, ...))
- local function LoadSkin()
- InspectFrame:StripTextures(true)
- InspectFrameInset:StripTextures(true)
- InspectTalentFramePointsBar:StripTextures()
- InspectFrame:CreateBackdrop("Transparent")
- InspectFrame.backdrop:SetAllPoints()
- T.SkinCloseButton(InspectFrameCloseButton)
-
- for i=1, 4 do
- T.SkinTab(_G["InspectFrameTab"..i])
- end
-
- InspectModelFrameBorderTopLeft:Kill()
- InspectModelFrameBorderTopRight:Kill()
- InspectModelFrameBorderTop:Kill()
- InspectModelFrameBorderLeft:Kill()
- InspectModelFrameBorderRight:Kill()
- InspectModelFrameBorderBottomLeft:Kill()
- InspectModelFrameBorderBottomRight:Kill()
- InspectModelFrameBorderBottom:Kill()
- InspectModelFrameBorderBottom2:Kill()
- InspectModelFrameBackgroundOverlay:Kill()
- InspectModelFrame:CreateBackdrop("Transparent")
-
- local slots = {
- "HeadSlot",
- "NeckSlot",
- "ShoulderSlot",
- "BackSlot",
- "ChestSlot",
- "ShirtSlot",
- "TabardSlot",
- "WristSlot",
- "HandsSlot",
- "WaistSlot",
- "LegsSlot",
- "FeetSlot",
- "Finger0Slot",
- "Finger1Slot",
- "Trinket0Slot",
- "Trinket1Slot",
- "MainHandSlot",
- "SecondaryHandSlot",
- "RangedSlot",
- }
- for _, slot in pairs(slots) do
- local icon = _G["Inspect"..slot.."IconTexture"]
- local slot = _G["Inspect"..slot]
- slot:StripTextures()
- slot:StyleButton(false)
- icon:SetTexCoord(.08, .92, .08, .92)
- icon:ClearAllPoints()
- icon:Point("TOPLEFT", 2, -2)
- icon:Point("BOTTOMRIGHT", -2, 2)
-
- slot:SetFrameLevel(slot:GetFrameLevel() + 2)
- slot:CreateBackdrop("Transparent")
- slot.backdrop:SetAllPoints()
- end
-
- T.SkinRotateButton(InspectModelFrameRotateLeftButton)
- T.SkinRotateButton(InspectModelFrameRotateRightButton)
- InspectModelFrameRotateRightButton:Point("TOPLEFT", InspectModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
-
- InspectPVPFrameBottom:Kill()
- InspectGuildFrameBG:Kill()
- InspectPVPFrame:HookScript("OnShow", function() InspectPVPFrameBG:Kill() end)
-
- for i=1, 3 do
- _G["InspectPVPTeam"..i]:StripTextures()
- _G["InspectTalentFrameTab"..i]:StripTextures()
- end
-
- InspectTalentFrame.bg = CreateFrame("Frame", nil, InspectTalentFrame)
- InspectTalentFrame.bg:SetTemplate("Transparent")
- InspectTalentFrame.bg:Point("TOPLEFT", InspectTalentFrameBackgroundTopLeft, "TOPLEFT", -2, 2)
- InspectTalentFrame.bg:Point("BOTTOMRIGHT", InspectTalentFrameBackgroundBottomRight, "BOTTOMRIGHT", -20, 52)
- InspectTalentFrame.bg:SetFrameLevel(InspectTalentFrame.bg:GetFrameLevel() - 2)
-
- for i = 1, MAX_NUM_TALENTS do
- local button = _G["InspectTalentFrameTalent"..i]
- local icon = _G["InspectTalentFrameTalent"..i.."IconTexture"]
- if button then
- button:StripTextures()
- button:StyleButton()
- button:SetTemplate("Transparent")
- button.SetHighlightTexture = T.dummy
- button.SetPushedTexture = T.dummy
- button:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
- button:GetPushedTexture():SetTexCoord(.08, .92, .08, .92)
- button:GetHighlightTexture():SetAllPoints(icon)
- button:GetPushedTexture():SetAllPoints(icon)
-
- if button.Rank then
- button.Rank:SetFont(C.media.font, 12, "THINOUTLINE")
- button.Rank:ClearAllPoints()
- button.Rank:SetPoint("BOTTOMRIGHT")
- end
-
- icon:ClearAllPoints()
- icon:Point("TOPLEFT", 2, -2)
- icon:Point("BOTTOMRIGHT", -2, 2)
- icon:SetTexCoord(.08, .92, .08, .92)
- end
- end
- -- color item by rarity on inspect frame.
- local function ColorItemBorder()
- if(not InspectFrame:IsShown()) then return end
- for _, slot in pairs(slots) do
- -- Color the equipment slots by rarity
- local target = _G["Inspect"..slot]
- local slotId, _, _ = GetInventorySlotInfo(slot)
- local itemId = GetInventoryItemID("target", slotId)
- if itemId then
- local _, _, rarity, _, _, _, _, _, _, _, _ = GetItemInfo(itemId)
- if rarity then
- target.backdrop:SetBackdropBorderColor(GetItemQualityColor(rarity))
- end
- else
- target.backdrop:SetBackdropBorderColor(unpack(C.media.bordercolor))
- end
- end
- end
- -- execute item coloring everytime we open character frame
- InspectFrame:HookScript("OnShow", ColorItemBorder)
- -- execute item coloring everytime an item is changed
- local CheckItemBorderColor = CreateFrame("Frame")
- CheckItemBorderColor:RegisterEvent("PLAYER_TARGET_CHANGED")
- CheckItemBorderColor:SetScript("OnEvent", ColorItemBorder)
- end
- T.SkinFuncs["Blizzard_InspectUI"] = LoadSkin