-
Notifications
You must be signed in to change notification settings - Fork 0
/
CQL_ElvUISkin.lua
325 lines (254 loc) · 9.88 KB
/
CQL_ElvUISkin.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
local IsAddOnLoaded = C_AddOns and C_AddOns.IsAddOnLoaded or IsAddOnLoaded
local DEFAULT_TEXT_COLOR = CreateColor(1, 1, 1, 1)
local COMPLETED_TEXT_COLOR = CreateColor(0.2, 1, 0.2, 1)
local RED_TEXT_COLOR = CreateColor(0.5, 0, 0, 1)
local FUBA_HEADER_COLOR = CreateColor(1, 0.8, 0.1, 1)
local FUBA_QUEST_ACCOUNT_COMPLETED_NOTICE_FONT_COLOR = CreateColor(0.4, 0.4, 0.4, 1)
local FUBA_QUEST_OPTIONAL_FONT_COLOR = CreateColor(.4, 1, 1,1)
local function InvertColor(r, g, b)
return 1 - r, 1 - g, 1 - b
end
local function HandleReward(frame)
if not frame then return end
local E, L, V, P, G = unpack(ElvUI)
local S = ElvUI[1]:GetModule('Skins')
for _, Region in next, { frame:GetRegions() } do
if Region:IsObjectType('Texture') and Region:GetTexture() == [[Interface\Spellbook\Spellbook-Parts]] then
Region:SetTexture(E.ClearTexture)
end
end
if frame.Icon then
frame.Icon:SetDrawLayer('ARTWORK')
S:HandleIcon(frame.Icon, true)
if frame.IconBorder then
S:HandleIconBorder(frame.IconBorder, frame.Icon.backdrop)
end
if frame.Rarity then
if (not frame.SetBackdrop) then Mixin(frame, BackdropTemplateMixin) end
S:HandleIconBorder(frame.Rarity, frame.Icon.backdrop)
end
end
if frame.Count then
frame.Count:SetDrawLayer('OVERLAY')
frame.Count:ClearAllPoints()
frame.Count:Point('BOTTOMRIGHT', frame.Icon, 'BOTTOMRIGHT', 0, 0)
end
if frame.NameFrame then
frame.NameFrame:SetAlpha(0)
frame.NameFrame:Hide()
end
if frame.IconOverlay then
frame.IconOverlay:SetAlpha(0)
end
if frame.Name then
frame.Name:FontTemplate()
end
if frame.CircleBackground then
frame.CircleBackground:SetAlpha(0)
frame.CircleBackgroundGlow:SetAlpha(0)
end
end
local function SkinForElvUI()
if (not IsAddOnLoaded("ElvUI")) then return end
if (not IsAddOnLoaded("Classic Quest Log")) then return end
local E, L, V, P, G = unpack(ElvUI)
local S = ElvUI[1]:GetModule('Skins')
local cql = ClassicQuestLog
if not cql then return end
cql:StripTextures()
cql:SetTemplate("Transparent")
-----------
--- Log ---
-----------
hooksecurefunc(cql.Log, "Update", function(self)
local content = self.ScrollFrame.Content
self:StripTextures()
self:SetTemplate("Transparent")
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar)
local somethingExpanded = self:IsSomethingExpanded()
local AllButton = self.ScrollFrame.AllButton
AllButton:StripTextures()
AllButton:SetNormalTexture(somethingExpanded and E.Media.Textures.MinusButton or E.Media.Textures.PlusButton)
AllButton:SetPushedTexture(somethingExpanded and E.Media.Textures.MinusButton or E.Media.Textures.PlusButton)
AllButton:ClearAllPoints()
AllButton:SetPoint('BOTTOMLEFT', cql, 'TOPLEFT', 6, -55)
local buttons = content.Buttons
for index, button in ipairs(buttons) do
local expandButton = button.ExpandButton
local info = button.info
if expandButton and info then
button.expandAtlas = cql.settings.CollapsedHeaders[info.title] and E.Media.Textures.PlusButton or E.Media.Textures.MinusButton
expandButton:SetTexture(cql.settings.CollapsedHeaders[info.title] and E.Media.Textures.PlusButton or E.Media.Textures.MinusButton)
end
end
end)
---------------
--- Options ---
---------------
hooksecurefunc(cql.Options, "Update", function(self)
self:StripTextures()
self:SetTemplate("Transparent")
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar)
end)
---------------
--- Details ---
---------------
hooksecurefunc(cql.Detail, "Update", function(self)
self:StripTextures()
self:SetTemplate("Transparent")
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar)
end)
hooksecurefunc(cql.Detail, "ShowTitle", function(self)
local content = self.ScrollFrame.Content
if not content then return end
content.TitleHeader:SetTextColor(FUBA_HEADER_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "ShowStatusTitle", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
if questID>0 and C_QuestLog.IsQuestDisabledForSession(questID) then
content.StatusTitle:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowStatusText", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
if questID>0 and C_QuestLog.IsQuestDisabledForSession(questID) then
content.StatusText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowObjectivesText", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
if questID > 0 then
content.ObjectivesText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowObjectives", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
local numObjectives = GetNumQuestLeaderBoards()
local objective
local text, type, finished
local objectivesTable = content.ObjectivesFrame.Objectives
local numVisibleObjectives = 0
if not (content and questID) then return end
if questID > 0 then
local waypointText = C_QuestLog.GetNextWaypointText(questID)
if waypointText then
numVisibleObjectives = numVisibleObjectives + 1
objective = self:AcquireObjective(numVisibleObjectives)
objective:SetTextColor(FUBA_QUEST_OPTIONAL_FONT_COLOR:GetRGB())
end
for i=1,numObjectives do
text,type,finished = GetQuestLogLeaderBoard(i)
if (type~="spell" and type~="log" and numVisibleObjectives<MAX_OBJECTIVES) then
numVisibleObjectives = numVisibleObjectives + 1
objective = self:AcquireObjective(numVisibleObjectives)
if finished then
objective:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB())
else
objective:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end
end
end
end)
hooksecurefunc(cql.Detail, "ShowSpecialObjectives", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
local spellID, spellName, spellTexture, finished = GetQuestLogCriteriaSpell()
local spellObjectiveLearnLabel = content.SpecialObjectivesFrame.SpellObjectiveLearnLabel
if finished then
spellObjectiveLearnLabel:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB())
else
spellObjectiveLearnLabel:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowRequiredMoney", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
local requiredMoney = C_QuestLog.GetRequiredMoney()
if requiredMoney > GetMoney() then
content.RequiredMoneyFrame.RequiredMoneyText:SetTextColor(RED_TEXT_COLOR:GetRGB())
else
content.RequiredMoneyFrame.RequiredMoneyText:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowGroupSize", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
local groupNum = C_QuestLog.GetSuggestedGroupSize(questID)
if not (content and questID and groupNum) then return end
if (questID > 0) and (groupNum > 0) then
content.GroupSize:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowDescriptionHeader", function(self)
local content = self.ScrollFrame.Content
if not (content and content.DescriptionHeader) then return end
content.DescriptionHeader:SetTextColor(FUBA_HEADER_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "ShowDescriptionText", function(self)
local content = self.ScrollFrame.Content
local questID = cql.Log:GetSelectedQuest()
if not (content and questID) then return end
if (questID > 0) then
content.DescriptionText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end
end)
hooksecurefunc(cql.Detail, "ShowAccountCompletedNotice", function(self)
local content = self.ScrollFrame.Content
if not content then return end
content.AccountCompletedNotice:SetTextColor(FUBA_QUEST_ACCOUNT_COMPLETED_NOTICE_FONT_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "ShowSeal", function(self)
local content = self.ScrollFrame.Content
if not content then return end
local frame = content.SealFrame
frame.Text:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "AcquireRewardButton", function(self)
local header = self.ScrollFrame.Content.RewardsFrame.Header
if not header then return end
header:SetTextColor(FUBA_HEADER_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "AddTextToRewards", function(self, fontstring)
if not fontstring then return end
fontstring:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB())
end)
hooksecurefunc(cql.Detail, "FillReward", function(self, rewardButton,questID,rewardType,rewardIndex,objectType,id,name,icon,quality,amount)
if not rewardButton then return end
HandleReward(rewardButton)
end)
--------------
--- Chrome ---
--------------
S:HandleCloseButton(ClassicQuestLogCloseButton)
for k,v in pairs({"CloseButton","AbandonButton","ShareButton","TrackButton"}) do
if cql.Chrome[v] then
S:HandleButton(cql.Chrome[v])
end
end
hooksecurefunc(cql.Chrome, "Update", function(self)
self:StripTextures()
self:SetTemplate("Transparent")
if not self.CountFrame.isSkinned then
self.CountFrame:StripTextures()
self.CountFrame:SetTemplate(nil, true)
self.CountFrame.isSkinned = true
end
end)
-- maybe skin but not needed really
--[[
MapButton
OptionsButton
SyncFrame.Button
]]
end
EventRegistry:RegisterFrameEventAndCallback("PLAYER_LOGIN", SkinForElvUI)