-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestwatcher.lua
321 lines (279 loc) · 11.4 KB
/
questwatcher.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
-- ------------------------------------------------------------------------
-- -- Config
-- ------------------------------------------------------------------------
-- local font = [[STANDARD_TEXT_FONT]]
-- local fontSize = 8
-- local texture = [[Interface\ChatFrame\ChatFrameBackground]]
-- local backdrop = {
-- bgFile = texture, edgeFile = texture, edgeSize = 1,
-- }
-- -- WATCHFRAME_LINEHEIGHT = 16 -- line height, per line (1 line is 1 item)
-- -- WATCHFRAME_TYPE_OFFSET = 2
-- -- WATCHFRAME_MULTIPLE_LINEHEIGHT = 20
-- WATCHFRAME_INITIAL_OFFSET = 2 -- Y-axis between first quest in the questwatcher
-- -- WATCHFRAME_TYPE_OFFSET = 0
-- -- WATCHFRAME_QUEST_OFFSET = 5 -- space between quests, Y-axis, needs to be pos
-- -- WATCHFRAMELINES_FONTSPACING = -1 -- space between the items of a quest, Y-axis, needs to be neg
-- -- WATCHFRAMELINES_FONTHEIGHT = 10 -- no apparent function
-- ------------------------------------------------------------------------
-- -- Font styling function
-- ------------------------------------------------------------------------
-- local function SetFontStyle( textString )
-- textString:SetFont(font, fontSize, 'MONOCHROMEOUTLINE')
-- textString:SetShadowColor(0, 0, 0, .9)
-- textString:SetShadowOffset(1, -1)
-- end
-- ------------------------------------------------------------------------
-- -- Setting the width of things
-- ------------------------------------------------------------------------
-- hooksecurefunc("ObjectiveTrackerFrame_SetWidth", function(width)
-- WATCHFRAME_EXPANDEDWIDTH = 225
-- WATCHFRAME_MAXLINEWIDTH = 215
-- if ObjectiveTrackerFrame:IsShown() and not ObjectiveTrackerFrame.collapsed then
-- ObjectiveTrackerFrame:SetWidth(WATCHFRAME_EXPANDEDWIDTH)
-- ObjectiveTrackerFrame_Update()
-- end
-- end)
-- ------------------------------------------------------------------------
-- -- Skin the Quest Buttons : Thanks to Phanx' code it got shorter!
-- ------------------------------------------------------------------------
-- hooksecurefunc("QuestObjectiveItem_UpdateCooldown", function(button)
-- if(string.match(button:GetName(), 'ObjectiveTrackerFrameItem%d+') and not button.skinned) then
-- button:SetSize(26, 26)
-- button:SetBackdrop(backdrop)
-- button:SetBackdropColor(0, 0, 0)
-- button:SetBackdropBorderColor(0, 0, 0)
-- local icon = _G[button:GetName() .. 'IconTexture']
-- icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
-- _G[button:GetName() .. 'NormalTexture']:SetTexture("")
-- button.skinned = true
-- end
-- end)
-- ------------------------------------------------------------------------
-- -- Add square or hide if there's a Dash
-- -- From Mythology/nibWatcherFrameAdv
-- ------------------------------------------------------------------------
-- hooksecurefunc("ObjectiveTrackerFrame_SetLine", function(line, _, _, isHeader, text, hasDash, _, _, eligible)
-- line.hasDash = hasDash == 1
-- if(line.hasDash and line.square) then
-- line.square:Show()
-- elseif(line.square) then
-- line.square:Hide()
-- end
-- end)
-- ------------------------------------------------------------------------
-- -- Function to colorize the quests and provide level for later on
-- ------------------------------------------------------------------------
-- local tags = {
-- Dungeon = 'D',
-- Elite = '+',
-- Group = 'G',
-- Heroic = 'H',
-- PVP = 'PvP',
-- Raid = 'R',
-- Scenario = 'Sc',
-- Legendary = 'L',
-- ["Raid (10)"] = "R10",
-- ["Raid (25)"] = "R25",
-- Daily = "•",
-- Repeatable = "Rep"
-- }
-- local function GetQuestData(self)
-- if(self.type == 'QUEST') then
-- local questIndex = GetQuestIndexForWatch(self.index)
-- local numEntries = GetNumQuestLogEntries()
-- if (questIndex) then
-- local titleText, level, questTag, groupSize, isHeader, _, isComplete, isDaily, questID = GetQuestLogTitle(questIndex)
-- if (isDaily) then
-- return 15/255, 215/255, 215/255, level..'•'
-- elseif (questTag) and (level) then
-- local color = GetQuestDifficultyColor(level)
-- return color.r, color.g, color.b, level..tags[questTag]
-- elseif (level) then
-- local color = GetQuestDifficultyColor(level)
-- return color.r, color.g, color.b, level
-- end
-- end
-- end
-- return 0.85, 0.45, 0
-- end
-- ------------------------------------------------------------------------
-- -- Is the quest being tracked on the map?
-- ------------------------------------------------------------------------
-- local function IsSuperTracked(self)
-- if(self.type ~= 'QUEST') then return end
-- local questIndex = GetQuestIndexForWatch(self.index)
-- if(questIndex) then
-- local _, _, _, _, _, _, _, _, id = GetQuestLogTitle(questIndex)
-- if(id and GetSuperTrackedQuestID() == id) then
-- return true
-- end
-- end
-- end
-- ------------------------------------------------------------------------
-- -- Colorize the square
-- ------------------------------------------------------------------------
-- local function HighlightLine(self, highlight)
-- for index = self.startLine, self.lastLine do
-- local line = self.lines[index]
-- if(line) then
-- if(index == self.startLine) then
-- local r, g, b, prefix = GetQuestData(self)
-- local text = line.text:GetText()
-- if(text and string.sub(text, -1) ~= '\032' and prefix) then
-- line.text:SetFormattedText('[%s] %s\032', prefix, text) -- adding the [xx] in front
-- end
-- if(highlight) then
-- line.text:SetTextColor(r, g, b)
-- else
-- line.text:SetTextColor(r * 6/7, g * 6/7, b * 6/7)
-- end
-- else
-- if(highlight) then
-- line.text:SetTextColor(6/7, 6/7, 6/7)
-- if(line.square) then
-- line.square:SetBackdropColor(1/5, 1/2, 4/5)
-- end
-- else
-- line.text:SetTextColor(5/7, 5/7, 5/7)
-- if(line.square) then
-- if(IsSuperTracked(self)) then
-- line.square:SetBackdropColor(5/7, 1/5, 1/5)
-- else
-- line.square:SetBackdropColor(4/5, 4/5, 1/5)
-- end
-- end
-- end
-- end
-- end
-- end
-- end
-- ------------------------------------------------------------------------
-- -- Actual skinning of quests (also creating squares)
-- ------------------------------------------------------------------------
-- local nextLine = 1
-- local function SkinLine()
-- for index = nextLine, 50 do
-- local line = _G['ObjectiveTrackerFrameLine' .. index]
-- if(line) then
-- SetFontStyle(line.text)
-- line.dash:SetAlpha(0)
-- local square = CreateFrame('Frame', nil, line)
-- square:SetPoint('TOPRIGHT', line, 'TOPLEFT', 6, -6)
-- square:SetSize(6, 6)
-- square:SetBackdrop(backdrop)
-- square:SetBackdropColor(4/5, 4/5, 1/5)
-- square:SetBackdropBorderColor(0, 0, 0)
-- line.square = square
-- if(line.hasDash) then
-- square:Show()
-- else
-- square:Hide()
-- end
-- else
-- nextLine = index
-- break
-- end
-- end
-- for index = 1, #WATCHFRAME_LINKBUTTONS do
-- HighlightLine(WATCHFRAME_LINKBUTTONS[index], false)
-- end
-- end
-- local nextScenarioLine = 1
-- local function SkinScenarioLine()
-- for index = nextScenarioLine, 50 do
-- local line = _G['ObjectiveTrackerFrameScenarioLine' .. index]
-- if(line) then
-- SetFontStyle(line.text)
-- local square = CreateFrame('Frame', nil, line)
-- square:SetPoint('TOPRIGHT', line, 'TOPLEFT', 6, -6)
-- square:SetSize(6, 6)
-- square:SetBackdrop(backdrop)
-- square:SetBackdropColor(4/5, 4/5, 1/5)
-- square:SetBackdropBorderColor(0, 0, 0)
-- line.square = square
-- line.icon:Hide()
-- else
-- nextScenarioLine = index
-- break
-- end
-- end
-- local _, _, numCriteria = C_Scenario.GetStepInfo()
-- for index = 1, numCriteria do
-- local text, _, completed = C_Scenario.GetCriteriaInfo(index)
-- for lineIndex = 1, nextScenarioLine do
-- local line = _G['ObjectiveTrackerFrameScenarioLine' .. lineIndex]
-- if(line and string.find(line.text:GetText(), text)) then
-- if(completed) then
-- line.square:SetBackdropColor(0, 1, 0)
-- else
-- line.square:SetBackdropColor(4/5, 4/5, 4/5)
-- end
-- end
-- end
-- end
-- end
-- ------------------------------------------------------------------------
-- -- Modifying the click track behavior
-- -- Taken from Mythology
-- ------------------------------------------------------------------------
-- local origClick
-- local function ClickLine(self, button, ...)
-- if(button == 'RightButton' and not IsShiftKeyDown() and self.type == 'QUEST') then
-- local _, _, _, _, _, _, _, _, questID = GetQuestLogTitle(GetQuestIndexForWatch(self.index))
-- QuestPOI_SelectButtonByQuestId('ObjectiveTrackerFrameLines', questID, true)
-- if(WorldMapFrame:IsShown()) then
-- WorldMapFrame_SelectQuestById(questID)
-- end
-- SetSuperTrackedQuestID(questID)
-- for index = 1, #WATCHFRAME_LINKBUTTONS do
-- if(index ~= self.index) then
-- HighlightLine(WATCHFRAME_LINKBUTTONS[index], false)
-- end
-- end
-- else
-- origClick(self, button, ...)
-- end
-- end
-- ------------------------------------------------------------------------
-- -- Removing the circled ?
-- ------------------------------------------------------------------------
-- hooksecurefunc('QuestPOI_DisplayButton', function(name, type, index)
-- if(name == 'ObjectiveTrackerFrameLines') then
-- _G['poi' .. name .. type .. '_' .. index]:Hide()
-- end
-- end)
-- local function null() end
-- ------------------------------------------------------------------------
-- -- The actual Setup
-- ------------------------------------------------------------------------
-- local Handler = CreateFrame('Frame')
-- Handler:RegisterEvent('PLAYER_LOGIN')
-- Handler:SetScript('OnEvent', function(self, event)
-- hooksecurefunc('ObjectiveTrackerFrame_Update', SkinLine)
-- hooksecurefunc('ObjectiveTrackerFrameScenario_UpdateScenario', SkinScenarioLine)
-- -----------------------------
-- -- Click behavior
-- origClick = ObjectiveTrackerFrameLinkButtonTemplate_OnClick
-- ObjectiveTrackerFrameLinkButtonTemplate_OnClick = ClickLine
-- ObjectiveTrackerFrameLinkButtonTemplate_Highlight = HighlightLine
-----------------------------
-- -- Positioning
-- ObjectiveTrackerFrame:ClearAllPoints()
-- ObjectiveTrackerFrame:SetPoint('TOPLEFT', 15, -10)
-- ObjectiveTrackerFrame:SetHeight(UIParent:GetHeight() - 300)
-- ObjectiveTrackerFrame.SetPoint = null
-- ObjectiveTrackerFrame.ClearAllPoints = null
-- -----------------------------
-- -- Changing the header
-- SetFontStyle(ObjectiveTrackerFrameTitle)
-- SetFontStyle(ObjectiveTrackerFrameScenarioFrame.ScrollChild.TextHeader.text)
-- ObjectiveTrackerFrameScenarioFrame.ScrollChild.TextHeader.text:SetTextColor(0.85, 0.85, 0)
-- -----------------------------
-- -- Skinning the button
-- ObjectiveTrackerFrameCollapseExpandButton:SetNormalTexture([[Interface\AddOns\Hyperbole\UI-Panel-QuestHideButton]])
-- ObjectiveTrackerFrameCollapseExpandButton:SetPushedTexture([[Interface\AddOns\Hyperbole\UI-Panel-QuestHideButton]])
-- SkinScenarioLine()
-- WorldMapPlayerUpper:EnableMouse(false)
-- WorldMapPlayerLower:EnableMouse(false)
-- end)