-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArgusEliteTracker.lua
1348 lines (1114 loc) · 51.9 KB
/
ArgusEliteTracker.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
local addonName, addonData = ...
local debugging = false
local function debug(...)
if debugging then
print(...)
end
end
local defaultFontName = "Fonts/FRIZQT__.TTF"
local plainBackdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 0.75, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 4, tile = false}
local zones = {
krokuun = {
{ questId = 48564, name = "Commander Endaxis", x = .4442, y = .5875, mapId = 1135, searchTerm = "endax" }, -- 1
{ questId = 48562, name = "Commander Sathrenael", x = .3368, y = .7587, mapId = 1135, searchTerm = "sathr" }, -- 2
{ questId = 48563, name = "Commander Vecaya", x = .3924, y = .5952, mapId = 1135, searchTerm = "vecay" }, -- 3
{ questId = 48666, name = "Imp Mother Laglath", x = .4153, y = .7026, mapId = 1135, searchTerm = "lagla" }, -- 4
{ questId = 48561, name = "Khazaduum", x = .4507, y = .0896, mapId = 1135, searchTerm = "khaza" }, -- 5
{ questId = 48667, name = "Naroua", x = .7021, y = .3438, mapId = 1135, searchTerm = "narou" }, -- 6
{ questId = 48627, name = "Siegemaster Voraan", x = .5815, y = .7474, mapId = 1135, searchTerm = "voraan" }, -- 7
{ questId = 48565, name = "Sister Subversia", x = .5394, y = .3139, mapId = 1135, searchTerm = "subver" }, -- 8
{ questId = 48628, name = "Talestra the Vile", x = .5555, y = .8018, mapId = 1135, searchTerm = "talest" }, -- 9
{ questId = 48665, name = "Tar Spitter", x = .6928, y = .8045, mapId = 1135, searchTerm = "spitter" }, -- 10
{ questId = 48664, name = "Tereck the Selector", x = .6927, y = .5886, mapId = 1135, searchTerm = "tereck" }, -- 11
{ questId = 48629, name = "Vagath the Betrayed", x = .6113, y = .2069, mapId = 1135, searchTerm = "vagath" }, -- 12
},
antoranWastes = {
{ questId = 48817, name = "Admiral Rel'var", x = .7362, y = .7079, mapId = 1171, searchTerm = "rel'var" }, -- 1
{ questId = 48818, name = "All-Seer Xanarian", x = .7530, y = .5681, mapId = 1171, searchTerm = "xanari" }, -- 2
{ questId = 49183, name = "Blistermaw", x = .6178, y = .3697, mapId = 1171, searchTerm = "blister" }, -- 3
{ questId = 48865, name = "Chief Alchemist Munculus", x = .6091, y = .2275, mapId = 1171, searchTerm = "muncu" }, -- 4
{ questId = 48816, name = "Commander Texlaz", x = .8189, y = .6821, mapId = 1171, searchTerm = "texla" }, -- 5
{ questId = 48968, name = "Doomcaster Suprax", x = .5849, y = .1180, mapId = 1171, searchTerm = "supra" }, -- 6
{ questId = 49241, name = "Gar'zoth", x = .5623, y = .4585, mapId = 1171, searchTerm = "zoth" }, -- 7
{ questId = 48821, name = "Houndmaster Kerrax", x = .6296, y = .2486, mapId = 1171, searchTerm = "kerra" }, -- 8
{ questId = 48815, name = "Inquisitor Vethroz", x = .6068, y = .4767, mapId = 1171, searchTerm = "vethroz" }, -- 9
{ questId = 48813, name = "Lieutenant Xakaar", x = .6240, y = .5428, mapId = 1171, searchTerm = "xaka" }, -- 10
{ questId = 49240, name = "Mistress Il'thendra", x = .5737, y = .3352, mapId = 1171, searchTerm = "thendr" }, -- 12
{ questId = 48970, name = "Mother Rosula", x = .6672, y = .1812, mapId = 1171, searchTerm = "rosul" }, -- 13
{ questId = 48809, name = "Puscilla", x = .6442, y = .2035, mapId = 1171, searchTerm = "pusc" }, -- 14
{ questId = 48971, name = "Rezira the Seer", x = .6503, y = .8231, mapId = 1171, searchTerm = "rezi" }, -- 15
{ questId = 48967, name = "Squadron Commander Vishax", x = .8372, y = .8114, mapId = 1171, searchTerm = "vishax" }, -- 16
{ questId = 48966, name = "The Many-Faced Devourer", x = .5483, y = .3915, mapId = 1171, searchTerm = "faced" }, -- 17
{ questId = 48812, name = "Varga", x = .6432, y = .4862, mapId = 1171, searchTerm = "varga" }, -- 18
{ questId = 48811, name = "Ven'orn", x = .6487, y = .5651, mapId = 1171, searchTerm = "ven'orn" }, -- 19
{ questId = 48824, name = "Void Warden Valsuran", x = .5536, y = .2166, mapId = 1171, searchTerm = "valsur" }, -- 20
{ questId = 48810, name = "Vrax'thul", x = .5306, y = .3612, mapId = 1171, searchTerm = "vrax" }, -- 21
{ questId = 48822, name = "Watcher Aival", x = .5273, y = .3003, mapId = 1171, searchTerm = "aival" }, -- 22
{ questId = 48820, name = "Worldsplitter Skuul", x = .5090, y = .5580, mapId = 1171, searchTerm = "skuul" }, -- 23
{ questId = 48814, name = "Wrath-Lord Yarez", x = .6177, y = .6453, mapId = 1171, searchTerm = "yarez" }, -- 24
},
macAree = {
{ questId = 48709, name = "Ataxon", x = .3012, y = .4018, mapId = 1170, searchTerm = "atax" }, -- 1
{ questId = 48700, name = "Baruut the Bloodthirsty", x = .4365, y = .6072, mapId = 1170, searchTerm = "baruut" }, -- 2
{ questId = 48707, name = "Captain Faruq", x = .2683, y = .3046, mapId = 1170, searchTerm = "faruq" }, -- 3
{ questId = 48720, name = "Commander Xethgar", x = .5670, y = .1477, mapId = 1170, searchTerm = "xeth" }, -- 4
{ questId = 48702, name = "Feasel the Muffin Thief", x = .4120, y = .1178, mapId = 1170, searchTerm = "feasel" }, -- 5
{ questId = 48711, name = "Herald of Chaos", x = .3580, y = .5897, mapId = 1170, searchTerm = "herald" }, -- 6
{ questId = 48718, name = "Instructor Tarahna", x = .6172, y = .5031, mapId = 1170, searchTerm = "tarah" }, -- 7
{ questId = 48713, name = "Jed'hin Champion Vorusk", x = .4838, y = .4106, mapId = 1170, searchTerm = "vorusk" }, -- 8
{ questId = 48697, name = "Kaara the Pale", x = .3866, y = .5560, mapId = 1170, searchTerm = "kaara" }, -- 9
{ questId = 48714, name = "Overseer Y'Beda", x = .5863, y = .3808, mapId = 1170, searchTerm = "beda" }, -- 10
{ questId = 48717, name = "Overseer Y'Morna", x = .6084, y = .3041, mapId = 1170, searchTerm = "morna" }, --jens :'D -- 11
{ questId = 48716, name = "Overseer Y'Sorna", x = .5801, y = .3116, mapId = 1170, searchTerm = "sorna" }, -- 12
{ questId = 48712, name = "Sabuul", x = .4355, y = .4919, mapId = 1170, searchTerm = "sabuul" }, -- 13
{ questId = 48692, name = "Shadowcaster Voruun", x = .4476, y = .7173, mapId = 1170, searchTerm = "voruun" }, -- 14
{ questId = 48721, name = "Skreeg the Devourer", x = .4979, y = .0940, mapId = 1170, searchTerm = "skreeg" }, -- 15
{ questId = 48935, name = "Slithon the Last", x = .4976, y = .5288, mapId = 1170, searchTerm = "slithon" }, -- 16
{ questId = 48710, name = "Sorolis the Ill-Fated", x = .7025, y = .4608, mapId = 1170, searchTerm = "sorolis" }, -- 17
{ questId = 48693, name = "Soultwisted Monstrosity", x = .5277, y = .6723, mapId = 1170, searchTerm = "monstros" }, -- 18
{ questId = 48706, name = "Turek the Lucid", x = .3911, y = .6662, mapId = 1170, searchTerm = "turek" }, -- 19
{ questId = 48708, name = "Umbraliss", x = .3492, y = .3724, mapId = 1170, searchTerm = "umbrali" }, -- 20
{ questId = 48705, name = "Venomtail Skyfin", x = .3401, y = .4783, mapId = 1170, searchTerm = "venomt" }, -- 21
{ questId = 48704, name = "Vigilant Kuro", x = .6388, y = .6425, mapId = 1170, searchTerm = "kuro" }, -- 22
{ questId = 48703, name = "Vigilant Thanos", x = .3632, y = .2371, mapId = 1170, searchTerm = "thanos" }, -- 23
{ questId = 48695, name = "Wrangler Kravos", x = .5565, y = .5995, mapId = 1170, searchTerm = "kravos" }, -- 24
{ questId = 48719, name = "Zul'tan the Numerous", x = .6653, y = .2851, mapId = 1170, searchTerm = "zul'tan" }, -- 25
}
}
aetzonesdebug = nil
aetdebug = nil
local searching = false
-- /run print(GetCurrentMapAreaID())
local aet = CreateFrame("frame", "ArgusEliteTrackerFram", UIParent)
local events = {}
local zoneIds = { krokuun = 1135, antoranWastes = 1171, macAree = 1170 }
local selectedZone = zones.krokuun
local selectedZoneName = "krokuun"
local groupCreationActive = false
aet.quests = {
-- questId = elite
}
aet.groups = {
-- groupId = { elite }
}
if debugging then
aetzonesdebug = zones
aetdebug = aet
end
local function resetAll()
for name, elites in pairs(zones) do
for i, elite in pairs(zones[name]) do
elite.searchResults = 0
elite:SetNa()
end
end
end
-- local function UpdateKilledStatusForAll()
-- for name, elites in pairs(zones) do
-- for i, elite in pairs(zones[name]) do
-- elite.killed = IsQuestFlaggedCompleted(elite.questId)
-- end
-- end
-- end
local function HideFiltered()
if editMode then
for k,elite in pairs(selectedZone) do
elite.hidden = false
end
return 0
end
local numberOfHidden = 0
for i, elite in ipairs(selectedZone) do
elite.hidden = false
hiddenElites = {}
local function hideElite(elite)
local exists = hiddenElites[elite.name] ~= nil
if not exists then
hiddenElites[elite.name] = true
elite.hidden = true
numberOfHidden = numberOfHidden + 1
end
return exists
end
if ArgusEliteTrackerConfig.onlyShowElitesWithGroups then
if elite.searchResults < 1 then
hideElite(elite)
end
end
if ArgusEliteTrackerConfig.hideKilledElites == true then
if elite.killed then
hideElite(elite)
end
end
if ArgusEliteTrackerConfig.forceShowWorldQuestsIfNotKilled then
if elite.isWq then
if elite.hidden then
if hideElite(elite) then
numberOfHidden = numberOfHidden - 1
end
elite.hidden = false
end
if elite.killed then
if ArgusEliteTrackerConfig.hideKilledElites then
if hideElite(elite) then
numberOfHidden = numberOfHidden -1
end
elite.hidden = true
else
if hideElite(elite) then
numberOfHidden = numberOfHidden -1
end
elite.hidden = false
end
end
if ArgusEliteTrackerConfig.forceShowWorldQuestsIfForceHidden then
if ArgusEliteTrackerConfig.forceHidden[elite.questId] then
if elite.hidden then
numberOfHidden = numberOfHidden - 1
end
elite.hidden = false
end
end
end
end
if ArgusEliteTrackerConfig.forceShowWorldQuestsIfForceHidden then
if ArgusEliteTrackerConfig.forceHidden[elite.questId] then
if elite.isWq then
if elite.hidden then
numberOfHidden = numberOfHidden - 1
end
elite.hidden = false
else
hideElite(elite)
end
end
else
if ArgusEliteTrackerConfig.forceHidden[elite.questId] then
if not elite.hidden then
numberOfHidden = numberOfHidden + 1
end
elite.hidden = true
end
end
end
return numberOfHidden
end
-- You're my man
function updateArgusEliteTrackerFrame()
-- UpdateKilledStatusForAll()
aet.elitesContainer:ClearAllPoints()
aet.elitesContainer.krokuun:ClearAllPoints()
aet.elitesContainer.antoranWastes:ClearAllPoints()
aet.elitesContainer.macAree:ClearAllPoints()
numberOfHidden = HideFiltered()
local height = ((#selectedZone - numberOfHidden) * 16) + 50
local visibleCounter = 1
local beginOffset = -25
if ArgusEliteTrackerConfig.growUpwards then
beginOffset = 5
end
for i, elite in ipairs(selectedZone) do
local yOffset = beginOffset + (-(visibleCounter * 16))
if not elite.hidden then
elite:Show(yOffset)
visibleCounter = visibleCounter + 1
else
elite:Hide()
end
if not searching then
elite:Update()
end
end
if ArgusEliteTrackerConfig.growUpwards then
aet.elitesContainer:SetPoint("BOTTOMLEFT", aet, "TOPLEFT", 0, -2)
aet.elitesContainer.krokuun:SetPoint("TOPLEFT", aet.elitesContainer, "BOTTOMLEFT", 10, 30)
aet.elitesContainer.krokuun:SetSize(75, 20)
aet.elitesContainer.antoranWastes:SetPoint("TOPLEFT", aet.elitesContainer, "BOTTOMLEFT", (aet:GetWidth() / 3), 30)
aet.elitesContainer.antoranWastes:SetSize((aet:GetWidth() / 3) - (2 * 5) + 10, 20)
aet.elitesContainer.macAree:SetPoint("TOPLEFT", aet.elitesContainer, "BOTTOMLEFT", 10 + (aet:GetWidth() / 3) * 2 + 5, 30)
aet.elitesContainer.macAree:SetSize(75, 20)
-- aet.elitesContainer:SetPoint("BOTTOMLEFT", aet.zonesContainer, "TOPLEFT", 0, 0)
-- aet.elitesContainer:SetPoint("TOPLEFT", 0, -18)
else
aet.elitesContainer:SetPoint("TOPLEFT", 0, -24)
aet.elitesContainer.krokuun:SetPoint("topleft", aet.elitesContainer, "topleft", 10, -10)
aet.elitesContainer.krokuun:SetSize(75, 20)
aet.elitesContainer.antoranWastes:SetPoint("topleft", aet.elitesContainer, "topleft", (aet:GetWidth() / 3), -10)
aet.elitesContainer.antoranWastes:SetSize((aet:GetWidth() / 3) - (2 * 5) + 10, 20)
aet.elitesContainer.macAree:SetPoint("topleft", aet.elitesContainer, "topleft", 10 + (aet:GetWidth() / 3) * 2 + 5, -10)
aet.elitesContainer.macAree:SetSize(75, 20)
end
aet.elitesContainer:SetHeight(height)
end
local function playerIsOnArgus()
local currentMapId, _ = GetCurrentMapAreaID()
local onArgus = false
for i, v in pairs(zoneIds) do
if zoneIds[i] == currentMapId then
onArgus = true
end
end
-- because wtf :s
if onArgus == false then
if currentMapId == 1184 then onArgus = true end
end
return onArgus
end
local function hideZone(zone)
for i, elite in ipairs(zones[zone]) do
elite:Hide()
end
end
local function disableAllButtons()
aet.SearchAll:EnableMouse(false)
aet.SearchAll.Label:SetTextColor(1, 1, 1, 0.2)
for name, elites in pairs(zones) do
for i, elite in pairs(zones[name]) do
elite.button:EnableMouse(false)
elite.button.Label:SetTextColor(1, 1, 1, 0.2)
elite.cButton:EnableMouse(false)
elite.cButton.Label:SetTextColor(1, 1, 1, 0.2)
elite.jButton:EnableMouse(false)
elite.jButton.Label:SetTextColor(1, 1, 1, 0.2)
end
end
end
local function enableAllButtons()
aet.SearchAll:EnableMouse(true)
aet.SearchAll.Label:SetTextColor(1, 1, 1, 0.90)
for name, elites in pairs(zones) do
for i, elite in pairs(zones[name]) do
elite.button:EnableMouse(true)
elite.button.Label:SetTextColor(1, 1, 1, 1)
elite.cButton:EnableMouse(true)
elite.cButton.Label:SetTextColor(1, 1, 1, 1)
elite.jButton:EnableMouse(true)
elite.jButton.Label:SetTextColor(1, 1, 1, 1)
end
end
end
local function updateWorldQuests(elites, zoneId)
SetMapByID(zoneId)
local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneId)
local worldQuestNames = {}
if taskInfo ~= nil then
for i, info in ipairs(taskInfo) do
local questName = C_TaskQuest.GetQuestInfoByQuestID(info.questId)
if questName ~= nil then
table.insert(worldQuestNames, { questName = questName, questId = info.questId })
end
end
for i, elite in ipairs(elites) do
elite.isWq = false
elite.wqId = nil
for index = 1, #worldQuestNames do
if worldQuestNames[index].questName:lower():find(elite.name:lower(), 1, true) then
elite.isWq = true
elite.wqId = worldQuestNames[index].questId
end
end
end
end
end
local function updateWorldQuestsForAllArgusZones()
local currentMapOpen = GetCurrentMapAreaID()
for name, elites in pairs(zones) do
local zoneId = zoneIds[name]
updateWorldQuests(elites, zoneId)
end
SetMapByID(currentMapOpen)
end
local function resetAllGroups()
for name, _ in pairs(zones) do
for _, elite in pairs(zones[name]) do
table.wipe(elite.groups)
end
end
end
------------------------------------
-- Search all groups
------------------------------------
local secondCounterAll = 0
local searchForSecondsAll = 3
local function searchForAllGroupsCallback()
searching = false
updateWorldQuestsForAllArgusZones()
resetAllGroups()
local numResults, resultTable = C_LFGList.GetSearchResults()
-- Blizzard wut, resultTable has a limit of 100,
-- but numResults shows over 100 results was found (highest I had was 180 something)
-- debug(numResults, resultTable)
-- local counter = 0
for id = 1, #resultTable do
local resultId = resultTable[id]
local id, activityId, groupName, comment, voiceChat, iLvl,
honorLevel, age, numBNetFriends, numCharFriends, numGuildMates, isDelisted = C_LFGList.GetSearchResultInfo(resultId);
groupName = groupName:lower()
local ageInMinutes = age / 60
for name, _ in pairs(zones) do
for _, elite in pairs(zones[name]) do
elite.killed = IsQuestFlaggedCompleted(elite.questId) -- HERE
if not elite.killed then
elite:SetNa()
end
if groupName:find(elite.searchTerm, 1, true) and not isDelisted and ageInMinutes < 5 then
aet.groups[id] = elite
elite.groups[id] = { id = id, age = age }
elite.searchResults = elite.searchResults + 1
break
end
end
end
end
updateArgusEliteTrackerFrame()
end
local function onUpdateAll(self, elapsed)
secondCounterAll = secondCounterAll + elapsed
if secondCounterAll >= searchForSecondsAll then
self:SetScript("OnUpdate", nil)
secondCounterAll = 0
resetAll()
enableAllButtons()
searchForAllGroupsCallback()
end
end
local function searchForAll()
updateArgusEliteTrackerFrame()
searching = true
disableAllButtons()
-- local languages = C_LFGList.GetLanguageSearchFilter()
-- Need to understand this better, seems like there's a limit to 100 responses
-- C_LFGList.Search(6, LFGListSearchPanel_ParseSearchTerms(""), 0, 0, languages)
C_LFGList.Search(6, LFGListSearchPanel_ParseSearchTerms(""))
aet.SearchAll:SetScript("OnUpdate", onUpdateAll)
end
------------------------------------
-- Search for one group
------------------------------------
local function updateSearchedElite(elite)
searching = false
resetAllGroups()
elite.searchResults = 0
local numResults, resultTable = C_LFGList.GetSearchResults()
for id = 1, #resultTable do
local resultId = resultTable[id]
local id, activityId, groupName, comment, voiceChat, iLvl, honorLevel,
age, numBNetFriends, numCharFriends, numGuildMates, isDelisted = C_LFGList.GetSearchResultInfo(resultId);
groupName = groupName:lower()
local ageInMinutes = age / 60
if groupName:find(elite.searchTerm, 1, true) and not isDelisted and ageInMinutes < 5 then
aet.groups[id] = elite
elite.groups[id] = { id = id, age = age }
elite.searchResults = elite.searchResults + 1
end
end
updateArgusEliteTrackerFrame()
end
local secondCounter = 0
local searchForSeconds = 3
local function onUpdate(self, elapsed)
secondCounter = secondCounter + elapsed
if secondCounter >= searchForSeconds then
self:SetScript("OnUpdate", nil)
secondCounter = 0
enableAllButtons()
updateSearchedElite(self.elite)
end
end
local function searchForGroup(elite)
searching = true
updateWorldQuestsForAllArgusZones()
elite.killed = IsQuestFlaggedCompleted(elite.questId) -- HERE
local languages = C_LFGList.GetLanguageSearchFilter()
if elite.isWq and elite.wqId ~= nil then
C_LFGList.Search(1, LFGListSearchPanel_ParseSearchTerms(elite.searchTerm), 0, 0, languages)
else
C_LFGList.Search(6, LFGListSearchPanel_ParseSearchTerms(elite.searchTerm), 0, 0, languages)
end
disableAllButtons()
elite.button:SetScript("OnUpdate", onUpdate)
end
local function initiateSearch(self, button)
local elite = self.elite
if(button == "LeftButton") then
elite.searchResults = 0
elite:SetNa()
searchForGroup(elite)
elseif button == "RightButton" then
if TomTom and IsAddOnLoaded("TomTom") then
if elite.tomtom then
TomTom:RemoveWaypoint(elite.tomtom)
elite.tomtom = nil
end
elite.tomtom = TomTom:AddMFWaypoint(elite.mapId, false, elite.x, elite.y, { title = elite.name })
TomTom:SetClosestWaypoint()
end
end
end
-- LFGList.lua l730
-- local activities = C_LFGList.GetAvailableActivities(self.selectedCategory, 0, bit.bor(self.baseFilters, self.selectedFilters));
-- LFGList.lua l884
-- if(C_LFGList.CreateListing(activityID, name, itemLevel, honorLevel, voiceChatInfo, description, autoAccept, privateGroup, questID)) then
local function initiateZones()
local yOffset = 15
local statusWidth = 50
for name, elites in pairs(zones) do
local zoneId = zoneIds[name]
updateWorldQuests(elites, zoneId)
for i, elite in pairs(zones[name]) do
local name = elite.name
local buttonText = elite.name
elite.searchResults = 0
elite.killed = IsQuestFlaggedCompleted(elite.questId) -- HERE
elite.groups = {}
local eliteIsForceHidden = ArgusEliteTrackerConfig.forceHidden[elite.questId]
if eliteIsForceHidden == nil then
ArgusEliteTrackerConfig.forceHidden[elite.questId] = false
end
elite.cButton = CreateFrame("button", nil, aet.elitesContainer)
elite.cButton:SetBackdrop(plainBackdrop)
elite.cButton:SetBackdropColor(0, 0, 0, 0)
elite.cButton:SetBackdropBorderColor(1, 1, 1, 0)
elite.cButton:SetFrameLevel(aet.elitesContainer:GetFrameLevel() + 1)
elite.cButton:SetSize(40, 16)
elite.cButton.Label = addonData:createLabel("Create", 12, "CENTER", elite.cButton)
elite.cButton.elite = elite
elite.cButton:SetScript("OnClick", function(self)
self.elite:CreateGroup()
end)
elite.jButton = CreateFrame("button", nil, aet.elitesContainer)
elite.jButton:SetBackdrop(plainBackdrop)
elite.jButton:SetBackdropColor(0, 0, 0, 0)
elite.jButton:SetBackdropBorderColor(1, 1, 1, 0)
elite.jButton:SetFrameLevel(aet.elitesContainer:GetFrameLevel() + 1)
elite.jButton:SetSize(40, 16)
elite.jButton.Label = addonData:createLabel("Join", 12, "CENTER", elite.jButton)
elite.jButton.elite = elite
elite.jButton:SetScript("OnClick", function(self)
self.elite:ApplyToGroup()
end)
elite.lButton = CreateFrame("button", nil, aet.elitesContainer)
elite.lButton:SetBackdrop(plainBackdrop)
elite.lButton:SetBackdropColor(0, 0, 0, 0)
elite.lButton:SetBackdropBorderColor(1, 1, 1, 0)
elite.lButton:SetFrameLevel(aet.elitesContainer:GetFrameLevel() + 1)
elite.lButton:SetSize(40, 16)
elite.lButton.Label = addonData:createLabel("Leave", 12, "CENTER", elite.lButton)
elite.lButton.elite = elite
elite.lButton:SetScript("OnClick", function(self)
self.elite:LeaveGroup()
end)
elite.button = CreateFrame("button", nil, aet.elitesContainer)
elite.button:SetBackdrop(plainBackdrop)
elite.button:SetBackdropColor(0, 0, 0, 0)
elite.button:SetBackdropBorderColor(1, 1, 1, 0)
elite.button:SetFrameLevel(aet.elitesContainer:GetFrameLevel() + 1)
elite.button:SetSize(aet:GetWidth() - 50 - statusWidth - 10, 16)
elite.button.Label = addonData:createLabel(buttonText, 12, "CENTER", elite.button)
elite.button.elite = elite
elite.button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
elite.button:SetScript("OnClick", initiateSearch)
elite.status = CreateFrame("Frame", nil, aet.elitesContainer)
elite.status:SetBackdrop(plainBackdrop)
elite.status:SetBackdropColor(0, 0, 0, 0)
elite.status:SetBackdropBorderColor(1, 1, 1, 0)
elite.status:SetFrameLevel(aet.elitesContainer:GetFrameLevel() + 1)
elite.status:SetSize(statusWidth, 15)
elite.status.Label = addonData:createLabel("N/A", 12, "CENTER", elite.status)
function elite:Hide()
self.cButton:Hide()
self.jButton:Hide()
self.lButton:Hide()
self.button:Hide()
self.status:Hide()
end
function elite:Show(yOffset)
if yOffset ~= nil then
self.cButton:SetPoint("topleft", aet.elitesContainer, "topleft", 10, yOffset)
self.jButton:SetPoint("topleft", aet.elitesContainer, "topleft", 10, yOffset)
self.lButton:SetPoint("topleft", aet.elitesContainer, "topleft", 10, yOffset)
self.button:SetPoint("topleft", aet.elitesContainer, "topleft", 50, yOffset)
self.status:SetPoint("topright", aet.elitesContainer, "topright", -10, yOffset)
end
-- self:UpdateGroupButtons()
self:UpdateGroups()
self.button:Show()
self.status:Show()
end
function elite:GetGroupCount()
local counter = 0
for id, value in pairs(self.groups) do
counter = counter + 1
end
return counter
end
function elite:GetApplied()
local counter = 0
for id, value in pairs(self.groups) do
if value.applied then
counter = counter + 1
end
end
return counter
end
function elite:RemoveInvalidGroups()
local toRemove = {}
for k,v in pairs(self.groups) do
local id = select(1, C_LFGList.GetSearchResultInfo(id))
if id == nil then
table.insert(toRemove, id)
end
end
for k,v in pairs(toRemove) do
self.groups[v] = nil
end
end
function elite:EnableCreateGroup()
if searching then return end
self.cButton:EnableMouse(true)
self.cButton.Label:SetTextColor(1, 1, 1, 1)
end
function elite:DisableCreateGroup()
self.cButton:EnableMouse(false)
self.cButton.Label:SetTextColor(1, 1, 1, 0.2)
end
function elite:EnableJoinGroup()
self.jButton:EnableMouse(true)
end
function elite:DisableJoinGroup()
self.jButton:EnableMouse(false)
self.jButton.Label:SetTextColor(1, 1, 1, 0.2)
end
function elite:EnableLeaveGroup()
if searching then return end
self.lButton:EnableMouse(true)
self.lButton.Label:SetTextColor(1, 1, 1, 1)
end
function elite:DisableLeaveGroup()
self.lButton:EnableMouse(false)
self.lButton.Label:SetTextColor(1, 1, 1, 0.2)
end
function elite:EnableCreateAndJoinGroup()
self:EnableCreateGroup()
self:EnableJoinGroup()
end
function elite:DisableCreateAndJoinGroup()
self:DisableCreateGroup()
self:DisableJoinGroup()
end
function elite:SetNa()
if(not self.killed) and (not self.isWq) then
self.status.Label:SetTextColor(1, 0.45, 0.08, 1)
self.status.Label:SetText("(" .. self.searchResults .. ") N/A")
end
end
function elite:UpdateGroups()
self:RemoveInvalidGroups()
if editMode then
self.jButton:Hide()
self.cButton:Hide()
self.lButton:Hide()
return
end
groupCreationActive = select(1, C_LFGList.GetActiveEntryInfo())
if groupCreationActive then
self:DisableCreateAndJoinGroup()
else
if C_LFGList.IsCurrentlyApplying() then
-- debug("currently applying")
self:DisableCreateGroup()
if C_LFGList.GetNumApplications() >= 5 then
-- debug("listed for too many groups")
self:DisableJoinGroup()
else
if IsInGroup() then
-- debug("we're in a group")
if UnitIsGroupLeader("player") then
-- debug("we are the leader")
self:EnableJoinGroup()
else
-- debug("we are NOT the leader")
self:DisableJoinGroup()
end
else
-- debug("we're not in a group")
self:EnableJoinGroup()
end
end
else
if IsInGroup() then
-- debug("we are in a group")
if UnitIsGroupLeader("player") then
-- debug("we are the leader")
self:EnableCreateAndJoinGroup()
else
-- debug("we are not the leader")
self:DisableCreateAndJoinGroup()
end
else
-- debug("we are not in a group")
self:EnableCreateAndJoinGroup()
end
end
end
if self:GetGroupCount() > 0 then
self.jButton:Show()
self.cButton:Hide()
elseif self:GetGroupCount() == 0 then
self.cButton:Show()
self.jButton:Hide()
end
self.lButton:Hide()
if self.inGroup then
self.jButton:Hide()
self.cButton:Hide()
self.lButton:Show()
end
end
function elite:EditMode()
ArgusEliteTrackerConfig.forceHidden[self.questId] = not ArgusEliteTrackerConfig.forceHidden[self.questId]
self:Update()
end
function elite:Update()
if editMode then
self.status:Hide()
self.button:SetScript("OnClick", function()
self:EditMode()
end)
self.button.Label:SetTextColor(1, 1, 1, 1)
if ArgusEliteTrackerConfig.forceHidden[self.questId] then
self.button:SetBackdropColor(0.957, 0.306, 0.259, 0.9)
else
self.button:SetBackdropColor(0.259, 0.957, 0.384, 0.9)
end
return
else
self.button:SetBackdropColor(0, 0, 0, 0)
self.status:Show()
self.button:SetScript("OnClick", initiateSearch)
end
if self.killed then
self.button.Label:SetTextColor(1, 1, 1, 0.2)
self.status.Label:SetTextColor(0.30, 0.91, 0.46, 1)
self.status.Label:SetText("Killed")
elseif self.isWq then
self.status.Label:SetTextColor(0.85, 0.85, 0.2, 1)
self.status.Label:SetText("WQ")
else
if self.searchResults > 0 then
self.status.Label:SetTextColor(0.30, 0.91, 0.46, 1)
self.status.Label:SetText("(" .. self.searchResults .. ") YES")
else
self.status.Label:SetTextColor(0.96, 0.30, 0.29, 1)
self.status.Label:SetText("(0) NO")
end
end
self:RemoveInvalidGroups()
if self:GetGroupCount() > 0 then
local applied = self:GetApplied()
local groupCount = self:GetGroupCount()
self.jButton.Label:SetText("Join " .. tostring(groupCount-applied))
if groupCount - applied == 0 then
self.jButton.Label:SetTextColor(0.20, 0.91, 0.46, 0.5)
elseif applied > 0 then
self.jButton.Label:SetTextColor(0.20, 0.91, 0.46, 1)
else
self.jButton.Label:SetTextColor(1, 1, 1, 1)
end
end
self:UpdateGroups()
if self.hidden then
self:Hide()
end
end
function elite:LeaveGroup()
LeaveParty()
self.inGroup = false
end
function elite:ApplyToGroup()
if C_LFGList.GetNumApplications() >= 5 then
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF0000Applied to too many groups.")
return
end
local any = false
for _, v in pairs(self.groups) do
if not v.applied then
local tank, healer, dps = UnitGetAvailableRoles("player")
C_LFGList.ApplyToGroup(v.id, "Joined from ArgusEliteTracker", tank, healer, dps)
v.applied = true
any = true
break
end
end
self:Update()
updateArgusEliteTrackerFrame()
end
function elite:CreateGroup()
-- LFGList.lua l884
-- C_LFGList.CreateListing(activityID, name, itemLevel, honorLevel, voiceChatInfo, description, autoAccept, privateGroup, questID)
if self.isWq and self.wqId ~= nil then
local activityId = C_LFGList.GetActivityIDForQuestID(self.wqId)
if(C_LFGList.CreateListing(activityId, "", 0, 0, "", self.name .. ". Group created with ArgusEliteTracker.", true, false, self.wqId)) then
self.inGroup = true
else
debug("nOOoOooOoOo")
end
else
if(C_LFGList.CreateListing(16, self.name, 0, 0, "", self.name .. ". Group created with ArgusEliteTracker.", true, false)) then
self.inGroup = true
else
debug("NOOOOOOO")
end
end
end
elite:Hide()
elite:Show()
end
end
-- This will cause an ADDON_ACTION_BLOCKED event (because it didn't originate from a user hardware click?)
-- searchForAll()
end
---------------------------------------------
-- Create the addon frames
---------------------------------------------
function createArgusEliteTrackerFrames()
aet:SetPoint("CENTER", 0, 0)
aet:SetSize(300, 24)
aet:SetMovable(true)
aet:EnableMouse(true)
aet:RegisterForDrag("LeftButton")
aet:SetResizable(true)
aet:SetClampedToScreen(true)
aet.elitesContainer = CreateFrame("frame", nil, aet)
aet.elitesContainer:SetSize(300, 50)
aet.elitesContainer:SetBackdrop(plainBackdrop)
aet.elitesContainer:SetBackdropColor(0, 0, 0, 1)
aet.elitesContainer:SetBackdropBorderColor(1, 1, 1, 0)
-- Create a header for our addon frame
aet.TitleBar = CreateFrame("frame", nil, aet)
aet.TitleBar:SetPoint("topleft", 0, -1)
aet.TitleBar:SetPoint("topright", 0, 1)
aet.TitleBar:SetHeight(24)
aet.TitleBar:EnableMouse(false)
aet.TitleBar:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 2, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 0 })
aet.TitleBar:SetBackdrop(plainBackdrop)
aet.TitleBar:SetBackdropColor(1, .84, 0, 1)
aet.TitleBar:SetBackdropBorderColor(0, 0, 0, 0)
aet.TitleBar.Label = aet.TitleBar:CreateFontString()
aet.TitleBar.Label:SetFont(defaultFontName, 12)
aet.TitleBar.Label:SetPoint("CENTER", aet.TitleBar, "CENTER", 0, 0)
aet.TitleBar.Label:SetText("Argus Elite Tracker")
aet.elitesContainer:SetFrameLevel(aet.TitleBar:GetFrameLevel() - 1)
aet.SearchAll = CreateFrame("button", "AetSearchAllButton", aet.TitleBar)
aet.SearchAll:SetPoint("left", aet.TitleBar, "left", 4, 0)
aet.SearchAll:SetSize(58, 15)
aet.SearchAll:EnableMouse(true)
aet.SearchAll:SetBackdrop(plainBackdrop)
aet.SearchAll:SetFrameLevel(aet.TitleBar:GetFrameLevel() + 1)
aet.SearchAll:SetBackdropColor(0, 0, 0, 1)
aet.SearchAll:SetBackdropBorderColor(1, 1, 1, 0)
aet.SearchAll.Label = addonData:createLabel("Search all", 10, "CENTER", aet.SearchAll)
aet.SearchAll.Label:SetTextColor(0.95, 0.95, 0.95, 0.95, 1)
aet.Edit = CreateFrame("button", "AetEditButton", aet.TitleBar)
aet.Edit:SetPoint("right", aet.TitleBar, "right", -66, 0)
aet.Edit:SetSize(15, 15)
aet.Edit:SetBackdrop(plainBackdrop)
aet.Edit:SetFrameLevel(aet.TitleBar:GetFrameLevel() + 1)
aet.Edit:SetBackdropColor(0, 0, 0, 1)
aet.Edit:SetBackdropBorderColor(1, 1, 1, 0)
aet.Edit.Label = addonData:createLabel("E", 10, "CENTER", aet.Edit)