vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2  
3 function EQL_QuestTracker_OnLoad()
4 this:RegisterEvent("QUEST_FINISHED");
5 this:RegisterEvent("QUEST_COMPLETE");
6 this:RegisterEvent("VARIABLES_LOADED");
7 this:RegisterEvent("UI_INFO_MESSAGE");
8 this:RegisterEvent("CHAT_MSG_SYSTEM");
9 this:RegisterEvent("UNIT_QUEST_LOG_CHANGED");
10 end
11  
12 function EQL3_QuestWatchFrame_OnUpdate(elapsed)
13 EQL3_Temp.updateTime = EQL3_Temp.updateTime + elapsed;
14 if(EQL3_Temp.updateTime >= EQL3_Temp.updateTarget) then
15 EQL3_Temp.updateTime = 0;
16 EQL3_Temp.updateTarget = 3;
17  
18 if(EQL3_Temp.manageHeaders) then
19 EQL3_Temp.manageHeaders = false;
20 ManageQuestHeaders();
21 end
22  
23 MagageTrackedQuests();
24 QuestWatch_Update();
25 end
26 end
27  
28 function EQL_QuestTracker_OnEvent(event)
29 if (event == "CHAT_MSG_SYSTEM" and QuestlogOptions[EQL3_Player].AddNew == 1) then
30 if string.find(arg1, EQL_QUEST_ACCEPTED.." .+") then
31 local temp = string.gsub(arg1, EQL_QUEST_ACCEPTED.." ", "");
32 -- Got name, add to tracker
33 EQL3_Temp.AddTrack = temp;
34 EQL3_Temp.updateTime = 0;
35 EQL3_Temp.updateTarget = 1;
36 end
37 end
38  
39 if(event == "UI_INFO_MESSAGE") then
40 if(QuestlogOptions[EQL3_Player].AddUntracked == 1) then
41 if (string.find (arg1, ".+%s%d+/%d+")) then
42 local temp = string.gsub(arg1, " %d+/%d+", "");
43 FindAndAddQuestToTracker(temp);
44 elseif (string.find (arg1, ".+%s"..EQL_COMPLETE)) then
45 local temp = string.gsub(arg1, " "..EQL_COMPLETE, "");
46 FindAndAddQuestToTracker(temp);
47 end
48 end
49 end
50  
51 if (event == "VARIABLES_LOADED") then
52 if(QuestlogOptions[EQL3_Player] and QuestlogOptions[EQL3_Player].Color["TrackerBG"]) then
53 QuestWatchFrameBackdrop:SetBackdropBorderColor( QuestlogOptions[EQL3_Player].Color["TrackerBG"].r,
54 QuestlogOptions[EQL3_Player].Color["TrackerBG"].g,
55 QuestlogOptions[EQL3_Player].Color["TrackerBG"].b );
56 QuestWatchFrameBackdrop:SetBackdropColor( QuestlogOptions[EQL3_Player].Color["TrackerBG"].r,
57 QuestlogOptions[EQL3_Player].Color["TrackerBG"].g,
58 QuestlogOptions[EQL3_Player].Color["TrackerBG"].b );
59  
60 QuestWatchFrameBackdrop:SetAlpha(QuestlogOptions[EQL3_Player].Color["TrackerBG"].a);
61 end
62  
63 if(QuestlogOptions[EQL3_Player].LockTracker == 1) then
64 EQL3_QuestWatchFrame:SetUserPlaced(0);
65 EQL3_QuestWatchFrame:RegisterForDrag(0);
66 EQL3_QuestWatchFrame:SetMovable(false);
67 EQL3_QuestWatchFrame:EnableMouse(false);
68 else
69 EQL3_QuestWatchFrame:RegisterForDrag("LeftButton");
70 end
71  
72 if (QuestlogOptions[EQL3_Player].LockPoints and
73 QuestlogOptions[EQL3_Player].LockPoints.corner and
74 QuestlogOptions[EQL3_Player].LockPoints.pointone and
75 QuestlogOptions[EQL3_Player].LockPoints.pointtwo) then
76  
77 EQL3_QuestWatchFrame:ClearAllPoints();
78 EQL3_QuestWatchFrame:SetPoint(QuestlogOptions[EQL3_Player].LockPoints.corner,"UIParent","BOTTOMLEFT",QuestlogOptions[EQL3_Player].LockPoints.pointone,QuestlogOptions[EQL3_Player].LockPoints.pointtwo);
79 end
80  
81 SetTrackerFontSize();
82  
83 EQL3_Temp.updateTime = 0;
84 EQL3_Temp.updateTarget = 1;
85 EQL3_Temp.manageHeaders = true;
86  
87 end
88 if ( event == "QUEST_FINISHED" or event == "QUEST_COMPLETE" ) then
89 MagageTrackedQuests();
90 end
91  
92 if( event == "QUESTLOG_CHANGED" and not EQL3_Temp.firstManagement ) then
93 MagageTrackedQuests();
94 EQL3_Temp.firstManagement = true;
95 end
96 end
97  
98  
99  
100 local old_QuestWatch_Update = QuestWatch_Update;
101 -- QuestWatch functions
102 function QuestWatch_Update()
103  
104 if(not EQL3_Temp.hasManaged) then
105 QuestWatchFrame:Hide();
106 return;
107 end
108 -- MagageTrackedQuests();
109  
110 if ( QuestlogOptions[EQL3_Player].TrackerIsMinimized == 1 ) then
111 QuestWatch_SetMinimized();
112 return;
113 end
114  
115 local numObjectives;
116 local questWatchMaxWidth = 0;
117 local tempWidth;
118 local watchText;
119 local text, type, finished;
120 local questTitle
121 local watchTextIndex = 1;
122 local questIndex;
123 local objectivesCompleted;
124 local level;
125 local tempColor, tempColor2, tempColor3;
126 local tempArray = {}, tempI;
127 local tempObj, tempDone, tempLevel, tempTag;
128  
129 local qwHeight=12;
130 local questLogTitleText, isComplete, isCompleted, isRemoved;
131 local currentHeader = nil;
132 local temp, isCollapsed, isOk;
133  
134 for i=1, table.getn(QuestlogOptions[EQL3_Player].QuestWatches), 1 do
135 isRemoved = false;
136 questIndex = EQL3_GetQuestIndexForWatch(i);
137 if ( questIndex ) then
138 _, level, _, _, _, isCompleted = GetQuestLogTitle(questIndex);
139 numObjectives = GetNumQuestLeaderBoards(questIndex);
140  
141 -- Check Header
142 temp, isCollapsed = GetQuestHeaderForWatch(i);
143 if (currentHeader == nil or currentHeader ~= temp) then
144 currentHeader = temp;
145 if(QuestlogOptions[EQL3_Player].ShowZonesInTracker == 1) then
146 watchText = getglobal("EQL3_QuestWatchLine"..watchTextIndex);
147 if(watchText ~= nil) then
148 watchText:SetText(currentHeader);
149 tempWidth = watchText:GetWidth();
150 -- Set the anchor of the title line a little lower
151 if ( watchTextIndex > 1 ) then
152 watchText:SetPoint("TOPLEFT", "EQL3_QuestWatchLine"..(watchTextIndex - 1), "BOTTOMLEFT", 0, -4);
153 qwHeight = qwHeight+4;
154 end
155 if (QuestlogOptions[EQL3_Player].CustomZoneColor == 1) then
156 watchText:SetTextColor(QuestlogOptions[EQL3_Player].Color["Zone"].r, QuestlogOptions[EQL3_Player].Color["Zone"].g, QuestlogOptions[EQL3_Player].Color["Zone"].b);
157 else
158 watchText:SetTextColor(1, 1, 1);
159 end
160 watchText:Show();
161 if ( tempWidth > questWatchMaxWidth ) then
162 questWatchMaxWidth = tempWidth;
163 end
164 end
165 watchTextIndex = watchTextIndex + 1;
166 end
167 end
168  
169 if(QuestlogOptions[EQL3_Player].RemoveFinished == 1 and isCompleted) then
170 isRemoved = true;
171 end
172  
173 if(isCollapsed == nil and questIndex > 0 and not isRemoved) then
174 -- Set title
175 questLogTitleText, tempLevel, tempTag, _, _, isComplete = GetQuestLogTitle(questIndex);
176 watchText = getglobal("EQL3_QuestWatchLine"..watchTextIndex);
177 if(watchText ~= nil and questLogTitleText ~= nil) then
178 if(QuestlogOptions[EQL3_Player].ShowQuestLevels == 1) then
179 if (tempTag ~= NIL) then
180 tempLevel = tempLevel.."+";
181 end
182 watchText:SetText(" ".."["..tempLevel.."] "..questLogTitleText);
183 else
184 watchText:SetText(" "..questLogTitleText);
185 end
186 tempWidth = watchText:GetWidth();
187 -- Set the anchor of the title line a little lower
188 if ( watchTextIndex > 1 ) then
189 watchText:SetPoint("TOPLEFT", "EQL3_QuestWatchLine"..(watchTextIndex - 1), "BOTTOMLEFT", 0, -4);
190 qwHeight = qwHeight+4;
191 end
192 watchText:Show();
193 if ( tempWidth > questWatchMaxWidth ) then
194 questWatchMaxWidth = tempWidth;
195 end
196 end
197 watchTextIndex = watchTextIndex + 1;
198  
199 if(QuestlogOptions[EQL3_Player].MinimizeFinished == 1 and isCompleted) then
200 numObjectives = 0;
201 end
202  
203  
204 local markerID = 0;
205  
206 if ( numObjectives > 0 ) then
207 objectivesCompleted = 0;
208 tempObj = 0;
209 tempDone = 0;
210 for j=1, numObjectives do
211 text, type, finished = GetQuestLogLeaderBoard(j, questIndex);
212  
213 if ( finished and QuestlogOptions[EQL3_Player].RemoveCompletedObjectives == 1 ) then
214 -- Do nothing
215 else
216  
217 watchText = getglobal("EQL3_QuestWatchLine"..watchTextIndex);
218 if(watchText ~= nil) then
219 -- Set Objective text
220 if ( QuestlogOptions[EQL3_Player].ShowObjectiveMarkers == 1 ) then
221 if (QuestlogOptions[EQL3_Player].UseTrackerListing == 1) then -- Tracker Listing
222 watchText:SetText(" "..EQL3_TrackerLists[QuestlogOptions[EQL3_Player].TrackerList][markerID]..") "..text);
223 else
224 watchText:SetText(" "..EQL3_TrackerSymbols[QuestlogOptions[EQL3_Player].TrackerSymbol].." "..text);
225 end
226 else
227 watchText:SetText(" "..text);
228 end
229  
230  
231 -- Color the objectives
232 if (QuestlogOptions[EQL3_Player].CustomObjetiveColor == 1) then
233 tempColor = { r=QuestlogOptions[EQL3_Player].Color["ObjectiveEmpty"].r,
234 g=QuestlogOptions[EQL3_Player].Color["ObjectiveEmpty"].g,
235 b=QuestlogOptions[EQL3_Player].Color["ObjectiveEmpty"].b };
236  
237 tempColor2 = { r=QuestlogOptions[EQL3_Player].Color["ObjectiveComplete"].r,
238 g=QuestlogOptions[EQL3_Player].Color["ObjectiveComplete"].g,
239 b=QuestlogOptions[EQL3_Player].Color["ObjectiveComplete"].b };
240 else
241 tempColor = {r=0.8, g=0.8, b=0.8};
242 tempColor2 = {r=HIGHLIGHT_FONT_COLOR.r, g=HIGHLIGHT_FONT_COLOR.g, b=HIGHLIGHT_FONT_COLOR.b};
243 end
244  
245  
246 if ( finished ) then
247 watchText:SetTextColor(tempColor2.r, tempColor2.g, tempColor2.b);
248 objectivesCompleted = objectivesCompleted + 1;
249 else
250 tempI = 0;
251 tempArray = {};
252 for v in string.gfind(text, "%d+") do
253 tempI = tempI+1;
254 table.insert (tempArray, v);
255 end
256 if (tempI == 0) then
257 tempI = 2;
258 tempArray[1] = "0";
259 tempArray[2] = "1";
260 elseif (tempI == 1) then
261 tempI = 2;
262 tempArray[2] = 99999;
263 end
264 tempObj = tempObj + tempArray[tempI];
265 tempDone = tempDone + tempArray[tempI-1];
266  
267 if (QuestlogOptions[EQL3_Player].FadeObjectiveColor == 1) then
268 tempColor3 = EQL3_FadeColors(tempColor, tempColor2, tempArray[tempI-1], tempArray[tempI]);
269 else
270 tempColor3 = tempColor;
271 end
272 watchText:SetTextColor(tempColor3.r, tempColor3.g, tempColor3.b);
273 end
274  
275  
276 tempWidth = watchText:GetWidth();
277 if ( tempWidth > questWatchMaxWidth ) then
278 questWatchMaxWidth = tempWidth;
279 end
280 watchText:SetPoint("TOPLEFT", "EQL3_QuestWatchLine"..(watchTextIndex - 1), "BOTTOMLEFT", 0, 0);
281 watchText:Show();
282 end
283 watchTextIndex = watchTextIndex + 1;
284  
285 markerID = markerID+1;
286 end --if not complete... bla bla bla
287 end -- For
288 else
289 tempObj = 1;
290 tempDone = 0;
291 numObjectives = 0;
292 objectivesCompleted = -1;
293 end
294  
295 -- Brighten the quest title if all the quest objectives were met
296 watchText = getglobal("EQL3_QuestWatchLine"..watchTextIndex-markerID-1);
297  
298 if (QuestlogOptions[EQL3_Player].CustomHeaderColor == 1) then
299 if (QuestlogOptions[EQL3_Player].FadeHeaderColor == 1) then
300 if ( isComplete or objectivesCompleted == numObjectives ) then
301 tempColor = { r=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].r,
302 g=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].g,
303 b=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].b };
304 else
305 tempColor3 = {r=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].r,
306 g=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].g,
307 b=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].b };
308  
309 tempColor2 = {r=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].r,
310 g=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].g,
311 b=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].b };
312 tempColor = EQL3_FadeColors(tempColor3, tempColor2, tempDone, tempObj);
313 end
314 else
315 if ( isComplete or objectivesCompleted == numObjectives ) then
316 tempColor = { r=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].r,
317 g=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].g,
318 b=QuestlogOptions[EQL3_Player].Color["HeaderComplete"].b };
319 else
320 tempColor = { r=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].r,
321 g=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].g,
322 b=QuestlogOptions[EQL3_Player].Color["HeaderEmpty"].b };
323 end
324 end
325 watchText:SetTextColor(tempColor.r, tempColor.g, tempColor.b);
326 else
327 if ( isComplete or objectivesCompleted == numObjectives ) then
328 watchText:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
329 else
330 watchText:SetTextColor(0.75, 0.61, 0);
331 end
332 end
333  
334  
335  
336 end
337  
338 end
339 end
340  
341 -- Set tracking indicator
342 if ( GetNumQuestWatches() > 0 ) then
343 EQL3_QuestLogTrackTracking:SetVertexColor(0, 1.0, 0);
344 else
345 EQL3_QuestLogTrackTracking:SetVertexColor(1.0, 0, 0);
346 end
347  
348 -- If no watch lines used then hide the frame and return
349 if ( watchTextIndex == 1 ) then
350 EQL3_QuestWatchFrame:Hide();
351 return;
352 else
353 EQL3_QuestWatchFrame:Show();
354 EQL3_QuestWatchFrame:SetHeight(watchTextIndex * (QuestlogOptions[EQL3_Player].TrackerFontHeight+1) + qwHeight);
355 EQL3_QuestWatchFrame:SetWidth(questWatchMaxWidth+12);
356 end
357  
358 -- Hide unused watch lines
359 if(watchTextIndex < MAX_QUESTWATCH_LINES) then
360 for i=watchTextIndex, MAX_QUESTWATCH_LINES do
361 getglobal("EQL3_QuestWatchLine"..i):Hide();
362 end
363 end
364  
365 QuestWatchFrameBackdrop:SetPoint("TOPLEFT", "EQL3_QuestWatchFrame", "TOPLEFT", -8, -4);
366  
367 -- UIParent_ManageFramePositions();
368 if (not EQL3_Temp.movingWatchFrame) then
369 if (QuestlogOptions[EQL3_Player].LockPoints and
370 QuestlogOptions[EQL3_Player].LockPoints.corner and
371 QuestlogOptions[EQL3_Player].LockPoints.pointone and
372 QuestlogOptions[EQL3_Player].LockPoints.pointtwo) then
373 EQL3_QuestWatchFrame:ClearAllPoints();
374 EQL3_QuestWatchFrame:SetPoint(QuestlogOptions[EQL3_Player].LockPoints.corner,"UIParent","BOTTOMLEFT",QuestlogOptions[EQL3_Player].LockPoints.pointone,QuestlogOptions[EQL3_Player].LockPoints.pointtwo);
375 end
376 end
377  
378 end
379  
380 -- EQL3_QuestWatchFrame = QuestWatchFrame;
381  
382  
383 -- Functions
384 function EQL3_FadeColors(tempColor, tempColor2, done, obj)
385 local color = {r=0, g=0, b=0};
386 local multiplier;
387  
388 multiplier = (done / obj);
389 color.r = tempColor.r + ((tempColor2.r - tempColor.r)*multiplier);
390 color.g = tempColor.g + ((tempColor2.g - tempColor.g)*multiplier);
391 color.b = tempColor.b + ((tempColor2.b - tempColor.b)*multiplier);
392  
393 return color;
394 end
395  
396  
397 -- Old QuestRacking
398 local Original_RemoveQuestWatch = RemoveQuestWatch;
399 local Original_IsQuestWatched = IsQuestWatched;
400 local Original_GetNumQuestWatches = GetNumQuestWatches;
401 local Original_AddQuestWatch = AddQuestWatch;
402 local Original_GetQuestIndexForWatch = GetQuestIndexForWatch;
403  
404  
405 function SortWatchedQuests()
406 if (QuestlogOptions[EQL3_Player].ShowZonesInTracker == 1) then
407 table.sort(QuestlogOptions[EQL3_Player].QuestWatches);
408 else
409 if(QuestlogOptions[EQL3_Player].SortTrackerItems == 1) then
410 -- Make theese sort on title rather than zone+level+title
411 table.sort(QuestlogOptions[EQL3_Player].QuestWatches, SortCompare);
412  
413 end
414 end
415 end
416  
417 function SortCompare(first, second)
418 local temp = string.gsub(first, ".+,%d+,[%[%d+%+*%]]*", "");
419  
420 local temp2 = string.gsub(second, ".+,%d+,[%[%d+%+*%]]*", "");
421  
422 if(temp < temp2) then
423 return true;
424 end
425 return false;
426 end
427  
428  
429 -- QuestlogOptions.QuestWatches
430 function EQL3_AddQuestWatch(questIndex)
431 local questName, level = GetQuestLogTitle(questIndex);
432  
433 local questLogHeader, tempId;
434  
435 isHeader = false;
436 tempId = questIndex;
437 while (not isHeader) do
438 questLogHeader, _, _, isHeader = GetQuestLogTitle(tempId);
439 tempId = tempId-1;
440 end
441  
442 table.insert(QuestlogOptions[EQL3_Player].QuestWatches, questLogHeader..","..level..","..questName);
443  
444 SortWatchedQuests();
445  
446 MagageTrackedQuests();
447 end
448  
449 function EQL3_RemoveQuestWatch(questIndex)
450 local questName, level = GetQuestLogTitle(questIndex);
451  
452 local questLogHeader, isHeader, tempId;
453  
454 isHeader = false;
455 tempId = questIndex;
456 while (not isHeader) do
457 questLogHeader, _, _, isHeader = GetQuestLogTitle(tempId);
458 tempId = tempId-1;
459 end
460  
461 local temp = questLogHeader..","..level..","..questName;
462  
463 if(table.getn(QuestlogOptions[EQL3_Player].QuestWatches) > 0) then
464 for i=1, table.getn(QuestlogOptions[EQL3_Player].QuestWatches) do
465 if (QuestlogOptions[EQL3_Player].QuestWatches[i] == temp) then
466 table.remove(QuestlogOptions[EQL3_Player].QuestWatches , i);
467 break;
468 end
469 end
470 end
471  
472 SortWatchedQuests();
473  
474 MagageTrackedQuests();
475 end
476  
477 function EQL3_IsQuestWatched(questIndex)
478 local questName, level = GetQuestLogTitle(questIndex);
479 local questLogHeader, isHeader, tempId;
480  
481 isHeader = false;
482 tempId = questIndex;
483 while (not isHeader and tempId > 0) do
484 questLogHeader, _, _, isHeader = GetQuestLogTitle(tempId);
485 tempId = tempId-1;
486 -- if(tempId <= 0) then
487 -- questLogHeader, _, _, isHeader = GetQuestLogTitle(1);
488 -- break;
489 -- end
490 end
491  
492 local temp = questLogHeader..","..level..","..questName;
493 if(table.getn(QuestlogOptions[EQL3_Player].QuestWatches) > 0) then
494 for i=1, table.getn(QuestlogOptions[EQL3_Player].QuestWatches) do
495 if (QuestlogOptions[EQL3_Player].QuestWatches[i] == temp) then
496 return true;
497 end
498 end
499 end
500 return false;
501 end
502  
503 function GetNumQuestWatches()
504 return table.getn(QuestlogOptions[EQL3_Player].QuestWatches);
505 end
506  
507 function EQL3_GetQuestIndexForWatch(id)
508 local numEntries = GetNumQuestLogEntries();
509 local questLogTitleText, level;
510 local questLogHeader, isHeader, tempId;
511 local questFound = false;
512 local temp, currentHeader=nil;
513  
514  
515 for i=1, numEntries, 1 do
516 questLogTitleText, level, _, isHeader, _ = GetQuestLogTitle(i);
517 if (isHeader) then
518 currentHeader = questLogTitleText;
519 else
520 temp = currentHeader..","..level..","..questLogTitleText;
521 if ( temp == QuestlogOptions[EQL3_Player].QuestWatches[id] ) then
522 return i;
523 end
524 end
525 end
526 return 0;
527 end
528  
529 function GetQuestHeaderForWatch(questIndex)
530 if(QuestlogOptions[EQL3_Player].QuestWatches[questIndex]) then
531 local numEntries = GetNumQuestLogEntries();
532 local questLogHeader, isCollapsed;
533 local s = QuestlogOptions[EQL3_Player].QuestWatches[questIndex];
534 local temp=nil;
535 for w in string.gfind(s, "[^,]+") do
536 if(temp == nil) then
537 temp = w;
538 break;
539 end
540 end
541 for i=1, numEntries, 1 do
542 questLogHeader, _, _, _, isCollapsed = GetQuestLogTitle(i);
543 if(questLogHeader == temp) then
544 return questLogHeader, isCollapsed;
545 end
546 end
547 return temp, true;
548 end
549 return "", false;
550 end
551  
552  
553  
554  
555 function MagageTrackedQuests()
556 EQL3_Temp.QuestList = {};
557 QuestlogOptions[EQL3_Player].HeaderList = {};
558  
559 local tempHeaderList = {};
560 local numEntries = GetNumQuestLogEntries();
561 local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete;
562 local currentHeader = nil;
563 local temp;
564  
565 -- Make Header List
566 for j=numEntries, 1, -1 do
567 questLogTitleText, _, _, isHeader, isCollapsed = GetQuestLogTitle(j);
568 if (isHeader and isCollapsed) then
569 tempHeaderList[j] = 1;
570 table.insert(QuestlogOptions[EQL3_Player].HeaderList, questLogTitleText);
571 ExpandQuestHeader(j);
572 else
573 tempHeaderList[j] = 0;
574 end
575 end
576  
577 -- Make quest list
578 local numEntries2 = GetNumQuestLogEntries();
579 for j=1, numEntries2, 1 do
580 questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(j);
581  
582 if (isHeader) then
583 currentHeader = questLogTitleText;
584 else
585 temp = currentHeader..","..level..","..questLogTitleText;
586 table.insert(EQL3_Temp.QuestList, temp);
587  
588  
589 if (EQL3_Temp.AddTrack and EQL3_Temp.AddTrack == questLogTitleText) then
590 table.insert(QuestlogOptions[EQL3_Player].QuestWatches, temp);
591 EQL3_Temp.AddTrack = nil;
592 end
593  
594 -- If complete, remove it from the tracker...
595 if (QuestlogOptions[EQL3_Player].RemoveFinished == 1 and isComplete) then
596 for x=1, table.getn(QuestlogOptions[EQL3_Player].QuestWatches) do
597 if (QuestlogOptions[EQL3_Player].QuestWatches[x] == temp) then
598 table.remove(QuestlogOptions[EQL3_Player].QuestWatches , x);
599 break;
600 end
601 end
602 end
603 end
604 end
605  
606 -- Clear Header List
607 for j=1, numEntries, 1 do
608 if(tempHeaderList[j] == 1) then
609 CollapseQuestHeader(j);
610 end
611 end
612  
613 -- Compare all tracked items to list
614 local numWatches = table.getn(QuestlogOptions[EQL3_Player].QuestWatches);
615 local numEntries = table.getn(EQL3_Temp.QuestList);
616 local found = false;
617 for i=numWatches, 1, -1 do
618 found = false;
619 for j=0, numEntries, 1 do
620 if (QuestlogOptions[EQL3_Player].QuestWatches[i] == EQL3_Temp.QuestList[j]) then
621 found = true;
622 break;
623 end
624 end
625 if(not found) then
626 table.remove(QuestlogOptions[EQL3_Player].QuestWatches, i);
627 end
628 end
629  
630 SortWatchedQuests();
631 end
632  
633  
634  
635 function EQL3_ClearTracker()
636 QuestlogOptions[EQL3_Player].QuestWatches = {};
637 end
638  
639  
640  
641  
642  
643 function QuestWatchFrame_LockCornerForGrowth()
644 local Left = EQL3_QuestWatchFrame:GetLeft();
645 local Right = EQL3_QuestWatchFrame:GetRight();
646 local Top = EQL3_QuestWatchFrame:GetTop();
647 local Bottom = EQL3_QuestWatchFrame:GetBottom();
648 local lock;
649 local pointone;
650 local pointtwo;
651 local TOPBOTTOM_MEDIAN = 384;
652 local LEFTRIGHT_MEDIAN = 512;
653 if (Left and Right and Top and Bottom) then
654 if (Bottom < TOPBOTTOM_MEDIAN and Top > TOPBOTTOM_MEDIAN) then
655 local topcross = Top - TOPBOTTOM_MEDIAN;
656 local bottomcross = TOPBOTTOM_MEDIAN - Bottom;
657 if (bottomcross > topcross) then
658 lock = "BOTTOM";
659 pointtwo = Bottom;
660 else
661 lock = "TOP";
662 pointtwo = Top;
663 end
664 elseif (Top > TOPBOTTOM_MEDIAN) then
665 lock = "TOP";
666 pointtwo = Top;
667 elseif (Bottom < TOPBOTTOM_MEDIAN) then
668 lock = "BOTTOM";
669 pointtwo = Bottom;
670 end
671 if (Left < LEFTRIGHT_MEDIAN and Right > LEFTRIGHT_MEDIAN) then
672 local leftcross = LEFTRIGHT_MEDIAN - Left;
673 local rightcross = Right - LEFTRIGHT_MEDIAN;
674 if (rightcross > leftcross) then
675 lock = lock.."RIGHT";
676 pointone = Right;
677 else
678 lock = lock.."LEFT";
679 pointone = Left;
680 end
681 elseif (Left < LEFTRIGHT_MEDIAN) then
682 lock = lock.."LEFT";
683 pointone = Left;
684 elseif (Right > LEFTRIGHT_MEDIAN) then
685 lock = lock.."RIGHT";
686 pointone = Right;
687 end
688 if (lock and lock ~= "" and pointone and pointtwo) then
689 EQL3_QuestWatchFrame:ClearAllPoints();
690 EQL3_QuestWatchFrame:SetPoint(lock,"UIParent","BOTTOMLEFT",pointone,pointtwo);
691 QuestlogOptions[EQL3_Player].LockPoints = {};
692 QuestlogOptions[EQL3_Player].LockPoints.corner = lock;
693 QuestlogOptions[EQL3_Player].LockPoints.pointone = pointone;
694 QuestlogOptions[EQL3_Player].LockPoints.pointtwo = pointtwo;
695 elseif (QuestlogOptions[EQL3_Player].LockPoints and
696 QuestlogOptions[EQL3_Player].LockPoints.corner and
697 QuestlogOptions[EQL3_Player].LockPoints.pointone and
698 QuestlogOptions[EQL3_Player].LockPoints.pointtwo) then
699 EQL3_QuestWatchFrame:ClearAllPoints();
700 EQL3_QuestWatchFrame:SetPoint(QuestlogOptions[EQL3_Player].LockPoints.corner,"UIParent","BOTTOMLEFT",QuestlogOptions[EQL3_Player].LockPoints.pointone,QuestlogOptions[EQL3_Player].LockPoints.pointtwo);
701 end
702 end
703 end
704  
705  
706 function FindAndAddQuestToTracker(theObjective)
707 local oldSelection = GetQuestLogSelection();
708 local questID;
709 local numEntries = GetNumQuestLogEntries();
710 local questTitle;
711 local numObjectives;
712  
713 -- local tempHeaderList = {};
714 local numEntries2 = GetNumQuestLogEntries();
715 local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete;
716 local text, typ, finished;
717  
718 --[[ Make Header List
719 for j=numEntries2, 1, -1 do
720 _, _, _, isHeader, isCollapsed = GetQuestLogTitle(j);
721 if (isHeader and isCollapsed) then
722 tempHeaderList[j] = 1;
723 ExpandQuestHeader(j);
724 else
725 tempHeaderList[j] = 0;
726 end
727 end ]]--
728  
729 -- Find that quest!
730 local found = false;
731 for i=1, numEntries, 1 do
732 questID = i;
733 questTitle, _, _, isHeader = GetQuestLogTitle(questID);
734 if (not isHeader) then
735 SelectQuestLogEntry(questID);
736 if(questTitle and not IsQuestWatched(questID)) then
737 numObjectives = GetNumQuestLeaderBoards();
738 if(numObjectives > 0) then
739 for j=1, numObjectives, 1 do
740 text, typ, finished = GetQuestLogLeaderBoard(j);
741 if(not text or strlen(text) == 0) then
742 text = typ;
743 end
744 text = string.gsub(text, " %d+/%d+", "");
745 text = string.gsub(text, " "..EQL_COMPLETE, "");
746 if(theObjective == text) then
747 EQL3_Temp.AddTrack = questTitle;
748 found = true;
749 end
750 if(found) then
751 break;
752 end
753 end
754 end
755 end
756 end
757 if(found) then
758 break;
759 end
760 end
761  
762 --[[ Clear Header List
763 for j=1, numEntries2, 1 do
764 if(tempHeaderList[j] == 1) then
765 CollapseQuestHeader(j);
766 end
767 end ]]--
768  
769 SelectQuestLogEntry(oldSelection);
770  
771 MagageTrackedQuests();
772 end
773  
774  
775 function QuestWatch_SetMinimized()
776 if ( GetNumQuestWatches() == 0 ) then
777 EQL3_QuestWatchFrame:Hide();
778 return;
779 end
780  
781 for i=2, MAX_QUESTWATCH_LINES, 1 do
782 getglobal("EQL3_QuestWatchLine"..i):Hide();
783 end
784  
785 EQL3_QuestWatchLine1:SetText(EQL3_QUEST_TRACKER.." ("..GetNumQuestWatches()..")");
786 EQL3_QuestWatchLine1:SetTextColor(1.0, 0.82, 0.0);
787  
788  
789 EQL3_QuestWatchFrame:Show();
790 EQL3_QuestWatchFrame:SetHeight(QuestlogOptions[EQL3_Player].TrackerFontHeight+1 + 22);
791 EQL3_QuestWatchFrame:SetWidth(EQL3_QuestWatchLine1:GetWidth()+36);
792  
793 QuestWatchFrameBackdrop:SetPoint("TOPLEFT", "EQL3_QuestWatchFrame", "TOPLEFT", -8, -4);
794  
795 -- UIParent_ManageFramePositions();
796 if (QuestlogOptions[EQL3_Player].LockPoints and
797 QuestlogOptions[EQL3_Player].LockPoints.corner and
798 QuestlogOptions[EQL3_Player].LockPoints.pointone and
799 QuestlogOptions[EQL3_Player].LockPoints.pointtwo) then
800 EQL3_QuestWatchFrame:ClearAllPoints();
801 EQL3_QuestWatchFrame:SetPoint(QuestlogOptions[EQL3_Player].LockPoints.corner,"UIParent","BOTTOMLEFT",QuestlogOptions[EQL3_Player].LockPoints.pointone,QuestlogOptions[EQL3_Player].LockPoints.pointtwo);
802 end
803 end
804