vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | MonkeyQuest: |
||
4 | Displays your quests for quick viewing. |
||
5 | |||
6 | Website: http://wow.visualization.ca/ |
||
7 | Author: Trentin (monkeymods@gmail.com) |
||
8 | |||
9 | |||
10 | Contributors: |
||
11 | Celdor |
||
12 | - Help with the Quest Log Freeze bug |
||
13 | |||
14 | Diungo |
||
15 | - Toggle grow direction |
||
16 | |||
17 | Pkp |
||
18 | - Color Quest Titles the same as the quest level |
||
19 | |||
20 | wowpendium.de |
||
21 | - German translation |
||
22 | |||
23 | MarsMod |
||
24 | - Valid player name before the VARIABLES_LOADED event bug |
||
25 | - Settings resetting bug |
||
26 | |||
27 | Dunewarrior |
||
28 | - Tooltip update for WoW 1.7.0 |
||
29 | |||
30 | Global |
||
31 | - PvP Quests |
||
32 | |||
33 | --]] |
||
34 | |||
35 | -- script variables not saved |
||
36 | MonkeyQuest = {}; |
||
37 | MonkeyQuest.m_bLoaded = false; -- true when the config variables are loaded |
||
38 | MonkeyQuest.m_bVariablesLoaded = false; |
||
39 | MonkeyQuest.m_iNumQuestButtons = 40; -- 40 is the max possible entries in the quest log (20 quests and 20 different locations) |
||
40 | MonkeyQuest.m_iMaxTextWidth = 229; -- wraps the text if it gets too long, mostly needed for objectives |
||
41 | MonkeyQuest.m_strPlayer = ""; |
||
42 | MonkeyQuest.m_aQuestList = {}; |
||
43 | MonkeyQuest.m_aQuestItemList = {}; |
||
44 | MonkeyQuest.m_bGotQuestLogUpdate = false; |
||
45 | MonkeyQuest.m_bNeedRefresh = false; |
||
46 | MonkeyQuest.m_fTimeSinceRefresh = 0.0; |
||
47 | MonkeyQuest.m_bCleanQuestList = true; -- used to clean up the hidden list on the first questlog update event |
||
48 | |||
49 | MonkeyQuest.m_colourBorder = { r = TOOLTIP_DEFAULT_COLOR.r, g = TOOLTIP_DEFAULT_COLOR.g, b = TOOLTIP_DEFAULT_COLOR.b }; |
||
50 | |||
51 | |||
52 | |||
53 | function MonkeyQuest_OnLoad() |
||
54 | |||
55 | -- register events |
||
56 | this:RegisterEvent('VARIABLES_LOADED'); |
||
57 | this:RegisterEvent('QUEST_LOG_UPDATE'); -- used to know when to refresh the MonkeyQuest text |
||
58 | this:RegisterEvent('UNIT_NAME_UPDATE'); -- this is the event I use to get per character config settings |
||
59 | this:RegisterEvent('PLAYER_ENTERING_WORLD'); -- this event gives me a good character name in situations where 'UNIT_NAME_UPDATE' doesn't even trigger |
||
60 | this:RegisterEvent('PLAYER_LEVEL_UP'); -- when you level up the difficulty of some quests may change |
||
61 | |||
62 | -- events when zone changes to update the zone highlighting quests |
||
63 | this:RegisterEvent('ZONE_CHANGED'); |
||
64 | this:RegisterEvent('ZONE_CHANGED_INDOORS'); |
||
65 | this:RegisterEvent('ZONE_CHANGED_NEW_AREA'); |
||
66 | |||
67 | |||
68 | -- initialize the border and backdrop of the main frame |
||
69 | --this:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
||
70 | --this:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, 0); |
||
71 | |||
72 | -- setup the title of the main frame |
||
73 | MonkeyQuestTitleText:SetText(MONKEYQUEST_TITLE); |
||
74 | MonkeyQuestTitleText:SetTextColor(MONKEYLIB_TITLE_COLOUR.r, MONKEYLIB_TITLE_COLOUR.g, MONKEYLIB_TITLE_COLOUR.b); |
||
75 | MonkeyQuestTitleText:Show(); |
||
76 | |||
77 | MonkeyQuestSlash_Init(); |
||
78 | |||
79 | -- overide af tooltip functions |
||
80 | MonkeyQuest_OLD_aftt_setName = aftt_setName; |
||
81 | aftt_setName = MonkeyQuest_NEW_aftt_setName; |
||
82 | |||
83 | -- this will catch mobs needed for quests |
||
84 | this:RegisterEvent('UPDATE_MOUSEOVER_UNIT'); |
||
85 | |||
86 | -- this should catch items when you're going to sell them |
||
87 | MonkeyQuest_OLD_ContainerFrameItemButton_OnEnter = ContainerFrameItemButton_OnEnter; |
||
88 | ContainerFrameItemButton_OnEnter = MonkeyQuest_NEW_ContainerFrameItemButton_OnEnter; |
||
89 | |||
90 | end |
||
91 | |||
92 | function MonkeyQuest_OnUpdate(arg1) |
||
93 | -- if not loaded yet then get out |
||
94 | if (MonkeyQuest.m_bLoaded == false) then |
||
95 | return; |
||
96 | end |
||
97 | |||
98 | -- need to make sure we don't read from the quest list before a QUEST_LOG_UPDATE or we'll get the previous character's data |
||
99 | if (MonkeyQuest.m_bGotQuestLogUpdate == false) then |
||
100 | return; |
||
101 | end |
||
102 | |||
103 | -- update the timer |
||
104 | MonkeyQuest.m_fTimeSinceRefresh = MonkeyQuest.m_fTimeSinceRefresh + arg1; |
||
105 | |||
106 | -- if it's been more than MONKEYQUEST_DELAY seconds and we need to process a dropped QUEST_LOG_UPDATE |
||
107 | if (MonkeyQuest.m_fTimeSinceRefresh > MONKEYQUEST_DELAY and MonkeyQuest.m_bNeedRefresh == true) then |
||
108 | MonkeyQuest_Refresh(); |
||
109 | end |
||
110 | |||
111 | if (MonkeyQuest.m_bCleanQuestList == true) then |
||
112 | if (MonkeyQuest.m_fTimeSinceRefresh > 15.0) then |
||
113 | MonkeyQuestInit_CleanQuestList(); |
||
114 | MonkeyQuest.m_bCleanQuestList = false; |
||
115 | end |
||
116 | end |
||
117 | end |
||
118 | |||
119 | function MonkeyQuest_OnQuestLogUpdate() |
||
120 | |||
121 | -- if everything's been loaded, refresh the Quest Monkey Display |
||
122 | if (MonkeyQuest.m_bLoaded == true) then |
||
123 | if (MonkeyQuest.m_bNeedRefresh == true) then |
||
124 | -- don't process, let the OnUpdate catch it, but reset the timer |
||
125 | MonkeyQuest.m_fTimeSinceRefresh = 0.0; |
||
126 | else |
||
127 | MonkeyQuest.m_bNeedRefresh = true; |
||
128 | MonkeyQuest.m_fTimeSinceRefresh = 0.0; |
||
129 | end |
||
130 | end |
||
131 | end |
||
132 | |||
133 | -- OnEvent Function |
||
134 | function MonkeyQuest_OnEvent(event) |
||
135 | |||
136 | if (event == 'VARIABLES_LOADED') then |
||
137 | -- this event gets called when the variables are loaded |
||
138 | -- there's a possible situation where the other events might get a valid |
||
139 | -- player name BEFORE this event, which resets your config settings :( |
||
140 | |||
141 | MonkeyQuest.m_bVariablesLoaded = true; |
||
142 | |||
143 | -- double check that the mod isn't already loaded |
||
144 | if (not MonkeyQuest.m_bLoaded) then |
||
145 | |||
146 | MonkeyQuest.m_strPlayer = UnitName('player'); |
||
147 | |||
148 | -- if MonkeyQuest.m_strPlayer is UNKNOWNOBJECT get out, need a real name |
||
149 | if (MonkeyQuest.m_strPlayer ~= nil and MonkeyQuest.m_strPlayer ~= UNKNOWNOBJECT) then |
||
150 | -- should have a valid player name here |
||
151 | MonkeyQuestInit_LoadConfig(); |
||
152 | end |
||
153 | end |
||
154 | |||
155 | -- exit this event |
||
156 | return; |
||
157 | |||
158 | end -- VARIABLES_LOADED |
||
159 | |||
160 | if (event == 'UNIT_NAME_UPDATE') then |
||
161 | -- this event gets called whenever a unit's name changes (supposedly) |
||
162 | -- Note: Sometimes it gets called when unit's name gets set to |
||
163 | -- UNKNOWNOBJECT |
||
164 | |||
165 | -- double check that the mod isn't already loaded |
||
166 | if (not MonkeyQuest.m_bLoaded) then |
||
167 | -- this is the first place I know that reliably gets the player name |
||
168 | MonkeyQuest.m_strPlayer = UnitName('player'); |
||
169 | |||
170 | -- if MonkeyQuest.m_strPlayer is UNKNOWNOBJECT get out, need a real name |
||
171 | if (MonkeyQuest.m_strPlayer ~= nil and MonkeyQuest.m_strPlayer ~= UNKNOWNOBJECT) then |
||
172 | -- should have a valid player name here |
||
173 | MonkeyQuestInit_LoadConfig(); |
||
174 | end |
||
175 | end |
||
176 | |||
177 | -- exit this event |
||
178 | return; |
||
179 | |||
180 | end -- UNIT_NAME_UPDATE |
||
181 | |||
182 | if (event == 'PLAYER_ENTERING_WORLD') then |
||
183 | -- this event gets called when the player enters the world |
||
184 | -- Note: on initial login this event will not give a good player name |
||
185 | |||
186 | -- double check that the mod isn't already loaded |
||
187 | if (not MonkeyQuest.m_bLoaded) then |
||
188 | |||
189 | MonkeyQuest.m_strPlayer = UnitName('player'); |
||
190 | |||
191 | -- if MonkeyQuest.m_strPlayer is UNKNOWNOBJECT get out, need a real name |
||
192 | if (MonkeyQuest.m_strPlayer ~= nil and MonkeyQuest.m_strPlayer ~= UNKNOWNOBJECT) then |
||
193 | -- should have a valid player name here |
||
194 | MonkeyQuestInit_LoadConfig(); |
||
195 | end |
||
196 | end |
||
197 | |||
198 | -- exit this event |
||
199 | return; |
||
200 | |||
201 | end -- PLAYER_ENTERING_WORLD |
||
202 | |||
203 | if (event == 'QUEST_LOG_UPDATE') then |
||
204 | MonkeyQuest.m_bGotQuestLogUpdate = true; |
||
205 | MonkeyQuest_OnQuestLogUpdate(); |
||
206 | return; |
||
207 | end -- QUEST_LOG_UPDATE |
||
208 | |||
209 | if (event == 'ZONE_CHANGED' or event == 'ZONE_CHANGED_INDOORS' or event == 'ZONE_CHANGED_NEW_AREA') then |
||
210 | MonkeyQuest_Refresh(); |
||
211 | end -- ZONE_CHANGED |
||
212 | |||
213 | if (event == 'PLAYER_LEVEL_UP') then |
||
214 | MonkeyQuest_Refresh(); |
||
215 | end -- PLAYER_LEVEL_UP |
||
216 | |||
217 | if (event == 'TOOLTIP_ANCHOR_DEFAULT') then |
||
218 | |||
219 | if (MonkeyQuest_SearchTooltip() == true) then |
||
220 | GameTooltip:AddLine(MONKEYQUEST_TOOLTIP_QUESTITEM, MONKEYLIB_TITLE_COLOUR.r, MONKEYLIB_TITLE_COLOUR.g, MONKEYLIB_TITLE_COLOUR.b, 1); |
||
221 | GameTooltip:SetHeight(GameTooltip:GetHeight() + 14); |
||
222 | end |
||
223 | end -- TOOLTIP_ANCHOR_DEFAULT |
||
224 | |||
225 | if (event == 'UPDATE_MOUSEOVER_UNIT') then |
||
226 | -- check if this is a quest item |
||
227 | MonkeyQuest_SearchTooltip(); |
||
228 | end -- UPDATE_MOUSEOVER_UNIT |
||
229 | end |
||
230 | |||
231 | -- this function is called when the frame should be dragged around |
||
232 | function MonkeyQuest_OnMouseDown(arg1) |
||
233 | -- if not loaded yet then get out |
||
234 | if (MonkeyQuest.m_bLoaded == false) then |
||
235 | return; |
||
236 | end |
||
237 | |||
238 | -- left button moves the frame around |
||
239 | if (arg1 == "LeftButton" and MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLocked == false) then |
||
240 | MonkeyQuestFrame:StartMoving(); |
||
241 | end |
||
242 | |||
243 | -- right button on the title or frame opens up the MonkeyBuddy, if it's there |
||
244 | if (arg1 == "RightButton" and MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bAllowRightClick == true) then |
||
245 | if (MonkeyBuddyFrame ~= nil) then |
||
246 | ShowUIPanel(MonkeyBuddyFrame); |
||
247 | |||
248 | -- make MonkeyBuddy show the MonkeyQuest config |
||
249 | MonkeyBuddyQuestTab_OnClick(); |
||
250 | end |
||
251 | end |
||
252 | end |
||
253 | |||
254 | -- this function is called when the frame is stopped being dragged around |
||
255 | function MonkeyQuest_OnMouseUp(arg1) |
||
256 | -- if not loaded yet then get out |
||
257 | if (MonkeyQuest.m_bLoaded == false) then |
||
258 | return; |
||
259 | end |
||
260 | |||
261 | if (arg1 == "LeftButton") then |
||
262 | MonkeyQuestFrame:StopMovingOrSizing(); |
||
263 | |||
264 | -- save the position |
||
265 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft = MonkeyQuestFrame:GetLeft(); |
||
266 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop = MonkeyQuestFrame:GetTop(); |
||
267 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom = MonkeyQuestFrame:GetBottom(); |
||
268 | end |
||
269 | end |
||
270 | |||
271 | function MonkeyQuest_OnEnter() |
||
272 | |||
273 | -- BIB support |
||
274 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB == true) then |
||
275 | MonkeyQuestFrame:Show(); |
||
276 | end |
||
277 | end |
||
278 | |||
279 | function MonkeyQuest_OnLeave() |
||
280 | |||
281 | -- BIB support |
||
282 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB == true) then |
||
283 | MonkeyQuest_Hide(); |
||
284 | end |
||
285 | end |
||
286 | |||
287 | function MonkeyQuestCloseButton_OnClick() |
||
288 | |||
289 | -- if not loaded yet then get out |
||
290 | if (MonkeyQuest.m_bLoaded == false) then |
||
291 | return; |
||
292 | end |
||
293 | |||
294 | MonkeyQuest_Hide(); |
||
295 | end |
||
296 | |||
297 | function MonkeyQuestCloseButton_OnEnter() |
||
298 | -- no noob tip? |
||
299 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then |
||
300 | return; |
||
301 | end |
||
302 | |||
303 | -- put the tool tip in the default position |
||
304 | GameTooltip:SetOwner(this, "ANCHOR_TOPRIGHT"); |
||
305 | |||
306 | -- set the tool tip text |
||
307 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
308 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_CLOSE, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
309 | GameTooltip:AddLine(MONKEYQUEST_HELP_OPEN_MSG, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
310 | |||
311 | |||
312 | GameTooltip:Show(); |
||
313 | end |
||
314 | |||
315 | function MonkeyQuestMinimizeButton_OnClick() |
||
316 | |||
317 | -- if not loaded yet then get out |
||
318 | if (MonkeyQuest.m_bLoaded == false) then |
||
319 | return; |
||
320 | end |
||
321 | |||
322 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized = not MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized; |
||
323 | |||
324 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized == true) then |
||
325 | MonkeyQuestMinimizeButton:SetNormalTexture("Interface\\AddOns\\MonkeyLibrary\\Textures\\MinimizeButton-Down"); |
||
326 | else |
||
327 | MonkeyQuestMinimizeButton:SetNormalTexture("Interface\\AddOns\\MonkeyLibrary\\Textures\\MinimizeButton-Up"); |
||
328 | end |
||
329 | |||
330 | MonkeyQuest_Refresh(); |
||
331 | end |
||
332 | |||
333 | function MonkeyQuestMinimizeButton_OnEnter() |
||
334 | -- no noob tip? |
||
335 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then |
||
336 | return; |
||
337 | end |
||
338 | |||
339 | -- put the tool tip in the default position |
||
340 | GameTooltip:SetOwner(this, "ANCHOR_TOPRIGHT"); |
||
341 | |||
342 | -- set the tool tip text |
||
343 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
344 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized) then |
||
345 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_RESTORE, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
346 | else |
||
347 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_MINIMIZE, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
348 | end |
||
349 | |||
350 | GameTooltip:Show(); |
||
351 | end |
||
352 | |||
353 | function MonkeyQuestShowHiddenCheckButton_OnClick() |
||
354 | |||
355 | -- if not loaded yet then get out |
||
356 | if (MonkeyQuest.m_bLoaded == false) then |
||
357 | return; |
||
358 | end |
||
359 | |||
360 | if (this:GetChecked()) then |
||
361 | PlaySound("igMainMenuOptionCheckBoxOff"); |
||
362 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden = true; |
||
363 | else |
||
364 | PlaySound("igMainMenuOptionCheckBoxOn"); |
||
365 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden = false; |
||
366 | end |
||
367 | |||
368 | MonkeyQuest_Refresh(); |
||
369 | end |
||
370 | |||
371 | function MonkeyQuestShowHiddenCheckButton_OnEnter() |
||
372 | |||
373 | -- no noob tip? |
||
374 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then |
||
375 | return; |
||
376 | end |
||
377 | |||
378 | -- put the tool tip in the default position |
||
379 | GameTooltip:SetOwner(this, "ANCHOR_TOPRIGHT"); |
||
380 | |||
381 | -- set the tool tip text |
||
382 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
383 | if (this:GetChecked()) then |
||
384 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_HIDEALLHIDDEN, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
385 | else |
||
386 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_SHOWALLHIDDEN, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
387 | end |
||
388 | |||
389 | GameTooltip:Show(); |
||
390 | end |
||
391 | |||
392 | function MonkeyQuest_Show() |
||
393 | |||
394 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bDisplay = true; |
||
395 | MonkeyQuestFrame:Show(); |
||
396 | MonkeyQuest_Refresh(); |
||
397 | end |
||
398 | |||
399 | function MonkeyQuest_Hide() |
||
400 | |||
401 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bDisplay = false; |
||
402 | MonkeyQuestFrame:Hide(); |
||
403 | end |
||
404 | |||
405 | function MonkeyQuest_SetAlpha(iAlpha) |
||
406 | |||
407 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iAlpha = iAlpha; |
||
408 | MonkeyQuestFrame:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, iAlpha); |
||
409 | |||
410 | --MonkeyQuestFrame:SetAlpha(0.5); |
||
411 | end |
||
412 | |||
413 | function MonkeyQuest_SetFrameAlpha(iAlpha) |
||
414 | |||
415 | MonkeyQuestFrame:SetAlpha(iAlpha); |
||
416 | end |
||
417 | |||
418 | function MonkeyQuest_Refresh() |
||
419 | |||
420 | -- if not loaded yet, get outta here |
||
421 | if (MonkeyQuest.m_bLoaded == false) then |
||
422 | return; |
||
423 | end |
||
424 | |||
425 | -- BIB bad options check |
||
426 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB == true) then |
||
427 | if (BIB_MonkeyQuestButton ~= nil) then |
||
428 | if (not BIB_MonkeyQuestButton:IsShown()) then |
||
429 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB = false; |
||
430 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor = "ANCHOR_TOPLEFT"; |
||
431 | MonkeyQuest_Show(); |
||
432 | end |
||
433 | else |
||
434 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB = false; |
||
435 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor = "ANCHOR_TOPLEFT"; |
||
436 | MonkeyQuest_Show(); |
||
437 | end |
||
438 | end |
||
439 | |||
440 | -- set the check state of the MonkeyQuestShowHiddenCheckButton |
||
441 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden == true) then |
||
442 | MonkeyQuestShowHiddenCheckButton:SetChecked(1); |
||
443 | else |
||
444 | MonkeyQuestShowHiddenCheckButton:SetChecked(0); |
||
445 | end |
||
446 | |||
447 | -- make sure the minimize button has the right texture |
||
448 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized == true) then |
||
449 | MonkeyQuestMinimizeButton:SetNormalTexture("Interface\\AddOns\\MonkeyLibrary\\Textures\\MinimizeButton-Down"); |
||
450 | else |
||
451 | MonkeyQuestMinimizeButton:SetNormalTexture("Interface\\AddOns\\MonkeyLibrary\\Textures\\MinimizeButton-Up"); |
||
452 | end |
||
453 | |||
454 | local strMonkeyQuestBody = ""; |
||
455 | local colour; |
||
456 | local strTitleColor; |
||
457 | local iButtonId = 1; |
||
458 | local bNextHeader = false; |
||
459 | |||
460 | -- Remember the currently selected quest log entry |
||
461 | local tmpQuestLogSelection = GetQuestLogSelection(); |
||
462 | |||
463 | local iNumEntries, iNumQuests = GetNumQuestLogEntries(); |
||
464 | |||
465 | MonkeyQuestTitleText:SetTextHeight(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFontHeight + 2); |
||
466 | -- set the title, with or without the number of quests |
||
467 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNumQuests == true) then |
||
468 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bHideTitle == false) then |
||
469 | MonkeyQuestTitleText:SetText(MONKEYQUEST_TITLE .. " " .. iNumQuests .. "/" .. MAX_QUESTLOG_QUESTS); |
||
470 | else |
||
471 | MonkeyQuestTitleText:SetText(iNumQuests .. "/" .. MAX_QUESTLOG_QUESTS); |
||
472 | end |
||
473 | elseif (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bHideTitle == false) then |
||
474 | MonkeyQuestTitleText:SetText(MONKEYQUEST_TITLE); |
||
475 | else |
||
476 | MonkeyQuestTitleText:SetText(""); |
||
477 | end |
||
478 | |||
479 | -- update the BIB text |
||
480 | if (BIB_MonkeyQuestButton_GetButtonText) then |
||
481 | BIB_MonkeyQuestButton_GetButtonText(); |
||
482 | end |
||
483 | |||
484 | |||
485 | MonkeyQuest.m_iNumEntries = iNumEntries; |
||
486 | |||
487 | -- hide all the text buttons |
||
488 | for i = 1, MonkeyQuest.m_iNumQuestButtons, 1 do |
||
489 | getglobal("MonkeyQuestButton" .. i .. "Text"):SetText(""); |
||
490 | getglobal("MonkeyQuestButton" .. i .. "Text"):Hide(); |
||
491 | getglobal("MonkeyQuestButton" .. i):Hide(); |
||
492 | getglobal("MonkeyQuestHideButton" .. i):Hide(); |
||
493 | getglobal("MonkeyQuestButton" .. i .. "Text"):SetWidth(MonkeyQuestFrame:GetWidth() - MONKEYQUEST_PADDING - 8); |
||
494 | getglobal("MonkeyQuestButton" .. i .. "Text"):SetTextHeight(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFontHeight); |
||
495 | end |
||
496 | |||
497 | |||
498 | MonkeyQuest_RefreshQuestItemList(); |
||
499 | |||
500 | |||
501 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bMinimized == false) then |
||
502 | |||
503 | for i = 1, iNumEntries, 1 do |
||
504 | -- strQuestLogTitleText the title text of the quest, may be a header (ex. Wetlands) |
||
505 | -- strQuestLevel the level of the quest |
||
506 | -- strQuestTag the tag on the quest (ex. COMPLETED) |
||
507 | local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(i); |
||
508 | |||
509 | -- are we looking for the next header? |
||
510 | if (bNextHeader == true and isHeader) then |
||
511 | -- no longer skipping quests |
||
512 | bNextHeader = false; |
||
513 | end |
||
514 | |||
515 | if (bNextHeader == false) then |
||
516 | -- no longer looking for the next header |
||
517 | -- Select the quest log entry for other functions like GetNumQuestLeaderBoards() |
||
518 | SelectQuestLogEntry(i); |
||
519 | |||
520 | -- double check this quest is in the hidden list, if not, it's a new quest |
||
521 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText] == nil) then |
||
522 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText] = {}; |
||
523 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText].m_bChecked = true; |
||
524 | end |
||
525 | |||
526 | if (isHeader) then |
||
527 | |||
528 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText].m_bChecked == true) then |
||
529 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bNoHeaders == false or |
||
530 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden == true or |
||
531 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bAlwaysHeaders == true) then |
||
532 | |||
533 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
534 | format(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strHeaderOpenColour .. "%s|r", |
||
535 | "- " .. strQuestLogTitleText) .. "\n"; |
||
536 | |||
537 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):SetText(strMonkeyQuestBody); |
||
538 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):Show(); |
||
539 | getglobal("MonkeyQuestButton" .. iButtonId):Show(); |
||
540 | |||
541 | -- set the bg colour |
||
542 | getglobal("MonkeyQuestButton" .. iButtonId .. "Texture"):SetVertexColor(0.0, 0.0, 0.0, 0.0); |
||
543 | |||
544 | getglobal("MonkeyQuestButton" .. iButtonId).m_iQuestIndex = i; |
||
545 | getglobal("MonkeyQuestButton" .. iButtonId).id = iButtonId; |
||
546 | |||
547 | getglobal("MonkeyQuestHideButton" .. iButtonId):Hide(); |
||
548 | getglobal("MonkeyQuestHideButton" .. iButtonId).m_strQuestLogTitleText = strQuestLogTitleText; |
||
549 | |||
550 | iButtonId = iButtonId + 1; |
||
551 | |||
552 | strMonkeyQuestBody = ""; |
||
553 | end |
||
554 | else |
||
555 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden == true or |
||
556 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bAlwaysHeaders == true) then |
||
557 | |||
558 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
559 | format(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strHeaderClosedColour .. "%s|r", |
||
560 | "+ " .. strQuestLogTitleText) .. "\n"; |
||
561 | |||
562 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):SetText(strMonkeyQuestBody); |
||
563 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):Show(); |
||
564 | getglobal("MonkeyQuestButton" .. iButtonId):Show(); |
||
565 | |||
566 | -- set the bg colour |
||
567 | getglobal("MonkeyQuestButton" .. iButtonId .. "Texture"):SetVertexColor(0.0, 0.0, 0.0, 0.0); |
||
568 | |||
569 | getglobal("MonkeyQuestButton" .. iButtonId).m_iQuestIndex = i; |
||
570 | getglobal("MonkeyQuestButton" .. iButtonId).id = iButtonId; |
||
571 | |||
572 | getglobal("MonkeyQuestHideButton" .. iButtonId):Hide(); |
||
573 | getglobal("MonkeyQuestHideButton" .. iButtonId).m_strQuestLogTitleText = strQuestLogTitleText; |
||
574 | |||
575 | iButtonId = iButtonId + 1; |
||
576 | |||
577 | strMonkeyQuestBody = ""; |
||
578 | end |
||
579 | -- keep looping through the list until we find the next header |
||
580 | bNextHeader = true; |
||
581 | end |
||
582 | else |
||
583 | -- check if the user even wants this displayed |
||
584 | if ((MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText].m_bChecked == true or |
||
585 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden) and |
||
586 | (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bHideCompletedQuests == false or |
||
587 | (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bHideCompletedQuests == true and not isComplete) or |
||
588 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden)) then |
||
589 | |||
590 | -- the user has this quest checked off or he's showing all quests anyways, so we show it |
||
591 | getglobal("MonkeyQuestHideButton" .. iButtonId):Show(); |
||
592 | |||
593 | -- update hide quests buttons |
||
594 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[strQuestLogTitleText].m_bChecked == true) then |
||
595 | getglobal("MonkeyQuestHideButton" .. iButtonId):SetChecked(1); |
||
596 | else |
||
597 | getglobal("MonkeyQuestHideButton" .. iButtonId):SetChecked(0); |
||
598 | end |
||
599 | |||
600 | getglobal("MonkeyQuestHideButton" .. iButtonId).m_strQuestLogTitleText = strQuestLogTitleText; |
||
601 | |||
602 | |||
603 | |||
604 | colour = GetDifficultyColor(strQuestLevel); |
||
605 | |||
606 | -- Begin Pkp Changes |
||
607 | if(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bColourTitle) then |
||
608 | strTitleColor = format("|c%02X%02X%02X%02X", 255, colour.r * 255, colour.g * 255, colour.b * 255); |
||
609 | else |
||
610 | strTitleColor = MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strQuestTitleColour; |
||
611 | end |
||
612 | |||
613 | -- padding |
||
614 | strMonkeyQuestBody = strMonkeyQuestBody .. " "; |
||
615 | |||
616 | -- check if the user wants the quest levels |
||
617 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowQuestLevel == true) then |
||
618 | |||
619 | if (strQuestTag == ELITE) then |
||
620 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
621 | format("|c%02X%02X%02X%02X%s|r", 255, colour.r * 255, colour.g * 255, colour.b * 255, |
||
622 | "[" .. strQuestLevel .. "+] "); |
||
623 | |||
624 | elseif (strQuestTag == MONKEYQUEST_DUNGEON) then |
||
625 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
626 | format("|c%02X%02X%02X%02X%s|r", 255, colour.r * 255, colour.g * 255, colour.b * 255, |
||
627 | "[" .. strQuestLevel .. "d] "); |
||
628 | |||
629 | elseif (strQuestTag == RAID) then |
||
630 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
631 | format("|c%02X%02X%02X%02X%s|r", 255, colour.r * 255, colour.g * 255, colour.b * 255, |
||
632 | "[" .. strQuestLevel .. "r] "); |
||
633 | |||
634 | elseif (strQuestTag == MONKEYQUEST_PVP) then |
||
635 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
636 | format("|c%02X%02X%02X%02X%s|r", 255, colour.r * 255, colour.g * 255, colour.b * 255, |
||
637 | "[" .. strQuestLevel .. "p] "); |
||
638 | else |
||
639 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
640 | format("|c%02X%02X%02X%02X%s|r", 255, colour.r * 255, colour.g * 255, colour.b * 255, |
||
641 | "[" .. strQuestLevel .. "] "); |
||
642 | end |
||
643 | end |
||
644 | |||
645 | -- add the completed tag, if needed |
||
646 | if (isComplete and isComplete < 0) then |
||
647 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
648 | format(strTitleColor .. "%s|r", strQuestLogTitleText) .. |
||
649 | " (" .. MONKEYQUEST_QUEST_FAILED .. ")\n"; |
||
650 | elseif (isComplete and isComplete > 0) then |
||
651 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
652 | format(strTitleColor .. "%s|r", strQuestLogTitleText) .. |
||
653 | " (" .. MONKEYQUEST_QUEST_DONE .. ")\n"; |
||
654 | else |
||
655 | strMonkeyQuestBody = strMonkeyQuestBody .. |
||
656 | format(strTitleColor .. "%s|r", strQuestLogTitleText) .. "\n"; |
||
657 | end |
||
658 | |||
659 | |||
660 | local strQuestDescription, strQuestObjectives = GetQuestLogQuestText(); |
||
661 | |||
662 | if (GetNumQuestLeaderBoards() > 0) then |
||
663 | for ii=1, GetNumQuestLeaderBoards(), 1 do |
||
664 | --local string = getglobal("QuestLogObjective"..ii); |
||
665 | local strLeaderBoardText, strType, iFinished = GetQuestLogLeaderBoard(ii); |
||
666 | |||
667 | MonkeyQuest_AddQuestItemToList(strLeaderBoardText); |
||
668 | |||
669 | if (strLeaderBoardText) then |
||
670 | if (not iFinished) then |
||
671 | strMonkeyQuestBody = strMonkeyQuestBody .. " " .. MonkeyQuest_GetLeaderboardColorStr(strLeaderBoardText) .. |
||
672 | strLeaderBoardText .. "\n"; |
||
673 | elseif (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bHideCompletedObjectives == false |
||
674 | or MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowHidden) then |
||
675 | strMonkeyQuestBody = strMonkeyQuestBody .. " " .. |
||
676 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour .. |
||
677 | strLeaderBoardText .. "\n"; |
||
678 | end |
||
679 | end |
||
680 | end |
||
681 | elseif (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bObjectives) then |
||
682 | -- this quest has no leaderboard so display the objective instead if the config is set |
||
683 | |||
684 | strMonkeyQuestBody = strMonkeyQuestBody .. " " .. |
||
685 | format(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strOverviewColour .. "%s|r", |
||
686 | strQuestObjectives) .. "\n"; |
||
687 | --format("|c%02X%02X%02X%02X%s|r", 255, GRAY_FONT_COLOR.r * 255, GRAY_FONT_COLOR.g * 255, |
||
688 | --GRAY_FONT_COLOR.b * 255, strQuestObjectives) .. "\n"; |
||
689 | end |
||
690 | |||
691 | -- finally set the text |
||
692 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):SetText(strMonkeyQuestBody); |
||
693 | getglobal("MonkeyQuestButton" .. iButtonId .. "Text"):Show(); |
||
694 | getglobal("MonkeyQuestButton" .. iButtonId):Show(); |
||
695 | |||
696 | -- set the bg colour |
||
697 | getglobal("MonkeyQuestButton" .. iButtonId .. "Texture"):SetVertexColor(0.0, 0.0, 0.0, 0.0); |
||
698 | |||
699 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowZoneHighlight) then |
||
700 | local strSubZoneText = string.lower(GetSubZoneText()); |
||
701 | |||
702 | if (strSubZoneText ~= "") then |
||
703 | if (string.find(string.lower(strQuestDescription), strSubZoneText, 1, true) or |
||
704 | string.find(string.lower(strQuestObjectives), strSubZoneText, 1, true)) then |
||
705 | |||
706 | local a, r, g, b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strZoneHighlightColour); |
||
707 | |||
708 | getglobal("MonkeyQuestButton" .. iButtonId .. "Texture"):SetVertexColor(r, g, b, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iAlpha); |
||
709 | end |
||
710 | end |
||
711 | end |
||
712 | |||
713 | |||
714 | getglobal("MonkeyQuestButton" .. iButtonId).m_iQuestIndex = i; |
||
715 | getglobal("MonkeyQuestButton" .. iButtonId).m_strQuestObjectives = strQuestObjectives; |
||
716 | |||
717 | iButtonId = iButtonId + 1; |
||
718 | |||
719 | strMonkeyQuestBody = ""; |
||
720 | end |
||
721 | end |
||
722 | end |
||
723 | end |
||
724 | end |
||
725 | |||
726 | |||
727 | for i = 1, MonkeyQuest.m_iNumQuestButtons, 1 do |
||
728 | getglobal("MonkeyQuestButton" .. i .. "Text"):SetWidth(MonkeyQuestFrame:GetWidth() - MONKEYQUEST_PADDING - 8); |
||
729 | end |
||
730 | |||
731 | -- Restore the current quest log selection |
||
732 | SelectQuestLogEntry(tmpQuestLogSelection); |
||
733 | |||
734 | MonkeyQuest_Resize(); |
||
735 | -- we don't have a dropped QUEST_LOG_UPDATE anymore |
||
736 | MonkeyQuest.m_bNeedRefresh = false; |
||
737 | MonkeyQuest.m_fTimeSinceRefresh = 0.0; |
||
738 | end |
||
739 | |||
740 | function MonkeyQuest_RefreshQuestItemList() |
||
741 | |||
742 | local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete; |
||
743 | local i; |
||
744 | local iNumEntries, iNumQuests = GetNumQuestLogEntries(); |
||
745 | |||
746 | |||
747 | MonkeyQuest.m_aQuestItemList = nil; |
||
748 | MonkeyQuest.m_aQuestItemList = {}; |
||
749 | |||
750 | for i = 1, iNumEntries, 1 do |
||
751 | -- strQuestLogTitleText the title text of the quest, may be a header (ex. Wetlands) |
||
752 | -- strQuestLevel the level of the quest |
||
753 | -- strQuestTag the tag on the quest (ex. COMPLETED) |
||
754 | strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(i); |
||
755 | |||
756 | if (not isHeader) then |
||
757 | -- Select the quest log entry for other functions like GetNumQuestLeaderBoards() |
||
758 | SelectQuestLogEntry(i); |
||
759 | |||
760 | if (GetNumQuestLeaderBoards() > 0) then |
||
761 | for ii=1, GetNumQuestLeaderBoards(), 1 do |
||
762 | --local string = getglobal("QuestLogObjective"..ii); |
||
763 | local strLeaderBoardText, strType, iFinished = GetQuestLogLeaderBoard(ii); |
||
764 | |||
765 | MonkeyQuest_AddQuestItemToList(strLeaderBoardText); |
||
766 | |||
767 | end |
||
768 | end |
||
769 | end |
||
770 | end |
||
771 | end |
||
772 | |||
773 | -- does a decent job of figuring out if the quest objective is an item and if so adds it to the list |
||
774 | function MonkeyQuest_AddQuestItemToList(strLeaderBoardText) |
||
775 | local i, j, strItemName, iNumItems, iNumNeeded = string.find(strLeaderBoardText, "(.*):%s*([-%d]+)%s*/%s*([-%d]+)%s*$"); |
||
776 | |||
777 | if (iNumItems == nil) then |
||
778 | -- not a quest item |
||
779 | return; |
||
780 | end |
||
781 | |||
782 | i, j = string.find(strItemName, MONKEYQUEST_TOOLTIP_SLAIN); |
||
783 | |||
784 | if (i ~= nil) then |
||
785 | strItemName = string.sub(strItemName, 1, i - 2); |
||
786 | end |
||
787 | |||
788 | if (MonkeyQuest.m_aQuestItemList[strItemName] == nil) then |
||
789 | MonkeyQuest.m_aQuestItemList[strItemName] = {}; |
||
790 | end |
||
791 | |||
792 | MonkeyQuest.m_aQuestItemList[strItemName].m_iNumItems = iNumItems; |
||
793 | MonkeyQuest.m_aQuestItemList[strItemName].m_iNumNeeded = iNumNeeded; |
||
794 | end |
||
795 | |||
796 | function MonkeyQuest_Resize() |
||
797 | |||
798 | local iHeight = 0; |
||
799 | local text; |
||
800 | local button; |
||
801 | local iTextWidth = 0; |
||
802 | local iPadding = MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iQuestPadding; |
||
803 | |||
804 | |||
805 | -- if not loaded yet then get out |
||
806 | if (MonkeyQuest.m_bLoaded == false) then |
||
807 | return; |
||
808 | end |
||
809 | |||
810 | --iTextWidth = MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameWidth - MONKEYQUEST_PADDING - 8; |
||
811 | iTextWidth = MonkeyQuestFrame:GetWidth() - MONKEYQUEST_PADDING - 8; |
||
812 | |||
813 | -- make sure the titlebutton is the right size for the title text |
||
814 | MonkeyQuestTitleButton:SetWidth(MonkeyQuestTitleText:GetWidth()); |
||
815 | MonkeyQuestTitleButton:SetHeight(MonkeyQuestTitleText:GetHeight()); |
||
816 | |||
817 | for i = 1, MonkeyQuest.m_iNumQuestButtons, 1 do |
||
818 | text = getglobal("MonkeyQuestButton" .. i .. "Text"); |
||
819 | button = getglobal("MonkeyQuestButton" .. i); |
||
820 | |||
821 | if (text:IsVisible()) then |
||
822 | text:SetWidth(iTextWidth); |
||
823 | |||
824 | iHeight = iHeight + text:GetHeight() + iPadding; |
||
825 | |||
826 | button:SetWidth(text:GetWidth()); |
||
827 | button:SetHeight(text:GetHeight()); |
||
828 | end |
||
829 | end |
||
830 | |||
831 | iHeight = iHeight + MonkeyQuestTitleText:GetHeight() + MONKEYQUEST_PADDING; |
||
832 | |||
833 | --MonkeyQuestFrame:SetWidth(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameWidth); |
||
834 | MonkeyQuestFrame:SetHeight(iHeight); |
||
835 | |||
836 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft == nil) then |
||
837 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft = 500; |
||
838 | end |
||
839 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop == nil) then |
||
840 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop = 500; |
||
841 | end |
||
842 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom == nil) then |
||
843 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom = 539; |
||
844 | end |
||
845 | |||
846 | |||
847 | |||
848 | -- Set the grow direction |
||
849 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bLockBIB == false) then |
||
850 | -- Added by Diungo |
||
851 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bGrowUp == false) then |
||
852 | MonkeyQuestFrame:ClearAllPoints(); |
||
853 | -- grow down |
||
854 | MonkeyQuestFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", |
||
855 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft, |
||
856 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop); |
||
857 | |||
858 | -- check to see if it grew off the screen |
||
859 | --if (MonkeyQuestFrame:GetBottom() < 0) then |
||
860 | -- MonkeyQuestFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", |
||
861 | -- MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft, |
||
862 | -- MonkeyQuestFrame:GetHeight() - 2); |
||
863 | --end |
||
864 | else |
||
865 | MonkeyQuestFrame:ClearAllPoints(); |
||
866 | -- grow up |
||
867 | MonkeyQuestFrame:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", |
||
868 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft, |
||
869 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom); |
||
870 | |||
871 | -- check to see if it grew off the screen |
||
872 | --if (MonkeyQuestFrame:GetTop() > 1024) then |
||
873 | -- MonkeyQuestFrame:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", |
||
874 | -- MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft, |
||
875 | -- 1024 - (MonkeyQuestFrame:GetHeight() - 2)); |
||
876 | --end |
||
877 | end |
||
878 | end |
||
879 | |||
880 | -- save the position |
||
881 | if (MonkeyQuestFrame:GetLeft() ~= nil) then |
||
882 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft = MonkeyQuestFrame:GetLeft(); |
||
883 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop = MonkeyQuestFrame:GetTop(); |
||
884 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom = MonkeyQuestFrame:GetBottom(); |
||
885 | end |
||
886 | end |
||
887 | |||
888 | -- Get a colour for the leaderboard item depending on how "done" it is |
||
889 | function MonkeyQuest_GetLeaderboardColorStr(strText) |
||
890 | local i, j, strItemName, iNumItems, iNumNeeded = string.find(strText, "(.*):%s*([-%d]+)%s*/%s*([-%d]+)%s*$"); |
||
891 | local colour = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
892 | local colourInitial = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
893 | local colourMid = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
894 | local colourComplete = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
895 | |||
896 | colourInitial.a, colourInitial.r, colourInitial.g, colourInitial.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour); |
||
897 | colourMid.a, colourMid.r, colourMid.g, colourMid.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strMidObjectiveColour); |
||
898 | colourComplete.a, colourComplete.r, colourComplete.g, colourComplete.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour); |
||
899 | |||
900 | local colourDelta1 = { |
||
901 | a = (colourMid.a - colourInitial.a), |
||
902 | r = (colourMid.r - colourInitial.r), |
||
903 | g = (colourMid.g - colourInitial.g), |
||
904 | b = (colourMid.b - colourInitial.b) |
||
905 | }; |
||
906 | |||
907 | local colourDelta2 = { |
||
908 | a = (colourComplete.a - colourMid.a), |
||
909 | r = (colourComplete.r - colourMid.r), |
||
910 | g = (colourComplete.g - colourMid.g), |
||
911 | b = (colourComplete.b - colourMid.b) |
||
912 | }; |
||
913 | |||
914 | if (iNumItems ~= nil) then |
||
915 | -- standard x/y type objective |
||
916 | |||
917 | if ((iNumItems / iNumNeeded) < 0.5) then |
||
918 | colour.r = colourInitial.r + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.r); |
||
919 | colour.g = colourInitial.g + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.g); |
||
920 | colour.b = colourInitial.b + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.b); |
||
921 | else |
||
922 | colour.r = colourMid.r + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.r); |
||
923 | colour.g = colourMid.g + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.g); |
||
924 | colour.b = colourMid.b + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.b); |
||
925 | end |
||
926 | else |
||
927 | -- it's a quest with no numerical objectives |
||
928 | local i, j, strItemName, strItems, strNeeded = string.find(strText, "(.*):%s*([-%a]+)%s*/%s*([-%a]+)%s*$"); |
||
929 | |||
930 | -- is it a string/string type? |
||
931 | if (strItems ~= nil) then |
||
932 | if (strItems == strNeeded) then |
||
933 | -- strings are equal, completed objective |
||
934 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour; |
||
935 | else |
||
936 | -- strings are not equal, uncompleted objective |
||
937 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour; |
||
938 | end |
||
939 | else |
||
940 | -- special objective |
||
941 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strSpecialObjectiveColour; |
||
942 | end |
||
943 | end |
||
944 | |||
945 | -- just incase the numbers went slightly out of range |
||
946 | if (colour.r > 1.0) then |
||
947 | colour.r = 1.0; |
||
948 | end |
||
949 | if (colour.g > 1.0) then |
||
950 | colour.g = 1.0; |
||
951 | end |
||
952 | if (colour.b > 1.0) then |
||
953 | colour.b = 1.0; |
||
954 | end |
||
955 | if (colour.r < 0.0) then |
||
956 | colour.r = 0.0; |
||
957 | end |
||
958 | if (colour.g < 0.0) then |
||
959 | colour.g = 0.0; |
||
960 | end |
||
961 | if (colour.b < 0.0) then |
||
962 | colour.b = 0.0; |
||
963 | end |
||
964 | |||
965 | return MonkeyLib_ARGBToColourStr(colour.a, colour.r, colour.g, colour.b); |
||
966 | end |
||
967 | |||
968 | -- Get a colour for the leaderboard item depending on how "done" it is |
||
969 | function MonkeyQuest_GetCompletenessColorStr(iNumItems, iNumNeeded) |
||
970 | local colour = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
971 | local colourInitial = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
972 | local colourMid = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
973 | local colourComplete = {a = 1.0, r = 1.0, g = 1.0, b = 1.0}; |
||
974 | |||
975 | colourInitial.a, colourInitial.r, colourInitial.g, colourInitial.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour); |
||
976 | colourMid.a, colourMid.r, colourMid.g, colourMid.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strMidObjectiveColour); |
||
977 | colourComplete.a, colourComplete.r, colourComplete.g, colourComplete.b = MonkeyLib_ColourStrToARGB(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour); |
||
978 | |||
979 | local colourDelta1 = { |
||
980 | a = (colourMid.a - colourInitial.a), |
||
981 | r = (colourMid.r - colourInitial.r), |
||
982 | g = (colourMid.g - colourInitial.g), |
||
983 | b = (colourMid.b - colourInitial.b) |
||
984 | }; |
||
985 | |||
986 | local colourDelta2 = { |
||
987 | a = (colourComplete.a - colourMid.a), |
||
988 | r = (colourComplete.r - colourMid.r), |
||
989 | g = (colourComplete.g - colourMid.g), |
||
990 | b = (colourComplete.b - colourMid.b) |
||
991 | }; |
||
992 | |||
993 | if (iNumItems ~= nil) then |
||
994 | -- standard x/y type objective |
||
995 | |||
996 | if ((iNumItems / iNumNeeded) < 0.5) then |
||
997 | colour.r = colourInitial.r + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.r); |
||
998 | colour.g = colourInitial.g + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.g); |
||
999 | colour.b = colourInitial.b + ((iNumItems / (iNumNeeded / 2)) * colourDelta1.b); |
||
1000 | else |
||
1001 | colour.r = colourMid.r + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.r); |
||
1002 | colour.g = colourMid.g + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.g); |
||
1003 | colour.b = colourMid.b + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.b); |
||
1004 | end |
||
1005 | else |
||
1006 | -- it's a quest with no numerical objectives |
||
1007 | local i, j, strItemName, strItems, strNeeded = string.find(strText, "(.*):%s*([-%a]+)%s*/%s*([-%a]+)%s*$"); |
||
1008 | |||
1009 | -- is it a string/string type? |
||
1010 | if (strItems ~= nil) then |
||
1011 | if (strItems == strNeeded) then |
||
1012 | -- strings are equal, completed objective |
||
1013 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour; |
||
1014 | else |
||
1015 | -- strings are not equal, uncompleted objective |
||
1016 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour; |
||
1017 | end |
||
1018 | else |
||
1019 | -- special objective |
||
1020 | return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strSpecialObjectiveColour; |
||
1021 | end |
||
1022 | end |
||
1023 | |||
1024 | -- just incase the numbers went slightly out of range |
||
1025 | if (colour.r > 1.0) then |
||
1026 | colour.r = 1.0; |
||
1027 | end |
||
1028 | if (colour.g > 1.0) then |
||
1029 | colour.g = 1.0; |
||
1030 | end |
||
1031 | if (colour.b > 1.0) then |
||
1032 | colour.b = 1.0; |
||
1033 | end |
||
1034 | if (colour.r < 0.0) then |
||
1035 | colour.r = 0.0; |
||
1036 | end |
||
1037 | if (colour.g < 0.0) then |
||
1038 | colour.g = 0.0; |
||
1039 | end |
||
1040 | if (colour.b < 0.0) then |
||
1041 | colour.b = 0.0; |
||
1042 | end |
||
1043 | |||
1044 | return colour.a, colour.r, colour.g, colour.b; |
||
1045 | end |
||
1046 | |||
1047 | -- when the mouse goes over the main frame, this gets called |
||
1048 | function MonkeyQuestTitle_OnEnter() |
||
1049 | -- noob tip? |
||
1050 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == true) then |
||
1051 | |||
1052 | -- put the tool tip in the specified position |
||
1053 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then |
||
1054 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1055 | else |
||
1056 | GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor); |
||
1057 | end |
||
1058 | |||
1059 | -- set the tool tip text |
||
1060 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
1061 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_TITLE, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
1062 | |||
1063 | GameTooltip:Show(); |
||
1064 | |||
1065 | return; |
||
1066 | end |
||
1067 | |||
1068 | -- put the tool tip in the default position |
||
1069 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1070 | |||
1071 | -- set the tool tip text |
||
1072 | GameTooltip:SetText(MONKEYQUEST_TITLE_VERSION, MONKEYLIB_TITLE_COLOUR.r, MONKEYLIB_TITLE_COLOUR.g, MONKEYLIB_TITLE_COLOUR.b, 1); |
||
1073 | GameTooltip:AddLine(MONKEYQUEST_DESCRIPTION, GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b, 1); |
||
1074 | GameTooltip:Show(); |
||
1075 | |||
1076 | end |
||
1077 | |||
1078 | function MonkeyQuestButton_OnLoad() |
||
1079 | this:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
||
1080 | end |
||
1081 | |||
1082 | function MonkeyQuestButton_OnClick(button) |
||
1083 | |||
1084 | local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(this.m_iQuestIndex); |
||
1085 | |||
1086 | |||
1087 | if (isHeader) then |
||
1088 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[getglobal("MonkeyQuestHideButton" .. this.id).m_strQuestLogTitleText].m_bChecked = |
||
1089 | not MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[getglobal("MonkeyQuestHideButton" .. this.id).m_strQuestLogTitleText].m_bChecked; |
||
1090 | |||
1091 | MonkeyQuest_Refresh(); |
||
1092 | MonkeyQuestFrame:Show(); |
||
1093 | MonkeyQuest_Refresh(); |
||
1094 | |||
1095 | return; |
||
1096 | end |
||
1097 | |||
1098 | -- print text to the chat edit frame if shift is down and the |
||
1099 | -- chat frame edit box is open and it's not a zone header |
||
1100 | if (IsShiftKeyDown() and ChatFrameEditBox:IsVisible()) then |
||
1101 | -- what button was it? |
||
1102 | if (button == "LeftButton") then |
||
1103 | if (strQuestTag == ELITE) then |
||
1104 | ChatFrameEditBox:Insert("[" .. strQuestLevel .. "+] " .. strQuestLogTitleText .. " "); |
||
1105 | |||
1106 | elseif (strQuestTag == MONKEYQUEST_DUNGEON) then |
||
1107 | ChatFrameEditBox:Insert("[" .. strQuestLevel .. "d] " .. strQuestLogTitleText .. " "); |
||
1108 | |||
1109 | elseif (strQuestTag == RAID) then |
||
1110 | ChatFrameEditBox:Insert("[" .. strQuestLevel .. "r] " .. strQuestLogTitleText .. " "); |
||
1111 | |||
1112 | elseif (strQuestTag == MONKEYQUEST_PVP) then |
||
1113 | ChatFrameEditBox:Insert("[" .. strQuestLevel .. "p] " .. strQuestLogTitleText .. " "); |
||
1114 | |||
1115 | else |
||
1116 | ChatFrameEditBox:Insert("[" .. strQuestLevel .. "] " .. strQuestLogTitleText .. " "); |
||
1117 | |||
1118 | end |
||
1119 | else |
||
1120 | local strChatObjectives = ""; |
||
1121 | |||
1122 | -- Remember the currently selected quest log entry |
||
1123 | local tmpQuestLogSelection = GetQuestLogSelection(); |
||
1124 | |||
1125 | -- Select the quest log entry for other functions like GetNumQuestLeaderBoards() |
||
1126 | SelectQuestLogEntry(this.m_iQuestIndex); |
||
1127 | |||
1128 | if (GetNumQuestLeaderBoards() > 0) then |
||
1129 | for i=1, GetNumQuestLeaderBoards(), 1 do |
||
1130 | --local string = getglobal("QuestLogObjective"..ii); |
||
1131 | local strLeaderBoardText, strType, iFinished = GetQuestLogLeaderBoard(i); |
||
1132 | |||
1133 | if (strLeaderBoardText) then |
||
1134 | strChatObjectives = strChatObjectives .. "{" .. strLeaderBoardText .. "} "; |
||
1135 | end |
||
1136 | end |
||
1137 | elseif (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bObjectives) then |
||
1138 | -- this quest has no leaderboard so display the objective instead if the config is set |
||
1139 | local strQuestDescription, strQuestObjectives = GetQuestLogQuestText(); |
||
1140 | |||
1141 | strChatObjectives = strChatObjectives .. "{" .. strQuestObjectives .. "} "; |
||
1142 | end |
||
1143 | |||
1144 | ChatFrameEditBox:Insert(strChatObjectives); |
||
1145 | |||
1146 | -- Restore the currently selected quest log entry |
||
1147 | SelectQuestLogEntry(tmpQuestLogSelection); |
||
1148 | |||
1149 | end |
||
1150 | |||
1151 | -- the user isn't trying to actually open the real quest log, so just exit here |
||
1152 | return; |
||
1153 | end |
||
1154 | |||
1155 | if (IsControlKeyDown()) then |
||
1156 | -- what button was it? |
||
1157 | if (button == "LeftButton") then |
||
1158 | -- Select the quest log entry for other functions like GetNumQuestLeaderBoards() |
||
1159 | SelectQuestLogEntry(this.m_iQuestIndex); |
||
1160 | |||
1161 | -- try and share this quest with party members |
||
1162 | if (GetQuestLogPushable() and GetNumPartyMembers() > 0) then |
||
1163 | QuestLogPushQuest(); |
||
1164 | end |
||
1165 | |||
1166 | else |
||
1167 | -- Remember the currently selected quest log entry |
||
1168 | --local tmpQuestLogSelection = GetQuestLogSelection(); |
||
1169 | |||
1170 | -- Select the quest log entry for other functions like GetNumQuestLeaderBoards() |
||
1171 | SelectQuestLogEntry(this.m_iQuestIndex); |
||
1172 | |||
1173 | SetAbandonQuest(); |
||
1174 | StaticPopup_Show("ABANDON_QUEST", GetAbandonQuestName()); |
||
1175 | |||
1176 | -- Restore the currently selected quest log entry |
||
1177 | --SelectQuestLogEntry(tmpQuestLogSelection); |
||
1178 | end |
||
1179 | |||
1180 | -- the user isn't trying to actually open the real quest log, so just exit here |
||
1181 | return; |
||
1182 | end |
||
1183 | |||
1184 | -- if MonkeyQuestLog is installed, open that instead |
||
1185 | if (MkQL_SetQuest ~= nil) then |
||
1186 | if (MkQL_Main_Frame:IsVisible()) then |
||
1187 | if (MkQL_global_iCurrQuest == this.m_iQuestIndex) then |
||
1188 | MkQL_Main_Frame:Hide(); |
||
1189 | return; |
||
1190 | end |
||
1191 | end |
||
1192 | MkQL_SetQuest(this.m_iQuestIndex); |
||
1193 | return; |
||
1194 | end |
||
1195 | |||
1196 | -- show the real questlog |
||
1197 | ShowUIPanel(QuestLogFrame); |
||
1198 | |||
1199 | -- check if there's even a need to mess with the offset |
||
1200 | if (MonkeyQuest.m_iNumEntries > QUESTS_DISPLAYED) then |
||
1201 | |||
1202 | -- move the real quest log list scrollbar to the correct place |
||
1203 | if (this.m_iQuestIndex < MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED) then |
||
1204 | FauxScrollFrame_SetOffset(QuestLogListScrollFrame, this.m_iQuestIndex - 1); |
||
1205 | QuestLogListScrollFrameScrollBar:SetValue((this.m_iQuestIndex - 1) * QUESTLOG_QUEST_HEIGHT); |
||
1206 | else |
||
1207 | FauxScrollFrame_SetOffset(QuestLogListScrollFrame, MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED); |
||
1208 | QuestLogListScrollFrameScrollBar:SetValue((MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED) * QUESTLOG_QUEST_HEIGHT); |
||
1209 | end |
||
1210 | end |
||
1211 | |||
1212 | -- actually select the quest entry |
||
1213 | SelectQuestLogEntry(this.m_iQuestIndex); |
||
1214 | QuestLog_SetSelection(this.m_iQuestIndex); |
||
1215 | |||
1216 | -- update the real quest log |
||
1217 | QuestLog_Update(); |
||
1218 | |||
1219 | |||
1220 | -- if MonkeyQuestLog is installed, open that instead |
||
1221 | end |
||
1222 | |||
1223 | function MonkeyQuestButton_OnEnter() |
||
1224 | |||
1225 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "NONE") then |
||
1226 | return; |
||
1227 | end |
||
1228 | |||
1229 | local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(this.m_iQuestIndex); |
||
1230 | |||
1231 | if (strQuestLogTitleText == nil) then |
||
1232 | return; |
||
1233 | end |
||
1234 | |||
1235 | if (isHeader) then |
||
1236 | -- no noob tip? |
||
1237 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then |
||
1238 | return; |
||
1239 | end |
||
1240 | |||
1241 | -- put the tool tip in the specified position |
||
1242 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then |
||
1243 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1244 | else |
||
1245 | GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor); |
||
1246 | end |
||
1247 | |||
1248 | -- set the tool tip text |
||
1249 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
1250 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_QUESTHEADER, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
1251 | |||
1252 | GameTooltip:Show(); |
||
1253 | return; |
||
1254 | end |
||
1255 | |||
1256 | -- put the tool tip in the specified position |
||
1257 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then |
||
1258 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1259 | else |
||
1260 | GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor); |
||
1261 | end |
||
1262 | |||
1263 | -- set the tool tip text |
||
1264 | GameTooltip:SetText(strQuestLogTitleText, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
1265 | GameTooltip:AddLine(this.m_strQuestObjectives, GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b, 1); |
||
1266 | GameTooltip:AddLine(strQuestTag, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
1267 | |||
1268 | |||
1269 | -- see if any nearby group mates are on this quest |
||
1270 | local iNumPartyMembers = GetNumPartyMembers(); |
||
1271 | local isOnQuest, i; |
||
1272 | |||
1273 | for i = 1, iNumPartyMembers do |
||
1274 | isOnQuest = IsUnitOnQuest(this.m_iQuestIndex, "party" .. i); |
||
1275 | |||
1276 | if (isOnQuest and isOnQuest == 1) then |
||
1277 | -- this member is on the quest |
||
1278 | GameTooltip:AddLine(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour .. UnitName("party" .. i)); |
||
1279 | else |
||
1280 | -- this member isn't on the quest |
||
1281 | GameTooltip:AddLine(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour .. UnitName("party" .. i)); |
||
1282 | end |
||
1283 | end |
||
1284 | |||
1285 | GameTooltip:Show(); |
||
1286 | end |
||
1287 | |||
1288 | function MonkeyQuestHideButton_OnLoad() |
||
1289 | |||
1290 | end |
||
1291 | |||
1292 | function MonkeyQuestHideButton_OnEnter() |
||
1293 | -- no noob tip? |
||
1294 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then |
||
1295 | return; |
||
1296 | end |
||
1297 | |||
1298 | -- put the tool tip in the specified position |
||
1299 | if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then |
||
1300 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1301 | else |
||
1302 | GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor); |
||
1303 | end |
||
1304 | |||
1305 | -- set the tool tip text |
||
1306 | GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); |
||
1307 | GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_HIDEBUTTON, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1); |
||
1308 | |||
1309 | GameTooltip:Show(); |
||
1310 | |||
1311 | end |
||
1312 | |||
1313 | function MonkeyQuestHideButton_OnClick() |
||
1314 | -- if not loaded yet then get out |
||
1315 | if (MonkeyQuest.m_bLoaded == false) then |
||
1316 | return; |
||
1317 | end |
||
1318 | |||
1319 | if (this:GetChecked()) then |
||
1320 | PlaySound("igMainMenuOptionCheckBoxOff"); |
||
1321 | |||
1322 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[this.m_strQuestLogTitleText].m_bChecked = true; |
||
1323 | |||
1324 | else |
||
1325 | PlaySound("igMainMenuOptionCheckBoxOn"); |
||
1326 | |||
1327 | MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[this.m_strQuestLogTitleText].m_bChecked = false; |
||
1328 | end |
||
1329 | |||
1330 | MonkeyQuest_Refresh(); |
||
1331 | MonkeyQuestFrame:Show(); |
||
1332 | MonkeyQuest_Refresh(); |
||
1333 | end |
||
1334 | |||
1335 | function MonkeyQuest_PrintPoints() |
||
1336 | if (DEFAULT_CHAT_FRAME) then |
||
1337 | DEFAULT_CHAT_FRAME:AddMessage("Left: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft); |
||
1338 | DEFAULT_CHAT_FRAME:AddMessage("Top: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop); |
||
1339 | DEFAULT_CHAT_FRAME:AddMessage("Bottom: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom); |
||
1340 | end |
||
1341 | end |