-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMissionReportButtonPlus.lua
2078 lines (1879 loc) · 96.1 KB
/
MissionReportButtonPlus.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
--------------------------------------------------------------------------------
--[[ Mission Report Button Plus ]]--
--
-- by erglo <erglo.coder+MRBP@gmail.com>
--
-- Copyright (C) 2021 Erwin D. Glockner (aka erglo, ergloCoder)
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses.
--
--------------------------------------------------------------------------------
--
-- Files used for reference:
-- REF.: <FrameXML/Blizzard_APIDocumentation/GarrisonConstantsDocumentation.lua>
-- REF.: <FrameXML/Blizzard_APIDocumentation/GarrisonInfoDocumentation.lua>
-- REF.: <FrameXML/GarrisonBaseUtils.lua>
-- REF.: <FrameXML/Minimap.lua>
-- REF.: <FrameXML/UIParent.lua>
-- REF.: <FrameXML/SharedColorConstants.lua>
-- REF.: <FrameXML/Blizzard_APIDocumentation/CovenantSanctumDocumentation.lua>
-- REF.: <FrameXML/Blizzard_GarrisonTemplates/Blizzard_GarrisonMissionTemplates.lua>
-- REF.: <FrameXML/Blizzard_ExpansionLandingPage/Blizzard_ExpansionLandingPage.lua>
-- REF.: <FrameXML/Blizzard_APIDocumentation/QuestLogDocumentation.lua>
-- (see also the function comments section for more reference)
--
--------------------------------------------------------------------------------
local AddonID, ns = ...;
local ShortAddonID = "MRBP";
local L = ns.L;
local _log = ns.dbg_logger;
local util = ns.utilities;
local LibQTip = LibStub('LibQTip-1.0');
local MenuTooltip, ExpansionTooltip, ReputationTooltip;
local LocalLibQTipUtil = ns.utils.libqtip;
local LocalTooltipUtil = ns.utilities.tooltip;
local LocalL10nUtil = ns.L10nUtil; --> <data\L10nUtils.lua>
local PlayerInfo = ns.PlayerInfo; --> <data\player.lua>
local ExpansionInfo = ns.ExpansionInfo; --> <data\expansion.lua>
local LandingPageInfo = ns.LandingPageInfo; --> <data\landingpage.lua>
local LocalFactionInfo = ns.FactionInfo; --> <data\factions.lua>
local LocalMajorFactionInfo = ns.MajorFactionInfo; --> <data\majorfactions.lua>
local LocalRequirementInfo = ns.RequirementInfo; --> <data\requirements.lua>
local LocalLandingPageTypeUtil = ns.LandingPageTypeUtil; --> <utils\landingpagetype.lua>
local LocalDragonridingUtil = ns.DragonridingUtil; --> <utils\dragonriding.lua> --> TODO - Rename to Skyriding
-- ns.poi9; --> <utils\poi-9-dragonflight.lua>
local MRBP_EventMessagesCounter = {};
-- Backwards compatibility
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded;
local LoadAddOn = C_AddOns.LoadAddOn;
local GarrisonFollowerOptions = GarrisonFollowerOptions;
local ExpansionLandingPageMinimapButton = ExpansionLandingPageMinimapButton;
local DIM_RED_FONT_COLOR = DIM_RED_FONT_COLOR;
local DISABLED_FONT_COLOR = DISABLED_FONT_COLOR;
local HIGHLIGHT_FONT_COLOR = HIGHLIGHT_FONT_COLOR;
local NORMAL_FONT_COLOR = NORMAL_FONT_COLOR;
local WARNING_FONT_COLOR = WARNING_FONT_COLOR;
local DARKGRAY_COLOR = DARKGRAY_COLOR;
local LIGHTERBLUE_FONT_COLOR = LIGHTERBLUE_FONT_COLOR;
local TEXT_DASH_SEPARATOR = L.TEXT_DELIMITER..QUEST_DASH..L.TEXT_DELIMITER;
local GENERIC_FRACTION_STRING = GENERIC_FRACTION_STRING;
----- Main ---------------------------------------------------------------------
-- Core functions + event listener frame
local MRBP = CreateFrame("Frame", AddonID.."EventListenerFrame")
FrameUtil.RegisterFrameForEvents(MRBP, {
"ADDON_LOADED",
"PLAYER_ENTERING_WORLD",
"PLAYER_CAMPING", --> when the player is camping (logging out)
"PLAYER_QUITING", --> when the player tries to quit, as opposed to logout, while outside an inn
"GARRISON_SHOW_LANDING_PAGE",
"GARRISON_HIDE_LANDING_PAGE",
"GARRISON_BUILDING_ACTIVATABLE",
"GARRISON_MISSION_FINISHED",
"GARRISON_INVASION_AVAILABLE",
"GARRISON_TALENT_COMPLETE",
-- "GARRISON_MISSION_STARTED", --> TODO - Track twinks' missions
"QUEST_TURNED_IN",
-- "QUEST_AUTOCOMPLETE",
"COVENANT_CHOSEN",
"COVENANT_SANCTUM_RENOWN_LEVEL_CHANGED",
"COVENANT_CALLINGS_UPDATED",
"MAJOR_FACTION_UNLOCKED",
}
)
MRBP:SetScript("OnEvent", function(self, event, ...)
if (event == "ADDON_LOADED") then
local addOnName = ...
if (addOnName == AddonID) then
-- Start add-on action from here
self:OnLoad()
self:UnregisterEvent("ADDON_LOADED")
end
elseif (event == "PLAYER_QUITING" or event == "PLAYER_CAMPING") then
-- Do some variables clean-up
LocalL10nUtil:CleanUpLabels()
elseif (event == "GARRISON_BUILDING_ACTIVATABLE") then
-- REF. <FrameXML/Blizzard_GarrisonUI/Blizzard_GarrisonLandingPage.lua>
local buildingName, garrisonType = ...
_log:debug(event, "buildingName:", buildingName, "garrisonType:", garrisonType)
-- These messages appear way too often, eg. every time the player teleports somewhere. This counter limits
-- the number of these messages per log-in session as follows:
-- 1x / log-in session if player was not in garrison zone
-- 1x / garrison
if (MRBP_EventMessagesCounter[event] == nil) then
MRBP_EventMessagesCounter[event] = {}
end
if (MRBP_EventMessagesCounter[event][garrisonType] == nil) then
MRBP_EventMessagesCounter[event][garrisonType] = {}
end
local buildings = C_Garrison.GetBuildings(garrisonType)
if buildings then
for i = 1, #buildings do
local buildingID = buildings[i].buildingID
local name, texture, shipmentCapacity = C_Garrison.GetLandingPageShipmentInfo(buildingID)
if (name == buildingName) then
_log:debug("building:", buildingID, name)
-- Add icon to building name
buildingName = util.CreateInlineIcon(texture).." "..buildingName;
if (MRBP_EventMessagesCounter[event][garrisonType][buildingID] == nil) then
MRBP_EventMessagesCounter[event][garrisonType][buildingID] = false
end
if (C_Garrison.IsPlayerInGarrison(garrisonType) or MRBP_EventMessagesCounter[event][garrisonType][buildingID] == false) then
local expansion = ExpansionInfo:GetExpansionDataByGarrisonType(garrisonType);
util.cprintEvent(expansion.name, GARRISON_BUILDING_COMPLETE, buildingName, GARRISON_FINALIZE_BUILDING_TOOLTIP);
MRBP_EventMessagesCounter[event][garrisonType][buildingID] = true
else
_log:debug("Skipped:", event, garrisonType, buildingID, name)
end
break
end
end
end
elseif (event == "GARRISON_INVASION_AVAILABLE") then
_log:debug(event, ...)
--> Draenor garrison only (!)
local expansionName = ExpansionInfo.data.WARLORDS_OF_DRAENOR.name;
util.cprintEvent(expansionName, GARRISON_LANDING_INVASION, nil, GARRISON_LANDING_INVASION_TOOLTIP);
elseif (event == "GARRISON_MISSION_FINISHED") then
-- REF.: <FrameXML/Blizzard_GarrisonUI/Blizzard_GarrisonMissionUI.lua>
local followerTypeID, missionID = ...;
local eventMsg = GarrisonFollowerOptions[followerTypeID].strings.ALERT_FRAME_TITLE;
local onlyGarrisonTypeID = true;
local garrisonTypeID = LandingPageInfo:GetGarrisonInfoByFollowerType(followerTypeID, onlyGarrisonTypeID);
local missionInfo = C_Garrison.GetBasicMissionInfo(missionID);
if missionInfo then
local missionLink = C_Garrison.GetMissionLink(missionID)
local missionIcon = missionInfo.typeTextureKit and missionInfo.typeTextureKit.."-Map" or missionInfo.typeAtlas
local missionName = util.CreateInlineIcon(missionIcon)..missionLink;
_log:debug(event, "followerTypeID:", followerTypeID, "missionID:", missionID, missionInfo.name)
--> TODO - Count and show number of twinks' finished missions ??? --> MRBP_GlobalMissions
--> TODO - Remove from MRBP_GlobalMissions
local expansion = ExpansionInfo:GetExpansionDataByGarrisonType(garrisonTypeID);
util.cprintEvent(expansion.name, eventMsg, missionName, nil, true);
end
elseif (event == "GARRISON_TALENT_COMPLETE") then
local garrisonTypeID, doAlert = ...
-- _log:debug(event, "garrTypeID:", garrTypeID, "doAlert:", doAlert)
local followerTypeID = GetPrimaryGarrisonFollowerType(garrisonTypeID)
local eventMsg = GarrisonFollowerOptions[followerTypeID].strings.TALENT_COMPLETE_TOAST_TITLE
-- REF. <FrameXML/Blizzard_GarrisonUI/Blizzard_GarrisonLandingPage.lua>
local talentTreeIDs = C_Garrison.GetTalentTreeIDsByClassID(garrisonTypeID, PlayerInfo:GetClassData("ID"));
local completeTalentID = C_Garrison.GetCompleteTalent(garrisonTypeID);
if (talentTreeIDs) then
for treeIndex, treeID in ipairs(talentTreeIDs) do
local treeInfo = C_Garrison.GetTalentTreeInfo(treeID);
for talentIndex, talent in ipairs(treeInfo.talents) do
if (talent.researched or talent.id == completeTalentID) then
-- GetTalentLink(talent.id)
local nameString = util.CreateInlineIcon(talent.icon).." "..talent.name;
local expansion = ExpansionInfo:GetExpansionDataByGarrisonType(garrisonTypeID);
util.cprintEvent(expansion.name, eventMsg, nameString);
end
end
end
end
elseif (event == "PLAYER_ENTERING_WORLD") then
local isInitialLogin, isReloadingUi = ...
_log:info("isInitialLogin:", isInitialLogin, "- isReloadingUi:", isReloadingUi)
-- The calendar and its data is not available until it has been opened at least once.
ToggleCalendar()
HideUIPanel(CalendarFrame)
local function printDayEvent()
_log:debug_type(_log.type.CALENDAR, "Scanning for WORLDQUESTS_EVENT...")
local dayEvent = util.calendar.GetActiveDayEvent(util.calendar.WORLDQUESTS_EVENT_ID) or util.calendar.GetActiveDayEvent(util.calendar.EASTERN_KINGDOMS_CUP_EVENT_ID)
local dayEventMsg = util.calendar.GetDayEventChatMessage(dayEvent);
if dayEventMsg then ns.cprint(dayEventMsg) end;
end
if isInitialLogin then
local addonName = "Blizzard_Calendar"
local loaded, finished = IsAddOnLoaded(addonName)
if not ( loaded ) then
_log:debug("Loading "..addonName)
local isLoaded, failedReason = LoadAddOn(addonName)
if failedReason then
_log:debug(string.format(ADDON_LOAD_FAILED, addonName, _G["ADDON_"..failedReason]))
end
end
C_Timer.After(5, printDayEvent)
--> FIXME - Not working on first account-login :(
-- But works after manual UI reload.
end
if isReloadingUi then
printDayEvent()
end
-- Check addons which interfere with this one; eg. by messing-up the button hooks
--> Currently known interference is the right-click menu of `War Plan` by cfxfox
local interferingAddonIDs = {"WarPlan"}
local informUser = false -- avoid informing the user on every single login or reload
local foundMessage = WARNING_FONT_COLOR:WrapTextInColorCode("Found interfering addon:")
for _, interferingAddonName in ipairs(interferingAddonIDs) do
if IsAddOnLoaded(interferingAddonName) then
local addonTitle = ns.GetAddOnMetadata(interferingAddonName, "Title")
_log.info(foundMessage, addonTitle)
self:RedoButtonHooks(informUser)
return -- stop at first match
end
end
elseif (event == "QUEST_TURNED_IN") then
-- REF.: <FrameXML/Blizzard_ExpansionLandingPage/Blizzard_DragonflightLandingPage.lua>
local questID, xpReward, moneyReward = ...;
local skyridingQuests = {
LocalDragonridingUtil.DRAGONFLIGHT_DRAGONRIDING_QUEST_ID,
LocalDragonridingUtil.WAR_WITHIN_SKYRIDING_QUEST_ID,
};
if tContains(skyridingQuests, questID) then
local landingPageInfo = LandingPageInfo:GetLandingPageInfo(ExpansionInfo.data.DRAGONFLIGHT.ID);
ns.cprint(landingPageInfo.msg.dragonridingUnlocked);
end
elseif (event == "GARRISON_HIDE_LANDING_PAGE") then
self:ShowMinimapButton()
elseif (event == "GARRISON_SHOW_LANDING_PAGE") then
-- Minimap button already visible through WoW default process
if (not ns.settings.showMinimapButton or ns.settings.useMouseOverMinimapMode) then
self:HideMinimapButton()
end
elseif (event == "COVENANT_CHOSEN") then
local covenantID = ...;
util.covenant.UpdateData(covenantID);
elseif (event == "COVENANT_SANCTUM_RENOWN_LEVEL_CHANGED") then
local newRenownLevel, oldRenownLevel = ...;
local covenantInfo = util.covenant.GetCovenantInfo();
if covenantInfo then
local covenantName = covenantInfo.color:WrapTextInColorCode(covenantInfo.name);
ns.cprint(covenantName..L.TEXT_DASH_DELIMITER..COVENANT_SANCTUM_RENOWN_LEVEL_UNLOCKED:format(newRenownLevel));
local renownInfo = util.covenant.GetRenownData(covenantInfo.ID);
if renownInfo.hasMaximumRenown then
ns.cprint(COVENANT_SANCTUM_RENOWN_REWARD_DESC_COMPLETE:format(covenantName));
end
end
elseif (event == "COVENANT_CALLINGS_UPDATED") then
-- Updates the Shadowlands "bounty board" infos.
-- REF.: <FrameXML/ObjectAPI/CovenantCalling.lua>
-- REF.: <FrameXML/Blizzard_APIDocumentation/CovenantCallingsConstantsDocumentation.lua>
-- REF.: <FrameXML/Blizzard_APIDocumentation/CovenantCallingsDocumentation.lua>
--> updates on opening the world map in Shadowlands.
local callings = ...;
-- _log:debug("Covenant callings received:", #callings);
LandingPageInfo:CheckInitialize();
LandingPageInfo[ExpansionInfo.data.SHADOWLANDS.ID].bountyBoard["GetBounties"] = function() return callings end;
elseif (event == "MAJOR_FACTION_UNLOCKED") then
-- REF.: <FrameXML/Blizzard_APIDocumentationGenerated/MajorFactionsDocumentation.lua>
local majorFactionID = ...;
local majorFactionData = LocalMajorFactionInfo:GetMajorFactionData(majorFactionID);
if majorFactionData then
local landingPageInfo = LandingPageInfo:GetLandingPageInfo(majorFactionData.expansionID);
local unlockedMessage = landingPageInfo.msg.majorFactionUnlocked;
local majorFactionColor = _G[strupper(majorFactionData.textureKit).."_MAJOR_FACTION_COLOR"];
unlockedMessage = unlockedMessage..TEXT_DASH_SEPARATOR..majorFactionColor:WrapTextInColorCode(majorFactionData.name);
ns.cprint(unlockedMessage);
end
end
end
);
-- Load this add-on's functions when the MR minimap button is ready.
function MRBP:OnLoad()
-- Load data and their handler
LocalL10nUtil:LoadInGameLabels();
LandingPageInfo:CheckInitialize();
-- Prepare quest data for the unlocking requirements
LocalRequirementInfo:Initialize();
-- Load settings and interface options
MRBP_Settings_Register();
self:RegisterSlashCommands();
self:SetButtonHooks();
-- _log:info("----- Addon is ready. -----")
end
----- Dropdown Menu ------------------------------------------------------------
-- Handle opening and closing of Garrison-/ExpansionLandingPage frames.
---@param garrisonTypeID number
--
local function MRBP_ToggleLandingPageFrames(garrisonTypeID, landingPageTypeID)
-- Always (!) hide the GarrisonLandingPage; all visible UI widgets can only
-- be loaded properly on opening.
if not landingPageTypeID and LocalLandingPageTypeUtil:IsValidGarrisonType(garrisonTypeID) then
if (ExpansionLandingPage and ExpansionLandingPage:IsShown()) then
_log:debug("Hiding ExpansionLandingPage");
HideUIPanel(ExpansionLandingPage);
end
if (GarrisonLandingPage == nil) then
-- Hasn't been opened in this session, yet
_log:debug("Showing GarrisonLandingPage1 type", garrisonTypeID);
ShowGarrisonLandingPage(garrisonTypeID);
else
-- Toggle the GarrisonLandingPage frame; only re-open it
-- if the garrison type is not the same.
if (GarrisonLandingPage:IsShown()) then
_log:debug("Hiding GarrisonLandingPage type", GarrisonLandingPage.garrTypeID);
HideUIPanel(GarrisonLandingPage);
if (garrisonTypeID ~= GarrisonLandingPage.garrTypeID) then
_log:debug("Showing GarrisonLandingPage2 type", garrisonTypeID);
ShowGarrisonLandingPage(garrisonTypeID);
end
else
_log:debug("Showing GarrisonLandingPage3 type", garrisonTypeID);
ShowGarrisonLandingPage(garrisonTypeID);
end
end
end
-- Note: works currently only in Dragonflight and newer expansions
if LocalLandingPageTypeUtil:IsValidExpansionLandingPageType(landingPageTypeID) then
if (GarrisonLandingPage and GarrisonLandingPage:IsShown()) then
_log:debug("Hiding GarrisonLandingPage1 type", GarrisonLandingPage.garrTypeID);
HideUIPanel(GarrisonLandingPage);
end
if (ExpansionLandingPage and ExpansionLandingPage:IsShown() and ExpansionLandingPage.expansionLandingPageType ~= landingPageTypeID) then
HideUIPanel(ExpansionLandingPage);
end
ExpansionLandingPage.expansionLandingPageType = landingPageTypeID;
MRBP_ApplyExpansionLandingPageOverlay(landingPageTypeID);
ToggleExpansionLandingPage();
end
end
----- Menu item tooltip -----
local TOOLTIP_DASH_ICON_ID = 3083385;
-- local TOOLTIP_DASH_ICON_STRING = util.CreateInlineIcon(3083385);
local TOOLTIP_CLOCK_ICON_STRING = util.CreateInlineIcon1("auctionhouse-icon-clock"); -- "worldquest-icon-clock");
-- local TOOLTIP_CHECK_MARK_ICON_STRING = util.CreateInlineIcon(628564);
-- local TOOLTIP_YELLOW_CHECK_MARK_ICON_STRING = util.CreateInlineIcon(130751);
-- local TOOLTIP_GRAY_CHECK_MARK_ICON_STRING = util.CreateInlineIcon(130750);
-- local TOOLTIP_ORANGE_CHECK_MARK_ICON_STRING = util.CreateInlineIcon("Adventures-Checkmark");
--> Note: Don't delete! Used for testing.
local function AddMultiPOITestText(poiInfos, tooltipText)
if util.TableHasAnyEntries(poiInfos) then
tooltipText = tooltipText.."|n"
for _, poi in ipairs(poiInfos) do
-- Event name
if poi.atlasName then
local poiIcon = util.CreateInlineIcon(poi.atlasName)
tooltipText = tooltipText.."N:"..poiIcon..poi.name
else
tooltipText = tooltipText.."N:"..poi.name
end
-- POI IDs
tooltipText = tooltipText.."|n"..GRAY_FONT_COLOR_CODE
tooltipText = tooltipText.." > "..tostring(poi.areaPoiID)
tooltipText = tooltipText.." > "..tostring(poi.isPrimaryMapForPOI)
tooltipText = tooltipText.." > "..tostring(poi.widgetSetID or poi.atlasName or poi.textureIndex or '??') -- ..tostring(poi.factionID))
-- tooltipText = tooltipText..FONT_COLOR_CODE_CLOSE
-- Show description
if not L:StringIsEmpty(poi.description) then
tooltipText = tooltipText.."|nD:"..poi.description
end
-- Add location name
if poi.mapInfo then
tooltipText = tooltipText.."|nM:"..poi.mapInfo.name
tooltipText = tooltipText.." > "..tostring(poi.mapInfo.mapID)
end
-- Add time remaining info
if (poi.isTimed and poi.timeString)then
tooltipText = tooltipText.."|nT:"..TOOLTIP_CLOCK_ICON_STRING
tooltipText = tooltipText.." "..(poi.timeString or '???')
end
tooltipText = tooltipText..FONT_COLOR_CODE_CLOSE
-- Add space between this an previous details
tooltipText = tooltipText.."|n|n"
end
end
return tooltipText;
end
local function ShouldShowMissionsInfoText(garrisonTypeID)
return (
(garrisonTypeID == ExpansionInfo.data.SHADOWLANDS.garrisonTypeID and ns.settings.showCovenantMissionInfo) or
(garrisonTypeID == ExpansionInfo.data.BATTLE_FOR_AZEROTH.garrisonTypeID and ns.settings.showBfAMissionInfo) or
(garrisonTypeID == ExpansionInfo.data.LEGION.garrisonTypeID and ns.settings.showLegionMissionInfo and not PlayerInfo:IsPlayerEvokerClass()) or
(garrisonTypeID == ExpansionInfo.data.WARLORDS_OF_DRAENOR.garrisonTypeID and ns.settings.showWoDMissionInfo)
);
end
local function ShouldShowBountyBoardText(garrisonTypeID)
return (
(garrisonTypeID == ExpansionInfo.data.SHADOWLANDS.garrisonTypeID and ns.settings.showCovenantBounties) or
(garrisonTypeID == ExpansionInfo.data.BATTLE_FOR_AZEROTH.garrisonTypeID and ns.settings.showBfABounties) or
(garrisonTypeID == ExpansionInfo.data.LEGION.garrisonTypeID and ns.settings.showLegionBounties)
);
end
local function ShouldShowActiveThreatsText(garrisonTypeID)
return (
(garrisonTypeID == ExpansionInfo.data.SHADOWLANDS.garrisonTypeID and ns.settings.showMawThreats) or
(garrisonTypeID == ExpansionInfo.data.BATTLE_FOR_AZEROTH.garrisonTypeID and ns.settings.showNzothThreats)
);
end
-- Check whether the Timewalking Vendor details should be shown.
local function ShouldShowTimewalkingVendorText(expansionInfo)
if (expansionInfo.ID > ExpansionInfo.data.LEGION.ID) then return end
if (expansionInfo.ID == ExpansionInfo.data.WARLORDS_OF_DRAENOR.ID) then
return ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID) and ns.settings.showWoDTimewalkingVendor
end
if (expansionInfo.ID == ExpansionInfo.data.LEGION.ID) then
return ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID) and ns.settings.showLegionTimewalkingVendor
end
return false
end
-- Display the ExpansionLandingPageMinimapButton
function MRBP:ShowMinimapButton(isCalledByUser)
if (_log.level == _log.DEBUG) then
ns.cprint("IsShown:", ExpansionLandingPageMinimapButton:IsShown())
ns.cprint("IsVisible:", ExpansionLandingPageMinimapButton:IsVisible())
ns.cprint("showMinimapButton:", ns.settings.showMinimapButton)
ns.cprint("isCalledByUser:", isCalledByUser or false)
ns.cprint("garrisonType:", MRBP_GetLandingPageGarrisonType())
end
if not LocalRequirementInfo:IsAnyLandingPageAvailable() then return; end
local garrisonTypeID = MRBP_GetLandingPageGarrisonType()
if LocalLandingPageTypeUtil:IsValidGarrisonType(garrisonTypeID) then
if isCalledByUser then
if ( not ExpansionLandingPageMinimapButton:IsShown() ) then
ExpansionLandingPageMinimapButton:Show()
ExpansionLandingPageMinimapButton:UpdateIcon()
-- Manually set by user
ns.settings.showMinimapButton = true
_log:debug("--> Minimap button should stay visible. (user)")
else
-- Give user feedback, if button is already visible
ns.cprint(L.CHATMSG_MINIMAPBUTTON_ALREADY_SHOWN)
end
else
-- Fired by GARRISON_HIDE_LANDING_PAGE event
if ( ns.settings.showMinimapButton and (not ExpansionLandingPageMinimapButton:IsShown()) )then
ExpansionLandingPageMinimapButton:UpdateIcon()
ExpansionLandingPageMinimapButton:Show()
_log:debug("--> Minimap button should be visible. (event)")
end
end
end
end
-- Hide the ExpansionLandingPageMinimapButton
function MRBP:HideMinimapButton()
if ExpansionLandingPageMinimapButton:IsShown() then
ExpansionLandingPageMinimapButton:Hide()
end
end
ns.HideMinimapButton = MRBP.HideMinimapButton
-- Handle user action of showing the minimap button. Show it only if any command
-- table is unlocked.
function MRBP:ShowMinimapButton_User(isCalledByCancelFunc)
local isAnyUnlocked = LocalRequirementInfo:IsAnyLandingPageAvailable()
if (not isAnyUnlocked) then
-- Do nothing, as long as user hasn't unlocked any of the command tables available
-- Inform user about this, and disable checkbutton in config.
ns.cprint(L.CHATMSG_UNLOCKED_COMMANDTABLES_REQUIRED)
else
local isCalledByUser = not isCalledByCancelFunc
MRBP:ShowMinimapButton(isCalledByUser)
end
end
ns.ShowMinimapButton_User = MRBP.ShowMinimapButton_User
----- Hooks --------------------------------------------------------------------
-- Hook the functions related to the landing page's minimap button
-- and frame (mission report frame).
function MRBP:SetButtonHooks()
if ExpansionLandingPageMinimapButton then
_log:info("Hooking into the minimap button's tooltip + clicking behavior...")
-- Minimap button tooltip hook
ExpansionLandingPageMinimapButton:HookScript("OnEnter", MRBP_OnEnter)
-- ExpansionLandingPageMinimapButton:HookScript("SetTooltip", MRBP_OnEnter)
-- Mouse button hooks; by default only the left button is registered.
ExpansionLandingPageMinimapButton:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp")
ExpansionLandingPageMinimapButton:SetScript("OnClick", MRBP_OnClick)
-- ExpansionLandingPageMinimapButton:HookScript("OnClick", MRBP_OnClick) --> safer, but doesn't work properly!
-- Mouse Over Minimap Mode
Minimap:HookScript("OnEnter", MRBP_OnMinimapEnter)
Minimap:HookScript("OnLeave", MRBP_OnMinimapLeave)
ExpansionLandingPageMinimapButton:HookScript("OnLeave", MRBP_OnMinimapLeave)
end
-- GarrisonLandingPage (mission report frame) post hook
hooksecurefunc("ShowGarrisonLandingPage", MRBP_ShowGarrisonLandingPage)
end
function MRBP:RedoButtonHooks(informUser)
self:SetButtonHooks()
if informUser then
ns.cprint(L.CHATMSG_MINIMAPBUTTON_HOOKS_UPDATED)
end
end
function MRBP:CheckShowMinimapButtonInMouseOverMode()
if (ns.settings.useMouseOverMinimapMode and not ExpansionLandingPageMinimapButton:IsShown()) then
ExpansionLandingPageMinimapButton:Show();
end
end
-- Handle mouse-over behavior of the minimap button.
-- Note: 'self' refers to the ExpansionLandingPageMinimapButton, the parent frame.
--
-- REF.: <FrameXML/Minimap.xml>
-- REF.: <FrameXML/SharedTooltipTemplates.lua>
-- REF.: <FrameXML/Blizzard_Minimap/Minimap.lua>
--
function MRBP_OnEnter(self, button, description_only)
if description_only then
-- Needed for Addon Compartment details
return self.description;
end
MRBP:CheckShowMinimapButtonInMouseOverMode();
GameTooltip:SetOwner(self, "ANCHOR_LEFT");
if self:IsInMajorFactionRenownMode() then
RenownRewardUtil.AddMajorFactionToTooltip(GameTooltip, self.majorFactionID, GenerateClosure(self.SetTooltip, self));
else
GameTooltip:SetText(self.title, 1, 1, 1);
GameTooltip:AddLine(self.description, nil, nil, nil, true);
end
-- Add right click description
local tooltipAddonText = L.TOOLTIP_CLICKTEXT_MINIMAPBUTTON;
if ns.settings.showAddonNameInTooltip then
local addonAbbreviation = ns.AddonTitleShort..ns.AddonTitleSeparator;
tooltipAddonText = GRAY_FONT_COLOR:WrapTextInColorCode(addonAbbreviation).." "..tooltipAddonText;
end
-- Add special treat
local dayEvent = util.calendar.GetActiveDayEvent(util.calendar.WINTER_HOLIDAY_EVENT_ID);
if dayEvent then
-- Show an icon after the minimap tooltip text during the winter holiday event
local eventIcon = util.calendar.WINTER_HOLIDAY_ATLAS_NAME;
tooltipAddonText = tooltipAddonText.." "..util.CreateInlineIcon1(eventIcon);
end
GameTooltip_AddNormalLine(GameTooltip, tooltipAddonText);
-- Add middle click description
if (ns.settings.useMiddleButton and LocalDragonridingUtil:IsSkyridingUnlocked()) then
local tooltipMiddleClickText = L.TOOLTIP_CLICKTEXT2_MINIMAPBUTTON;
if ns.settings.showAddonNameInTooltip then
local addonAbbreviation = ns.AddonTitleShort..ns.AddonTitleSeparator;
tooltipMiddleClickText = GRAY_FONT_COLOR:WrapTextInColorCode(addonAbbreviation).." "..tooltipMiddleClickText;
end
GameTooltip_AddNormalLine(GameTooltip, tooltipMiddleClickText);
end
GameTooltip:Show();
end
function MRBP_OnMinimapEnter(self, ...)
MRBP:CheckShowMinimapButtonInMouseOverMode();
end
function MRBP_OnMinimapLeave(self)
if (ns.settings.useMouseOverMinimapMode and not (MenuTooltip and MenuTooltip:IsShown()) and not (Minimap.ZoomIn and Minimap.ZoomIn:IsShown())) then
MRBP:HideMinimapButton();
end
end
-----
local function MenuLine_OnClick(...)
-- print("Clicked:", ...)
local parentLineFrame, lineInfo, buttonName, isUp = ...
if lineInfo.func then
lineInfo.func()
end
end
-- Verify whether the mission-is-completed hint icon should be shown in the menu or not.
---@param garrisonTypeID number
---@return boolean
--
local function ShouldShowMissionCompletedHint(garrisonTypeID)
if not ns.settings.showMissionCompletedHint then
return false
end
local numInProgress, numCompleted = util.garrison.GetInProgressMissionCount(garrisonTypeID)
local hasCompletedMissions = numCompleted > 0
local hasCompletedAllMissions = hasCompletedMissions and numCompleted == numInProgress
if not ns.settings.showMissionCompletedHintOnlyForAll then
return hasCompletedMissions
end
return hasCompletedAllMissions
end
-- Return suitable information about eg. mission hints for given expansion.
local function GetExpansionHintIconInfo(expansionInfo)
local missionsAvailable, reputationRewardPending, timeWalkingVendorAvailable
if (expansionInfo.ID < ExpansionInfo.data.DRAGONFLIGHT.ID) then
missionsAvailable = ShouldShowMissionCompletedHint(expansionInfo.garrisonTypeID)
reputationRewardPending = ns.settings.showReputationRewardPendingHint and LocalFactionInfo:HasExpansionAnyReputationRewardPending(expansionInfo.ID)
timeWalkingVendorAvailable = ns.settings.showTimewalkingVendorHint and util.poi.HasTimewalkingVendor(expansionInfo.ID)
else
reputationRewardPending = ns.settings.showReputationRewardPendingHint and LocalMajorFactionInfo:HasMajorFactionReputationReward(expansionInfo.ID)
end
return {missionsAvailable, reputationRewardPending, timeWalkingVendorAvailable}
end
local function ShouldShowHintColumn()
local show = ns.settings.showMissionCompletedHint or ns.settings.showReputationRewardPendingHint or ns.settings.showTimewalkingVendorHint
return show
end
local settingsAtlasName = "Warfronts-BaseMapIcons-Empty-Workshop-Minimap"
----- LibQTip -----
local uiScale = UIParent:GetEffectiveScale()
-- local screenHeight = GetScreenHeight() * uiScale
-- Release the given `LibQTip.Tooltip`.
---@param tooltip LibQTip.Tooltip
--
local function ReleaseTooltip(tooltip)
if tooltip then
LibQTip:Release(tooltip)
tooltip = nil
end
end
local function MenuLine_ShowTooltips()
if (ExpansionTooltip and ExpansionTooltip:GetLineCount() > 0) then
-- Check if tooltip height fits the screen height
local screenHeight = GetScreenHeight() * uiScale; --> needs to be here, not reliable at start-up
local tooltipHeight = ExpansionTooltip:GetHeight() * uiScale;
if (tooltipHeight > screenHeight) then
ExpansionTooltip:UpdateScrolling();
-- local TOOLTIP_PADDING = 10; --> TODO - Add to style options
-- local sizeDifference = tooltipHeight - screenHeight;
-- ExpansionTooltip:SetHeight(2 * TOOLTIP_PADDING + ExpansionTooltip.height - sizeDifference);
end
ExpansionTooltip:SetClampedToScreen(true)
ExpansionTooltip:Show()
end
if (ReputationTooltip and ReputationTooltip:GetLineCount() > 0) then
ReputationTooltip:SetClampedToScreen(true)
ReputationTooltip:Show()
end
end
-- Create expansion summary content tooltip
local function MenuLine_CreateExpansionTooltip(parentFrame)
ExpansionTooltip = LibQTip:Acquire(ShortAddonID.."LibQTipExpansionTooltip", 1, "LEFT")
ExpansionTooltip:SetPoint("LEFT", parentFrame, "RIGHT", -5, 0)
ExpansionTooltip.OnRelease = ReleaseTooltip
ExpansionTooltip:SetScrollStep(50)
ExpansionTooltip:SetFrameLevel(parentFrame:GetFrameLevel() + 10)
end
-- Create (major) faction reputation summary content tooltip
local function MenuLine_CreateReputationTooltip(parentFrame)
ReputationTooltip = LibQTip:Acquire(ShortAddonID.."LibQTipReputationTooltip", 1, "LEFT")
ReputationTooltip:SetPoint("BOTTOMRIGHT", ExpansionTooltip, "BOTTOMLEFT", 1, 0)
ReputationTooltip.OnRelease = ReleaseTooltip
ReputationTooltip:SetFrameLevel(parentFrame:GetFrameLevel() + 10)
end
local function MenuLine_OnLeave()
if ( ExpansionTooltip.slider and ExpansionTooltip.slider:IsShown() ) then
ReleaseTooltip(ExpansionTooltip)
MenuLine_CreateExpansionTooltip(MenuTooltip)
if ReputationTooltip then
ReleaseTooltip(ReputationTooltip)
MenuLine_CreateReputationTooltip(MenuTooltip)
end
return
end
if (ExpansionTooltip:GetLineCount() > 0) then
ExpansionTooltip:Clear()
ExpansionTooltip:Hide()
end
if (ReputationTooltip:GetLineCount() > 0) then
ReputationTooltip:Clear()
ReputationTooltip:Hide()
end
end
-- Expansion summary content
local function MenuLine_OnEnter(...)
local lineFrame, expansionInfo, _ = ...
ExpansionTooltip:SetCellMarginV(0) --> needs to be set every time, since it has been reset by ":Clear()".
ReputationTooltip:SetCellMarginV(0) --> TODO - add to style options ???
-- Tooltip header (title + description)
local garrisonInfo = LandingPageInfo:GetLandingPageInfo(expansionInfo.ID); --> == landingPageInfo
local isSettingsLine = expansionInfo.ID == nil
local tooltipTitle = (ns.settings.preferExpansionName and not isSettingsLine) and garrisonInfo.title or expansionInfo.name
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, isSettingsLine and expansionInfo.label or tooltipTitle, nil, true)
local tooltipDescription = expansionInfo.description or garrisonInfo.description
if tooltipDescription then
local FontColor = expansionInfo.disabled and DISABLED_FONT_COLOR or NORMAL_FONT_COLOR
LocalTooltipUtil:AddTextLine(ExpansionTooltip, tooltipDescription, FontColor, ...)
end
if isSettingsLine then
-- Stop here; no content body for the settings line
MenuLine_ShowTooltips()
return
end
-- Tooltip body
local isForWarlordsOfDraenor = expansionInfo.ID == ExpansionInfo.data.WARLORDS_OF_DRAENOR.ID
local isForLegion = expansionInfo.ID == ExpansionInfo.data.LEGION.ID
local isForBattleForAzeroth = expansionInfo.ID == ExpansionInfo.data.BATTLE_FOR_AZEROTH.ID
local isForShadowlands = expansionInfo.ID == ExpansionInfo.data.SHADOWLANDS.ID
local isForDragonflight = expansionInfo.ID == ExpansionInfo.data.DRAGONFLIGHT.ID
local isForWarWithin = expansionInfo.ID == ExpansionInfo.data.WAR_WITHIN.ID
------ Unlocking requirements -----
-- Moved to next category (see below)
-- Special treatment for Evoker; they don't have a Class Hall in Legion, hence no mission table.
if (isForLegion and expansionInfo.disabled) then
if PlayerInfo:IsPlayerEvokerClass() then
LocalLibQTipUtil:AddBlankLineToTooltip(ExpansionTooltip)
LocalTooltipUtil:AddTextLine(ExpansionTooltip, garrisonInfo.msg.requirementText, DIM_RED_FONT_COLOR)
end
end
----- Reputation -----
if (expansionInfo.ID < ExpansionInfo.data.DRAGONFLIGHT.ID and LocalRequirementInfo:CanShowExpansionLandingPage(garrisonInfo)) then
if ns.IsExpansionOptionSet("showFactionReputation", expansionInfo.ID) then
local tooltip = ns.IsExpansionOptionSet("separateFactionTooltip", expansionInfo.ID) and ReputationTooltip or ExpansionTooltip
LocalTooltipUtil:AddFactionReputationLines(tooltip, expansionInfo)
end
if ns.IsExpansionOptionSet("showBonusFactionReputation", expansionInfo.ID) then
local tooltip = ns.IsExpansionOptionSet("separateBonusFactionTooltip", expansionInfo.ID) and ReputationTooltip or ExpansionTooltip
LocalTooltipUtil:AddBonusFactionReputationLines(tooltip, expansionInfo)
end
end
if (isForShadowlands and ns.settings.showCovenantRenownLevel) then
local tooltip = ns.settings.separateCovenantRenownLevelTooltip and ReputationTooltip or ExpansionTooltip
LocalTooltipUtil:AddCovenantRenownLevelLines(tooltip)
end
----- In-progress missions -----
if ShouldShowMissionsInfoText(expansionInfo.garrisonTypeID) then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, garrisonInfo.msg.missionsTitle)
if expansionInfo.disabled then
-- Show requirement info for unlocking the given expansion type
LocalTooltipUtil:AddTextLine(ExpansionTooltip, garrisonInfo.msg.requirementText, DIM_RED_FONT_COLOR)
else
local shouldShowMissionCompletedMessage = ShouldShowMissionCompletedHint(expansionInfo.garrisonTypeID)
LocalTooltipUtil:AddGarrisonMissionLines(ExpansionTooltip, garrisonInfo, shouldShowMissionCompletedMessage)
end
end
----- Timewalking Vendor (currently Draenor + Legion only) -----
if ShouldShowTimewalkingVendorText(expansionInfo) then
local vendorAreaPoiInfo = util.poi.FindTimewalkingVendor(expansionInfo);
if vendorAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, vendorAreaPoiInfo.name)
LocalTooltipUtil:AddIconLine(ExpansionTooltip, vendorAreaPoiInfo.mapInfo.name, vendorAreaPoiInfo.atlasName)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, vendorAreaPoiInfo.timeString)
end
end
----- Warlords of Draenor -----
if isForWarlordsOfDraenor then
-- Garrison Invasion
if (ns.settings.showWoDGarrisonInvasionAlert and util.garrison.IsDraenorInvasionAvailable()) then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showWoDGarrisonInvasionAlert"])
LocalTooltipUtil:AddIconLine(ExpansionTooltip, GARRISON_LANDING_INVASION_ALERT, "worldquest-tracker-questmarker", WARNING_FONT_COLOR)
LocalTooltipUtil:AddTextLine(ExpansionTooltip, GARRISON_LANDING_INVASION_TOOLTIP)
end
-- Draenor Treasures
if (ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID) and ns.settings.showDraenorTreasures) then
LocalTooltipUtil:AddDraenorTreasureLines(ExpansionTooltip)
end
end
----- Bounty board infos (Legion + BfA + Shadowlands only) -----
if ShouldShowBountyBoardText(expansionInfo.garrisonTypeID) then
LocalTooltipUtil:AddBountyBoardLines(ExpansionTooltip, garrisonInfo)
end
----- Legion -----
if (isForLegion and ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID)) then
-- Legion Invasion
if ns.settings.showLegionAssaultsInfo then
local legionAssaultsAreaPoiInfo = util.poi.GetLegionAssaultsInfo()
if legionAssaultsAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, legionAssaultsAreaPoiInfo.name)
LocalTooltipUtil:AddIconLine(ExpansionTooltip, legionAssaultsAreaPoiInfo.parentMapInfo.name, legionAssaultsAreaPoiInfo.atlasName, ns.settings.applyInvasionColors and legionAssaultsAreaPoiInfo.color)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, legionAssaultsAreaPoiInfo.timeString)
LocalTooltipUtil:AddAchievementLine(ExpansionTooltip, legionAssaultsAreaPoiInfo.description, TOOLTIP_DASH_ICON_ID, nil, legionAssaultsAreaPoiInfo.isCompleted)
end
end
-- Demon Invasions (Broken Shores)
if ns.settings.showBrokenShoreInvasionInfo then
local demonAreaPoiInfos = util.poi.GetBrokenShoreInvasionInfo()
if util.TableHasAnyEntries(demonAreaPoiInfos) then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showBrokenShoreInvasionInfo"])
for _, demonPoi in ipairs(demonAreaPoiInfos) do
LocalTooltipUtil:AddIconLine(ExpansionTooltip, demonPoi.name, demonPoi.atlasName, ns.settings.applyInvasionColors and demonPoi.color)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, demonPoi.timeString)
end
end
end
-- Invasion Points (Argus)
if ns.settings.showArgusInvasionInfo then
local riftAreaPoiInfos = util.poi.GetArgusInvasionPointsInfo()
if util.TableHasAnyEntries(riftAreaPoiInfos) then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showArgusInvasionInfo"])
for _, riftPoi in ipairs(riftAreaPoiInfos) do
LocalTooltipUtil:AddAchievementLine(ExpansionTooltip, riftPoi.description, riftPoi.atlasName, ns.settings.applyInvasionColors and riftPoi.color, riftPoi.isCompleted)
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, riftPoi.mapInfo.name)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, riftPoi.timeString)
end
end
end
end
----- World map threats (BfA + Shadowlands) -----
if ShouldShowActiveThreatsText(expansionInfo.garrisonTypeID) then
local activeThreats = util.threats.GetActiveThreats()
local threatData = activeThreats and activeThreats[expansionInfo.ID]
if threatData then
local headerName = (
isForBattleForAzeroth and L["showNzothThreats"] or
isForShadowlands and L["showMawThreats"] or
threatData[1].mapInfo.name or --> for future (yet uncovered) expansions
UNKNOWN --> just in case
)
local showColor = (
isForBattleForAzeroth and ns.settings.applyBfAFactionColors or
isForShadowlands and ns.settings.applyCovenantColors
)
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, headerName)
for i, threatInfo in ipairs(threatData) do --> TODO - Add major-minor assault type icon for N'Zoth Assaults
LocalTooltipUtil:AddAchievementLine(ExpansionTooltip, threatInfo.questName, threatInfo.atlasName, showColor and threatInfo.color, threatInfo.isCompleted)
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, threatInfo.mapInfo.name)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, threatInfo.timeLeftString)
end
end
end
----- Battle for Azeroth -----
if isForBattleForAzeroth then
if (ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID) and ns.settings.showBfAFactionAssaultsInfo) then
local factionAssaultsAreaPoiInfo = util.poi.GetBfAFactionAssaultsInfo()
if factionAssaultsAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showBfAFactionAssaultsInfo"])
LocalTooltipUtil:AddIconLine(ExpansionTooltip, factionAssaultsAreaPoiInfo.parentMapInfo.name, factionAssaultsAreaPoiInfo.atlasName, ns.settings.applyBfAFactionColors and factionAssaultsAreaPoiInfo.color)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, factionAssaultsAreaPoiInfo.timeString)
LocalTooltipUtil:AddAchievementLine(ExpansionTooltip, factionAssaultsAreaPoiInfo.description, TOOLTIP_DASH_ICON_ID, nil, factionAssaultsAreaPoiInfo.isCompleted)
end
end
if ns.settings.showBfAIslandExpeditionsInfo then
local islandExpeditionInfo = util.poi.GetBfAIslandExpeditionInfo()
if islandExpeditionInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showBfAIslandExpeditionsInfo"])
LocalTooltipUtil:AddIconLine(ExpansionTooltip, islandExpeditionInfo.name, islandExpeditionInfo.atlasName)
local appendedTextColor = islandExpeditionInfo.isCompleted and DISABLED_FONT_COLOR or NORMAL_FONT_COLOR
local appendedText = appendedTextColor:WrapTextInColorCode( PARENS_TEMPLATE:format(islandExpeditionInfo.fulfilledPercentageString) )
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, islandExpeditionInfo.progressText..L.TEXT_DELIMITER..appendedText, islandExpeditionInfo.isCompleted)
end
end
end
----- Dragonflight -----
if isForDragonflight then
-- Faction reputation progress
if ns.IsExpansionOptionSet("showMajorFactionRenownLevel", expansionInfo.ID) then
local tooltip = ns.IsExpansionOptionSet("separateMajorFactionTooltip", expansionInfo.ID) and ReputationTooltip or ExpansionTooltip
LocalTooltipUtil:AddMajorFactionsRenownLines(tooltip, expansionInfo)
end
if ns.IsExpansionOptionSet("showBonusFactionReputation", expansionInfo.ID) then
local tooltip = ns.IsExpansionOptionSet("separateBonusFactionTooltip", expansionInfo.ID) and ReputationTooltip or ExpansionTooltip
LocalTooltipUtil:AddBonusFactionReputationLines(tooltip, expansionInfo)
end
-- Dragon Glyphs
if ns.IsExpansionOptionSet("showDragonGlyphs", expansionInfo.ID) then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showDragonGlyphs"])
LocalTooltipUtil:AddDragonGlyphLines(ExpansionTooltip, expansionInfo.ID)
end
----- World Map events -----
if ns.IsExpansionOptionSet("showWorldMapEvents", expansionInfo.ID) then
-- Dragonriding Race
if ns.settings.showDragonRaceInfo then
local raceAreaPoiInfo = util.poi.GetDragonRaceInfo()
if raceAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showDragonRaceInfo"])
LocalTooltipUtil:AddIconLine(ExpansionTooltip, raceAreaPoiInfo.name, raceAreaPoiInfo.atlasName)
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, raceAreaPoiInfo.areaName)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, raceAreaPoiInfo.timeString)
if raceAreaPoiInfo.eventInfo then --> TODO - Test this for next event
local iconString = util.CreateInlineIcon(raceAreaPoiInfo.eventInfo.texture, 16, 16, 3, -1)
LocalTooltipUtil:AddTextLine(ExpansionTooltip, iconString..raceAreaPoiInfo.eventInfo.name)
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, raceAreaPoiInfo.eventInfo.timeString)
end
end
end
-- Camp Aylaag
if ns.settings.showCampAylaagInfo then
local campAreaPoiInfo = ns.poi9.GetCampAylaagInfo();
if campAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, campAreaPoiInfo.name);
LocalTooltipUtil:AddIconLine(ExpansionTooltip, campAreaPoiInfo.mapInfo.name, campAreaPoiInfo.atlasName);
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, campAreaPoiInfo.areaName, campAreaPoiInfo.isCompleted);
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, campAreaPoiInfo.timeString and campAreaPoiInfo.timeString or campAreaPoiInfo.description);
end
end
-- Grand Hunts
if ns.settings.showGrandHuntsInfo then
local huntsAreaPoiInfo = ns.poi9.GetGrandHuntsInfo();
if huntsAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, huntsAreaPoiInfo.name);
LocalTooltipUtil:AddIconLine(ExpansionTooltip, huntsAreaPoiInfo.mapInfo.name, huntsAreaPoiInfo.atlasName);
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, huntsAreaPoiInfo.timeString);
end
end
-- Iskaara Community Feast
if ns.settings.showCommunityFeastInfo then
local feastAreaPoiInfo = ns.poi9.GetCommunityFeastInfo();
if feastAreaPoiInfo then
LocalTooltipUtil:AddHeaderLine(ExpansionTooltip, L["showCommunityFeastInfo"]);
LocalTooltipUtil:AddIconLine(ExpansionTooltip, feastAreaPoiInfo.mapInfo.name, feastAreaPoiInfo.atlasName);
LocalTooltipUtil:AddObjectiveLine(ExpansionTooltip, feastAreaPoiInfo.name);
LocalTooltipUtil:AddTimeRemainingLine(ExpansionTooltip, feastAreaPoiInfo.timeString);
end