@@ -420,6 +420,33 @@ function RepHub:GetFactionAdditionalInfo(factionName)
420
420
return factionAdditionalInfo
421
421
end
422
422
423
+ function RepHub :GetTopCharacter ()
424
+ local topCharacterTable , topCharacterName , topCharacterReputationsCount = {}, " " , 0
425
+ table .foreach (
426
+ self .db .global .reputationList ,
427
+ function (_ , factionData )
428
+ table .foreach (
429
+ factionData .standings ,
430
+ function (characterName , standing )
431
+ topCharacterTable [characterName ] = (topCharacterTable [characterName ] or 0 ) + 1
432
+ end
433
+ )
434
+ end
435
+ )
436
+
437
+ table .foreach (
438
+ topCharacterTable ,
439
+ function (characterName , reputationsCount )
440
+ if reputationsCount > topCharacterReputationsCount then
441
+ topCharacterName = characterName
442
+ topCharacterReputationsCount = reputationsCount
443
+ end
444
+ end
445
+ )
446
+
447
+ return topCharacterName , topCharacterReputationsCount
448
+ end
449
+
423
450
-- GUI
424
451
425
452
function RepHub :CreateRepHubFrame ()
@@ -464,7 +491,8 @@ function RepHub:CreateRepHubFrame()
464
491
-- Stats
465
492
local StatsLabel = AceGUI :Create (" Label" )
466
493
StatsLabel :SetFullWidth (true )
467
- StatsLabel :SetText (" Total reputations: " .. RepHub :GetTableLength (self .db .global .reputationList ) .. " | Total characters: " .. # self .db .global .characterNames )
494
+ local topCharacterName , topCharacterReputationsCount = RepHub :GetTopCharacter ()
495
+ StatsLabel :SetText (" Total reputations: " .. RepHub :GetTableLength (self .db .global .reputationList ) .. " | Total characters: " .. # self .db .global .characterNames .. " | Top character: " .. topCharacterName .. " (" .. topCharacterReputationsCount .. " )" )
468
496
RepHubFrame :AddChild (StatsLabel )
469
497
470
498
-- Search
0 commit comments