Skip to content

Commit

Permalink
Update GetWatchedFactionInfo to new API (#5242)
Browse files Browse the repository at this point in the history
Co-authored-by: Boneshock <jordi.spammail@gmail.com>
Co-authored-by: Infus <infus@squorn.de>
  • Loading branch information
3 people committed Jul 24, 2024
1 parent 064fae4 commit 1217799
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions WeakAuras/Compatibility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1217799

Please sign in to comment.