-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtaintPrevent.lua
More file actions
1865 lines (1660 loc) · 87.7 KB
/
Copy pathtaintPrevent.lua
File metadata and controls
1865 lines (1660 loc) · 87.7 KB
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 folderName, Addon = ...
-- ============================================================================
-- ============================================================================
--
-- taintPrevent.lua -- OVERVIEW
--
-- PersistentWorldMap writes to WorldMapFrame.mapID (to persist the user's
-- last-viewed map across opens). That write permanently taints mapID; from
-- then on, ANY Blizzard code reading mapID inherits PWM-origin taint, and
-- protected calls or measurement-protected reads downstream of that taint
-- fail. WoW provides no API for an addon to assign mapID cleanly, so this
-- file is the workaround layer: defensive patches that keep PWM functional
-- in the presence of its own permanent taint.
--
-- Sections (each is a self-contained `do` block or labelled region):
--
-- (1) ADDON_ACTION_FORBIDDEN popup customization
-- Add a "Reload UI" button so we can offer a graceful recovery from
-- a residual taint trip without forcing the user to disable PWM.
--
-- (2) In-instance OnShow replacement to skip the READ emote
-- On entering any instance (BG, arena, 5-man, raid, scenario),
-- SetScript WorldMapFrame:OnShow to a manually-inlined copy of
-- WorldMapMixin:OnShow with the C_ChatInfo.PerformEmote("READ", ...)
-- line at Blizzard_WorldMap.lua:352 omitted. On leaving, restore
-- the raw Blizzard handler. This has a patch-day maintenance cost
-- -- diff Blizzard's OnShow against the local copy every retail
-- patch. Also installs the reading-emote opt-out HookScript
-- (formerly section (3)).
--
-- (3) [reserved] -- see section (2)
-- The reading-emote opt-out HookScript that used to live here moved
-- into section (2) so its lifecycle stays tied to (2)'s SetScript /
-- restore cycle. Numbering preserved to keep (4)-(10) stable.
--
-- (4) Combat-end refresh
-- Declares Addon.reloadAfterCombat (set by section (6)'s protected-
-- call shadows) and the PLAYER_REGEN_ENABLED handler that refreshes
-- the map once combat ends.
--
-- (5) Custom-tooltip system for map pins
-- PWM-owned tooltip frame + PWM-local copies of the Blizzard tooltip-
-- builder functions that hardcode the global GameTooltip. Routes pin
-- hover tooltips through our frame to dodge the "secret value"
-- measurement-arithmetic trap that fires on the canonical GameTooltip
-- when execution carries PWM-origin taint.
--
-- >>> CONTAINS BLIZZARD-SOURCE COPIES THAT MUST BE AUDITED ON EVERY
-- RETAIL PATCH. See the maintenance banner inside that section. <<<
--
-- (6) Per-pin protected-call shadowing + pool-acquire hook
-- Shadow SetPassThroughButtons / SetPropagateMouseClicks on each pin
-- to skip during combat. The pool-acquire wrapper also dispatches to
-- the custom-tooltip installer from section (5). Installed on
-- WorldMapFrame at load and on FlightMapFrame lazily when
-- Blizzard_FlightMap loads.
--
-- (7) HookPins
-- Manual OnClick emulation for boss / dungeon pins during combat
-- (their normal OnClick is tainted-blocked).
--
-- (8) Quest tracker hooks
-- QuestMapFrame_OpenToQuestDetails and QuestLogPopupDetailFrame_Show
-- don't bring up the right frames during combat -- we do it manually.
--
-- (9) Frame mutual-exclusion helpers
-- Close-X functions that respect combat lockdown.
--
-- (10) PLAYER_LOGIN startup
-- Preload EncounterJournal, fix initial frame anchors, register
-- UISpecialFrames, install the mutual-exclusion HookScripts.
--
-- ============================================================================
-- ============================================================================
--
--
-- ============================================================================
-- ============================================================================
-- == ==
-- == PATCH-DAY MAINTENANCE MANUAL ==
-- == Read this on EVERY retail patch before shipping a compatible build. ==
-- == ==
-- ============================================================================
-- ============================================================================
--
-- Three separate audits, each with its own last-synced date recorded inline.
-- Skipping any of them lets a Blizzard change silently break PWM: either the
-- taint dam fails and errors surface, or our copy of Blizzard code diverges
-- from the current behavior and features silently regress.
--
-- ----------------------------------------------------------------------------
-- AUDIT (A) -- Section (2)'s InstanceOnShow copy of WorldMapMixin:OnShow
-- ----------------------------------------------------------------------------
--
-- Blizzard source: Blizzard_WorldMap/Blizzard_WorldMap.lua
-- Blizzard symbol: WorldMapMixin:OnShow (lines 342-376 as of 12.1.0)
-- Our copy: local function InstanceOnShow(self) in section (2).
-- Deviation: omit the C_ChatInfo.PerformEmote("READ", nil, true)
-- call at line :352. Every other line must match.
--
-- Procedure:
-- 1. Open the Blizzard source at the cited symbol.
-- 2. Diff line-by-line against InstanceOnShow.
-- 3. Mirror ANY change (added line, reordered call, new local, ...).
-- 4. Keep the omitted-line comment where the PerformEmote call would be.
-- 5. Update the "Last synced" date in InstanceOnShow's header comment.
--
-- Symptoms of a stale copy:
-- * In-instance map open error resurfaces (Blizzard moved the emote
-- to a different line and our copy still runs the old version).
-- * Missing UI behaviors in in-instance map open (Blizzard added a
-- line we don't replicate: minimap sync, side panel state, etc.).
--
-- ----------------------------------------------------------------------------
-- AUDIT (B) -- Section (5)'s Blizzard-source tooltip-builder copies
-- ----------------------------------------------------------------------------
--
-- Blizzard sources (multiple files -- see the audit checklist banner
-- inside section (5) for the exact list of functions, files, and line
-- ranges).
-- Our copies: the PWM_* functions inside the "BLIZZARD-SOURCE COPIES"
-- block of section (5). Each one has its own inline
-- "COPY OF" / "Source lines" / "Adaptation" header.
-- Deviation: every reference to the canonical `GameTooltip` global
-- rewritten to a local `tooltip = PWMTooltip` binding.
-- Everything else must match.
--
-- Procedure:
-- 1. Open each cited Blizzard source at the cited function.
-- 2. Diff line-by-line against the PWM copy.
-- 3. Mirror ANY change; keep the GameTooltip -> PWMTooltip rewrite.
-- 4. Update the "Source lines" line-range in each COPY OF header if
-- Blizzard shifted things.
-- 5. Update the "AUDIT CHECKLIST" date in section (5)'s banner.
--
-- Symptoms of a stale copy:
-- * Wrong / missing tooltip content on world map pin hover (fields
-- added by Blizzard we don't render, format changes we don't mirror,
-- etc.).
-- * Silent tooltip errors under PWM taint that the canonical Blizzard
-- code would have handled.
--
-- ----------------------------------------------------------------------------
-- AUDIT (C) -- Section (5)'s pin-template dispatch coverage
-- ----------------------------------------------------------------------------
--
-- Blizzard sources: Blizzard_SharedMapDataProviders/, Blizzard_WorldMap/,
-- Blizzard_FlightMap/, Blizzard_AnimaDiversionUI/,
-- Blizzard_BattlefieldMap/ -- any addon that adds a
-- data provider to a map canvas.
-- Our coverage: the pinTemplate branches in PatchPinForCustomTooltip
-- (section (5)) and the canvas hooks in section (6).
--
-- Procedure:
-- Run the four greps documented in the "HOW TO RE-AUDIT" block inside
-- section (5)'s banner. Cross-reference each hit against the covered
-- mixins / templates. Add any newly-created derivatives to the
-- appropriate dispatch branch. Update the audit-checklist date and
-- the per-function line ranges in section (5)'s banner.
--
-- Symptoms of a stale audit:
-- * "attempt to perform arithmetic on a secret number value" errors
-- on hover of a specific pin type that isn't in our dispatch.
-- * Silent PWM-taint blame on tooltip functions the trap widened to
-- cover after our previous audit.
--
-- ----------------------------------------------------------------------------
-- Not part of the retail-patch cadence but worth re-checking when Blizzard
-- ships significant UI infrastructure changes:
--
-- * Blizzard_MapCanvas/Blizzard_MapCanvas.lua -- AcquirePin at :251,
-- particularly the OnEnter/OnLeave nil-assertion + SetScript block at
-- :262-289. Section (6)'s WrapPoolAcquire relies on these line numbers
-- being correct for its "fresh vs reused pin" branching.
--
-- * Blizzard_GameTooltip/Mainline/GameTooltip.xml -- the ItemTooltip
-- child of the canonical GameTooltip (lines 249-274 as of 12.0.5).
-- Section (5)'s PWMTooltip manually creates an
-- InternalEmbeddedItemTooltipTemplate child to mirror this; if
-- Blizzard restructures the tooltip template composition, the manual
-- child creation may need to change.
--
-- ============================================================================
-- ============================================================================
-- ============================================================================
-- Locals
-- ============================================================================
local InCombatLockdown = _G.InCombatLockdown
local IsInInstance = _G.IsInInstance
local C_Map_GetMapInfo = _G.C_Map.GetMapInfo
local QuestLogPopupDetailFrame = _G.QuestLogPopupDetailFrame
local WorldMapFrame = _G.WorldMapFrame
-- ============================================================================
-- (1) ADDON_ACTION_FORBIDDEN popup -- add a "Reload UI" button
-- ============================================================================
--
-- Blizzard's default popup only offers "Disable [addon] and reload" or
-- "Ignore". We add a third button that reloads without disabling, since the
-- residual taint trips we get are typically transient and a clean reload
-- recovers without sacrificing PWM.
--
do
local addonForbiddenFrame = CreateFrame("Frame")
addonForbiddenFrame:RegisterEvent("PLAYER_LOGIN")
addonForbiddenFrame:SetScript("OnEvent", function()
if StaticPopupDialogs and StaticPopupDialogs["ADDON_ACTION_FORBIDDEN"] then
local popup = StaticPopupDialogs["ADDON_ACTION_FORBIDDEN"]
-- A modified variant of the stock string:
-- ADDON_ACTION_FORBIDDEN = "%s has been blocked from an action only available to the Blizzard UI.\nYou can disable this addon and reload the UI."
popup.text = "%s has been blocked from an action only available to the Blizzard UI.\n\nIf this happens rarely, try reloading the UI first. Only if this issue keeps repeating unacceptably, consider disabling the addon."
popup.button3 = RELOADUI or "Reload UI"
popup.OnAlt = function()
C_UI.Reload()
end
end
end)
end
-- ============================================================================
-- (2) In-instance OnShow replacement to skip the READ emote
-- ============================================================================
--
-- HISTORICAL CONTEXT (do NOT reintroduce these approaches):
--
-- b5af17d, 20ab7b1, 16afd8f: wrapped C_ChatInfo.PerformEmote /
-- .CancelEmote to filter the READ emote. The wrapper WRITE from
-- tainted addon-load context permanently tainted the FIELD ENTRY on
-- C_ChatInfo.PerformEmote for the session; every subsequent secure read
-- (any /sorry, /wave, etc. typed by the user) inherited PWM taint and
-- blamed us for ADDON_ACTION_BLOCKED once Blizzard tightened a
-- downstream C protection in raid boss fights. Same trap the section
-- (5) banner spells out for _G.GameTooltip: writes to a globally-
-- visible function field from tainted execution taint the field entry
-- permanently.
--
-- Direct field WRITES to C_ChatInfo.* are OFF LIMITS, forever.
--
-- CURRENT APPROACH:
--
-- The error stems from OnShow's `C_ChatInfo.PerformEmote("READ", ...)` at
-- Blizzard_WorldMap.lua:352 reaching a protected C downstream when
-- OnShow's execution has any PWM taint. Since PWM-taint on WorldMapFrame
-- .mapID is inevitable during normal use (writing to mapID is PWM's
-- reason to exist), we must stop the emote line from being called at all
-- inside any instance where the downstream is protected. Observed to
-- trip in PvP instances (BG/arena), 5-man dungeons, and raids -- so we
-- gate on IsInInstance() rather than any narrower instanceType check.
--
-- * On entering an instance (PLAYER_ENTERING_WORLD), SetScript
-- WorldMapFrame's OnShow to InstanceOnShow: a MANUALLY-INLINED copy
-- of Blizzard's WorldMapMixin:OnShow (Blizzard_WorldMap.lua:342-376)
-- with the C_ChatInfo.PerformEmote line at :352 omitted. The emote
-- never fires while in an instance, so no protected downstream is
-- reached.
-- * On leaving an instance, SetScript back to the raw Blizzard handler
-- captured at addon load, and re-add the reading-emote-opt-out
-- HookScript that SetScript wipes.
--
-- Why not always SetScript (both in and out of instances): our wrapper's
-- execution is PWM-tainted (we're addon-defined). When Blizzard's OnShow
-- code runs UNDER that taint, downstream MoneyFrame widgets and other
-- tooltip machinery inherit taint and emit "secret number" arithmetic
-- errors on the map's own header. Empirically observed on 2026-04-01
-- (commit 20ab7b1 moved away from SetScript for exactly this reason).
-- By SetScript'ing only inside instances and reverting on exit, open-
-- world OnShow runs on Blizzard's raw handler with no PWM taint at all.
--
-- MAINTENANCE: see the PATCH-DAY MAINTENANCE MANUAL at the top of this
-- file (Audit (A)). "Last synced" date lives inline in the InstanceOnShow
-- copy below and is the single source of truth.
--
-- OWN OnShow HOOKS: SetScript wipes HookScript-wrappers, so if PWM's own
-- OnShow logic lived as HookScripts, entering an instance would wipe them
-- and (a) InstanceOnShow wouldn't call them either, so they'd stop firing
-- until the next map close-and-reopen after exit; (b) on instance exit
-- we'd have to re-add them all manually. To avoid both problems, PWM's
-- own OnShow work is registered via Addon.RegisterWorldMapOnShow (defined
-- below) and dispatched from a single point that both the plain HookScript
-- (outside instances) and InstanceOnShow (inside instances) call. Other
-- PWM files (restoreAndReset.lua) and other sections (section (10)) use
-- this registration instead of HookScript for the same reason.
--
-- THIRD-PARTY OnShow HOOKS -- KNOWN LIMITATION:
-- SetScript replaces the whole OnShow hook chain with InstanceOnShow, so
-- any HookScripts other addons attached to WorldMapFrame:OnShow do NOT
-- fire while the player is inside an instance. Popular map addons that
-- HookScript OnShow (Mapster, Leatrix_Maps, and similar) therefore skip
-- their in-instance customizations. Their hooks resume automatically on
-- instance exit -- see the restore path below, which SetScripts the frame
-- back to the captured pre-transition wrapper (Blizzard's OnShow + every
-- HookScript that was on it at the moment we transitioned in, ours and
-- third-party alike).
--
-- Third-party hooks added DURING an instance wrap InstanceOnShow and do
-- fire in-instance, but are then dropped on exit for the symmetric
-- reason (our restore doesn't know about them). This mainly affects the
-- /reload-during-an-instance case.
--
-- Why we accept this: the alternatives are worse. Calling the captured
-- pre-transition wrapper from InstanceOnShow to fan out third-party
-- hooks in-instance would re-run Blizzard's OnShow first (that's how
-- HookScript composition works -- the original is embedded, not
-- separable), which fires the PerformEmote we're specifically avoiding.
-- WoW doesn't expose an API to iterate a frame's HookScripts
-- individually, so we can't call "just the hooks" without also calling
-- Blizzard's OnShow. Temporarily swapping C_ChatInfo.PerformEmote around
-- the call would work mechanically but re-opens the field-entry taint
-- trap that broke /sorry (see HISTORICAL CONTEXT above).
--
-- Post-hooks on C_ChatInfo.PerformEmote itself (Leatrix_Maps's approach)
-- are POST-only -- they cancel the emote animation AFTER PerformEmote has
-- already fired ADDON_ACTION_BLOCKED from tainted execution. Fine for a
-- cosmetic emote toggle on an addon that doesn't taint mapID; useless
-- for suppressing the underlying error PWM has to deal with.
--
do
-- Callback list used by both the HookScript below (outside instances)
-- and by InstanceOnShow (inside instances). Forward-declared so
-- InstanceOnShow can close over it.
local onShowCallbacks = {}
Addon.RegisterWorldMapOnShow = function(fn)
table.insert(onShowCallbacks, fn)
end
-- ------------------------------------------------------------------------
-- MANUAL COPY of WorldMapMixin:OnShow (Blizzard_WorldMap.lua:342-376).
-- Last synced 2026-08-04 vs Midnight 12.1.0. See PATCH-DAY MANUAL,
-- Audit (A) at top of file for the sync procedure.
-- Deviation from source: the C_ChatInfo.PerformEmote("READ", nil, true)
-- call at line :352 is intentionally OMITTED here.
-- ------------------------------------------------------------------------
local function InstanceOnShow(self)
if self.needUpdateDisplayState then
local displayState = self:GetOpenDisplayState()
self:SetDisplayState(displayState)
self.needUpdateDisplayState = nil
end
local frameStrata = C_GameRules.GetGameRuleAsFrameStrata(Enum.GameRule.WorldMapFrameStrata)
if frameStrata and frameStrata ~= "UNKNOWN" then
self:SetFrameStrata(frameStrata)
end
local mapID = MapUtil.GetDisplayableMapForPlayer()
self:SetMapID(mapID)
MapCanvasMixin.OnShow(self)
self:ResetZoom()
-- OMITTED: C_ChatInfo.PerformEmote("READ", nil, true) -- see section (2) header.
PlaySound(SOUNDKIT.IG_QUEST_LOG_OPEN)
PlayerMovementFrameFader.AddDeferredFrame(self, .5, 1.0, .5, function()
return GetCVarBool("mapFade") and not self:IsMouseOver()
end)
self:CheckAndShowTutorialTooltip()
local miniWorldMap = GetCVarBool("miniWorldMap")
local maximized = self:IsMaximized()
if miniWorldMap ~= maximized then
if miniWorldMap then
self.BorderFrame.MaximizeMinimizeFrame:Minimize()
else
self.BorderFrame.MaximizeMinimizeFrame:Maximize()
end
end
EventRegistry:TriggerEvent("WorldMapOnShow")
-- Run PWM's own registered OnShow callbacks (see the OWN OnShow HOOKS
-- note in the section (2) header).
for _, fn in ipairs(onShowCallbacks) do fn(self) end
end
-- Dispatch HookScript: runs the callbacks after Blizzard's original
-- OnShow when we're NOT inside an instance. Inside instances,
-- InstanceOnShow calls the same callbacks directly at its tail.
WorldMapFrame:HookScript("OnShow", function(self)
for _, fn in ipairs(onShowCallbacks) do fn(self) end
end)
-- Reading-emote opt-out. Cancels the emote after Blizzard's OnShow fired
-- it, if the user has disabled it in PWM options. Only meaningful outside
-- instances (inside, InstanceOnShow doesn't fire the emote in the first
-- place). Cheap call, no field write.
Addon.RegisterWorldMapOnShow(function(self)
if not PWM_config.showReadingEmote and not IsInInstance() then
C_ChatInfo.CancelEmote()
end
end)
local instanceActive = false
local preInstanceOnShow = nil -- Blizzard OnShow + accumulated HookScripts
local instanceTransitionFrame = CreateFrame("Frame")
instanceTransitionFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
instanceTransitionFrame:SetScript("OnEvent", function()
if IsInInstance() then
if not instanceActive then
instanceActive = true
-- Snapshot the full current OnShow (Blizzard's + all HookScripts,
-- including our callback dispatch) so we can restore it verbatim
-- on exit.
preInstanceOnShow = WorldMapFrame:GetScript("OnShow")
WorldMapFrame:SetScript("OnShow", InstanceOnShow)
end
else
if instanceActive then
instanceActive = false
WorldMapFrame:SetScript("OnShow", preInstanceOnShow)
preInstanceOnShow = nil
end
end
end)
end
-- ============================================================================
-- (3) [reserved] -- see section (2)
-- ============================================================================
--
-- The reading-emote opt-out that used to live here is now installed inside
-- section (2) as ReadingEmoteOptOutHook because its lifecycle must be tied
-- to section (2)'s SetScript / restore cycle. Numbering preserved to keep
-- sections (4)-(10) stable.
-- ============================================================================
-- (4) Combat-end refresh
-- ============================================================================
--
-- Section (6)'s per-pin protected-call shadows skip protected calls during
-- combat and set this flag so we know a refresh is needed when combat ends.
-- Exposed on Addon because restoreAndReset.lua's RestoreMapState / ResetMap
-- also set it when they hit InCombatLockdown().
--
Addon.reloadAfterCombat = false
do
local leaveCombatFrame = CreateFrame("Frame")
leaveCombatFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
leaveCombatFrame:SetScript("OnEvent", function()
if InCombatLockdown() then return end
if Addon.reloadAfterCombat and WorldMapFrame:IsShown() then
WorldMapFrame:OnMapChanged()
Addon.PlayerPingAnimation(false)
end
Addon.reloadAfterCombat = false
end)
end
-- ============================================================================
-- ============================================================================
-- == ==
-- == (5) CUSTOM-TOOLTIP SYSTEM FOR MAP PINS ==
-- == ==
-- == Routes pin hover tooltips through a PWM-owned PWMTooltip frame so ==
-- == that the "secret value" measurement-arithmetic trap that fires on ==
-- == the canonical GameTooltip under PWM-origin taint doesn't trigger. ==
-- == ==
-- == Why this works: the secret-value protection applies to specific ==
-- == Blizzard canonical frames (the global GameTooltip and its built-in ==
-- == child frames). Addon-created instances built from GameTooltipTemplate ==
-- == return real numbers from measurement getters even under tainted ==
-- == execution. Routing tooltip builds through PWMTooltip dodges the trap. ==
-- == ==
-- == Why we DON'T just swap _G.GameTooltip: writes to a global from ==
-- == tainted execution permanently taint the _G FIELD ENTRY. Subsequent ==
-- == Blizzard reads of `GameTooltip` (BuffFrame, ActionButton, ==
-- == PetActionBar, ...) cascade into ADDON_ACTION_BLOCKED and unit-aura ==
-- == secret-number errors during combat. So this section makes NO _G ==
-- == writes anywhere. ==
-- == ==
-- == Why per-instance, not mixin-level: Blizzard's sub-mixin pattern -- ==
-- == e.g. AreaPOIEventPinMixin built via AreaPOIPinMixin:CreateSubPin(...) ==
-- == -- snapshot-copies methods at Blizzard load time, BEFORE our addon ==
-- == can edit the parent mixin. Per-instance replacement (driven by the ==
-- == pool-acquire hook in section (6)) is mixin-chain-agnostic. ==
-- == ==
-- == How OnMouseEnter / OnMouseLeave get installed (two paths): ==
-- == ==
-- == Fresh pins (newPin == true): we set pin.OnMouseEnter as a TABLE ==
-- == FIELD only. Blizzard's MapCanvasMixin:AcquirePin then runs ==
-- == `assert(pin:GetScript("OnEnter") == nil)` at Blizzard_MapCanvas.lua ==
-- == :280 (inside `if newPin then`) and binds the field as the script at ==
-- == :283-284. Calling SetScript ourselves on a new pin would trip the ==
-- == assert, so we must not. ==
-- == ==
-- == Reused pins (newPin == false): Blizzard SKIPS the :262-289 SetScript ==
-- == block entirely; whatever OnEnter/OnLeave scripts were bound at the ==
-- == pin's first creation persist. If that first creation happened before ==
-- == our pool wrapper was installed (e.g. another addon triggered an ==
-- == AcquirePin during load before us), the original Blizzard handler is ==
-- == permanently bound and table-field replacement alone has no effect -- ==
-- == the secret-number trap fires on every hover. Detect that case (first ==
-- == time we see this pin AND newPin is false) in the pool wrapper and ==
-- == rebind via SetScript explicitly. The :280 assert is inside `if newPin ==
-- == then` and does not fire on the reuse path, so SetScript is safe. ==
-- == ==
-- == +---------------------------------------------------------------+ ==
-- == | MAINTENANCE WARNING -- READ BEFORE EVERY RETAIL PATCH | ==
-- == +---------------------------------------------------------------+ ==
-- == ==
-- == The functions in the BLIZZARD-SOURCE COPIES region below are ==
-- == MECHANICALLY copied from Blizzard source code, with GameTooltip ==
-- == references rewritten to the local tooltip = PWMTooltip binding. ==
-- == After EVERY Retail patch, diff each Blizzard original against the ==
-- == PWM copy here and mirror any change. If you skip this audit, ==
-- == tooltip content silently diverges from Blizzard's intent. ==
-- == ==
-- == AUDIT CHECKLIST (last audited: 2026-08-04 vs Midnight 12.1.0) ==
-- == ==
-- == Blizzard_FrameXMLUtil/AreaPoiUtil.lua ==
-- == AreaPoiUtil.TryShowTooltip lines 3-72 ==
-- == ==
-- == Blizzard_GameTooltip/Mainline/GameTooltip.lua ==
-- == (local) AddFloorLocationLine lines 633-639 ==
-- == GameTooltip_AddQuest lines 641-759 ==
-- == ==
-- == Blizzard_UIPanels_Game/Mainline/WorldMapFrame.lua ==
-- == TaskPOI_OnEnter lines 167-187 ==
-- == ==
-- == Blizzard_SharedMapDataProviders/AreaPOIDataProvider.lua ==
-- == AreaPOIPinMixin:OnMouseEnter lines 159-181 ==
-- == (AreaPOIEventPinMixin, DelveEntrancePinMixin, QuestHubPin- ==
-- == GlowMixin all inherit/delegate to AreaPOIPinMixin:OnMouseEnter ==
-- == -- see file pointers under their own dispatch branches.) ==
-- == Canvas-specific XML inheritance: ==
-- == Blizzard_FlightMap/FM_AreaPOIDataProvider.xml:5 ==
-- == "FlightMap_AreaPOIPinTemplate" inherits AreaPOIPinTemplate ==
-- == (mixin: FlightMap_AreaPOIPinMixin = ==
-- == CreateFromMixins(AreaPOIPinMixin), no OnMouseEnter ==
-- == override.) ==
-- == ==
-- == Blizzard_SharedMapDataProviders/DelveEntranceDataProvider.lua ==
-- == DelveEntrancePinMixin = AreaPOIPinMixin:CreateSubPin(...) :42 ==
-- == (snapshot-copies AreaPOIPinMixin's OnMouseEnter at Blizzard ==
-- == load; no DelveEntrance-specific OnMouseEnter to mirror.) ==
-- == ==
-- == Blizzard_SharedMapDataProviders/QuestOfferDataProvider.lua ==
-- == QuestHubPinGlowMixin:OnMouseEnter lines 884-887 ==
-- == (calls AreaPOIPinMixin.OnMouseEnter(self) + self:AcknowledgeGlow =
-- == -- our dispatch branch preserves the AcknowledgeGlow call.) ==
-- == ==
-- == Blizzard_SharedMapDataProviders/WorldQuestDataProvider.lua ==
-- == WorldQuestPinMixin:OnMouseEnter lines 420-424 ==
-- == WorldQuestPinMixin:OnMouseLeave lines 426-430 ==
-- == The base "WorldQuestPinTemplate" itself is virtual only -- ==
-- == every canvas overrides GetPinTemplate to return a derivative: ==
-- == Blizzard_WorldMap/WM_WorldQuestDataProvider.lua:4 ==
-- == -> "WorldMap_WorldQuestPinTemplate" ==
-- == (mixin: WorldMap_WorldQuestPinMixin = ==
-- == CreateFromMixins(WorldQuestPinMixin), no OnMouseEnter ==
-- == override -- snapshot preserves the base's tooltip path.) ==
-- == Blizzard_FlightMap/FM_WorldQuestDataProvider.lua:4 ==
-- == -> "FlightMap_WorldQuestPinTemplate" ==
-- == Blizzard_AnimaDiversionUI/AD_WorldQuestDataProvider.lua:4 ==
-- == -> "AnimaDiversion_WorldQuestPinTemplate" ==
-- == All three derivatives snapshot WorldQuestPinMixin's handlers ==
-- == verbatim; PWM's WorldQuest branch dispatches on all four ==
-- == template names. ==
-- == ==
-- == Blizzard_SharedMapDataProviders/BonusObjectiveDataProvider.lua ==
-- == BonusObjectivePinMixin:OnMouseEnter lines 162-166 ==
-- == BonusObjectivePinMixin:OnMouseLeave lines 168-172 ==
-- == (ThreatObjectivePinMixin inherits BonusObjectivePinMixin via ==
-- == CreateFromMixins and uses the same handler structure.) ==
-- == ==
-- == Blizzard_SharedMapDataProviders/QuestOfferDataProvider.lua ==
-- == QuestOfferPinMixin:OnMouseEnter lines 424-426 ==
-- == QuestOfferPinMixin:OnMouseLeave lines 428-430 ==
-- == ==
-- == Blizzard_SharedMapDataProviders/InvasionDataProvider.lua ==
-- == InvasionPinMixin:OnMouseEnter lines 44-67 ==
-- == InvasionPinMixin:OnMouseLeave lines 69-71 ==
-- == ==
-- == Blizzard_SharedMapDataProviders/VignetteDataProvider.lua ==
-- == VignettePinBaseMixin:OnMouseEnter lines 453-487 ==
-- == VignettePinBaseMixin:OnMouseLeave lines 489-492 ==
-- == VignettePinBaseMixin:DisplayNormalTooltip lines 494-514 ==
-- == VignettePinBaseMixin:DisplayPvpBountyTooltip lines 516-537 ==
-- == VignettePinBaseMixin:DisplayTorghastTooltip lines 539-542 ==
-- == Canvas-specific XML inheritance: ==
-- == Blizzard_FlightMap/FM_VignetteDataProvider.xml:5 ==
-- == "FlightMap_VignettePinTemplate" inherits VignettePinTemplate =
-- == (mixin: FlightMap_VignettePinMixin = ==
-- == CreateFromMixins(VignettePinMixin), no OnMouseEnter ==
-- == override.) ==
-- == ==
-- == Blizzard_SharedMapDataProviders/QuestBlobDataProvider.lua ==
-- == QuestBlobPinMixin:UpdateTooltip lines 182-229 ==
-- == QuestBlobPinMixin:OnMouseEnter lines 231-233 ==
-- == QuestBlobPinMixin:OnMouseLeave lines 235-239 ==
-- == ==
-- == Reference points (no copies, but our code relies on these line ==
-- == numbers being correct -- spot-check on patch days): ==
-- == ==
-- == Blizzard_MapCanvas/Blizzard_MapCanvas.lua ==
-- == AcquirePin pin.pinTemplate assignment line 259 ==
-- == OnEnter/OnLeave nil-assertion + SetScript lines 280-284 ==
-- == ==
-- == Blizzard_GameTooltip/Mainline/GameTooltip.xml ==
-- == ItemTooltip child of canonical GameTooltip lines 249-274 ==
-- == ==
-- == When you update the audit date above, also update the per-function ==
-- == "Source lines" comments inline below if any line ranges shifted. ==
-- == ==
-- == HOW TO RE-AUDIT FOR NEWLY ADDED PIN TEMPLATES ==
-- == ==
-- == IMPORTANT: run the queries below across ALL Blizzard_* addons that ==
-- == add data providers to a map canvas -- NOT just the "shared" folder. ==
-- == Canvas-specific addons routinely OVERRIDE GetPinTemplate to return ==
-- == their own derivative template name (e.g. WorldMap_WorldQuestPin- ==
-- == Template) while snapshot-copying the base mixin's OnMouseEnter via ==
-- == CreateFromMixins -- so the base pin template is never actually ==
-- == created on that canvas, and matching only on the base template name ==
-- == is a silent miss. This bit us on 2026-06-10: our WorldQuestPin- ==
-- == Template dispatch entry was never hit on WorldMapFrame because ==
-- == Blizzard uses WorldMap_WorldQuestPinTemplate there. ==
-- == ==
-- == Folders to audit (retail): ==
-- == Blizzard_SharedMapDataProviders/ -- base mixins and shared ==
-- == Blizzard_WorldMap/ -- WM_* derivatives ==
-- == Blizzard_FlightMap/ -- FM_* derivatives ==
-- == Blizzard_AnimaDiversionUI/ -- AnimaDiversion_* derivatives ==
-- == Blizzard_BattlefieldMap/ -- uses base AreaPOI etc. ==
-- == ==
-- == Four queries together cover the full surface: ==
-- == ==
-- == (1) Direct calls to risky tooltip builders ==
-- == pattern: TaskPOI_OnEnter | AreaPoiUtil.TryShowTooltip ==
-- == | GameTooltip_AddWidgetSet | GameTooltip_AddQuestRewards- ==
-- == ToTooltip | EmbeddedItemTooltip_ | SetTooltipMoney ==
-- == ==
-- == (2) Templates inheriting OnMouseEnter from a covered template via ==
-- == XML or via CreateSubPin / CreateFromMixins: ==
-- == pattern: CreateSubPin | inherits=".*PinTemplate" ==
-- == | CreateFromMixins\((WorldQuest|BonusObjective|AreaPOI| ==
-- == QuestOffer|Invasion|Vignette|QuestBlob)PinMixin\) ==
-- == Then cross-reference each hit against the covered mixins above. ==
-- == ==
-- == (3) Templates that delegate to a covered OnMouseEnter via a live ==
-- == table lookup inside their own OnMouseEnter body: ==
-- == pattern: \.OnMouseEnter\(self\) ==
-- == Cross-reference the target mixin against the covered list. ==
-- == ==
-- == (4) All GetPinTemplate return values ACROSS every audited folder: ==
-- == pattern: return "([A-Za-z_]+PinTemplate)" ==
-- == Every template name that appears here MUST match one of the ==
-- == dispatch branches in PatchPinForCustomTooltip. If a template ==
-- == isn't matched but its mixin chain uses a covered mixin, add it ==
-- == to the appropriate branch. Silent misses live here. ==
-- == ==
-- == Negative-result reference: BaseMapPoiPinMixin:OnMouseEnter (Shared- ==
-- == MapPoiTemplates.lua:163) calls only CheckShowTooltip, which uses ==
-- == GameTooltip_SetTitle / AddNormalLine / AddInstructionLine -- pure ==
-- == text, no measured widgets, no secret-number trap. So every template ==
-- == whose only OnMouseEnter source is BaseMapPoiPinMixin:CreateSubPin ==
-- == is safe to skip. ==
-- == ==
-- ============================================================================
-- ============================================================================
-- Diagnostic toggle. When true, every patched pin hover prints to chat and
-- we also log when a pin instance gets patched. Set false for silent play.
-- (We do NOT use issecure() as a proxy for "will the trap fire" -- inside
-- our own addon code it returns false regardless of whether the shared-
-- state taint that actually fires the secret-number protection is present.)
Addon.PWM_DEBUG_TOOLTIPS = false
-- The custom tooltip frame, plus a manually-installed ItemTooltip child
-- because GameTooltipTemplate alone doesn't include the children that the
-- canonical GameTooltip element in GameTooltip.xml declares inline (see
-- the reference to GameTooltip.xml:249-274 in the audit checklist).
-- Without ItemTooltip, helpers that read tooltip.ItemTooltip crash with
-- nil indexing.
local PWMTooltip = CreateFrame("GameTooltip", "PWMTooltip", UIParent, "GameTooltipTemplate")
PWMTooltip:SetFrameStrata("TOOLTIP")
PWMTooltip:Hide()
PWMTooltip.supportsItemComparison = true
do
local itemTooltip = CreateFrame("Frame", nil, PWMTooltip, "InternalEmbeddedItemTooltipTemplate")
itemTooltip:SetSize(100, 100)
itemTooltip:SetPoint("BOTTOMLEFT", PWMTooltip, "BOTTOMLEFT", 10, 13)
itemTooltip:Hide()
itemTooltip.yspacing = 13
PWMTooltip.ItemTooltip = itemTooltip
-- Wire shopping tooltips for item-comparison (mirrors the inline OnLoad on
-- the canonical ItemTooltip child in GameTooltip.xml).
if itemTooltip.Tooltip and ShoppingTooltip1 and ShoppingTooltip2 then
itemTooltip.Tooltip.shoppingTooltips = { ShoppingTooltip1, ShoppingTooltip2 }
end
end
-- DebugLog: small helper to consolidate the diagnostic chat-print boilerplate
-- that would otherwise be repeated in every PWM_*_OnMouseEnter handler.
local function DebugLog(fmt, ...)
if Addon.PWM_DEBUG_TOOLTIPS then
print(string.format("|cFF60FF60[PWM]|r " .. fmt, ...))
end
end
-- Shared OnMouseLeave for pin types whose only cleanup is hiding our
-- tooltip. Pins that need extra cleanup or an owner-check guard
-- (WorldQuest, Vignette, AreaPOI, QuestBlob) define their own below.
local function PWM_OnMouseLeave_HideOnly(self)
PWMTooltip:Hide()
end
-- ============================================================================
-- ==== BLIZZARD-SOURCE COPIES -- AUDIT ON EVERY RETAIL PATCH =============
-- ============================================================================
--
-- Each function below carries a "COPY OF" header citing the Blizzard source
-- file, function name, line range, and the exact adaptation applied. To
-- audit on a patch day: open the cited Blizzard file, navigate to the line
-- range, diff against the PWM copy here, and mirror any change. Update the
-- "Source lines" header if a range shifted, and the "last audited" date in
-- the top-of-section banner.
-- ----------------------------------------------------------------------------
-- COPY OF: Blizzard_FrameXMLUtil/AreaPoiUtil.lua :: AreaPoiUtil.TryShowTooltip
-- Source lines: 3-72
-- Adaptation: `local tooltip = GetAppropriateTooltip()` -> PWMTooltip.
-- ----------------------------------------------------------------------------
local function PWM_AreaPoiUtil_TryShowTooltip(region, anchor, poiInfo, customFn)
local hasDescription = poiInfo.description and poiInfo.description ~= ""
local isTimed, hideTimer = C_AreaPoiInfo.IsAreaPOITimed(poiInfo.areaPoiID)
local showTimer = not poiInfo.forceHideTimer and (poiInfo.secondsLeft or (isTimed and not hideTimer))
local hasWidgetSet = poiInfo.tooltipWidgetSet ~= nil
local hasTooltip = hasDescription or showTimer or hasWidgetSet
local addedTooltipLine = false
if hasTooltip then
local tooltip = PWMTooltip -- ADAPTED
local verticalPadding = nil
tooltip:SetOwner(region, anchor)
if region:HasDisplayName() then
GameTooltip_SetTitle(tooltip, region:GetDisplayName(), HIGHLIGHT_FONT_COLOR)
addedTooltipLine = true
end
if hasDescription then
GameTooltip_AddNormalLine(tooltip, poiInfo.description)
addedTooltipLine = true
end
if showTimer then
local secondsLeft = poiInfo.secondsLeft or C_AreaPoiInfo.GetAreaPOISecondsLeft(poiInfo.areaPoiID)
if secondsLeft and secondsLeft > 0 then
local timeString = SecondsToTime(secondsLeft)
timeString = HIGHLIGHT_FONT_COLOR:WrapTextInColorCode(timeString)
GameTooltip_AddNormalLine(tooltip, MAP_TOOLTIP_TIME_LEFT:format(timeString))
addedTooltipLine = true
end
end
if poiInfo.textureKit == "OribosGreatVault" then
GameTooltip_AddBlankLineToTooltip(tooltip)
GameTooltip_AddInstructionLine(tooltip, ORIBOS_GREAT_VAULT_POI_TOOLTIP_INSTRUCTIONS, false)
addedTooltipLine = true
end
if hasWidgetSet then
local overflow = GameTooltip_AddWidgetSet(tooltip, poiInfo.tooltipWidgetSet, addedTooltipLine and poiInfo.addPaddingAboveTooltipWidgets and 10)
if overflow then
verticalPadding = -overflow
end
end
if poiInfo.textureKit then
local backdropStyle = GAME_TOOLTIP_TEXTUREKIT_BACKDROP_STYLES[poiInfo.textureKit]
if (backdropStyle) then
SharedTooltip_SetBackdropStyle(tooltip, backdropStyle)
end
end
if customFn then
customFn(tooltip)
end
tooltip:Show()
-- need to set padding after Show or else there will be a flicker
if verticalPadding then
tooltip:SetPadding(0, verticalPadding)
end
return true
end
return false
end
-- ----------------------------------------------------------------------------
-- COPY OF: Blizzard_GameTooltip/Mainline/GameTooltip.lua :: AddFloorLocationLine
-- Source lines: 633-639 (file-local helper used by GameTooltip_AddQuest)
-- Adaptation: none -- already parameterized -- but we duplicate the body
-- because Blizzard's version is `local` and unreachable from outside.
-- ----------------------------------------------------------------------------
local function PWM_AddFloorLocationLine(tooltip, floorLocation, aboveString, belowString)
if floorLocation == Enum.QuestLineFloorLocation.Below then
tooltip:AddLine(belowString, 0.5, 0.5, 0.5, true)
elseif floorLocation == Enum.QuestLineFloorLocation.Above then
tooltip:AddLine(aboveString, 0.5, 0.5, 0.5, true)
end
end
-- ----------------------------------------------------------------------------
-- COPY OF: Blizzard_GameTooltip/Mainline/GameTooltip.lua :: GameTooltip_AddQuest
-- Source lines: 641-759
-- Adaptation: every reference to the `GameTooltip` global rewritten to the
-- local `tooltip = PWMTooltip`. The function's `self` argument still refers
-- to the PIN, as in Blizzard's source.
-- ----------------------------------------------------------------------------
local function PWM_GameTooltip_AddQuest(self)
local tooltip = PWMTooltip -- ADAPTED
local questID = self.questID
if not HaveQuestData(questID) then
GameTooltip_SetTitle(tooltip, RETRIEVING_DATA, RED_FONT_COLOR)
GameTooltip_SetTooltipWaitingForData(tooltip, true)
tooltip:Show()
return
end
local widgetSetAdded = false
local widgetSetID = C_TaskQuest.GetQuestUIWidgetSetByType(questID, Enum.MapIconUIWidgetSetType.Tooltip)
local isThreat = C_QuestLog.IsThreatQuest(questID)
local title, factionID, capped = C_TaskQuest.GetQuestInfoByQuestID(questID)
title = title or self.questName
if self.worldQuest or C_QuestLog.IsWorldQuest(questID) then
self.worldQuest = true
local tagInfo = C_QuestLog.GetQuestTagInfo(self.questID)
local quality = tagInfo and tagInfo.quality or Enum.WorldQuestQuality.Common
local colorData = ColorManager.GetColorDataForWorldQuestQuality(quality)
if colorData then
GameTooltip_SetTitle(tooltip, title, colorData.color)
else
GameTooltip_SetTitle(tooltip, title)
end
if C_QuestLog.IsAccountQuest(questID) then
GameTooltip_AddColoredLine(tooltip, ACCOUNT_QUEST_LABEL, ACCOUNT_WIDE_FONT_COLOR)
end
QuestUtils_AddQuestTypeToTooltip(tooltip, questID, NORMAL_FONT_COLOR)
local factionData = factionID and C_Reputation.GetFactionDataByID(factionID)
if factionData then
local questAwardsReputationWithFaction = C_QuestLog.DoesQuestAwardReputationWithFaction(questID, factionID)
local reputationYieldsRewards = (not capped) or C_Reputation.IsFactionParagonForCurrentPlayer(factionID)
if questAwardsReputationWithFaction and reputationYieldsRewards then
tooltip:AddLine(factionData.name)
else
tooltip:AddLine(factionData.name, GRAY_FONT_COLOR:GetRGB())
end
end
GameTooltip_AddQuestTimeToTooltip(tooltip, questID)
elseif isThreat then
GameTooltip_SetTitle(tooltip, title)
GameTooltip_AddQuestTimeToTooltip(tooltip, questID)
else
GameTooltip_SetTitle(tooltip, title, NORMAL_FONT_COLOR)
end
if self.isCombatAllyQuest or (C_QuestLog.GetQuestType(questID) == Enum.QuestTag.CombatAlly) then
GameTooltip_AddColoredLine(tooltip, AVAILABLE_FOLLOWER_QUEST, HIGHLIGHT_FONT_COLOR, true)
GameTooltip_AddColoredLine(tooltip, GRANTS_FOLLOWER_XP, GREEN_FONT_COLOR, true)
elseif self.isQuestStart then
GameTooltip_AddColoredLine(tooltip, AVAILABLE_QUEST, HIGHLIGHT_FONT_COLOR, true)
PWM_AddFloorLocationLine(tooltip, self.floorLocation, QUESTLINE_LOCATED_ABOVE, QUESTLINE_LOCATED_BELOW)
else
local questDescription = ""
local questCompleted = C_QuestLog.IsComplete(questID)
if questCompleted and self.shouldShowObjectivesAsStatusBar then
questDescription = QUEST_WATCH_QUEST_READY
GameTooltip_AddColoredLine(tooltip, QUEST_DASH .. questDescription, HIGHLIGHT_FONT_COLOR)
elseif not questCompleted and self.shouldShowObjectivesAsStatusBar then
local questLogIndex = C_QuestLog.GetLogIndexForQuestID(questID)
if questLogIndex then
questDescription = select(2, GetQuestLogQuestText(questLogIndex))
GameTooltip_AddColoredLine(tooltip, QUEST_DASH .. questDescription, HIGHLIGHT_FONT_COLOR)
end
end
local numObjectives = self.numbObjectives or C_QuestLog.GetNumQuestObjectives(questID)
for objectiveIndex = 1, numObjectives do
local objectiveText, objectiveType, finished, numFulfilled, numRequired = GetQuestObjectiveInfo(questID, objectiveIndex, false)
local showObjective = not (finished and isThreat)
if showObjective then
if self.shouldShowObjectivesAsStatusBar then
local percent = math.floor((numFulfilled / numRequired) * 100)
GameTooltip_ShowProgressBar(tooltip, 0, numRequired, numFulfilled, PERCENTAGE_STRING:format(percent))
elseif objectiveText and (#objectiveText > 0) then
local color = finished and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR
tooltip:AddLine(QUEST_DASH .. objectiveText, color.r, color.g, color.b, true)
end
end
end
local objectiveText, objectiveType, finished, numFulfilled, numRequired = GetQuestObjectiveInfo(questID, 1, false)
if objectiveType == "progressbar" then
local percent = C_TaskQuest.GetQuestProgressBarInfo(questID)
local showObjective = not (finished and isThreat)
if percent and showObjective then
GameTooltip_ShowProgressBar(tooltip, 0, 100, percent, PERCENTAGE_STRING:format(percent))
end
end
if widgetSetID then
widgetSetAdded = true
GameTooltip_AddWidgetSet(tooltip, widgetSetID)
end
GameTooltip_AddQuestRewardsToTooltip(tooltip, questID, self.questRewardTooltipStyle or TOOLTIP_QUEST_REWARDS_STYLE_DEFAULT)
if self.worldQuest and C_TooltipInfo.GM then
local tooltipData = C_TooltipInfo.GM.GetDebugWorldQuestInfo(questID)
if tooltipData then
local tooltipInfo = { tooltipData = tooltipData, append = true }
tooltip:ProcessInfo(tooltipInfo)
tooltip:Show()
end
end
end
if not widgetSetAdded and widgetSetID then
GameTooltip_AddWidgetSet(tooltip, widgetSetID)
end
tooltip:Show()
end
-- ----------------------------------------------------------------------------
-- COPY OF: Blizzard_UIPanels_Game/Mainline/WorldMapFrame.lua :: TaskPOI_OnEnter
-- Source lines: 167-187
-- Adaptation: GameTooltip -> local tooltip = PWMTooltip;
-- GameTooltip_AddQuest -> PWM_GameTooltip_AddQuest. The calling-quest
-- branch still delegates to Blizzard's CallingPOI_OnEnter (calling quests
-- are rare and that path uses the canonical GameTooltip).
-- ----------------------------------------------------------------------------
local function PWM_TaskPOI_OnEnter(self, skipSetOwner)
local tooltip = PWMTooltip -- ADAPTED
if not skipSetOwner then
tooltip:SetOwner(self, "ANCHOR_RIGHT")
end
if not HaveQuestData(self.questID) then
GameTooltip_SetTitle(tooltip, RETRIEVING_DATA, RED_FONT_COLOR)
GameTooltip_SetTooltipWaitingForData(tooltip, true)
tooltip:Show()
return
end
if C_QuestLog.IsQuestCalling(self.questID) then
CallingPOI_OnEnter(self) -- UNADAPTED: writes to global GameTooltip; rare path
return
end
PWM_GameTooltip_AddQuest(self)
EventRegistry:TriggerEvent("TaskPOI.TooltipShown", self, self.questID, self)
self:OnLegendPinMouseEnter()
end
-- ----------------------------------------------------------------------------
-- COPY OF: AreaPOIDataProvider.lua :: AreaPOIPinMixin:OnMouseEnter
-- Source lines: 159-181
-- Adaptation:
-- * self:TryShowTooltip() -> PWM_AreaPoiUtil_TryShowTooltip(self, ...)
-- * self.UpdateTooltip points at OUR handler so timer-driven refreshes
-- also use PWMTooltip.
-- This handler also serves the templates whose OnMouseEnter is (or
-- delegates to) AreaPOIPinMixin's. Per-instance replacement catches them