/Tukui/modules/skins/spellbook.lua
http://github.com/Asphyxia/Tukui · Lua · 224 lines · 183 code · 36 blank · 5 comment · 27 complexity · 8c27105b8da59963c9c74b205dd7103a MD5 · raw file
- local T, C, L = unpack(select(2, ...))
- local function LoadSkin()
- T.SkinCloseButton(SpellBookFrameCloseButton)
- local StripAllTextures = {
- "SpellBookFrame",
- "SpellBookFrameInset",
- "SpellBookSpellIconsFrame",
- "SpellBookSideTabsFrame",
- "SpellBookPageNavigationFrame",
- }
- local KillTextures = {
- "SpellBookPage1",
- "SpellBookPage2",
- }
- for _, object in pairs(StripAllTextures) do
- _G[object]:StripTextures()
- end
- for _, texture in pairs(KillTextures) do
- _G[texture]:Kill()
- end
- local pagebackdrop = CreateFrame("Frame", nil, SpellBookPage1:GetParent())
- pagebackdrop:Point("TOPLEFT", SpellBookFrame, "TOPLEFT", 50, -50)
- pagebackdrop:Point("BOTTOMRIGHT", SpellBookPage1, "BOTTOMRIGHT", 15, 35)
- T.SkinNextPrevButton(SpellBookPrevPageButton)
- T.SkinNextPrevButton(SpellBookNextPageButton)
- --Skin SpellButtons
- local function SpellButtons(self, first)
- for i=1, SPELLS_PER_PAGE do
- local button = _G["SpellButton"..i]
- local icon = _G["SpellButton"..i.."IconTexture"]
-
- if first then
- for i=1, button:GetNumRegions() do
- local region = select(i, button:GetRegions())
- if region:GetObjectType() == "Texture" then
- if region:GetTexture() ~= "Interface\\Buttons\\ActionBarFlyoutButton" then
- region:SetTexture(nil)
- end
- end
- end
- end
-
- if _G["SpellButton"..i.."Highlight"] then
- _G["SpellButton"..i.."Highlight"]:SetTexture(1, 1, 1, 0.3)
- _G["SpellButton"..i.."Highlight"]:ClearAllPoints()
- _G["SpellButton"..i.."Highlight"]:SetAllPoints(icon)
- end
- if icon then
- icon:SetTexCoord(.08, .92, .08, .92)
- icon:ClearAllPoints()
- icon:SetAllPoints()
- if not button.backdrop then
- button:CreateBackdrop("Transparent", true)
- end
- end
-
- local r, g, b = _G["SpellButton"..i.."SpellName"]:GetTextColor()
- if r < 0.8 then
- _G["SpellButton"..i.."SpellName"]:SetTextColor(0.6, 0.6, 0.6)
- end
- _G["SpellButton"..i.."SubSpellName"]:SetTextColor(0.6, 0.6, 0.6)
- _G["SpellButton"..i.."RequiredLevelString"]:SetTextColor(0.6, 0.6, 0.6)
- end
- end
- SpellButtons(nil, true)
- hooksecurefunc("SpellButton_UpdateButton", SpellButtons)
- SpellBookPageText:SetTextColor(0.6, 0.6, 0.6)
- --Skill Line Tabs
- for i=1, MAX_SKILLLINE_TABS do
- local tab = _G["SpellBookSkillLineTab"..i]
- _G["SpellBookSkillLineTab"..i.."Flash"]:Kill()
- if tab then
- tab:StripTextures()
- tab:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
- tab:GetNormalTexture():ClearAllPoints()
- tab:GetNormalTexture():Point("TOPLEFT", 2, -2)
- tab:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
-
- tab:CreateBackdrop("Transparent")
- tab.backdrop:SetAllPoints()
- tab:StyleButton(true)
-
- local point, relatedTo, point2, x, y = tab:GetPoint()
- tab:Point(point, relatedTo, point2, 1, y)
- end
- end
- local function SkinSkillLine()
- for i=1, MAX_SKILLLINE_TABS do
- local tab = _G["SpellBookSkillLineTab"..i]
- local _, _, _, _, isGuild = GetSpellTabInfo(i)
- if isGuild then
- tab:GetNormalTexture():ClearAllPoints()
- tab:GetNormalTexture():Point("TOPLEFT", 2, -2)
- tab:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
- tab:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
- end
- end
- end
- hooksecurefunc("SpellBookFrame_UpdateSkillLineTabs", SkinSkillLine)
- SpellBookFrame:SetTemplate("Transparent")
- SpellBookFrame:CreateShadow("Transparent")
- --Profession Tab
- local professionbuttons = {
- "PrimaryProfession1SpellButtonTop",
- "PrimaryProfession1SpellButtonBottom",
- "PrimaryProfession2SpellButtonTop",
- "PrimaryProfession2SpellButtonBottom",
- "SecondaryProfession1SpellButtonLeft",
- "SecondaryProfession1SpellButtonRight",
- "SecondaryProfession2SpellButtonLeft",
- "SecondaryProfession2SpellButtonRight",
- "SecondaryProfession3SpellButtonLeft",
- "SecondaryProfession3SpellButtonRight",
- "SecondaryProfession4SpellButtonLeft",
- "SecondaryProfession4SpellButtonRight",
- }
- local professionheaders = {
- "PrimaryProfession1",
- "PrimaryProfession2",
- "SecondaryProfession1",
- "SecondaryProfession2",
- "SecondaryProfession3",
- "SecondaryProfession4",
- }
- for _, header in pairs(professionheaders) do
- _G[header.."Missing"]:SetTextColor(1, 1, 0)
- _G[header].missingText:SetTextColor(0.6, 0.6, 0.6)
- end
- for _, button in pairs(professionbuttons) do
- local icon = _G[button.."IconTexture"]
- local rank = _G[button.."SubSpellName"]
- local button = _G[button]
- button:StripTextures()
- if rank then rank:SetTextColor(1, 1, 1) end
- if icon then
- icon:SetTexCoord(.08, .92, .08, .92)
- icon:ClearAllPoints()
- icon:Point("TOPLEFT", 2, -2)
- icon:Point("BOTTOMRIGHT", -2, 2)
- if not button.backdrop then
- button:CreateBackdrop("Transparent", true)
- button.backdrop:SetAllPoints()
- end
- end
- end
- local professionstatusbars = {
- "PrimaryProfession1StatusBar",
- "PrimaryProfession2StatusBar",
- "SecondaryProfession1StatusBar",
- "SecondaryProfession2StatusBar",
- "SecondaryProfession3StatusBar",
- "SecondaryProfession4StatusBar",
- }
- for _, statusbar in pairs(professionstatusbars) do
- local statusbar = _G[statusbar]
- statusbar:StripTextures()
- statusbar:SetStatusBarTexture(C["media"].normTex)
- statusbar:SetStatusBarColor(0, 220/255, 0)
- statusbar:CreateBackdrop("Transparent")
-
- statusbar.rankText:ClearAllPoints()
- statusbar.rankText:SetPoint("CENTER")
- end
- --Mounts/Companions
- for i = 1, NUM_COMPANIONS_PER_PAGE do
- local button = _G["SpellBookCompanionButton"..i]
- local icon = _G["SpellBookCompanionButton"..i.."IconTexture"]
- button:StripTextures()
- button:StyleButton(false)
-
- if icon then
- icon:SetTexCoord(.08, .92, .08, .92)
- icon:ClearAllPoints()
- icon:Point("TOPLEFT", 2, -2)
- icon:Point("BOTTOMRIGHT", -2, 2)
- if not button.backdrop then
- button:CreateBackdrop("Transparent", true)
- button.backdrop:SetAllPoints()
- end
- end
- end
- T.SkinButton(SpellBookCompanionSummonButton)
- SpellBookCompanionModelFrame:StripTextures()
- SpellBookCompanionModelFrameShadowOverlay:StripTextures()
- SpellBookCompanionsModelFrame:Kill()
- SpellBookCompanionModelFrame:SetTemplate("Transparent")
- T.SkinRotateButton(SpellBookCompanionModelFrameRotateRightButton)
- T.SkinRotateButton(SpellBookCompanionModelFrameRotateLeftButton)
- SpellBookCompanionModelFrameRotateRightButton:Point("TOPLEFT", SpellBookCompanionModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
- --Bottom Tabs
- for i=1, 5 do
- T.SkinTab(_G["SpellBookFrameTabButton"..i])
- end
- end
- tinsert(T.SkinFuncs["Tukui"], LoadSkin)