-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtaintPrevent.lua
More file actions
1431 lines (1244 loc) · 63.9 KB
/
Copy pathtaintPrevent.lua
File metadata and controls
1431 lines (1244 loc) · 63.9 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) PerformEmote / CancelEmote guards
-- In PvP instances, the WorldMap "READ" emote becomes a protected
-- call and trips ADDON_ACTION_FORBIDDEN once mapID is tainted.
-- Wrap the two API functions to skip the emote in PvP.
--
-- (3) Reading-emote opt-out
-- OnShow hook that cancels the emote when the user has disabled it.
--
-- (4) Combat-end refresh
-- Declares Addon.reloadAfterCombat (set by section 5'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).
--
-- (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.
--
-- ============================================================================
-- ============================================================================
-- ============================================================================
-- Locals
-- ============================================================================
local InCombatLockdown = _G.InCombatLockdown
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) Prevent PerformEmote/CancelEmote taint in PvP instances
-- ============================================================================
--
-- WorldMapMixin:OnShow calls C_ChatInfo.PerformEmote("READ", nil, true) and
-- :OnHide calls C_ChatInfo.CancelEmote(). Both are protected in PvP
-- instances. Because our addon taints WorldMapFrame.mapID, Blizzard's OnShow
-- reads the tainted value and the call to PerformEmote runs in insecure
-- execution -- triggering ADDON_ACTION_FORBIDDEN in PvP.
--
-- Fix: wrap both API functions to skip the "READ" emote in PvP instances.
-- We avoid SetScript on OnShow itself because that would make all of OnShow
-- addon-originated, causing MoneyFrame "secret number" errors downstream.
--
do
local function IsInPvPInstance()
local isInstance, instanceType = IsInInstance()
return isInstance and instanceType == "pvp"
end
local origPerformEmote = C_ChatInfo.PerformEmote
C_ChatInfo.PerformEmote = function(emote, ...)
if IsInPvPInstance() and emote == "READ" then return end
return origPerformEmote(emote, ...)
end
local origCancelEmote = C_ChatInfo.CancelEmote
C_ChatInfo.CancelEmote = function(...)
if IsInPvPInstance() then return end
return origCancelEmote(...)
end
end
-- ============================================================================
-- (3) Reading-emote opt-out
-- ============================================================================
--
-- Outside PvP, cancel the reading emote when the user has it disabled.
-- HookScript (not SetScript) so the OnShow handler stays Blizzard-originated.
--
WorldMapFrame:HookScript("OnShow", function(self)
if not PWM_config.showReadingEmote then
C_ChatInfo.CancelEmote()
end
end)
-- ============================================================================
-- (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 main.lua / restoreAndReset.lua also set it (for
-- their own deferred-refresh paths).
--
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-06-08 vs Midnight 12.0.5) ==
-- == ==
-- == Blizzard_FrameXMLUtil/AreaPoiUtil.lua ==
-- == AreaPoiUtil.TryShowTooltip lines 3-72 ==
-- == ==
-- == Blizzard_GameTooltip/Mainline/GameTooltip.lua ==
-- == (local) AddFloorLocationLine lines 619-625 ==
-- == GameTooltip_AddQuest lines 627-745 ==
-- == ==
-- == Blizzard_UIPanels_Game/Mainline/WorldMapFrame.lua ==
-- == TaskPOI_OnEnter lines 159-179 ==
-- == ==
-- == 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.) ==
-- == ==
-- == 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 869-872 ==
-- == (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 ==
-- == ==
-- == 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 ==
-- == ==
-- == Blizzard_SharedMapDataProviders/QuestBlobDataProvider.lua ==
-- == QuestBlobPinMixin:UpdateTooltip lines 182-229 ==
-- == QuestBlobPinMixin:OnMouseEnter lines 231-233 ==
-- == ==
-- == 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 ==
-- == ==
-- == Greps for risky-builder CALL SITES alone misses templates that ==
-- == reach those builders by inheritance / delegation rather than by a ==
-- == literal call in their own .lua file. Three queries together cover ==
-- == the full surface (run all three against the Blizzard_SharedMap- ==
-- == DataProviders folder, and check the FlightMap/QuestMap folders too): ==
-- == ==
-- == (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" ==
-- == 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. ==
-- == ==
-- == 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.
-- (WorldQuest, Vignette, and AreaPOI need extra cleanup -- they have their
-- own handlers 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: 619-625 (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: 627-745
-- 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: 159-179
-- 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
-- all because we install on pin.OnMouseEnter directly:
-- * AreaPOIPinTemplate -- direct match
-- * AreaPOIEventPinTemplate -- mixin delegates via live lookup
-- (AreaPOIEventDataProvider.lua:76)
-- * DelveEntrancePinTemplate -- AreaPOIPinMixin:CreateSubPin
-- (DelveEntranceDataProvider.lua:42)
-- * QuestHubPinTemplate -- XML inherits AreaPOIPinTemplate;
-- its mixin's OnMouseEnter delegates
-- to AreaPOIPinMixin.OnMouseEnter
-- (QuestOfferDataProvider.lua:869-872)
-- and additionally calls
-- self:AcknowledgeGlow() -- preserved
-- by the QuestHub branch in
-- PatchPinForCustomTooltip below.
-- ----------------------------------------------------------------------------
local function PWM_AreaPOIPin_OnMouseEnter(self)
DebugLog("AreaPOI hover: areaPoiID=%s pinTemplate=%s",
tostring(self.poiInfo and self.poiInfo.areaPoiID),
tostring(self.pinTemplate or "?"))
if not self:HasDisplayName() then
return
end
-- ADAPTED: was `self.UpdateTooltip = function() self:OnMouseEnter() end`
self.UpdateTooltip = function() PWM_AreaPOIPin_OnMouseEnter(self) end
local function customFn(tooltip) self:AddCustomTooltipData(tooltip) end
local tooltipShown = PWM_AreaPoiUtil_TryShowTooltip(self, "ANCHOR_RIGHT", self.poiInfo, customFn)
if not tooltipShown then
self:GetMap():TriggerEvent("SetAreaLabel", MAP_AREA_LABEL_TYPE.POI, self:GetDisplayName(), self.description)
end
EventRegistry:TriggerEvent("AreaPOIPin.MouseOver", self, tooltipShown, self.poiInfo.areaPoiID, self:GetDisplayName())
self:OnLegendPinMouseEnter()
if self.highlightWorldQuestsOnHover then
self:GetMap():TriggerEvent("HighlightMapPins.WorldQuests", self.pinHoverHighlightType)
end
if self.highlightVignettesOnHover then
self:GetMap():TriggerEvent("HighlightMapPins.Vignettes", self.pinHoverHighlightType)
end
end
-- AreaPOI OnMouseLeave intentionally has no module-level function: Blizzard's
-- source doesn't hide the tooltip there (it relies on GameTooltip's owner-
-- tracking), but our PWMTooltip needs an explicit hide AND we want to keep
-- forwarding to the per-pin original (which fires map TriggerEvents). The
-- per-instance closure is built inside PatchPinForCustomTooltip below.
-- ----------------------------------------------------------------------------
-- COPY OF: WorldQuestDataProvider.lua :: WorldQuestPinMixin:OnMouseEnter / :OnMouseLeave
-- Source lines: 420-424 (OnMouseEnter), 426-430 (OnMouseLeave)
-- Adaptation: TaskPOI_OnEnter -> PWM_TaskPOI_OnEnter; TaskPOI_OnLeave (which
-- does GameTooltip:Hide()) -> PWMTooltip:Hide(). The other two original
-- calls (POIButtonMixin.OnEnter/Leave, OnLegendPinMouseEnter/Leave) stay.
--
-- These handlers are ALSO REUSED for BonusObjective and ThreatObjective pin
-- templates. Per the audit checklist, BonusObjectivePinMixin:OnMouseEnter /
-- :OnMouseLeave (BonusObjectiveDataProvider.lua:162-172) have identical
-- structure to WorldQuest's, and ThreatObjectivePinMixin inherits from
-- BonusObjectivePinMixin via CreateFromMixins -- so the same PWM handlers
-- are correct for all three. When auditing, check that the three Blizzard
-- handlers remain structurally identical.
-- ----------------------------------------------------------------------------
local function PWM_WorldQuestPin_OnMouseEnter(self)
DebugLog("WorldQuest hover: questID=%s pinTemplate=%s",
tostring(self.questID), tostring(self.pinTemplate or "?"))
PWM_TaskPOI_OnEnter(self)
POIButtonMixin.OnEnter(self)
self:OnLegendPinMouseEnter()
end
local function PWM_WorldQuestPin_OnMouseLeave(self)
PWMTooltip:Hide()
POIButtonMixin.OnLeave(self)
self:OnLegendPinMouseLeave()
end
-- ----------------------------------------------------------------------------
-- COPY OF: QuestOfferDataProvider.lua :: QuestOfferPinMixin:OnMouseEnter
-- Source lines: 424-426 (OnMouseEnter; OnMouseLeave is just a TaskPOI_OnLeave
-- call which we replace with PWM_OnMouseLeave_HideOnly in the dispatch).
-- Adaptation: TaskPOI_OnEnter -> PWM_TaskPOI_OnEnter.
-- ----------------------------------------------------------------------------
local function PWM_QuestOfferPin_OnMouseEnter(self)
DebugLog("QuestOffer hover: questID=%s pinTemplate=%s",
tostring(self.questID), tostring(self.pinTemplate or "?"))
PWM_TaskPOI_OnEnter(self)
end
-- ----------------------------------------------------------------------------
-- COPY OF: InvasionDataProvider.lua :: InvasionPinMixin:OnMouseEnter
-- Source lines: 44-67 (OnMouseEnter; OnMouseLeave is one line and uses
-- PWM_OnMouseLeave_HideOnly via the dispatch).
-- Adaptation: GameTooltip -> local tooltip = PWMTooltip.
-- ----------------------------------------------------------------------------
local function PWM_InvasionPin_OnMouseEnter(self)
DebugLog("Invasion hover: invasionID=%s pinTemplate=%s",
tostring(self.invasionID), tostring(self.pinTemplate or "?"))
local tooltip = PWMTooltip -- ADAPTED
local invasionInfo = C_InvasionInfo.GetInvasionInfo(self.invasionID)
local timeLeftMinutes = C_InvasionInfo.GetInvasionTimeLeft(self.invasionID)
tooltip:SetOwner(self, "ANCHOR_RIGHT")
tooltip:SetText(invasionInfo.name, HIGHLIGHT_FONT_COLOR:GetRGB())
if timeLeftMinutes and timeLeftMinutes > 0 then
local timeString = SecondsToTime(timeLeftMinutes * 60)
tooltip:AddLine(BONUS_OBJECTIVE_TIME_LEFT:format(timeString), NORMAL_FONT_COLOR:GetRGB())
end
if invasionInfo.rewardQuestID then
if not HaveQuestData(invasionInfo.rewardQuestID) then
tooltip:AddLine(RETRIEVING_DATA, RED_FONT_COLOR:GetRGB())
GameTooltip_SetTooltipWaitingForData(tooltip, true)
else
GameTooltip_AddQuestRewardsToTooltip(tooltip, invasionInfo.rewardQuestID)
GameTooltip_SetTooltipWaitingForData(tooltip, false)
end
end
tooltip:Show()
end
-- ----------------------------------------------------------------------------
-- COPY OF: VignetteDataProvider.lua :: VignettePinBaseMixin:Display{Normal,PvpBounty,Torghast}Tooltip
-- Source lines: 494-514, 516-537, 539-542
-- Adaptation: instance methods turned into module-local functions taking
-- (pin, tooltip), so the caller controls which tooltip frame the build
-- happens on. Every `GameTooltip` reference -> the passed `tooltip` arg.
-- ----------------------------------------------------------------------------
local function PWM_Vignette_DisplayNormalTooltip(pin, tooltip)
local vignetteName = pin:GetVignetteName()
if vignetteName ~= "" then
GameTooltip_SetTitle(tooltip, vignetteName)
local groupSizeString = pin:GetRecommendedGroupSizeString()
if groupSizeString then
GameTooltip_AddInstructionLine(tooltip, groupSizeString)
end
local objectiveString = pin:GetObjectiveString()
if objectiveString then
local noWrap = false
GameTooltip_AddHighlightLine(tooltip, objectiveString, noWrap)
end
return true
end
return false
end
local function PWM_Vignette_DisplayPvpBountyTooltip(pin, tooltip)
local player = PlayerLocation:CreateFromGUID(pin:GetObjectGUID())
local class = select(3, C_PlayerInfo.GetClass(player))
local race = C_PlayerInfo.GetRace(player)
local name = C_PlayerInfo.GetName(player)
if race and class and name then
local classInfo = C_CreatureInfo.GetClassInfo(class)
local factionInfo = C_CreatureInfo.GetFactionInfo(race)
GameTooltip_SetTitle(tooltip, name, GetClassColorObj(classInfo.classFile))
GameTooltip_AddColoredLine(tooltip, factionInfo.name, GetFactionColor(factionInfo.groupTag))
local rewardQuestID = pin:GetRewardQuestID()
if rewardQuestID then
GameTooltip_AddQuestRewardsToTooltip(tooltip, pin:GetRewardQuestID(), TOOLTIP_QUEST_REWARDS_STYLE_PVP_BOUNTY)
end
return true
end
return false
end
local function PWM_Vignette_DisplayTorghastTooltip(pin, tooltip)
SharedTooltip_SetBackdropStyle(tooltip, GAME_TOOLTIP_BACKDROP_STYLE_RUNEFORGE_LEGENDARY)
return PWM_Vignette_DisplayNormalTooltip(pin, tooltip)
end
-- ----------------------------------------------------------------------------
-- COPY OF: VignetteDataProvider.lua :: VignettePinBaseMixin:OnMouseEnter / :OnMouseLeave
-- Source lines: 453-487 (OnMouseEnter), 489-492 (OnMouseLeave)
-- Adaptation: GameTooltip -> local tooltip = PWMTooltip; Display* methods
-- replaced with the PWM_Vignette_Display* helpers above.
-- Covers VignettePinMixin (CreateFromMixins(SuperTrackableVignettePinMixin,
-- VignettePinBaseMixin)), VignettePinPOIButtonMixin, and
-- FyrakkFlightVignettePinMixin via per-instance replacement at acquire time.
-- ----------------------------------------------------------------------------
local function PWM_VignettePin_OnMouseEnter(self)
DebugLog("Vignette hover: pinTemplate=%s vignetteGUID=%s",
tostring(self.pinTemplate or "?"),
tostring(self.vignetteGUID or "?"))
if self.hasTooltip then
local verticalPadding = nil
local tooltip = PWMTooltip -- ADAPTED
tooltip:SetOwner(self, "ANCHOR_RIGHT")
-- ADAPTED: was `self.UpdateTooltip = self.OnMouseEnter`. self.OnMouseEnter
-- has been replaced with this function via per-instance replacement, so
-- the original form would still resolve to us -- but be explicit.
self.UpdateTooltip = function() PWM_VignettePin_OnMouseEnter(self) end
local waitingForData, titleAdded = false, false
if self:GetVignetteType() == Enum.VignetteType.Normal or self:GetVignetteType() == Enum.VignetteType.Treasure then
titleAdded = PWM_Vignette_DisplayNormalTooltip(self, tooltip)
elseif self:GetVignetteType() == Enum.VignetteType.PvPBounty then
titleAdded = PWM_Vignette_DisplayPvpBountyTooltip(self, tooltip)
waitingForData = not titleAdded
elseif self:GetVignetteType() == Enum.VignetteType.Torghast then
titleAdded = PWM_Vignette_DisplayTorghastTooltip(self, tooltip)
end
if not waitingForData and self.tooltipWidgetSet then
local overflow = GameTooltip_AddWidgetSet(tooltip, self.tooltipWidgetSet, titleAdded and self.vignetteInfo.addPaddingAboveTooltipWidgets and 10)
if overflow then
verticalPadding = -overflow
end
elseif waitingForData then
GameTooltip_SetTitle(tooltip, RETRIEVING_DATA)
end
tooltip:Show()
if verticalPadding then
tooltip:SetPadding(0, verticalPadding)
end
end
self:OnLegendPinMouseEnter()
end
local function PWM_VignettePin_OnMouseLeave(self)
PWMTooltip:Hide()
self:OnLegendPinMouseLeave()
end
-- ----------------------------------------------------------------------------
-- COPY OF: QuestBlobDataProvider.lua :: QuestBlobPinMixin:UpdateTooltip / :OnMouseEnter
-- Source lines: 182-229 (UpdateTooltip), 231-233 (OnMouseEnter)
-- Adaptation: GameTooltip -> local tooltip = PWMTooltip;
-- TaskPOI_OnEnter -> PWM_TaskPOI_OnEnter;
-- GameTooltip:GetOwner() -> tooltip:GetOwner().
-- We also assign pin.UpdateTooltip to our PWM version in the dispatch so
-- other callers (cursor updates etc.) route through PWMTooltip too.
-- ----------------------------------------------------------------------------
local function PWM_QuestBlobPin_UpdateTooltip(self)
if POIButtonHighlightManager:HasHighlight() then
return
end
local mouseX, mouseY = self:GetMap():GetNormalizedCursorPosition()
local questID, numPOITooltips = self:UpdateMouseOverTooltip(mouseX, mouseY)
local questLogIndex = questID and C_QuestLog.GetLogIndexForQuestID(questID)
if not questLogIndex then
self:OnMouseLeave()
return
end
local tooltip = PWMTooltip -- ADAPTED
local tooltipOwner = tooltip:GetOwner() -- ADAPTED
if tooltipOwner and tooltipOwner ~= self then
return
end
tooltip:SetOwner(self, "ANCHOR_CURSOR_RIGHT", 5, 2)
local title = C_QuestLog.GetTitleForQuestID(questID)
local numObjectives = GetNumQuestLeaderBoards(questLogIndex)
if C_QuestLog.IsThreatQuest(questID) then
local skipSetOwner = true
PWM_TaskPOI_OnEnter(self, skipSetOwner) -- ADAPTED
return
end
tooltip:SetText(title)
QuestUtils_AddQuestTypeToTooltip(tooltip, questID, NORMAL_FONT_COLOR)
for i = 1, numObjectives do
local text, objectiveType, finished
if numPOITooltips == numObjectives then
local questPOIIndex = self:GetTooltipIndex(i)
text, objectiveType, finished = GetQuestPOILeaderBoard(questPOIIndex, questLogIndex)
else
text, objectiveType, finished = GetQuestLogLeaderBoard(i, questLogIndex)
end
if text and not finished then
tooltip:AddLine(QUEST_DASH .. text, 1, 1, 1, true)
end
end
tooltip:Show()
end
local function PWM_QuestBlobPin_OnMouseEnter(self)
DebugLog("QuestBlob hover: pinTemplate=%s",
tostring(self.pinTemplate or "?"))
PWM_QuestBlobPin_UpdateTooltip(self)
end
-- ============================================================================
-- ==== END OF BLIZZARD-SOURCE COPIES =======================================
-- ============================================================================
-- Per-instance handler installer. Called from the pool-acquire hook in
-- section (6), once per new pin instance. Dispatches on pinTemplate
-- (threaded down because pin.pinTemplate isn't assigned yet at our call
-- site -- AcquirePin sets it AFTER pool:Acquire returns).
--
-- This function ONLY updates the OnMouseEnter / OnMouseLeave TABLE FIELDS.
-- The script-binding side is handled by the caller in section (6) because
-- it differs between fresh and reused pins: on a fresh pin Blizzard binds
-- the script for us at Blizzard_MapCanvas.lua:283-284 (so we must NOT
-- SetScript here -- the :280 assert would trip); on a reused pin Blizzard
-- skips that block entirely and the caller does an explicit SetScript.
-- See the section (5) banner above for the full reasoning.