Skip to content

Commit 386d203

Browse files
committed
WIP - Bring new Profession Book Skin to live
1 parent 23b2d81 commit 386d203

File tree

1 file changed

+10
-201
lines changed

1 file changed

+10
-201
lines changed

ElvUI/Mainline/Modules/Skins/SpellBook.lua

Lines changed: 10 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,12 @@ local E, L, V, P, G = unpack(ElvUI)
22
local S = E:GetModule('Skins')
33

44
local _G = _G
5-
local next, select = next, select
6-
local hooksecurefunc = hooksecurefunc
7-
8-
local CreateFrame = CreateFrame
9-
local GetProfessionInfo = GetProfessionInfo
10-
local IsPassiveSpell = IsPassiveSpell
11-
12-
local BOOKTYPE_PROFESSION = BOOKTYPE_PROFESSION
5+
local next = next
136

147
local function clearBackdrop(self)
158
self:SetBackdropColor(0, 0, 0, 1)
169
end
1710

18-
local function spellButtonHighlight(button, texture)
19-
if texture == [[Interface\Buttons\ButtonHilight-Square]] then
20-
button:SetColorTexture(1, 1, 1, 0.3)
21-
end
22-
end
23-
24-
local function UpdateButton()
25-
if _G.SpellBookFrame.bookType == BOOKTYPE_PROFESSION then
26-
return
27-
end
28-
29-
for i = 1, _G.SPELLS_PER_PAGE do
30-
local button = _G['SpellButton'..i]
31-
if button.backdrop then
32-
button.backdrop:SetShown(button.SpellName:IsShown())
33-
end
34-
35-
local highlight = button.SpellHighlightTexture
36-
if highlight then
37-
if highlight:IsShown() then
38-
E:Flash(highlight, 1, true)
39-
else
40-
E:StopFlash(highlight)
41-
end
42-
end
43-
44-
if E.private.skins.parchmentRemoverEnable then
45-
button.SpellSubName:SetTextColor(0.6, 0.6, 0.6)
46-
button.RequiredLevelString:SetTextColor(0.6, 0.6, 0.6)
47-
48-
local r = button.SpellName:GetTextColor()
49-
if r < 0.8 then
50-
button.SpellName:SetTextColor(0.6, 0.6, 0.6)
51-
elseif r ~= 1 then
52-
button.SpellName:SetTextColor(1, 1, 1)
53-
end
54-
end
55-
end
56-
end
57-
5811
local function HandleSkillButton(button)
5912
if not button then return end
6013
button:SetCheckedTexture(E.media.normTex)
@@ -74,114 +27,30 @@ local function HandleSkillButton(button)
7427
if nameFrame then nameFrame:Hide() end
7528
end
7629

77-
function S:SpellBookFrame()
30+
function S:Blizzard_ProfessionsBook()
7831
if not (E.private.skins.blizzard.enable and E.private.skins.blizzard.spellbook) then return end
7932

80-
local SpellBookFrame = _G.SpellBookFrame
81-
S:HandlePortraitFrame(SpellBookFrame)
82-
83-
for _, frame in next, { _G.SpellBookSpellIconsFrame, _G.SpellBookSideTabsFrame, _G.SpellBookPageNavigationFrame } do
84-
frame:StripTextures()
85-
end
33+
local ProfessionsBookFrame = _G.ProfessionsBookFrame
34+
S:HandleFrame(ProfessionsBookFrame)
8635

8736
if E.global.general.disableTutorialButtons then
88-
_G.SpellBookFrameTutorialButton:Kill()
89-
else
90-
_G.SpellBookFrameTutorialButton.Ring:Hide()
91-
end
92-
93-
if E.private.skins.parchmentRemoverEnable then
94-
_G.SpellBookPage1:SetAlpha(0)
95-
_G.SpellBookPage2:SetAlpha(0)
96-
_G.SpellBookPageText:SetTextColor(0.6, 0.6, 0.6)
37+
ProfessionsBookFrameTutorialButton:Kill()
9738
else
98-
local pagebackdrop = CreateFrame('Frame', nil, SpellBookFrame)
99-
pagebackdrop:SetTemplate()
100-
pagebackdrop:Point('TOPLEFT', _G.SpellBookPage1, 'TOPLEFT', -2, 2)
101-
pagebackdrop:Point('BOTTOMRIGHT', SpellBookFrame, 'BOTTOMRIGHT', -8, 4)
102-
SpellBookFrame.pagebackdrop = pagebackdrop
103-
104-
for i = 1, 2 do
105-
local page = _G['SpellBookPage'..i]
106-
page:SetParent(pagebackdrop)
107-
page:SetDrawLayer('BACKGROUND', 3)
108-
end
109-
end
110-
111-
S:HandleNextPrevButton(_G.SpellBookPrevPageButton, nil, nil, true)
112-
S:HandleNextPrevButton(_G.SpellBookNextPageButton, nil, nil, true)
113-
114-
_G.SpellBookPageText:ClearAllPoints()
115-
_G.SpellBookPageText:Point('RIGHT', _G.SpellBookPrevPageButton, 'LEFT', -5, 0)
116-
117-
for i = 1, _G.SPELLS_PER_PAGE do
118-
local button = _G['SpellButton'..i]
119-
local highlight =_G['SpellButton'..i..'Highlight']
120-
121-
for _, region in next, { button:GetRegions() } do
122-
if region:IsObjectType('Texture') and (region ~= button.FlyoutArrow
123-
and region ~= button.GlyphIcon and region ~= button.GlyphActivate
124-
and region ~= button.AbilityHighlight and region ~= button.SpellHighlightTexture) then
125-
region:SetTexture()
126-
end
127-
end
128-
129-
E:RegisterCooldown(button.cooldown)
130-
S:HandleIcon(button.IconTexture)
131-
132-
button:CreateBackdrop(nil, true)
133-
button.IconTexture:SetInside(button.backdrop)
134-
135-
local ht = button.SpellHighlightTexture
136-
if ht then
137-
ht:SetColorTexture(0.8, 0.8, 0, 0.6)
138-
ht:SetInside(button.backdrop)
139-
end
140-
141-
if button.shine then
142-
button.shine:ClearAllPoints()
143-
button.shine:Point('TOPLEFT', button, 'TOPLEFT', -3, 3)
144-
button.shine:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', 3, -3)
145-
end
146-
147-
if E.private.skins.parchmentRemoverEnable then
148-
button:SetHighlightTexture(E.ClearTexture)
149-
end
150-
151-
highlight:SetAllPoints(button.IconTexture)
152-
hooksecurefunc(highlight, 'SetTexture', spellButtonHighlight)
153-
154-
hooksecurefunc(button, 'UpdateButton', UpdateButton)
155-
end
156-
157-
_G.SpellBookSkillLineTab1:Point('TOPLEFT', '$parent', 'TOPRIGHT', E.PixelMode and 0 or E.Border + E.Spacing, -36)
158-
159-
for i = 1, 8 do
160-
local tab = _G['SpellBookSkillLineTab'..i]
161-
tab:StripTextures()
162-
tab:SetTemplate()
163-
tab:StyleButton(nil, true)
39+
ProfessionsBookFrameTutorialButton.Ring:Hide()
16440
end
16541

