From df3f797fdcbf7c524d7f0d06e4e9b39ba197fb46 Mon Sep 17 00:00:00 2001 From: telkar-rg Date: Sat, 7 Oct 2023 09:39:56 +0200 Subject: [PATCH] Multi-Acc Support Altoholic can only show up to 10 characters in the character tabs. Therefore show the chars of the highest level and of the highest gear. --- Altoholic-Addon/Altoholic/Altoholic.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Altoholic-Addon/Altoholic/Altoholic.lua b/Altoholic-Addon/Altoholic/Altoholic.lua index f90ec4b..7a5a11a 100644 --- a/Altoholic-Addon/Altoholic/Altoholic.lua +++ b/Altoholic-Addon/Altoholic/Altoholic.lua @@ -646,7 +646,26 @@ function Altoholic:ShowClassIcons() local i = 1 local realm, account = Altoholic:GetCurrentRealm() - for characterName, character in pairs(DS:GetCharacters(realm, account)) do + + + -- #################### + local CharNameList = DS:GetCharacters(realm, account) + local CharNameList_sort = {} + + for k,v in pairs(CharNameList) do + table.insert(CharNameList_sort,{k,v, DS:GetAverageItemLevel(v), DS:GetCharacterLevel(v)}) + end + + -- sort for level first, avg iLevel secondly + table.sort(CharNameList_sort, function(a,b) return b[3]+b[4]*10000 < a[3]+a[4]*10000 end) + -- DEBUG_CHARLIST = CharNameList + -- print("-- altoholic DEBUG READY") + -- #################### + + + -- for characterName, character in pairs(DS:GetCharacters(realm, account)) do + for _,charTbl in ipairs(CharNameList_sort) do + local characterName, character = charTbl[1], charTbl[2] local itemName = entry .. i; local itemButton = _G[itemName]; itemButton:SetScript("OnEnter", function(self)