Index: binaries/data/mods/public/gui/lobby/lobby.js =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.js +++ binaries/data/mods/public/gui/lobby/lobby.js @@ -350,6 +350,7 @@ updateSubject(Engine.LobbyGetRoomSubject()); updateLobbyColumns(); + onPlayerListSelection(); Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); } @@ -533,6 +534,20 @@ } /** + * + * Update the caption of the toggle buddy button. + * + * @param {boolean} isBuddy + * @param {boolean} disable - If the button should be disabled + */ +function updateToggleBuddy(isBuddy, disable) +{ + let toggleBuddyButton = Engine.GetGUIObjectByName("toggleBuddyButton"); + toggleBuddyButton.caption = isBuddy ? translate("Unmark as Buddy") : translate("Mark as Buddy"); + toggleBuddyButton.enabled = !disable; +} + +/** * Do a full update of the player listing, including ratings from cached C++ information. */ function updatePlayerList() @@ -630,6 +645,7 @@ return; let index = g_Buddies.indexOf(name); + updateToggleBuddy(index == -1, false); if (index != -1) g_Buddies.splice(index, 1); else @@ -690,6 +706,9 @@ lookupSelectedUserProfile("playersBox"); let playerList = Engine.GetGUIObjectByName("playersBox"); + let disable = playerList.selected == -1 || playerList.list[playerList.selected] == g_Username; + updateToggleBuddy(disable || playerList.list_buddy[playerList.selected], disable); + if (playerList.selected != -1) selectGameFromPlayername(playerList.list[playerList.selected]); } Index: binaries/data/mods/public/gui/lobby/lobby.xml =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.xml +++ binaries/data/mods/public/gui/lobby/lobby.xml @@ -91,7 +91,6 @@ - Toggle Buddy toggleBuddy();