Dominos

Dominos

19M Downloads

Reputation Bar (Dominos_XP/xp.lua) patch to handle Friendship reputation

b-morgan opened this issue ยท 2 comments

commented

The following patch to Dominos_XP/xp.lua will handle friendship reputations properly.

@@ -292,7 +292,18 @@
 end

 function XP:UpdateReputation()
-   local name, reaction, min, max, value = GetWatchedFactionInfo()
+   local friendID, friendRep, friendMaxRep, friendName, friendText, friendTexture, friendTextLevel, friendThreshold, nextFriendThreshold
+   local name, reaction, min, max, value, factionID = GetWatchedFactionInfo()
+   friendID = GetFriendshipReputation(factionID);
+   if ( friendID ) then
+       friendID, friendRep, friendMaxRep, friendName, friendText, friendTexture, friendTextLevel, friendThreshold, nextFriendThreshold = GetFriendshipReputation(factionID);
+       if ( nextFriendThreshold ) then
+           min, max, value = friendThreshold, nextFriendThreshold, friendRep;
+       else
+           -- max rank, make it look like a full bar
+           min, max, value = 0, 1, 1;
+       end
+   end
    max = max - min
    value = value - min

@@ -309,8 +320,11 @@
    textEnv.repMax = max
    textEnv.tnl = max - value
    textEnv.pct = round(value / max * 100)
-   textEnv.repLevel = _G['FACTION_STANDING_LABEL' .. reaction]
-
+   if ( friendID ) then
+       textEnv.repLevel = friendTextLevel
+   else
+       textEnv.repLevel = _G['FACTION_STANDING_LABEL' .. reaction]
+   end
    local getRepText = assert(loadstring(self:GetRepFormat(), "getRepText"))
    setfenv(getRepText, textEnv)
    self.text:SetText(getRepText())

commented

Thanks, I've merged the changes into the 5.4 version.

commented

The lines "max = max - min" and "value = value - min" after line 300 in the 5.4.0 beta are missing.