-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathWorldQuestTracker_GroupFinder.lua
2125 lines (1762 loc) · 73.6 KB
/
WorldQuestTracker_GroupFinder.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
-- ~disabled
local addonId, wqtInternal = ...
--world quest tracker object
local WorldQuestTracker = WorldQuestTrackerAddon
if (not WorldQuestTracker) then
return
end
--framework
local DF = _G ["DetailsFramework"]
if (not DF) then
print ("|cFFFFAA00World Quest Tracker: framework not found, if you just installed or updated the addon, please restart your client.|r")
return
end
--localization
local L = DF.Language.GetLanguageTable(addonId)
local ff = WorldQuestTrackerFinderFrame
local rf = WorldQuestTrackerRareFrame
local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap
ff.cannot_group_quest = {}
--> store players near the player
ff.PlayersNearby = {}
ff.PlayersInvited = {}
local GameCooltip = GameCooltip2
local _
local C_TaskQuest = _G.C_TaskQuest
local isWorldQuest = QuestUtils_IsQuestWorldQuest
--create tick frame
ff.TickFrame = CreateFrame("frame", nil, UIParent, "BackdropTemplate")
--finder frame setup
ff.Width = 240
ff.Height = 116
ff.ButtonWidth = 236
ff.ButtonHeight = 20
ff.ButtonVerticalPadding = 4
ff.TitleHeight = 20 + (ff.ButtonVerticalPadding*2)
ff.divBarY = -55
ff.topLevelY = -28
ff.buttonRowY = -8 --from the div bar
ff:SetSize(ff.Width, ff.Height)
DF:ApplyStandardBackdrop(ff)
ff:SetPoint("center")
ff:EnableMouse (true)
ff:SetMovable (true)
ff:Hide()
ff.lastToggleRequest = 0
hooksecurefunc("PVEFrame_ToggleFrame", function()
if (ff.lastToggleRequest == time()) then
--the call came from world quest tracker it self
return
else
ff.lastToggleRequest = time()
end
local isFFShown = ff:IsShown()
--if FF isn't shown, make sure to restore the alpha
--even if this is a hide call
if (not isFFShown) then
PVEFrame:SetAlpha(1)
return
end
--player pressed to show/hide the group finder interface
local isPVEFrameShown = PVEFrame:IsShown()
local PVEFrameAlpha = PVEFrame:GetAlpha()
if (isFFShown and PVEFrameAlpha == 0 and not isPVEFrameShown) then
--player pressed to show group finder, but is was just with zero alpha due to FF being Shown
--here need to show again the group finder and adjust its alpha to 1
PVEFrame_ToggleFrame()
PVEFrame:SetAlpha(1)
return
end
end)
--right click to close label
ff.RightClickClose = DF:CreateLabel (ff, "right click to close this window")
ff.RightClickClose:SetPoint("bottom", ff, "bottom", 0, 2)
ff.RightClickClose.color = "gray"
ff:SetScript("OnMouseDown", function(self, button)
if (button == "RightButton") then
ff:HideFrame(true)
end
end)
--captcha text input
function ff.OnCaptchaEnterPressed(textEntryBox, _, text)
--print("text entered:", text)
end
local captchaTextInstruction = ff:CreateFontString(nil, "overlay", "GameFontNormal")
captchaTextInstruction:SetText("For group search, enter questId:")
--captchaTextInstruction:SetPoint("topleft", ff, "topleft", 2, -26)
captchaTextInstruction:SetPoint("topleft", ff, "topleft", 2, ff.divBarY - 7)
DF:SetFontSize(captchaTextInstruction, 10)
local captchaText = ff:CreateFontString(nil, "overlay", "GameFontNormal")
captchaText:SetPoint("topleft", captchaTextInstruction, "bottomleft", 0, -5)
DF:SetFontSize(captchaText, 18)
ff.CaptchaText = captchaText
local captchaEntry = DF:CreateTextEntry (ff, ff.OnCaptchaEnterPressed, 80, 22, "CaptchaEntry", "$parentCaptchaEntry", nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
captchaEntry:SetPoint("left", captchaText, "right", 8, 0)
captchaEntry:SetJustifyH("left")
captchaEntry:SetTextInsets(10, -10, 0, 0)
captchaEntry:SetHook("OnEnterPressed", function(editBox)
_G.WorldQuestTrackerFinderFrameAcceptButton:Click()
end)
captchaEntry:SetHook("OnChar", function(editBox)
end)
--create group button
local createGroupFrame = CreateFrame("frame", "WorldQuestTrackerCreateQuestGroupFrame", UIParent)
createGroupFrame:Hide()
createGroupFrame:SetSize(200, 20)
createGroupFrame.questName = createGroupFrame:CreateFontString(nil, "overlay", "GameFontNormal")
--create small lines for each number
local supportCaptchaFrame = CreateFrame("frame", nil, captchaEntry.widget)
supportCaptchaFrame:SetAllPoints()
for i = 1, 5 do
local line = supportCaptchaFrame:CreateTexture(nil, "overlay", nil, 7)
line:SetColorTexture(1, 1, 1, 0.5)
line:SetSize(10, 1)
line:SetPoint("left", supportCaptchaFrame, "left", i*12, -8)
end
supportCaptchaFrame:SetScript("OnEvent", function(self, event, ...)
if (event == "LFG_LIST_SEARCH_RESULT_UPDATED") then
--search results are ready
supportCaptchaFrame.searchId = select(1, ...)
--print(supportCaptchaFrame.searchId)
--local searchResultInfo = C_LFGList.GetSearchResultInfo(supportCaptchaFrame.searchId);
elseif (event == "LFG_LIST_SEARCH_RESULTS_RECEIVED") then
local results = LFGListFrame.SearchPanel.results
--no results?
if (results and #results == 0) then
--show the create group button if in quest category
local selectedCategory = LFGListFrame.SearchPanel.categoryID
if (selectedCategory ~= 1) then
return
end
createGroupFrame:SetParent(LFGListFrame.SearchPanel)
if LFGListSearchPanelScrollFrame then
createGroupFrame:SetPoint("top", LFGListSearchPanelScrollFrame.StartGroupButton, "bottom", 0, -5)
end
createGroupFrame:Show()
else
createGroupFrame:Hide()
end
end
end)
--hook search result lines to auto signup when clicking on them
C_Timer.After(1, function()
--hook onclick from buttons in the result frame
--LFGListFrame.SearchPanel.ScrollFrame doesn't exist in dragonflight
--[=[
for i = 1, #LFGListFrame.SearchPanel.ScrollFrame.buttons do
local button = LFGListFrame.SearchPanel.ScrollFrame.buttons[i]
button:HookScript("OnClick", function(self, button)
if (button == "RightButton") then
return
end
--if already applied to a group, reclicking should cancel the apply
--check if the entry is valid
if (LFGListFrame.SearchPanel.selectedResult) then
_G.LFGListSearchPanel_SignUp(LFGListFrame.SearchPanel)
--this should only work on questing and custom, player may want to select the role on other categories
local selectedCategory = LFGListFrame.SearchPanel.categoryID
if (selectedCategory ~= 1) then
return
end
--checking the boxes make them be saved for the next time player uses it
-- _G.LFGListApplicationDialog.TankButton.CheckButton:SetChecked(true)
-- _G.LFGListApplicationDialog.HealerButton.CheckButton:SetChecked(true)
-- _G.LFGListApplicationDialog.DamagerButton.CheckButton:SetChecked(true)
--_G.LFGListApplicationDialog.Description:SetText("World Quest Tracker.") - causing an error
_G.LFGListApplicationDialogSignUpButton_OnClick(_G.LFGListApplicationDialog.SignUpButton)
end
end)
end
--]=]
--hook onclick from the start group button
--LFGListSearchPanelScrollFrameScrollChild doesn't exists in dragonflight
--[=[
LFGListSearchPanelScrollFrameScrollChild.StartGroupButton:HookScript("OnClick", function(self)
--only work for category quest
local selectedCategory = LFGListFrame.SearchPanel.categoryID
if (selectedCategory ~= 1 and selectedCategory ~= 6) then
return
end
end)
--]=]
end)
--hiddenSearchButton
ff.hiddenSearchButton = CreateFrame("button", "$parentHiddenSearchButton", ff, "BackdropTemplate")
ff.hiddenSearchButton:RegisterForClicks("LeftButtonDown", "RightButtonDown")
ff.hiddenSearchButton:SetScript("OnClick", function(self, mouseButton)
if (mouseButton == "RightButton") then
ff:HideFrame(true)
return
end
ff.WasLFGWindowOpened = _G.PVEFrame:IsShown()
if (not ff.WasLFGWindowOpened) then
ff.lastToggleRequest = time()
_G.PVEFrame_ToggleFrame()
end
_G.LFGListUtil_OpenBestWindow()
_G.LFGListCategorySelection_SelectCategory(LFGListFrame.CategorySelection, 1, 0)
--make the quest
LFGListFrame.CategorySelection.FindGroupButton:Click()
--literally take the search box from the group finder window and put it in the wqt window
local stolenSearchBox = LFGListFrame.SearchPanel.SearchBox
stolenSearchBox:ClearAllPoints()
stolenSearchBox:SetPoint("left", captchaText, "right", 10, 0)
stolenSearchBox:SetIgnoreParentAlpha(true)
_G.PVEFrame:SetAlpha(0)
stolenSearchBox:SetFrameLevel(captchaEntry:GetFrameLevel() + 2)
stolenSearchBox:Show()
stolenSearchBox:SetFocus(true)
stolenSearchBox:SetAlpha(0)
ff.hiddenSearchButton.fakeInputMarkTexture:SetPoint("left", captchaEntry.widget, "left", 12, 0)
ff.hiddenSearchButton.fakeInputMarkAnim:Play()
end)
ff.hiddenSearchButton:SetPoint("topleft", captchaEntry.widget, "topleft", -100, 10)
ff.hiddenSearchButton:SetPoint("bottomright", captchaEntry.widget, "bottomright", 235, -10)
ff.hiddenSearchButton:SetFrameLevel(captchaEntry:GetFrameLevel() + 1)
local fakeInputMark = ff.hiddenSearchButton:CreateTexture(nil, "overlay", nil, 7)
fakeInputMark:SetColorTexture(1, 1, 1, 1)
fakeInputMark:SetSize(2, 18)
fakeInputMark.animHub = DF:CreateAnimationHub(fakeInputMark, function()fakeInputMark:Show();fakeInputMark:SetAlpha(1)end, function()fakeInputMark:Hide();fakeInputMark:SetAlpha(1)end)
fakeInputMark.animHub:SetLooping("REPEAT")
ff.hiddenSearchButton.fakeInputMarkTexture = fakeInputMark
ff.hiddenSearchButton.fakeInputMarkAnim = fakeInputMark.animHub
fakeInputMark.Alpha1 = DF:CreateAnimation(fakeInputMark.animHub, "ALPHA", 1, 0, 0, 1)
fakeInputMark.Alpha1:SetEndDelay(0.55)
fakeInputMark.Alpha2 = DF:CreateAnimation(fakeInputMark.animHub, "ALPHA", 2, 0, 1, 0)
fakeInputMark.Alpha2:SetEndDelay(0.55)
local givebackStolenSearchBox = function()
--restore search box point
local stolenSearchBox = LFGListFrame.SearchPanel.SearchBox
stolenSearchBox:ClearAllPoints()
stolenSearchBox:SetPoint("topleft", LFGListFrame.SearchPanel.CategoryName, "bottomleft", 4, -7)
stolenSearchBox:ClearFocus()
stolenSearchBox:SetIgnoreParentAlpha(false)
stolenSearchBox:SetAlpha(1)
end
local restoreFrames = function()
--restore search box point
givebackStolenSearchBox()
ff.hiddenSearchButton.fakeInputMarkAnim:Stop()
ff.hiddenSearchButton.fakeInputMarkTexture:Hide()
if (_G.PVEFrame:IsShown() and _G.PVEFrame:GetAlpha() > .9) then
--already shown, the user might have requested to open it, all good!
return
end
_G.PVEFrame:SetAlpha(1)
if (ff.WasLFGWindowOpened) then
if (not _G.PVEFrame:IsShown()) then
ff.lastToggleRequest = time()
_G.PVEFrame_ToggleFrame()
end
elseif (_G.PVEFrame:IsShown()) then
ff.lastToggleRequest = time()
_G.PVEFrame_ToggleFrame()
end
end
do
local stolenSearchBox = LFGListFrame.SearchPanel.SearchBox
stolenSearchBox:HookScript("OnTextChanged", function(self)
local text = self:GetText()
captchaEntry:SetText(text)
ff.hiddenSearchButton.fakeInputMarkTexture:SetPoint("left", captchaEntry.widget, "left", 12 + (#text * 12), 0)
end)
stolenSearchBox:HookScript("OnEditFocusLost", function(self)
if (ff:IsShown()) then
ff.hiddenSearchButton.fakeInputMarkAnim:Stop()
ff.hiddenSearchButton.fakeInputMarkTexture:Hide()
end
end)
stolenSearchBox:HookScript("OnEditFocusGained", function(self)
if (ff:IsShown()) then
ff.hiddenSearchButton.fakeInputMarkAnim:Play()
ff.hiddenSearchButton.fakeInputMarkTexture:Show()
end
end)
stolenSearchBox:HookScript("OnEnterPressed", function(self)
if (ff:IsShown()) then
ff.EnterPressedTime = GetTime()
_G.PVEFrame:SetAlpha(1)
givebackStolenSearchBox()
ff.SearchTime = GetTime()
end
end)
ff:SetScript("OnShow", function()
ff.hiddenSearchButton:Show()
ff.GroupButtonsFrame:Show()
ff.GroupButtonsFrame:SetPoint("top", ff, "top", 0, ff.topLevelY)
ff.leaveButtonSolo:Hide()
local children = {ff.GroupButtonsFrame:GetChildren()}
local firstChild = children[1]
firstChild:SetPoint("left", ff.GroupButtonsFrame, "left", 0, 0)
local padding = 2
for i = 2, #children do
local child = children[i]
child:SetPoint("left", children[i-1], "right", padding, 0)
end
local width = #children * firstChild:GetWidth() + ((#children-2) * padding)
ff.GroupButtonsFrame:SetSize(width, firstChild:GetHeight())
end)
ff:SetScript("OnHide", function()
ff.hiddenSearchButton:Hide()
restoreFrames()
end)
--LFGListSearchPanelScrollFrameScrollChild isn't present on dragonflight
--start group OnClick hook
--[=[
LFGListSearchPanelScrollFrameScrollChild.StartGroupButton:HookScript("OnClick", function()
--hide the ff
ff.WasLFGWindowOpened = true
ff:Hide()
C_Timer.After(0.05, function()
if (not LFGListFrame.EntryCreation.Name.Instructions2) then
LFGListFrame.EntryCreation.Name.Instructions2 = WorldQuestTracker:CreateLabel(LFGListFrame.EntryCreation.Name)
LFGListFrame.EntryCreation.Name.Instructions2:SetPoint("right", -21, 0)
LFGListFrame.EntryCreation.Name.Instructions2.color = "gray"
LFGListFrame.EntryCreation.Name.Instructions2.alpha = 0.3
LFGListFrame.EntryCreation.Name.Instructions2.align = ">"
LFGListFrame.SearchPanel.SearchBox.Instructions2 = WorldQuestTracker:CreateLabel (LFGListFrame.SearchPanel.SearchBox)
LFGListFrame.SearchPanel.SearchBox.Instructions2:SetPoint("right", -21, 0)
LFGListFrame.SearchPanel.SearchBox.Instructions2.color = "gray"
LFGListFrame.SearchPanel.SearchBox.Instructions2.alpha = 0.3
LFGListFrame.SearchPanel.SearchBox.Instructions2.align = ">"
--ballon popup
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon = CreateFrame("frame", "WorldQuestTrackerGroupFinderPopup", LFGListFrame.EntryCreation.Name, "MicroButtonAlertTemplate_BFA")
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon:SetFrameLevel(2000)
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon.Text:SetSpacing(4)
DF:SetFontSize(LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon.Text, 20)
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon:SetPoint("bottomleft", LFGListFrame.SearchPanel.SearchBox, "topleft", 0, 20)
LFGListFrame.EntryCreation.Name:HookScript("OnEnterPressed", function()
LFGListFrame.EntryCreation.ListGroupButton:Click()
end)
LFGListFrame.EntryCreation.Name:HookScript("OnHide", function()
LFGListFrame.EntryCreation.Name.Instructions2.text = ""
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon:Hide()
end)
end
if (ff.SearchTime and ff.SearchTime+30 > GetTime()) then
LFGListFrame.EntryCreation.Name.Instructions2.text = "Enter questID: " .. ff.CurrentWorldQuest
LFGListFrame.EntryCreation.Name.Instructions:SetText("")
LFGListFrame.SearchPanel.SearchBox.Instructions:SetText("")
LFGListFrame.SearchPanel.SearchBox:SetFocus(true)
LFGListFrame.SearchPanel.SearchBox.Instructions2.text = "Enter questID: " .. ff.CurrentWorldQuest
ff.SearchTime = GetTime()
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon.label = ff.CurrentWorldQuest
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon.Text:SetText(LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon.label)
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon:SetPoint("bottomleft", LFGListFrame.EntryCreation.Name, "topleft", 0, 20)
LFGListFrame.SearchPanel.SearchBox.QuestIDBalloon:Show()
end
end)
end)
--]=]
end
supportCaptchaFrame:RegisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED")
supportCaptchaFrame:RegisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED")
--search for a group in group finder button, create with bliz api
local acceptButton = CreateFrame("button", "$parentAcceptButton", ff, "BackdropTemplate")
acceptButton:SetSize(80, 22)
acceptButton:SetPoint("left", supportCaptchaFrame, "right", 5, 0)
acceptButton:SetFrameStrata("HIGH")
acceptButton:SetFrameLevel(LFGListFrame.SearchPanel.SearchBox:GetFrameLevel() + 5)
DF:ApplyStandardBackdrop(acceptButton)
acceptButton:SetNormalFontObject("GameFontNormal")
acceptButton:SetText(_G.SEARCH)
acceptButton:SetScript("OnClick", function(self, button)
local captcha = tonumber(captchaEntry:GetText())
if (captcha == ff.CurrentWorldQuest) then
LFGListFrame.CategorySelection.FindGroupButton:Click()
_G.PVEFrame:SetAlpha(1)
givebackStolenSearchBox()
ff.SearchTime = GetTime()
else
captchaEntry:SetTextColor(1, .2, 0, 1)
C_Timer.After(0.15, function() captchaEntry:SetTextColor(1, 1, 1, 1) end)
C_Timer.After(0.3, function() captchaEntry:SetTextColor(1, .2, 0, 1) end)
C_Timer.After(0.45, function() captchaEntry:SetTextColor(1, 1, 1, 1) end)
C_Timer.After(0.6, function() captchaEntry:SetTextColor(1, .2, 0, 1) end)
C_Timer.After(0.75, function() captchaEntry:SetTextColor(1, 1, 1, 1) end)
end
end)
do
local file, size, flags = captchaEntry:GetFont()
captchaEntry:SetFont (file, 18, flags)
end
--create a divisor
ff.divbar = ff:CreateTexture(nil, "overlay")
ff.divbar:SetTexture([[Interface\QUESTFRAME\AutoQuest-Parts]])
ff.divbar:SetTexCoord(238/512, 445/512, 0/64, 4/64)
ff.divbar:SetHeight(3)
ff.divbar:SetDesaturated(true)
ff.divbar:SetAlpha(0.5)
ff.divbar:SetVertexColor(0.5, 0.5, 0.5, 1)
ff.divbar:SetPoint("topleft", ff, "topleft", 3, ff.divBarY)
ff.divbar:SetPoint("topright", ff, "topright", -3, ff.divBarY)
ff.overlayCaptcha = CreateFrame("frame", nil, ff, "BackdropTemplate")
ff.overlayCaptcha:SetPoint("topleft", ff.divbar, "topleft", -2, 0)
ff.overlayCaptcha:SetPoint("bottomright", ff, "bottomright", 0, 0)
ff.overlayCaptcha:SetFrameStrata("DIALOG")
ff.overlayCaptcha:SetBackdrop({bgFile = [[Interface\ACHIEVEMENTFRAME\UI-GuildAchievement-Parchment-Horizontal-Desaturated]], tileSize = 64, tile = true})
ff.overlayCaptcha:SetBackdropColor(0, 0, 0, 1)
ff.overlayCaptcha:EnableMouse(true)
ff.overlayCaptcha:Hide(true)
--row with buttons
ff.GroupButtonsFrame = CreateFrame("frame", nil, ff)
--button settings
local groupButtonOnEnter = function(self)
if (not self.tooltip or self.tooltip == "") then
return
end
GameCooltip:Preset(2)
GameCooltip:AddLine(self.tooltip)
GameCooltip:ShowCooltip(self)
end
local groupButtonOnLeave = function(self)
GameCooltip:Hide()
end
local setupGroupButton = function(button, index, iconTexture, iconTexCoord, func, tooltip)
local buttonIndex = index
local width = 40 * 0.9
local height = 25 * 0.9
button:SetSize(width, height)
DF:ApplyStandardBackdrop(button)
local icon = button:CreateTexture(nil, "artwork", nil, 2)
icon:SetPoint("center", 0, 0)
icon:SetSize(width-2, height-2)
icon:SetTexture(iconTexture)
icon:SetDesaturated(true)
if (iconTexCoord) then
icon:SetTexCoord(unpack(iconTexCoord))
end
button:SetScript("OnClick", func)
if (tooltip) then
button:SetScript("OnEnter", groupButtonOnEnter)
button:SetScript("OnLeave", groupButtonOnLeave)
button.tooltip = tooltip
end
local highlight = button:CreateTexture(nil, "highlight")
highlight:SetColorTexture(1, 1, 1, .3)
highlight:SetPoint("center", 0, 0)
highlight:SetSize(width-2, height-2)
end
--invite nearby players
local groupButtons_InviteNearbyPlayers = CreateFrame("button", "$parentInviteNearbyPlayersButton", ff.GroupButtonsFrame, "BackdropTemplate")
local invitePlayersOnClick = function()
GameCooltip:Hide()
GameCooltip:ExecFunc(groupButtons_InviteNearbyPlayers)
end
local playerSelectedToInvite = function(self, fixedValue, value)
GameCooltip2:Hide()
ff.PlayersNearby [value] = nil
ff.PlayersInvited [value] = true
_G.C_PartyInfo.InviteUnit(value)
C_Timer.After (0.006, function()
GameCooltip:ExecFunc(groupButtons_InviteNearbyPlayers)
end)
end
local buildInviteMenu = function()
GameCooltip2:Preset(2)
local playerName = next(ff.PlayersNearby)
if (playerName) then
local added = false
for playerName, playerInfo in pairs(ff.PlayersNearby) do
local spottedAt, guid = unpack(playerInfo)
if (spottedAt + 20 > GetTime()) then
local className, classId = GetPlayerInfoByGUID(guid)
if (classId) then
GameCooltip:AddLine(playerName, "", 1, classId)
else
GameCooltip:AddLine(playerName)
end
GameCooltip:AddMenu(1, playerSelectedToInvite, playerName)
added = true
end
end
if (not added) then
GameCooltip2:AddLine ("No other players nearby.")
end
else
GameCooltip2:AddLine ("No other players nearby.")
end
end
groupButtons_InviteNearbyPlayers.CoolTip = {
Type = "menu",
BuildFunc = buildInviteMenu,
OnEnterFunc = function(self)
groupButtons_InviteNearbyPlayers.button_mouse_over = true
end,
OnLeaveFunc = function(self)
groupButtons_InviteNearbyPlayers.button_mouse_over = false
end,
FixedValue = "none",
ShowSpeed = 0.006,
Options = function()
GameCooltip:SetOption("MyAnchor", "bottom")
GameCooltip:SetOption("RelativeAnchor", "top")
GameCooltip:SetOption("WidthAnchorMod", 0)
GameCooltip:SetOption("HeightAnchorMod", 4)
GameCooltip:SetOption("LineHeightSizeOffset", 4)
GameCooltip:SetOption("VerticalPadding", -4)
GameCooltip:SetOption("FrameHeightSizeOffset", -4)
end
}
GameCooltip2:CoolTipInject (groupButtons_InviteNearbyPlayers)
setupGroupButton(groupButtons_InviteNearbyPlayers, 1, [[Interface\FriendsFrame\PlusManz-PlusManz]], {0, 1, 11/64, 58/64}, function()
invitePlayersOnClick()
end)
--open group finder window
local groupButtons_OpenGroupFinder = CreateFrame("button", "$parentOpenGroupFinderButton", ff.GroupButtonsFrame, "BackdropTemplate")
setupGroupButton(groupButtons_OpenGroupFinder, 2, [[Interface\Icons\Achievement_General_StayClassy]], {.10, .90, .20, .80}, function()
restoreFrames()
ff:HideFrame(true)
if (not _G.PVEFrame:IsShown()) then
ff.lastToggleRequest = time()
_G.PVEFrame_ToggleFrame()
end
_G.LFGListUtil_OpenBestWindow()
_G.LFGListCategorySelection_SelectCategory(LFGListFrame.CategorySelection, 1, 0)
_G.LFGListCategorySelection_StartFindGroup(LFGListFrame.CategorySelection, 0)
end, "Open Premade Groups")
--ignore quest
local groupButtons_IgnoreQuest = CreateFrame("button", "$parentIgnoreQuestButton", ff.GroupButtonsFrame, "BackdropTemplate")
setupGroupButton(groupButtons_IgnoreQuest, 3, [[Interface\COMMON\icon-noloot]], {0, 1, .1, .9}, function()
DF:ShowPromptPanel ("Don't Show Popups for the Quest: " .. (ff.CurrentQuestName or "-") .. "?", function()
if (ff.CurrentWorldQuest) then
WorldQuestTracker.db.profile.groupfinder.ignored_quests [ff.CurrentWorldQuest] = true
WorldQuestTracker:Msg ("Quest " .. (ff.CurrentQuestName or "-") .. " added to ignore list.")
end
ff:HideFrame (true)
end, function() end)
end, "Ignore this quest (won't popup next time)")
--leave group
local groupButtons_LeaveGroup = CreateFrame("button", "$parentLeaveGroupButton", ff.GroupButtonsFrame, "BackdropTemplate")
setupGroupButton(groupButtons_LeaveGroup, 4, [[Interface\COMMON\CommonIcons]], {92/256, 137/256, 6/128, 36/128}, function()
if (not IsInGroup()) then
return
end
if (ff.QuestCompletedHidingTimer and not ff.QuestCompletedHidingTimer._cancelled) then
ff.QuestCompletedHidingTimer:Cancel()
elseif (ff.QuestCancelledHidingTimer and not ff.QuestCancelledHidingTimer._cancelled) then
ff.QuestCancelledHidingTimer:Cancel()
end
ff:HideFrame(true)
C_PartyInfo.LeaveParty()
end, "Leave Group")
--place holder
--[=[
local groupButtons_PlaceHolder = CreateFrame("button", "$parentPlaceHolderButton", ff, "BackdropTemplate")
setupGroupButton(groupButtons_PlaceHolder, 5, [[Interface\Calendar\MeetingIcon]], nil, function()
_G.PVEFrame_ToggleFrame()
_G.LFGListUtil_OpenBestWindow()
_G.LFGListCategorySelection_SelectCategory(LFGListFrame.CategorySelection, 1, 0)
end)
--]=]
--leave group big button
local leaveButtonSolo = CreateFrame("button", "$parentLeaveButtonSolo", ff, "BackdropTemplate")
DF:ApplyStandardBackdrop(leaveButtonSolo)
leaveButtonSolo:SetPoint("top", ff, "top", 0, ff.topLevelY)
leaveButtonSolo:Hide()
ff.leaveButtonSolo = leaveButtonSolo
leaveButtonSolo.text = leaveButtonSolo:CreateFontString(nil, "overlay", "GameFontNormal")
leaveButtonSolo.text:SetPoint("center", 0, 0)
leaveButtonSolo.text:SetText("Leave Group")
--create a title bar
DF:CreateTitleBar(ff, "Title")
--create the options button
ff.Options = CreateFrame ("button", "$parentTopRightOptionsButton", ff, "BackdropTemplate")
ff.Options:SetPoint("right", ff.CloseButton, "left", -2, 0)
ff.Options:SetSize(16, 16)
ff.Options:SetNormalTexture ([[Interface\GossipFrame\BinderGossipIcon]])
ff.Options:SetHighlightTexture ([[Interface\GossipFrame\BinderGossipIcon]])
ff.Options:SetPushedTexture ([[Interface\GossipFrame\BinderGossipIcon]])
ff.Options:GetNormalTexture():SetDesaturated (true)
ff.Options:GetHighlightTexture():SetDesaturated (true)
ff.Options:GetPushedTexture():SetDesaturated (true)
ff.Options:SetAlpha(0.7)
--require full load before run
C_Timer.After(0.5, function()
ff.Options.CoolTip = {
Type = "menu",
BuildFunc = ff.BuildOptionsMenuFunc,
OnEnterFunc = function(self) end,
OnLeaveFunc = function(self) end,
FixedValue = "none",
ShowSpeed = 0.05,
Options = {
["FixedWidth"] = 300,
},
}
GameCooltip:CoolTipInject (ff.Options)
--create the quest icon
ff.QuestIcon = WorldQuestTracker.CreateZoneWidget(1, "GroupFinderIcon", ff)
ff.QuestIcon:SetPoint("left", ff.TitleBar, "left", 2, 0)
ff.QuestIcon.Animation = DF:CreateAnimationHub(ff.QuestIcon)
DF:CreateAnimation(ff.QuestIcon.Animation, "scale", 1, 0.2, 1, 1, 1.2, 1.2)
DF:CreateAnimation(ff.QuestIcon.Animation, "scale", 2, 0.2, 1.2, 1.2, 1, 1)
end)
--animations
local onShowAnimationHub = DF:CreateAnimationHub (ff, function()ff:Show()end)
DF:CreateAnimation (onShowAnimationHub, "ALPHA", 1, 1/14, 0, 1)
ff.AnimationShow = onShowAnimationHub
local onHideAnimationHub = DF:CreateAnimationHub (ff, function()end, function()ff:Hide()end)
DF:CreateAnimation (onHideAnimationHub, "ALPHA", 1, 0.5, 1, 0)
ff.AnimationHide = onHideAnimationHub
function WorldQuestTracker.RegisterGroupFinderFrameOnLibWindow()
local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(ff, WorldQuestTracker.db.profile.groupfinder.frame)
LibWindow.MakeDraggable(ff)
LibWindow.RestorePosition(ff)
ff.IsRegistered = true
function ff:ShowFrame()
ff.AnimationHide:Stop()
ff.AnimationShow:Play()
ff.Options:Show()
groupButtons_LeaveGroup:Disable()
if (IsInGroup()) then
groupButtons_LeaveGroup:Enable()
else
groupButtons_LeaveGroup:Disable()
end
end
function ff:HideFrame (noAnimation)
ff:SetScript("OnUpdate", nil)
ff.AnimationShow:Stop()
if (noAnimation) then
ff:Hide()
else
ff.AnimationHide:Play()
end
end
end
--events
ff:RegisterEvent ("QUEST_TURNED_IN")
ff:RegisterEvent ("QUEST_ACCEPTED")
ff:RegisterEvent ("QUEST_REMOVED")
ff:RegisterEvent ("GROUP_ROSTER_UPDATE")
ff:RegisterEvent ("GROUP_INVITE_CONFIRMATION")
ff:RegisterEvent ("LFG_LIST_APPLICANT_LIST_UPDATED")
ff:RegisterEvent ("ZONE_CHANGED_NEW_AREA")
ff:RegisterEvent ("PLAYER_ENTERING_WORLD")
ff:RegisterEvent ("PLAYER_LOGIN")
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", function (_, _, msg)
if (not WorldQuestTracker.db.profile.groupfinder.send_whispers) then
if (msg:find ("World Quest Tracker")) then
if (msg:find ("Invite for World Quest")) then
return true
end
end
end
end)
local playerEnteredWorldQuestZone = function(questID, npcID, npcName)
if (true) then
--return
end
if (ff.buttonAcquired) then
ff.buttonAcquired:Hide()
QuestObjectiveFindGroup_ReleaseButton(ff.buttonAcquired)
ff.buttonAcquired = nil
end
ff.overlayCaptcha:Hide()
--> update the frame
local title, isNpc, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex
if (npcID) then
--> check if the group finder can search for rares
if (WorldQuestTracker.db.profile.rarescan.search_group) then
if (WorldQuestTracker.db.profile.groupfinder.ignored_quests [npcID]) then
return
end
if (WorldQuestTracker.db.profile.groupfinder.dont_open_in_group and IsInGroup()) then
return
end
title = npcName
questID = npcID
isNpc = true
end
elseif (questID) then
title = C_TaskQuest.GetQuestInfoByQuestID (questID)
end
if (title) then
ff.IsInQuestZone = true
ff.CurrentWorldQuest = questID
ff.NpcID = isNpc and questID
--> toggle buttons
groupButtons_OpenGroupFinder:Enable()
groupButtons_IgnoreQuest:Enable()
if (not IsInGroup()) then
groupButtons_LeaveGroup:Disable()
else
groupButtons_LeaveGroup:Enable()
end
ff:ShowFrame()
if (type (questID) == "number") then
title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
--print(tagID, worldQuestType, rarity, isElite) -- 136, 2, 1, true
if (isElite) then
groupButtons_OpenGroupFinder:Disable()
C_Timer.After (3, function()
groupButtons_OpenGroupFinder:Enable()
end)
end
--print(tagID, tagName, worldQuestType , rarity , isElite)
if ((tagID == 112 or tagID == 136) and worldQuestType == 2 and (rarity == 1 or rarity == 2) and isElite) then
groupButtons_OpenGroupFinder:Disable()
C_Timer.After(3, function()
groupButtons_OpenGroupFinder:Enable()
end)
local findButton = QuestObjectiveFindGroup_AcquireButton(ff, questID)
findButton:ClearAllPoints()
findButton:SetPoint("center", ff, "center", 0, -28)
findButton:SetSize(64, 64)
findButton:SetFrameStrata("FULLSCREEN")
findButton:Show()
ff.overlayCaptcha:Show()
--TODO > arrumar o auto hide to painel quando completar a quest
--TODO > fechar o painel quando entrar em grupo
--TODO > reabrir o painel se sair do grupo e ainda estiver na quest
--TODO > não poder abrir o frame do LFG enquanto estiver em combate
ff.buttonAcquired = findButton
end
end
ff.CurrentQuestName = title
ff:SetTitle(title)
ff.QuestIcon:Show()
local questData = WorldQuestTracker.GetQuestDataFromCache(questID, true)
if (questData) then
WorldQuestTracker.SetupWorldQuestButton(ff.QuestIcon, questData)
else
ff.QuestIcon.mapID = WorldQuestTracker.GetCurrentStandingMapAreaID()
ff.QuestIcon.questID = questID
ff.QuestIcon.numObjectives = 1
ff.QuestIcon.questName = title
ff.QuestIcon.Order = 1
ff.QuestIcon.Currency_Gold = 0
ff.QuestIcon.Currency_ArtifactPower = 0
ff.QuestIcon.Currency_Resources = 0
ff.QuestIcon.worldQuestType = worldQuestType
ff.QuestIcon.rarity = rarity
ff.QuestIcon.isElite = isElite
ff.QuestIcon.tradeskillLineIndex = tradeskillLineIndex
ff.QuestIcon.inProgress = false
ff.QuestIcon.selected = false
ff.QuestIcon.isSelected = false
ff.QuestIcon.isCriteria = false
ff.QuestIcon.isSpellTarget = false
ff.QuestIcon:Hide()
end
--update a second time
C_Timer.After(1.5, function()
questData = WorldQuestTracker.GetQuestDataFromCache(questID, true)
if (questData) then
WorldQuestTracker.SetupWorldQuestButton(ff.QuestIcon, questData)
else
ff.QuestIcon:Hide()
end
ff.QuestIcon:SetParent(ff)
ff.QuestIcon:SetPoint("left", ff.TitleBar, "left", 2, 0)
ff.QuestIcon.AnchorFrame:SetParent(ff)
ff.QuestIcon.AnchorFrame:SetPoint("left", ff.TitleBar, "left", 2, 0)
ff.QuestIcon.flagText:SetText("")
ff.QuestIcon.flagTextShadow:SetText("")
ff.QuestIcon.bgFlag:Hide()
ff.QuestIcon.blackGradient:Hide()
ff.QuestIcon.Animation:Play()
end)
ff.QuestIcon:SetParent(ff)
ff.QuestIcon:SetPoint("left", ff.TitleBar, "left", 2, 0)
ff.QuestIcon.AnchorFrame:SetParent(ff)
ff.QuestIcon.AnchorFrame:SetPoint("left", ff.TitleBar, "left", 2, 0)
ff.QuestIcon.flagText:SetText("")
ff.QuestIcon.flagTextShadow:SetText("")
ff.QuestIcon.bgFlag:Hide()
ff.QuestIcon.blackGradient:Hide()
ff.CaptchaText:SetText(questID)
ff.CaptchaEntry:SetText("")
--ff.CaptchaEntry:SetText("59599") --debug
wipe(ff.PlayersNearby)
wipe(ff.PlayersInvited)
ff:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--> check for active timers and disable them
if (ff.QuestCompletedHidingTimer and not ff.QuestCompletedHidingTimer._cancelled) then
ff.QuestCompletedHidingTimer:Cancel()
end
if (ff.QuestCancelledHidingTimer and not ff.QuestCancelledHidingTimer._cancelled) then
ff.QuestCancelledHidingTimer:Cancel()
end
end
end
--QuestObjectiveSetupBlockButton_AddRightButton
--[=[
hooksecurefunc("QuestObjectiveSetupBlockButton_AddRightButton", function(block, groupFinderButton, buttonType)
if (buttonType == "groupFinder") then
-- for a, b in pairs(block.TrackedQuest) do
-- print(a,b)
-- end
-- groupFinderButton
local questID = block and block.TrackedQuest and block.TrackedQuest.questID
if (questID) then
local questName = C_TaskQuest.GetQuestInfoByQuestID(questID)
if (questName) then
C_Timer.After(0.5, function()
if (ff:IsShown()) then
if (ff.CurrentQuestName == questName) then
--print("Hello!")
end
end
end)
end
end
end
end)
--]=]
function ff:PlayerEnteredWorldQuestZone(questID, npcID, npcName)
C_Timer.After(0.6, function()
--delay the call for the enter zone
playerEnteredWorldQuestZone(questID, npcID, npcName)
end)
end
function ff:PlayerLeftWorldQuestZone (questID, questCompleted)
--questCompleted is true when the zone left came from the quest completed event
ff.IsInQuestZone = nil
ff.IsInWQGroup = nil
--stop auto invites if any
ff:SetScript("OnUpdate", nil)
if (questCompleted) then
--> cancel the timer for leaving the quest area if any
if (ff.QuestCancelledHidingTimer and not ff.QuestCancelledHidingTimer._cancelled) then
ff.QuestCancelledHidingTimer:Cancel()
end
if (ff.QuestCompletedHidingTimer and not ff.QuestCompletedHidingTimer._cancelled) then
ff.QuestCompletedHidingTimer:Cancel()
end
local isInInstance = IsInInstance()
if (IsInGroup() and not isInInstance) then