diff --git a/game/marble/client/scripts/playerList.cs b/game/marble/client/scripts/playerList.cs index 2cf7e85d..252da07b 100644 --- a/game/marble/client/scripts/playerList.cs +++ b/game/marble/client/scripts/playerList.cs @@ -132,7 +132,12 @@ function handleClientJoin(%msgType, %msgString, %clientName, %joinData, %isMe) // spew about new player echo(detag(%clientName) SPC "joined the game"); sfxPlay(PlayerJoinSfx); - %msg = avar($Text::Msg::PlayerJoin, detag(%clientName)); + %displayName = detag(%clientName); + if ($pref::Lobby::StreamerMode) + { + %displayName = getSubStr(%displayName, 0, 1) @ "..."; + } + %msg = avar($Text::Msg::PlayerJoin, %displayName); addChatLine(%msg); } @@ -170,7 +175,12 @@ function handleClientDrop(%msgType, %msgString, %clientName, %clientId, %xbLiveI // spew about dropping player echo(detag(%clientName) SPC "left the game"); sfxPlay(PlayerDropSfx); - %msg = avar($Text::Msg::PlayerDrop, detag(%clientName)); + %displayName = detag(%clientName); + if ($pref::Lobby::StreamerMode) + { + %displayName = getSubStr(%displayName, 0, 1) @ "..."; + } + %msg = avar($Text::Msg::PlayerDrop, %displayName); addChatLine(%msg); } @@ -179,6 +189,10 @@ function handleClientDrop(%msgType, %msgString, %clientName, %clientId, %xbLiveI function handleMPGameOver(%msgType, %msgString, %tied, %leaderName, %leaderPoints) { %name = detag(%leaderName); + if ($pref::Lobby::StreamerMode) + { + %name = getSubStr(%name, 0, 1) @ "..."; + } %msg = ""; if (%tied) diff --git a/game/marble/client/scripts/xbLive.cs b/game/marble/client/scripts/xbLive.cs index 4bebf1ca..23f93718 100644 --- a/game/marble/client/scripts/xbLive.cs +++ b/game/marble/client/scripts/xbLive.cs @@ -9,7 +9,6 @@ function getDiscordUsername(%userId) function DiscordUsernameRequest::onLine(%this, %line) { - echo(%line); %resp = jsonParse(%line); if (%resp.code == 200) { diff --git a/game/marble/client/ui/JoinGameInviteDlg.gui b/game/marble/client/ui/JoinGameInviteDlg.gui index f6002c48..d5977737 100644 --- a/game/marble/client/ui/JoinGameInviteDlg.gui +++ b/game/marble/client/ui/JoinGameInviteDlg.gui @@ -72,6 +72,10 @@ function JoinGameInviteDlg::show(%userId, %username, %avatar) Canvas.pushDialog(JoinGameInviteDlg); JoinGameInviteDlg.isShowing = true; } + if ($pref::Lobby::StreamerMode) + { + %username = getSubStr(%username, 0, 1) @ "..."; + } serverplay2d(HelpDingSfx); JoinGameInviteDlg.responded = false; JoinGameInviteDlg.userId = %userId; @@ -143,4 +147,43 @@ function DiscordAvatarDownload::downloadFailed(%this, %path) function DiscordAvatarDownload::onDisconnect(%this) { %this.delete(); +} + +function getInviteDiscordUsername(%userId) +{ + echo("USER ID: " @ %userId); + if (isObject(DiscordIUsernameRequest)) + DiscordIUsernameRequest.delete(); + new HTTPObject(DiscordIUsernameRequest); + DiscordIUsernameRequest.get("https://openmbu.com", "/api/v1/discord/user/" @ %userId, ""); +} + +function DiscordIUsernameRequest::onLine(%this, %line) +{ + %resp = jsonParse(%line); + if (%resp.code == 200) + { + %this.success = true; + + %username = %resp.realname; + if ($pref::Lobby::StreamerMode) + { + %username = getSubStr(%username, 0, 1) @ "..."; + } + + JoinGameInviteDlg.username = %username; + } + else + { + %this.success = false; + } + %resp.delete(); +} + +function DiscordIUsernameRequest::onDisconnect(%this) +{ + if (!%this.success) { + echo("Failed to fetch discord display name!"); + } + %this.delete(); } \ No newline at end of file