Skip to content

Commit

Permalink
LuaTexts: Force update reputation texts using old APIs
Browse files Browse the repository at this point in the history
Fixes WA-1444
  • Loading branch information
nebularg committed Aug 15, 2024
1 parent e19d31f commit ab38b7a
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions Modules/LuaTexts/LuaTexts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -780,30 +780,6 @@ end

-- update pre-mop/pre-dragonflight default rep text for friendships
local function fix_rep_std_text()
local OLD_CODE1 = [[
local name,_,min,max,value = GetWatchedFactionInfo()
if IsMouseOver() then
return name or ConfigMode()
else
local bar_cur,bar_max = value-min,max-min
return "%d/%d (%s%%)",bar_cur,bar_max,Percent(bar_cur,bar_max)
end]]
local OLD_CODE2 = [[
local name, _, min, max, value, id = GetWatchedFactionInfo()
if IsMouseOver() then
return name or ConfigMode()
else
local fs_id, fs_rep, _, _, _, _, _, fs_threshold, next_fs_threshold = GetFriendshipReputation(id)
if fs_id then
if next_fs_threshold then
min, max, value = fs_threshold, next_fs_threshold, fs_rep
else
min, max, value = 0, 1, 1
end
end
local bar_cur,bar_max = value-min,max-min
return "%d/%d (%s%%)",bar_cur,bar_max,Percent(bar_cur,bar_max)
end]]
local sv = PitBull4.db:GetNamespace("LuaTexts").profiles
for _, profile in next, sv do
local layouts = profile.layouts
Expand All @@ -812,7 +788,7 @@ end]]
local elements = layout.elements
if elements then
for _, text in next, elements do
if text.code == OLD_CODE1 or text.code == OLD_CODE2 then
if text.code:find("GetWatchedFactionInfo", nil, true) or text.code:find("GetFriendshipReputation", nil, true) then
text.code = PROVIDED_CODES[L["Reputation"]][L["Standard"]].code
end
end
Expand Down

0 comments on commit ab38b7a

Please sign in to comment.