/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

  1. local T, C, L = unpack(select(2, ...))
  2. local function LoadSkin()
  3. T.SkinCloseButton(SpellBookFrameCloseButton)
  4. local StripAllTextures = {
  5. "SpellBookFrame",
  6. "SpellBookFrameInset",
  7. "SpellBookSpellIconsFrame",
  8. "SpellBookSideTabsFrame",
  9. "SpellBookPageNavigationFrame",
  10. }
  11. local KillTextures = {
  12. "SpellBookPage1",
  13. "SpellBookPage2",
  14. }
  15. for _, object in pairs(StripAllTextures) do
  16. _G[object]:StripTextures()
  17. end
  18. for _, texture in pairs(KillTextures) do
  19. _G[texture]:Kill()
  20. end
  21. local pagebackdrop = CreateFrame("Frame", nil, SpellBookPage1:GetParent())
  22. pagebackdrop:Point("TOPLEFT", SpellBookFrame, "TOPLEFT", 50, -50)
  23. pagebackdrop:Point("BOTTOMRIGHT", SpellBookPage1, "BOTTOMRIGHT", 15, 35)
  24. T.SkinNextPrevButton(SpellBookPrevPageButton)
  25. T.SkinNextPrevButton(SpellBookNextPageButton)
  26. --Skin SpellButtons
  27. local function SpellButtons(self, first)
  28. for i=1, SPELLS_PER_PAGE do
  29. local button = _G["SpellButton"..i]
  30. local icon = _G["SpellButton"..i.."IconTexture"]
  31. if first then
  32. for i=1, button:GetNumRegions() do
  33. local region = select(i, button:GetRegions())
  34. if region:GetObjectType() == "Texture" then
  35. if region:GetTexture() ~= "Interface\\Buttons\\ActionBarFlyoutButton" then
  36. region:SetTexture(nil)
  37. end
  38. end
  39. end
  40. end
  41. if _G["SpellButton"..i.."Highlight"] then
  42. _G["SpellButton"..i.."Highlight"]:SetTexture(1, 1, 1, 0.3)
  43. _G["SpellButton"..i.."Highlight"]:ClearAllPoints()
  44. _G["SpellButton"..i.."Highlight"]:SetAllPoints(icon)
  45. end
  46. if icon then
  47. icon:SetTexCoord(.08, .92, .08, .92)
  48. icon:ClearAllPoints()
  49. icon:SetAllPoints()
  50. if not button.backdrop then
  51. button:CreateBackdrop("Transparent", true)
  52. end
  53. end
  54. local r, g, b = _G["SpellButton"..i.."SpellName"]:GetTextColor()
  55. if r < 0.8 then
  56. _G["SpellButton"..i.."SpellName"]:SetTextColor(0.6, 0.6, 0.6)
  57. end
  58. _G["SpellButton"..i.."SubSpellName"]:SetTextColor(0.6, 0.6, 0.6)
  59. _G["SpellButton"..i.."RequiredLevelString"]:SetTextColor(0.6, 0.6, 0.6)
  60. end
  61. end
  62. SpellButtons(nil, true)
  63. hooksecurefunc("SpellButton_UpdateButton", SpellButtons)
  64. SpellBookPageText:SetTextColor(0.6, 0.6, 0.6)
  65. --Skill Line Tabs
  66. for i=1, MAX_SKILLLINE_TABS do
  67. local tab = _G["SpellBookSkillLineTab"..i]
  68. _G["SpellBookSkillLineTab"..i.."Flash"]:Kill()
  69. if tab then
  70. tab:StripTextures()
  71. tab:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
  72. tab:GetNormalTexture():ClearAllPoints()
  73. tab:GetNormalTexture():Point("TOPLEFT", 2, -2)
  74. tab:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
  75. tab:CreateBackdrop("Transparent")
  76. tab.backdrop:SetAllPoints()
  77. tab:StyleButton(true)
  78. local point, relatedTo, point2, x, y = tab:GetPoint()
  79. tab:Point(point, relatedTo, point2, 1, y)
  80. end
  81. end
  82. local function SkinSkillLine()
  83. for i=1, MAX_SKILLLINE_TABS do
  84. local tab = _G["SpellBookSkillLineTab"..i]
  85. local _, _, _, _, isGuild = GetSpellTabInfo(i)
  86. if isGuild then
  87. tab:GetNormalTexture():ClearAllPoints()
  88. tab:GetNormalTexture():Point("TOPLEFT", 2, -2)
  89. tab:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
  90. tab:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
  91. end
  92. end
  93. end
  94. hooksecurefunc("SpellBookFrame_UpdateSkillLineTabs", SkinSkillLine)
  95. SpellBookFrame:SetTemplate("Transparent")
  96. SpellBookFrame:CreateShadow("Transparent")
  97. --Profession Tab
  98. local professionbuttons = {
  99. "PrimaryProfession1SpellButtonTop",
  100. "PrimaryProfession1SpellButtonBottom",
  101. "PrimaryProfession2SpellButtonTop",
  102. "PrimaryProfession2SpellButtonBottom",
  103. "SecondaryProfession1SpellButtonLeft",
  104. "SecondaryProfession1SpellButtonRight",
  105. "SecondaryProfession2SpellButtonLeft",
  106. "SecondaryProfession2SpellButtonRight",
  107. "SecondaryProfession3SpellButtonLeft",
  108. "SecondaryProfession3SpellButtonRight",
  109. "SecondaryProfession4SpellButtonLeft",
  110. "SecondaryProfession4SpellButtonRight",
  111. }
  112. local professionheaders = {
  113. "PrimaryProfession1",
  114. "PrimaryProfession2",
  115. "SecondaryProfession1",
  116. "SecondaryProfession2",
  117. "SecondaryProfession3",
  118. "SecondaryProfession4",
  119. }
  120. for _, header in pairs(professionheaders) do
  121. _G[header.."Missing"]:SetTextColor(1, 1, 0)
  122. _G[header].missingText:SetTextColor(0.6, 0.6, 0.6)
  123. end
  124. for _, button in pairs(professionbuttons) do
  125. local icon = _G[button.."IconTexture"]
  126. local rank = _G[button.."SubSpellName"]
  127. local button = _G[button]
  128. button:StripTextures()
  129. if rank then rank:SetTextColor(1, 1, 1) end
  130. if icon then
  131. icon:SetTexCoord(.08, .92, .08, .92)
  132. icon:ClearAllPoints()
  133. icon:Point("TOPLEFT", 2, -2)
  134. icon:Point("BOTTOMRIGHT", -2, 2)
  135. if not button.backdrop then
  136. button:CreateBackdrop("Transparent", true)
  137. button.backdrop:SetAllPoints()
  138. end
  139. end
  140. end
  141. local professionstatusbars = {
  142. "PrimaryProfession1StatusBar",
  143. "PrimaryProfession2StatusBar",
  144. "SecondaryProfession1StatusBar",
  145. "SecondaryProfession2StatusBar",
  146. "SecondaryProfession3StatusBar",
  147. "SecondaryProfession4StatusBar",
  148. }
  149. for _, statusbar in pairs(professionstatusbars) do
  150. local statusbar = _G[statusbar]
  151. statusbar:StripTextures()
  152. statusbar:SetStatusBarTexture(C["media"].normTex)
  153. statusbar:SetStatusBarColor(0, 220/255, 0)
  154. statusbar:CreateBackdrop("Transparent")
  155. statusbar.rankText:ClearAllPoints()
  156. statusbar.rankText:SetPoint("CENTER")
  157. end
  158. --Mounts/Companions
  159. for i = 1, NUM_COMPANIONS_PER_PAGE do
  160. local button = _G["SpellBookCompanionButton"..i]
  161. local icon = _G["SpellBookCompanionButton"..i.."IconTexture"]
  162. button:StripTextures()
  163. button:StyleButton(false)
  164. if icon then
  165. icon:SetTexCoord(.08, .92, .08, .92)
  166. icon:ClearAllPoints()
  167. icon:Point("TOPLEFT", 2, -2)
  168. icon:Point("BOTTOMRIGHT", -2, 2)
  169. if not button.backdrop then
  170. button:CreateBackdrop("Transparent", true)
  171. button.backdrop:SetAllPoints()
  172. end
  173. end
  174. end
  175. T.SkinButton(SpellBookCompanionSummonButton)
  176. SpellBookCompanionModelFrame:StripTextures()
  177. SpellBookCompanionModelFrameShadowOverlay:StripTextures()
  178. SpellBookCompanionsModelFrame:Kill()
  179. SpellBookCompanionModelFrame:SetTemplate("Transparent")
  180. T.SkinRotateButton(SpellBookCompanionModelFrameRotateRightButton)
  181. T.SkinRotateButton(SpellBookCompanionModelFrameRotateLeftButton)
  182. SpellBookCompanionModelFrameRotateRightButton:Point("TOPLEFT", SpellBookCompanionModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
  183. --Bottom Tabs
  184. for i=1, 5 do
  185. T.SkinTab(_G["SpellBookFrameTabButton"..i])
  186. end
  187. end
  188. tinsert(T.SkinFuncs["Tukui"], LoadSkin)