Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 4e24efe

Browse files
committed
Fix for some shadowlands reputations showing under "other"
1 parent e35bd1a commit 4e24efe

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

Objects/STATUSBTN.lua

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ end
391391
--- Creates a table containing provided data
392392
-- @param name, hasFriendStatus, standing, minrep, maxrep, value, colors
393393
-- @return reptable: Table containing provided data
394-
function STATUSBTN:SetRepWatch(ID, name, standing, header, minrep, maxrep, value, colors, headerOverride)
394+
function STATUSBTN:SetRepWatch(ID, name, standing, header, minrep, maxrep, value, colors)
395395
local reptable = {}
396396
reptable.ID = ID
397397
reptable.name = name
@@ -407,7 +407,6 @@ function STATUSBTN:SetRepWatch(ID, name, standing, header, minrep, maxrep, value
407407
reptable.r = colors.r
408408
reptable.g = colors.g
409409
reptable.b = colors.b
410-
reptable.headerOverride = headerOverride
411410

412411
return reptable
413412
end
@@ -438,8 +437,8 @@ function STATUSBTN:repstrings_Update(repGainedString)
438437

439438
for i=1, GetNumFactions() do
440439
local name, _, standingID, min, max, value, _, _, isHeader, _, hasRep, _, isChild, factionID = GetFactionInfo(i)
440+
441441
local colors = {}
442-
local headerOverride
443442

444443
if not standingID then --not sure if we will ever be in a position where standingID comes back as nil, but if so, protect for it.
445444
standingID = 0
@@ -453,17 +452,20 @@ function STATUSBTN:repstrings_Update(repGainedString)
453452

454453
if isHeader and not isChild then --set a header variable that will get set on each rep that follows until the next header is set
455454
header = name
455+
if header == "Guild" then --the "Guild" category is kinda stupid to just have alone, so we should override it with "Other"
456+
header = "Other"
457+
end
456458
end
457459

458460
if (not isHeader or hasRep) and not IsFactionInactive(i) then
459461

460-
local fID, standing, isParagon
462+
local friendID, standing, isParagon
461463
if not Neuron.isWoWClassic then --classic doesn't have Friendships or Paragon, carefull
462-
fID, _, _, _, _, _, standing, _, _ = GetFriendshipReputation(factionID)
464+
friendID, _, _, _, _, _, standing, _, _ = GetFriendshipReputation(factionID)
463465
isParagon = C_Reputation.IsFactionParagon(factionID)
464466
end
465467

466-
if not fID then --not a "Friendship" faction, i.e. Chromie or Brawlers Guild
468+
if not friendID then --not a "Friendship" faction, i.e. Chromie or Brawlers Guild
467469
if not isParagon then
468470
colors.r, colors.g, colors.b = BAR_REP_DATA[standingID].r, BAR_REP_DATA[standingID].g, BAR_REP_DATA[standingID].b
469471
standing = BAR_REP_DATA[standingID].l --convert numerical standingID to text i.e "Exalted" instead of 8
@@ -480,17 +482,16 @@ function STATUSBTN:repstrings_Update(repGainedString)
480482
end
481483
else --is a "Friendship" faction
482484
if string.find(name, "Brawl'gar Arena") or string.find(name, "Bizmo's Brawlpub") then
483-
colors.r, colors.g, colors.b = BAR_REP_DATA[standingID].r, BAR_REP_DATA[standingID].g, BAR_REP_DATA[standingID].b --offset by two, because friendships don't have "hated" or "hostile" ranks
485+
colors.r, colors.g, colors.b = BAR_REP_DATA[standingID].r, BAR_REP_DATA[standingID].g, BAR_REP_DATA[standingID].b
484486
else
485487
if standingID + 2 > 8 then
486488
standingID = 6
487489
end
488490
colors.r, colors.g, colors.b = BAR_REP_DATA[standingID+2].r, BAR_REP_DATA[standingID+2].g, BAR_REP_DATA[standingID+2].b --offset by two, because friendships don't have "hated" or "hostile" ranks
489491
end
490-
headerOverride = "Other"
491492
end
492493

493-
local repData = self:SetRepWatch(i, name, standing, header, min, max, value, colors, headerOverride)
494+
local repData = self:SetRepWatch(i, name, standing, header, min, max, value, colors)
494495

495496
--repGainedString is a phrase that reads like "Reputation with Zandalari Empire increased by 75.", except on login it's type boolean for some reason
496497
if repGainedString and type(repGainedString) ~= "boolean" and repGainedString:find(name) or self.data.autoWatch == i then --this line automatically assigns the most recently updated repData to RepWatch[0], and the "auto" option assigns RepWatch[0] to be shown
@@ -545,20 +546,10 @@ function STATUSBTN:repDropDown_Initialize() --Initialize the dropdown menu for c
545546

546547
for k,v in pairs(RepWatch) do --insert all factions and percentages into "data"
547548
if k > 0 then --skip the "0" entry which is our autowatch
548-
local header
549-
if v.headerOverride then
550-
header = v.headerOverride
551-
else
552-
header = v.header
553-
if v.header == "Guild" then --the "Guild" category is kinda stupid to just have alone, so we should override it with "Other"
554-
header = "Other"
555-
end
556-
end
557-
558-
if not repDataTable[header]then
559-
repDataTable[header] = {}
549+
if not repDataTable[v.header]then
550+
repDataTable[v.header] = {}
560551
end
561-
table.insert(repDataTable[header], { ID=v.ID, name=v.name, standing=v.standing, percent=v.percent, hex=v.hex})
552+
table.insert(repDataTable[v.header], { ID=v.ID, name=v.name, standing=v.standing, percent=v.percent, hex=v.hex})
562553
end
563554
end
564555

@@ -637,7 +628,19 @@ function STATUSBTN:repDropDown_Initialize() --Initialize the dropdown menu for c
637628
end--create a comparison table for our custom sort routine
638629

639630
--these are the English Strings. It would be good to get these translated
640-
local SORT_TABLE = {["Battle for Azeroth"]=1, ["Legion"]=2, ["Warlords of Draenor"]=3, ["Mists of Pandaria"]=4, ["Cataclysm"]=5, ["Wrath of the Lich King"]=6, ["The Burning Crusade"]=7, ["Classic"]=8, ["Guild"]=9, ["Other"]=10}
631+
local SORT_TABLE = {
632+
["Shadowlands"] = 1,
633+
["Battle for Azeroth"]=2,
634+
["Legion"]=3,
635+
["Warlords of Draenor"]=4,
636+
["Mists of Pandaria"]=5,
637+
["Cataclysm"]=6,
638+
["Wrath of the Lich King"]=7,
639+
["The Burning Crusade"]=8,
640+
["Classic"]=9,
641+
["Guild"]=10,
642+
["Other"]=11
643+
}
641644
--sort the list of our reputation brackets according the priority table above
642645
table.sort(innerMenu, function(a,b)
643646
if SORT_TABLE[a.text] and SORT_TABLE[b.text] then

0 commit comments

Comments
 (0)