-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitanQuests.lua
1477 lines (1318 loc) · 43.2 KB
/
TitanQuests.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--------------------------------------------------------------------------
-- TitanQuests.lua
--------------------------------------------------------------------------
--[[
Titan Panel [Quests]
Displays number of quests in Titan Panel. When hovered over it
displays the following info:
- total number of quests
- number of Elite quests
- number of Dungeon quests
- number of Raid quests
- number of PvP quests
- number of regular quests (non elite/dungeon/raid/pvp)
- number of daily quests
- number of quests in log currently completed
Right-click to see a color coded list of current quests. When hovered
over a dropdown menu will appear with the quest objective text,
a list of quest objectives, and commands to:
- add to Blizzard's Quest Tracker,
- share quest,
- abandon quest,
- open quest details
- link quest to chat.
The Options menu allows you to sort and group the quests by level, zone,
or by title. You can also apply a filter to view only dungeon, elite,
complete, incomplete, or regular quests.
Can toggle MonkeyQuest, QuestHistory, PartyQuests, QuestIon and
QuestBank if these AddOns are installed.
NOTE: Requires Titan Panel version 3.0+
TODO: Minor French and German translations. Complete Korean translations.
]]--
-- Create a shortcut to save typing
local SC = TitanQuests
--
-- _OnLoad
-- Register with Titan and register the events needed
--
function SC.Button_OnLoad(self)
SC.DisplayDebug (1, "TQ event: OnLoad");
-- set registry so Titan Panel can display and update the
-- Titan Quests button.
self.registry = {
id = SC.id,
version = SC.version,
menuText = SC.id,
buttonTextFunction = "TitanPanelQuestsButton_GetButtonText",
category = "Interface",
tooltipTitle = SC.id,
tooltipTextFunction = "TitanPanelQuestsButton_GetTooltipText",
icon = SC.artwork_path.."TitanQuests",
iconWidth = 16,
savedVariables = {
ShowIcon = 1,
ShowLabelText = 1,
SortByLevel = TITAN_NIL,
SortByLocation = 1,
SortByTitle = TITAN_NIL,
ShowElite = TITAN_NIL,
ShowDungeon = TITAN_NIL,
ShowRaid = TITAN_NIL,
ShowPVP = TITAN_NIL,
ShowRegular = TITAN_NIL,
ShowCompleted = TITAN_NIL,
ShowIncomplete = TITAN_NIL,
ShowAll = 1,
GroupBehavior = 1,
ShowQuestEvents = 1,
ClickBehavior = TITAN_NIL,
QuestsWatched = { nil, nil, nil, nil, nil },
QShowText = 1,
QShowDesc = 1,
QShowObj = 1,
QShowRewards = 1,
QShowParty = 1,
}
};
self:RegisterEvent("VARIABLES_LOADED");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
self:RegisterEvent("UNIT_NAME_UPDATE");
self:RegisterEvent("QUEST_LOG_UPDATE");
-- self:RegisterEvent("QUEST_WATCH_UPDATE");
-- self:RegisterEvent("QUEST_ITEM_UPDATE");
-- shamelessly print a load message to chat window
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE
..SC.app..SC.id.." "..SC.version
.." by "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"..SC.AUTHOR..FONT_COLOR_CODE_CLOSE);
end
function SC.Button_OnUpdate(self, Elapsed)
if ( SC.watched ) then
return;
end
if ( SC.settings_init ) then
return;
end
if ( TitanGetVar(SC.id,"QuestsWatched") ~= nil ) then
SC.InitSettings();
end
end
function SC.Button_OnEvent(self, event, a1, ...)
if ( event == "VARIABLES_LOADED" ) then
SC.watched = nil;
SC.settings_init = nil;
elseif event == "UNIT_NAME_UPDATE" then
SC.DisplayDebug (1, "TQ event: "..event);
SC.watched = nil;
SC.settings_init = nil;
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
SC.DisplayDebug (1, "TQ event: "..event);
SC.watched = nil;
SC.settings_init = nil;
-- Initialize the quest cache to get everything rolling.
SC.list = SC.BuildQuestList ();
SC.count = SC.BuildQuestCount (SC.list);
-- Make any changes to the Titan button
TitanPanelButton_UpdateButton(SC.id);
TitanPanelButton_UpdateTooltip();
-- A set of debug lines
SC.DisplayDebugItem (1, "TQ var ShowIcon:", TitanGetVar(SC.id, "ShowIcon"));
SC.DisplayDebugItem (1, "TQ var ShowLabelText:", TitanGetVar(SC.id, "ShowLabelText"));
SC.DisplayDebugItem (1, "TQ var SortByLocation:", TitanGetVar(SC.id, "SortByLocation"));
SC.DisplayDebugItem (1, "TQ var ShowLabelText:", TitanGetVar(SC.id, "ShowLabelText"));
SC.DisplayDebugItem (1, "TQ var SortByTitle:", TitanGetVar(SC.id, "SortByTitle"));
SC.DisplayDebugItem (1, "TQ var GroupBehavior:", TitanGetVar(SC.id, "GroupBehavior"));
-- Update the QuestWatched trackers
SC.UpdateSettings();
SC.DisplayDebug (1, "TQ event: "..event.." fini");
elseif ( event == "QUEST_LOG_UPDATE" ) then
SC.DisplayDebug (1, "TQ event: "..event);
if TitanGetVar(SC.id, "ShowQuestEvents") then
-- only do if the user requests
--[[
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE
.."TQ: "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"
.."Update quest list"
..FONT_COLOR_CODE_CLOSE);
--]]
SC.list = SC.BuildQuestList ()
end
-- Make any changes to the Titan button
TitanPanelButton_UpdateButton(SC.id);
TitanPanelButton_UpdateTooltip();
-- Update the QuestWatched trackers
SC.UpdateSettings();
-- elseif ( event == "QUEST_WATCH_UPDATE" ) then
-- SC.DisplayDebug (1, "TQ event: "..event);
--[[
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE
.." TQ: "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"..event..FONT_COLOR_CODE_CLOSE)
--]]
-- elseif ( event == "QUEST_ITEM_UPDATE" ) then
-- SC.DisplayDebug (1, "TQ event: "..event);
--[[
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE
.." TQ: "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"..event..FONT_COLOR_CODE_CLOSE);
--]]
end
end
function SC.Button_OnClick(self, button)
SC.DisplayDebug (1, "TQ event: _OnClick");
if ( button == "LeftButton" ) then
SC.ToggleQuestLog()
end
end
function SC.Button_OnEnter()
SC.DisplayDebug (1, "TQ event: _OnEnter");
-- Initialize the quest cache incase something has changed.
SC.list = SC.BuildQuestList ();
SC.count = SC.BuildQuestCount (SC.list);
-- Make any changes to the Titan button
TitanPanelButton_UpdateButton(SC.id);
TitanPanelButton_UpdateTooltip();
-- Update the QuestWatched trackers
SC.UpdateSettings();
end
--
-- initialize all Titan Quests settings
--
function SC.InitSettings()
SC.settings_init = 1;
-- Load up the Blizzard Quest Tracker
if ( not SC.watched ) then
if (TitanGetVar(SC.id, "QuestsWatched") ~= nil) then
SC.watched = TitanGetVar(SC.id, "QuestsWatched");
else
SC.watched = { nil, nil, nil, nil, nil };
TitanSetVar(SC.id, "QuestsWatched", SC.watched);
end
for i=1, MAX_WATCHABLE_QUESTS do
if (SC.watched[i] ~= nil) then
if ( GetNumQuestLeaderBoards(SC.watched[i]) > 0 ) then
local foundQuest = nil;
for j=1, GetNumQuestWatches() do
local questIndex = GetQuestIndexForWatch(j);
if ( questIndex == SC.watched[i] ) then
foundQuest = 1;
end;
end
if (not foundQuest) then
AddQuestWatch(SC.watched[i]);
end
else
SC.watched[i] = nil;
TitanSetVar(SC.id,
"QuestsWatched", SC.watched);
end
end
end
QuestWatch_Update();
end
end
--
-- update the Titan Quests settings following a log update
--
function SC.UpdateSettings()
local questIndex;
local numWatched;
-- Fill in the watched quests.
if ( not SC.watched
or not TitanGetVar(SC.id, "QuestsWatched") ) then
return;
end
numWatched = GetNumQuestWatches();
for i=1, MAX_WATCHABLE_QUESTS do
if ( i <= numWatched ) then
questIndex = GetQuestIndexForWatch(i);
if ( questIndex ) then
SC.watched[i] = questIndex;
end
else
SC.watched[i] = nil;
end
end
TitanSetVar(SC.id, "QuestsWatched", SC.watched);
end
--
-- create button text for the Titan bar
-- has to remain in global namespace for Titan
--
function TitanPanelQuestsButton_GetButtonText(id)
-- create string for Titan bar display
-- local buttonRichText = format(SC.BUTTON_TEXT,
-- TitanUtils_GetGreenText(SC.count.complete),
-- TitanUtils_GetHighlightText(SC.count.total) );
local NumEntries, NumQuests = GetNumQuestLogEntries();
local buttonRichText = format(SC.BUTTON_TEXT,
TitanUtils_GetGreenText(NumQuests) );
-- Return our button label
return SC.BUTTON_LABEL, buttonRichText;
end
--
-- create tooltip text for Titan bar
-- has to remain in global namespace for Titan
--
function TitanPanelQuestsButton_GetTooltipText()
local tooltipRichText = "";
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_QUESTS_TEXT)
..TitanUtils_GetHighlightText(SC.count.total.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_ELITE_TEXT)
..TitanUtils_GetHighlightText(SC.count.elite.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_DUNGEON_TEXT)
..TitanUtils_GetHighlightText(SC.count.dungeon.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_RAID_TEXT)
..TitanUtils_GetHighlightText(SC.count.raid.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_PVP_TEXT)
..TitanUtils_GetHighlightText(SC.count.pvp.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_REGULAR_TEXT)
..TitanUtils_GetHighlightText(SC.count.regular.."\n");
tooltipRichText = tooltipRichText.."\n";
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_DAILY_TEXT)
..TitanUtils_GetHighlightText(SC.count.daily.."\n");
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_COMPLETED_TEXT)
..TitanUtils_GetHighlightText(SC.count.complete).."\n";
tooltipRichText = tooltipRichText
..TitanUtils_GetNormalText(SC.TOOLTIP_INCOMPLETE_TEXT)
..TitanUtils_GetHighlightText(SC.count.incomplete).."\n";
tooltipRichText = tooltipRichText.."\n"
..TitanUtils_GetGreenText(SC.TOOLTIP_HINT_TEXT);
return tooltipRichText;
end
--
-- create menu after a right-click
-- has to remain in global namespace for Titan
--
function TitanPanelRightClickMenu_PrepareQuestsMenu()
-- create the right level of menu once the menu is up.
if ( UIDROPDOWNMENU_MENU_LEVEL >= 2 ) then
-- show other menu levels
SC.CreateMenu();
else
-- create the menu list of quests showing title +
SC.CreateQuestListMenu()
end
end
--
-- create the menu for the quest list
--
function SC.CreateQuestListMenu()
-- get quest list from cache
local questlist = SC.list;
-- total number of quests
local numQuests = #(questlist); -- table.getn(questlist);
local groupBy = "Location";
-- tracking length of list
-- Starts at 1 because "Quests" header is added elsewhere. - Ryessa
local numButtons = 1;
if ( TitanGetVar(SC.id, "SortByLevel") ) then
table.sort(questlist,
function(a,b) return (a.questLevel < b.questLevel); end);
groupBy = "Level";
end
if ( TitanGetVar(SC.id, "SortByTitle") ) then
table.sort(questlist,
function(a,b) return (a.questTitle < b.questTitle); end);
groupBy = "Title";
end
local useTag;
local completeTag;
local questWatched = "";
local diff;
local groupId = "";
local lastGroupId = "";
local questDisplayCount = 0;
local i = 0;
local info = {};
-- create a configuration entry
info = {};
info.text = SC.OPTIONS_TEXT;
info.value = "Options";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info);
numButtons = numButtons + 1;
-- output quest list to menu
for i=1, numQuests do
local unCheckableQuest = nil; -- added
if ( TitanGetVar(SC.id, "SortByLocation")
and TitanGetVar(SC.id, "GroupBehavior") ) then
groupId = questlist[i].questLocation;
elseif ( TitanGetVar(SC.id, "SortByLevel")
and TitanGetVar(SC.id, "GroupBehavior") ) then
groupId = SC.LEVEL_TEXT..questlist[i].questLevel;
end
-- check to see if quest is to be displayed
local checkDisplay = 0;
if ( TitanGetVar(SC.id, "ShowElite") ) then
if ( questlist[i].questTag == ELITE ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowDungeon") ) then
if ( questlist[i].questTag == SC.DUNGEON ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowRaid") ) then
if ( questlist[i].questTag == SC.RAID ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowPVP") ) then
if ( questlist[i].questTag == SC.PVP ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowRegular") ) then
if ( questlist[i].questTag == nil ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowCompleted") ) then
if ( questlist[i].questisComplete ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(SC.id, "ShowIncomplete") ) then
if ( not questlist[i].questisComplete ) then
checkDisplay = 1;
end
else
checkDisplay = 1;
end
-- Make sure it is not a header (location)
-- and that the user wants to see it.
if ( checkDisplay == 1 and questlist[i].questLevel > 0 ) then
questDisplayCount = questDisplayCount + 1;
info = {};
if ( groupId ~= "" and groupId ~= lastGroupId ) then
info.text = groupId;
info.isTitle = 1;
info.notCheckable = 1;
UIDropDownMenu_AddButton(info);
numButtons = numButtons + 1;
info = {};
lastGroupId = groupId;
questDisplayCount = questDisplayCount + 1;
end
if ( IsQuestWatched(questlist[i].questID) ) then
TitanSetVar(SC.id, questlist[i].questID, 1);
-- info.checked = TitanGetVar(SC.id, questlist[i].questID);
end
info.text = SC.GetQuestText(questlist[i].questID);
info.value = {SC.id, questlist[i].questID, nil};
info.hasArrow = 1;
info.func = function () SC.ClickQuest () end;
info.keepShownOnClick = 1;
UIDropDownMenu_AddButton(info);
numButtons = numButtons + 1;
-- Add a tracking variable to set the button id for this quest.
TitanSetVar(SC.id, questlist[i].questID.."ButtonID"
, numButtons);
end
end
end
--
-- Toggle display of quest details
--
function SC.ToggleQShow (detail_item)
TitanToggleVar(SC.id, detail_item);
end
--
-- Show toggle functions
--
function SC.showall_clear()
TitanSetVar(SC.id, "ShowAll", nil);
TitanSetVar(SC.id, "ShowElite", nil);
TitanSetVar(SC.id, "ShowDungeon", nil);
TitanSetVar(SC.id, "ShowRaid", nil);
TitanSetVar(SC.id, "ShowPVP", nil);
TitanSetVar(SC.id, "ShowRegular", nil);
TitanSetVar(SC.id, "ShowCompleted", nil);
TitanSetVar(SC.id, "ShowIncomplete", nil);
end
function SC.showall_set()
TitanSetVar(SC.id, "ShowAll", 1);
TitanSetVar(SC.id, "ShowElite", nil);
TitanSetVar(SC.id, "ShowDungeon", nil);
TitanSetVar(SC.id, "ShowRaid", nil);
TitanSetVar(SC.id, "ShowPVP", nil);
TitanSetVar(SC.id, "ShowRegular", nil);
TitanSetVar(SC.id, "ShowCompleted", nil);
TitanSetVar(SC.id, "ShowIncomplete", nil);
end
--
-- Toggle display of quest types
--
function SC.ToggleShowType (item)
if ( TitanGetVar(SC.id, item) ) then
SC.showall_set();
else
SC.showall_clear();
TitanSetVar(SC.id, item, 1);
end
DropDownList1:Hide();
end
--
-- SortBy toggle functions
--
function SC.SortClear()
TitanSetVar(SC.id, "SortByLevel", nil);
TitanSetVar(SC.id, "SortByLocation", nil);
TitanSetVar(SC.id, "SortByTitle", nil);
end
function SC.SortBy(item)
SC.SortClear();
TitanSetVar(SC.id, item, 1);
DropDownList1:Hide();
end
--
-- create 2nd or 3rd level right-click menu
--
function SC.CreateMenu()
local info = {};
if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then
if ( UIDROPDOWNMENU_MENU_VALUE == "Options" ) then
SC.MenuOptions ();
else
SC.CreateQuestList();
end
elseif ( UIDROPDOWNMENU_MENU_LEVEL == 3 ) then
if ( UIDROPDOWNMENU_MENU_VALUE == "DisplayAbout" ) then
local AboutText = SC.ABOUT_POPUP_TEXT;
info.text = AboutText;
info.value = "AboutTextPopUP";
info.notClickable = 1;
info.isTitle = 0;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
elseif ( UIDROPDOWNMENU_MENU_VALUE == "Sort" ) then
info = { };
info.text = SC.SORT_TEXT;
info.value = nil;
info.notClickable = nil;
info.isTitle = 1;
info.checked = nil;
info.func = nil;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- sort by location (default)
info = {};
info.text = SC.SORT_LOCATION_TEXT;
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.checked = TitanGetVar(SC.id, "SortByLocation");
info.func = function () SC.SortBy ("SortByLocation") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- sort by level
info.text = SC.SORT_LEVEL_TEXT;
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.checked = TitanGetVar(SC.id, "SortByLevel");
info.func = function () SC.SortBy ("SortByLevel") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- sort by title
info.text = SC.SORT_TITLE_TEXT;
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.checked = TitanGetVar(SC.id, "SortByTitle");
info.func = function () SC.SortBy ("SortByTitle") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
elseif ( UIDROPDOWNMENU_MENU_VALUE == "QShow" ) then
-- show / hide the quest details the user selected
info = { };
info.text = SC.SHOW_DETAILS_TITLE
info.value = nil;
info.notClickable = nil;
info.isTitle = 1;
info.checked = nil;
info.func = nil;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info = {};
info.text = SC.SHOW_DETAILS_NAME
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.keepShownOnClick = 1
info.checked = TitanGetVar(SC.id, "QShowText");
info.func = function () SC.ToggleQShow ("QShowText") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_DETAILS_DESCRIPTION
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.keepShownOnClick = 1
info.checked = TitanGetVar(SC.id, "QShowDesc");
info.func = function () SC.ToggleQShow ("QShowDesc") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_DETAILS_OBJECTIVES
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.keepShownOnClick = 1
info.checked = TitanGetVar(SC.id, "QShowObj");
info.func = function () SC.ToggleQShow ("QShowObj") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_DETAILS_REWARDS
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.keepShownOnClick = 1
info.checked = TitanGetVar(SC.id, "QShowRewards");
info.func = function () SC.ToggleQShow ("QShowRewards") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_DETAILS_PARTY
info.value = nil;
info.notClickable = nil;
info.isTitle = nil;
info.keepShownOnClick = 1
info.checked = TitanGetVar(SC.id, "QShowParty");
info.func = function () SC.ToggleQShow ("QShowParty") end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
elseif ( UIDROPDOWNMENU_MENU_VALUE == "Show" ) then
-- show the quest the user selected
info = { };
info.text = SC.SHOW_TEXT;
info.isTitle = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info = {};
info.text = SC.SHOW_ELITE_TEXT;
info.func = function () SC.ToggleShowType ("ShowElite") end
info.checked = TitanGetVar(SC.id, "ShowElite");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_DUNGEON_TEXT;
info.func = function () SC.ToggleShowType ("ShowDungeon") end
info.checked = TitanGetVar(SC.id, "ShowDungeon");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_RAID_TEXT;
info.func = function () SC.ToggleShowType ("ShowRaid") end;
info.checked = TitanGetVar(SC.id, "ShowRaid");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_PVP_TEXT;
info.func = function () SC.ToggleShowType ("ShowPVP") end;
info.checked = TitanGetVar(SC.id, "ShowPVP");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_REGULAR_TEXT;
info.func = function () SC.ToggleShowType ("ShowRegular") end;
info.checked = TitanGetVar(SC.id, "ShowRegular");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_COMPLETED_TEXT;
info.func = function () SC.ToggleShowType ("ShowCompleted") end;
info.checked = TitanGetVar(SC.id, "ShowCompleted");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_INCOMPLETE_TEXT;
info.func = function () SC.ToggleShowType ("ShowIncomplete") end;
info.checked = TitanGetVar(SC.id, "ShowIncomplete");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
info.text = SC.SHOW_ALL_TEXT;
info.func = function () SC.ToggleShowType ("ShowAll") end;
info.checked = TitanGetVar(SC.id, "ShowAll");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
elseif ( UIDROPDOWNMENU_MENU_VALUE == "Toggle" ) then
info = { };
info.text = SC.TOGGLE_TEXT;
info.isTitle = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- toggle blizzard's questlog
info = {};
if ( QuestLogFrame:IsVisible() ) then
info.text = SC.CLOSE_QUESTLOG_TEXT;
else
info.text = SC.OPEN_QUESTLOG_TEXT;
end
info.value = "OpenQuestLog";
info.func = function () SC.ToggleQuestLog() end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- toggle MonkeyQuest
if ( MonkeyQuestFrame ~= nil ) then
info = {};
if ( MonkeyQuestFrame:IsVisible() ) then
info.text = SC.CLOSE_MONKEYQUEST_TEXT;
else
info.text = SC.OPEN_MONKEYQUEST_TEXT;
end
info.value = "OpenMonkeyQuest";
info.func = function () SC.ToggleMonkeyQuest () end
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
-- toggle QuestIon
if ( QuestIon_Frame ~= nil ) then
info = {};
if ( QuestIon_Frame:IsVisible() ) then
info.text = SC.CLOSE_QUESTION_TEXT;
else
info.text = SC.OPEN_QUESTION_TEXT;
end
info.value = "OpenQuestIon";
info.func = QuestIon_ToggleVisible;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
-- toggle PartyQuests
if ( PartyQuestsFrame ~= nil ) then
info = {};
if ( PartyQuestsFrame:IsVisible() ) then
info.text = SC.CLOSE_PARTYQUESTS_TEXT;
else
info.text = SC.OPEN_PARTYQUESTS_TEXT;
end
info.value = "OpenPartyQuests";
info.func = TogglePartyQuests;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
-- toggle QuestHistory
if ( QuestHistoryFrame ~= nil ) then
info = {};
if ( QuestHistoryFrame:IsVisible() ) then
info.text = SC.CLOSE_QUESTHISTORY_TEXT;
else
info.text = SC.OPEN_QUESTHISTORY_TEXT;
end
info.value = "OpenQuestHistory";
info.func = QuestHistory_Toggle;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
-- toggle QuestBank
if (QuestBankFrame ~= nil ) then
info = {};
if ( QuestBankFrame:IsVisible() ) then
info.text = SC.CLOSE_QUESTBANK_TEXT;
else
info.text = SC.OPEN_QUESTHISTORY_TEXT;
end
info.value = "OpenQuestBank";
info.func = QuestBank_Toggle;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
-- end toggles
end
end
end
--
-- Click on a Quest entry to display a quest style window
--
function SC.ClickQuest()
-- for now, toggle the watcher for this quest
SC.ToggleWatchStatus ()
-- DEFAULT_CHAT_FRAME:AddMessage("OnClick: "..arg1);
--[[
if ( (TitanGetVar(SC.id, "ClickBehavior")
and not IsShiftKeyDown())
or (not TitanGetVar(SC.id, "ClickBehavior")
and IsShiftKeyDown()) ) then
SC.ToggleWatchStatus()
else
TitanPanelQuests_DisplayQuest();
this:GetParent():Hide();
end
--]]
end
--
-- Toggle Watch Status
--
function SC.ToggleWatchStatus()
local questID;
local button;
-- Get current Quest selected
questID = this.value[2];
-- Get the quest button
for i=1, UIDROPDOWNMENU_MAXBUTTONS, 1 do
button = getglobal("DropDownList1Button"..i);
if ( type(button.value) == type(this.value) ) then
if ( button.value[2] and this.value[2] == button.value[2] ) then
break;
else
button = nil;
end
else
button = nil;
end
end
-- Add/Remove quest from Quest Tracker
if ( IsQuestWatched(questID) ) then
-- Update Quest Tracker
RemoveQuestWatch(questID);
else
-- Update Quest Tracker
AddQuestWatch(questID);
end
QuestWatch_Update();
SC.UpdateSettings();
-- Toggle Status
TitanPanelRightClickMenu_ToggleVar(SC.id, questID);
-- Update watcher tag.
button:SetText(SC.GetQuestText(questID));
-- Hide the secondary pane in case it is shown
getglobal("DropDownList2"):Hide();
--[[
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE
.."TQ: "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"
..(this:GetParent():GetName() or "?")
..FONT_COLOR_CODE_CLOSE);
if ( this:GetParent():GetName() == "DropDownList2" ) then
button.checked = nil;
getglobal(button:GetName().."Check"):Hide();
UIDropDownMenu_Refresh();
end
--]]
--[[
if (SC.IsWatchAllowed(questID)) then
QuestWatch_Update();
SC.UpdateSettings();
-- Toggle Status
TitanPanelRightClickMenu_ToggleVar(SC.id, questID);
-- Update watcher tag.
button:SetText(SC.GetQuestText(questID));
-- Update the secondary pane
getglobal("DropDownList2"):Hide();
if ( this:GetParent():GetName() == "DropDownList2" ) then
button.checked = 1;
getglobal(button:GetName().."Check"):Show();
UIDropDownMenu_Refresh();
end
else
-- Prevent checkmark from showing up... pretty counter-intuitive, we need to set this to checked
-- so that the later code in UIDropDownMenu.lua will uncheck it again. - Ryessa
if ( this:GetParent():GetName() == "DropDownList1" ) then
button.checked = 1;
else
button.checked = nil;
getglobal(button:GetName().."Check"):Hide();
this:GetParent():Hide();
UIDropDownMenu_Refresh();
end;
end
--]]
end
--
-- Click Behavior toggle function
--
function SC.ToggleClickBehavior()
TitanToggleVar(SC.id, "ClickBehavior");
end
--
-- Group Behavior toggle function
--
function SC.ToggleGroupBehavior()
TitanToggleVar(SC.id, "GroupBehavior");
TitanPanelRightClickMenu_Close();
end
--
-- Show events toggle function
--
function SC.ToggleShowEvents()
TitanToggleVar(SC.id, "ShowQuestEvents");
TitanPanelRightClickMenu_Close();
end
--
-- toggle MonkeyQuest
--
function SC.ToggleMonkeyQuest()
if ( MonkeyQuestFrame:IsVisible() ) then
HideUIPanel(MonkeyQuestFrame);
else
ShowUIPanel(MonkeyQuestFrame);
end
end
--
-- toggle MonkeyQuest
--
function SC.ToggleQuestLog()
if ( QuestLogFrame:IsVisible() ) then
HideUIPanel(QuestLogFrame)
else
ShowUIPanel(QuestLogFrame)
end
end
--
-- Options Menu
--
function SC.MenuOptions ()
local info = {};
-- sort selection
info = {};
info.text = SC.SORT_TEXT;
info.value = "Sort";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- show selection
info.text = SC.SHOW_TEXT;
info.value = "Show";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- show quest details
info.text = SC.SHOW_DETAILS_TITLE
info.value = "QShow";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
-- toggle dropdown menu
info.text = SC.TOGGLE_TEXT;
info.value = "Toggle";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
TitanPanelRightClickMenu_AddSpacer(UIDROPDOWNMENU_MENU_LEVEL);
--[[
-- toggle click behavior
info = {};
info.text = SC.CLICK_BEHAVIOR_TEXT;
info.value = "ClickBehavior";
info.hasArrow = nil;
info.keepShownOnClick = 1;
info.func = function () SC.ToggleClickBehavior () end;
info.checked = TitanGetVar(SC.id, "ClickBehavior");
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
--]]