Skip to content

Commit

Permalink
Fix compatibility issue with the new accessibility feature which is a…
Browse files Browse the repository at this point in the history
…llowing interaction with objects using nameplates.

UnitReaction returns nil on those 'GameObject' instead of a number...

LNR will treat those objects as NEUTRAL

https://news.blizzard.com/en-gb/world-of-warcraft/23876525/accessibility-updates-in-dragonflight
  • Loading branch information
2072 committed Dec 13, 2022
1 parent b3a08a7 commit 54749fe
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions LibNameplateRegistry-1.0/LibNameplateRegistry-1.0.lua
Expand Up @@ -43,7 +43,7 @@ This file was last updated on @file-date-iso@ by @file-author@
--
-- Library framework {{{
local MAJOR, MINOR = "LibNameplateRegistry-1.0", 19
local MAJOR, MINOR = "LibNameplateRegistry-1.0", 20
-- used to be set using debug packager tags but they've been broken ever since the new wowace.com...
-- see: https://www.curseforge.com/forums/wow-sites/wow-sites-feedback/185461-curse-keyword-substitution-not-applied-for
Expand Down Expand Up @@ -343,7 +343,16 @@ function LNR_Private.RawGetPlateType (frame)
local unitToken = LNR_Private:GetUnitTokenFromPlate(frame);
local reaction = UnitReaction('player', unitToken);
-- a recent accessibility update is using nameplates to display interaction
-- icons over GameObject on which UnitReaction returns nil.
-- In such case, return a number that will be interpreted as neutral
local reaction = UnitReaction('player', unitToken) or 3;
--@debug@
if DEBUG then
Debug(INFO, 'RawGetPlateType - unitToken:', unitToken, 'reaction:', UnitReaction('player', unitToken), 'final reaction:', reaction);
end
--@end-debug@
if reaction > 4 then
reaction = 'FRIENDLY';
Expand All @@ -354,7 +363,7 @@ function LNR_Private.RawGetPlateType (frame)
end
--TODO check if tapped state is still detectable in some ways (API removed in 7.0.3)
local unitType = UnitPlayerControlled(LNR_Private:GetUnitTokenFromPlate(frame)) and 'PLAYER' or 'NPC';
local unitType = UnitPlayerControlled(unitToken) and 'PLAYER' or 'NPC';
return reaction, unitType;
Expand Down

0 comments on commit 54749fe

Please sign in to comment.