Skip to content

Commit

Permalink
places where i missed streamer mode stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomityGuy committed Mar 17, 2024
1 parent 82841a5 commit 1cede65
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
18 changes: 16 additions & 2 deletions game/marble/client/scripts/playerList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion game/marble/client/scripts/xbLive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function getDiscordUsername(%userId)

function DiscordUsernameRequest::onLine(%this, %line)
{
echo(%line);
%resp = jsonParse(%line);
if (%resp.code == 200)
{
Expand Down
43 changes: 43 additions & 0 deletions game/marble/client/ui/JoinGameInviteDlg.gui
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

0 comments on commit 1cede65

Please sign in to comment.