1 Commits

Author SHA1 Message Date
paste 437a4ef561 fixed wrong character being selected upon logout 2026-07-06 17:54:54 -05:00
+9 -3
View File
@@ -203,17 +203,23 @@ function CharacterSelect_OnEvent()
elseif ( event == "CHARACTER_LIST_UPDATE" ) then elseif ( event == "CHARACTER_LIST_UPDATE" ) then
CharacterSelect_RebuildTranslationTable(); CharacterSelect_RebuildTranslationTable();
CharacterOrder_Apply(); CharacterOrder_Apply();
if ( this.pendingSelectedCharID ) then
this.selectedIndex = GetIndexFromCharID(this.pendingSelectedCharID);
this.pendingSelectedCharID = nil;
end
UpdateCharacterList(); UpdateCharacterList();
CharSelectCharacterName:SetText(GetCharacterInfo(GetCharIDFromIndex(this.selectedIndex))); CharSelectCharacterName:SetText(GetCharacterInfo(GetCharIDFromIndex(this.selectedIndex)));
Autologin_OnCharactersLoad(); Autologin_OnCharactersLoad();
elseif ( event == "UPDATE_SELECTED_CHARACTER" ) then elseif ( event == "UPDATE_SELECTED_CHARACTER" ) then
-- arg1 is a server-assigned charID; translate to a display index
-- so `selectedIndex` always means "position in the displayed list".
if ( arg1 == 0 ) then if ( arg1 == 0 ) then
CharSelectCharacterName:SetText(""); CharSelectCharacterName:SetText("");
else else
CharSelectCharacterName:SetText(GetCharacterInfo(arg1)); CharSelectCharacterName:SetText(GetCharacterInfo(arg1));
this.selectedIndex = GetIndexFromCharID(arg1); if ( table.getn(this.translationTable) == 0 ) then
this.pendingSelectedCharID = arg1;
else
this.selectedIndex = GetIndexFromCharID(arg1);
end
end end
UpdateCharacterSelection(); UpdateCharacterSelection();
elseif ( event == "SELECT_LAST_CHARACTER" ) then elseif ( event == "SELECT_LAST_CHARACTER" ) then