166-
hooksecurefunc('SpellBookFrame_UpdateSkillLineTabs', function()
167-
for i = 1, 8 do
168-
local tex = _G['SpellBookSkillLineTab'..i]:GetNormalTexture()
169-
if tex then
170-
S:HandleIcon(tex)
171-
tex:SetInside()
172-
end
173-
end
174-
end)
175-
17642
--Profession Tab
17743
for _, button in next, { _G.PrimaryProfession1, _G.PrimaryProfession2, _G.SecondaryProfession1, _G.SecondaryProfession2, _G.SecondaryProfession3 } do
17844
button.missingHeader:SetTextColor(1, 1, 0)
17945

46+
--[[ FIX ME 11.0
18047
if E.private.skins.parchmentRemoverEnable then
18148
button.missingText:SetTextColor(1, 1, 1)
18249
else
18350
button.missingText:SetTextColor(0, 0, 0)
18451
end
52+
]]
53+
button.missingText:SetTextColor(1, 1, 1)
18554

18655
local a, b, c, _, e = button.statusBar:GetPoint()
18756
button.statusBar:Point(a, b, c, 0, e)
@@ -226,66 +95,6 @@ function S:SpellBookFrame()
22695
S:HandleIcon(button.iconTexture, true)
22796
end
22897
end
229-
230-
-- Some Texture Magic
231-
hooksecurefunc('FormatProfession', function(frame, id)
232-
if not (id and frame and frame.icon) then return end
233-
234-
local texture = select(2, GetProfessionInfo(id))
235-
if texture then frame.icon:SetTexture(texture) end
236-
end)
237-
238-
hooksecurefunc('UpdateProfessionButton', function(button)
239-
local parent = button:GetParent()
240-
if not parent or not parent.spellOffset then return end
241-
242-
local spellIndex = button:GetID() + parent.spellOffset
243-
local isPassive = IsPassiveSpell(spellIndex, SpellBookFrame.bookType)
244-
if isPassive then
245-
button.highlightTexture:SetColorTexture(1, 1, 1, 0)
246-
else
247-
button.highlightTexture:SetColorTexture(1, 1, 1, .25)
248-
end
249-
250-
if E.private.skins.parchmentRemoverEnable then
251-
if button.spellString then
252-
button.spellString:SetTextColor(1, 1, 1)
253-
end
254-
if button.subSpellString then
255-
button.subSpellString:SetTextColor(1, 1, 1)
256-
end
257-
if button.SpellName then
258-
button.SpellName:SetTextColor(1, 1, 1)
259-
end
260-
if button.SpellSubName then
261-
button.SpellSubName:SetTextColor(1, 1, 1)
262-
end
263-
end
264-
end)
265-
266-
-- Bottom Tabs
267-
for i = 1, 5 do
268-
S:HandleTab(_G['SpellBookFrameTabButton'..i])
269-
end
270-
271-
-- Reposition Tabs
272-
hooksecurefunc('SpellBookFrame_Update', function()
273-
local tab = _G.SpellBookFrameTabButton1
274-
local index, lastTab = 1, tab
275-
while tab do
276-
tab:ClearAllPoints()
277-
278-
if index == 1 then
279-
tab:Point('TOPLEFT', _G.SpellBookFrame, 'BOTTOMLEFT', -3, 0)
280-
else
281-
tab:Point('TOPLEFT', lastTab, 'TOPRIGHT', -5, 0)
282-
lastTab = tab
283-
end
284-
285-
index = index + 1
286-
tab = _G['SpellBookFrameTabButton'..index]
287-
end
288-
end)
28998
end
29099

291-
S:AddCallback('SpellBookFrame')
100+
S:AddCallbackForAddon('Blizzard_ProfessionsBook')

0 commit comments

Comments
 (0)