@@ -3,20 +3,21 @@ local L = LibStub('AceLocale-3.0'):GetLocale(addonName)
33
44local FACTION_STANDING_LABEL_CUSTOM = {}
55local FACTION_BAR_COLORS_CUSTOM = {
6- [1 ] = {r = 152 , g = 32 , b = 32 },
7- [2 ] = {r = 222 , g = 0 , b = 10 },
8- [3 ] = {r = 209 , g = 102 , b = 33 },
9- [4 ] = {r = 222 , g = 255 , b = 10 },
10- [5 ] = {r = 7 , g = 255 , b = 13 },
11- [6 ] = {r = 10 , g = 222 , b = 136 },
12- [7 ] = {r = 18 , g = 224 , b = 204 },
13- [8 ] = {r = 5 , g = 255 , b = 189 },
6+ [1 ] = { r = 152 , g = 32 , b = 32 },
7+ [2 ] = { r = 222 , g = 0 , b = 10 },
8+ [3 ] = { r = 209 , g = 102 , b = 33 },
9+ [4 ] = { r = 222 , g = 255 , b = 10 },
10+ [5 ] = { r = 7 , g = 255 , b = 13 },
11+ [6 ] = { r = 10 , g = 222 , b = 136 },
12+ [7 ] = { r = 18 , g = 224 , b = 204 },
13+ [8 ] = { r = 5 , g = 255 , b = 189 },
1414}
1515do
1616 for standingID , color in pairs (FACTION_BAR_COLORS ) do
17- FACTION_BAR_COLORS_CUSTOM [standingID ] = FACTION_BAR_COLORS_CUSTOM [standingID ] or {r = color .r * 256 , g = color .g * 256 , b = color .b * 256 }
17+ FACTION_BAR_COLORS_CUSTOM [standingID ] = FACTION_BAR_COLORS_CUSTOM [standingID ] or
18+ { r = color .r * 256 , g = color .g * 256 , b = color .b * 256 }
1819 end
19- FACTION_BAR_COLORS_CUSTOM [9 ] = {r = 16 , g = 165 , b = 202 }
20+ FACTION_BAR_COLORS_CUSTOM [9 ] = { r = 16 , g = 165 , b = 202 }
2021
2122 for i = 1 , 8 do
2223 FACTION_STANDING_LABEL_CUSTOM [i ] = GetText (' FACTION_STANDING_LABEL' .. i )
@@ -234,7 +235,7 @@ local labelRows = {
234235 key = 2590 ,
235236 group = ' reputation' ,
236237 version = WOW_PROJECT_MAINLINE
237- },
238+ },
238239 hallowfall_arathi = {
239240 label = function ()
240241 return PermoksAccountManager .factions [2570 ].localName or ' Hallowfall Arathi'
@@ -244,7 +245,7 @@ local labelRows = {
244245 key = 2570 ,
245246 group = ' reputation' ,
246247 version = WOW_PROJECT_MAINLINE
247- },
248+ },
248249 the_assembly_of_the_deeps = {
249250 label = function ()
250251 return PermoksAccountManager .factions [2594 ].localName or ' The Assembly of the Deeps'
@@ -254,7 +255,7 @@ local labelRows = {
254255 key = 2594 ,
255256 group = ' reputation' ,
256257 version = WOW_PROJECT_MAINLINE
257- },
258+ },
258259 the_severed_threads = {
259260 label = function ()
260261 return PermoksAccountManager .factions [2600 ].localName or ' The Severed Threads'
@@ -264,7 +265,7 @@ local labelRows = {
264265 key = 2600 ,
265266 group = ' reputation' ,
266267 version = WOW_PROJECT_MAINLINE
267- },
268+ },
268269 the_general = {
269270 label = function ()
270271 return PermoksAccountManager .factions [2605 ].localName or ' The General'
@@ -274,7 +275,7 @@ local labelRows = {
274275 key = 2605 ,
275276 group = ' reputation' ,
276277 version = WOW_PROJECT_MAINLINE
277- },
278+ },
278279 the_vizier = {
279280 label = function ()
280281 return PermoksAccountManager .factions [2607 ].localName or ' The Vizier'
@@ -284,7 +285,7 @@ local labelRows = {
284285 key = 2607 ,
285286 group = ' reputation' ,
286287 version = WOW_PROJECT_MAINLINE
287- },
288+ },
288289 the_weaver = {
289290 label = function ()
290291 return PermoksAccountManager .factions [2601 ].localName or ' The Weaver'
@@ -294,7 +295,7 @@ local labelRows = {
294295 key = 2601 ,
295296 group = ' reputation' ,
296297 version = WOW_PROJECT_MAINLINE
297- },
298+ },
298299 brann_bronzebeard = {
299300 label = function ()
300301 return PermoksAccountManager .factions [2640 ].localName or ' Brann Bronzebeard'
@@ -559,7 +560,7 @@ local labelRows = {
559560 version = WOW_PROJECT_CATACLYSM_CLASSIC ,
560561 group = ' reputation'
561562 },
562- the_ashen_verdict = {
563+ the_ashen_verdict = {
563564 label = function ()
564565 local factionInfo = PermoksAccountManager .factions [1156 ]
565566 return factionInfo .localName or factionInfo .name
@@ -705,20 +706,22 @@ local friendshipStandings = {
705706local GetFriendshipReputation = C_GossipInfo and C_GossipInfo .GetFriendshipReputation or GetFriendshipReputation
706707-- TODO: Rework after DF launch
707708local function GetFactionOrFriendshipInfo (factionId , factionType )
708- local hasReward , renown
709- local name , _ , standing , barMin , barMax , barValue
709+ local barMin , barMax , barValue = 0 , 0 , 0
710+ local hasReward , renown , name , _ , standing
710711 if C_Reputation and C_Reputation .GetFactionDataByID then
711712 local factionData = C_Reputation .GetFactionDataByID (factionId )
712- name = factionData .name
713- standing = factionData .reaction
714- barMin = factionData .currentReactionThreshold
715- barMax = factionData .nextReactionThreshold
716- barValue = factionData .currentStanding
717- else
713+ if factionData then
714+ name = factionData .name
715+ standing = factionData .reaction
716+ barMin = factionData .currentReactionThreshold
717+ barMax = factionData .nextReactionThreshold
718+ barValue = factionData .currentStanding
719+ end
720+ else
718721 name , _ , standing , barMin , barMax , barValue = GetFactionInfoByID (factionId )
719722 end
720723 local isParagon = C_Reputation .IsFactionParagon and C_Reputation .IsFactionParagon (factionId )
721-
724+
722725 if isParagon then
723726 barValue , barMax , _ , hasReward = C_Reputation .GetFactionParagonInfo (factionId )
724727 barMin , standing , barValue = 0 , 9 , barValue % barMax
@@ -748,7 +751,6 @@ local function GetFactionOrFriendshipInfo(factionId, factionType)
748751end
749752
750753local function UpdateFaction (factionTable , factionId , standing , current , maximum , info , hasReward , renown )
751-
752754 factionTable [factionId ] = factionTable [factionId ] or {}
753755 local faction = factionTable [factionId ]
754756 faction .standing = standing
@@ -808,7 +810,7 @@ local function convertStanding(standing)
808810 if friendshipStandings [standing ] then
809811 return friendshipStandings [standing ]
810812 else
811- return standing :sub (1 ,1 )
813+ return standing :sub (1 , 1 )
812814 end
813815end
814816
@@ -832,10 +834,14 @@ function PermoksAccountManager:CreateFactionString(factionInfo)
832834 standing = factionInfo .standing
833835 end
834836
835- local color = factionInfo .hasReward and ' ff00ff00' or CreateColor (standingColor .r / 255 , standingColor .g / 255 , standingColor .b / 255 ):GenerateHexColor ()
837+ local color = factionInfo .hasReward and ' ff00ff00' or
838+ CreateColor (standingColor .r / 255 , standingColor .g / 255 , standingColor .b / 255 ):GenerateHexColor ()
836839 if factionInfo .renown then
837- return string.format (' %s - %s /%s' , BLUE_FONT_COLOR :WrapTextInColorCode (factionInfo .renown ), AbbreviateNumbers (factionInfo .current or 0 ), AbbreviateNumbers (factionInfo .max or 0 ))
840+ return string.format (' %s - %s /%s' , BLUE_FONT_COLOR :WrapTextInColorCode (factionInfo .renown ),
841+ AbbreviateNumbers (factionInfo .current or 0 ), AbbreviateNumbers (factionInfo .max or 0 ))
838842 elseif factionInfo .max then
839- return string.format (' |c%s%s|r/%s |cff%02X%02X%02X%s|r' , color , AbbreviateLargeNumbers (factionInfo .current or 0 ), AbbreviateNumbers (factionInfo .max or 0 ), standingColor .r , standingColor .g , standingColor .b , convertStanding (standing ))
843+ return string.format (' |c%s%s|r/%s |cff%02X%02X%02X%s|r' , color , AbbreviateLargeNumbers (factionInfo .current or 0 ),
844+ AbbreviateNumbers (factionInfo .max or 0 ), standingColor .r , standingColor .g , standingColor .b ,
845+ convertStanding (standing ))
840846 end
841847end
0 commit comments