diff --git a/WeakAuras/Compatibility.lua b/WeakAuras/Compatibility.lua index ca1ef862c9..2eeb3decb4 100644 --- a/WeakAuras/Compatibility.lua +++ b/WeakAuras/Compatibility.lua @@ -81,6 +81,19 @@ Private.ExecEnv.GetFactionDataByID = C_Reputation.GetFactionDataByID or function isAccountWide = nil } end + +-- GetWatchedFactionData behaves differentlly, but we only need the Id, so do a trival wrapper +if C_Reputation.GetWatchedFactionData then + Private.ExecEnv.GetWatchedFactionId = function() + local data = C_Reputation.GetWatchedFactionData() + return data and data.factionID or nil + end +else + Private.ExecEnv.GetWatchedFactionId = function() + return select(6, GetWatchedFactionInfo()) + end +end + Private.ExecEnv.ExpandFactionHeader = C_Reputation.ExpandFactionHeader or ExpandFactionHeader Private.ExecEnv.CollapseFactionHeader = C_Reputation.CollapseFactionHeader or CollapseFactionHeader Private.ExecEnv.AreLegacyReputationsShown = C_Reputation.AreLegacyReputationsShown or function() return true end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index c975c4e4a1..8243bcb7c1 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -2549,7 +2549,7 @@ Private.event_prototypes = { init = function(trigger) local ret = [=[ local useWatched = %s - local factionID = useWatched and select(6, GetWatchedFactionInfo()) or %q + local factionID = useWatched and Private.ExecEnv.GetWatchedFactionId() or %q local minValue, maxValue, currentValue local factionData = Private.ExecEnv.GetFactionDataByID(factionID) local name, description = factionData.name, factionData.description