From e10a314ec2314a6a24a59956c9594b3ba65cbd34 Mon Sep 17 00:00:00 2001 From: LankLTE <135308300+LankLTE@users.noreply.github.com> Date: Sun, 24 Dec 2023 22:57:00 -0800 Subject: [PATCH] add round time to the ahelp relay (#22937) * Basic roundtime implementation * Forgot to clamp the length checker --- .../Administration/Systems/BwoinkSystem.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Content.Server/Administration/Systems/BwoinkSystem.cs b/Content.Server/Administration/Systems/BwoinkSystem.cs index 00b771e448..101f8ecbac 100644 --- a/Content.Server/Administration/Systems/BwoinkSystem.cs +++ b/Content.Server/Administration/Systems/BwoinkSystem.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Net.Http; using System.Text; using System.Text.Json; @@ -70,7 +70,7 @@ namespace Content.Server.Administration.Systems _config.OnValueChanged(CVars.GameHostName, OnServerNameChanged, true); _config.OnValueChanged(CCVars.AdminAhelpOverrideClientName, OnOverrideChanged, true); _sawmill = IoCManager.Resolve().GetSawmill("AHELP"); - _maxAdditionalChars = GenerateAHelpMessage("", "", true).Length; + _maxAdditionalChars = GenerateAHelpMessage("", "", true, _timing.CurTime.ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel).Length; _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; SubscribeLocalEvent(OnGameRunLevelChanged); @@ -471,7 +471,7 @@ namespace Content.Server.Administration.Systems { str = str[..(DescriptionMax - _maxAdditionalChars - unameLength)]; } - _messageQueues[msg.UserId].Enqueue(GenerateAHelpMessage(senderSession.Name, str, !personalChannel, admins.Count == 0)); + _messageQueues[msg.UserId].Enqueue(GenerateAHelpMessage(senderSession.Name, str, !personalChannel, _timing.CurTime.ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel, admins.Count == 0)); } if (admins.Count != 0 || sendsWebhook) @@ -492,10 +492,10 @@ namespace Content.Server.Administration.Systems .ToList(); } - private static string GenerateAHelpMessage(string username, string message, bool admin, bool noReceivers = false) + private static string GenerateAHelpMessage(string username, string message, bool admin, string roundTime, GameRunLevel roundState, bool noReceivers = false) { var stringbuilder = new StringBuilder(); - + if (admin) stringbuilder.Append(":outbox_tray:"); else if (noReceivers) @@ -503,6 +503,8 @@ namespace Content.Server.Administration.Systems else stringbuilder.Append(":inbox_tray:"); + if(roundTime != string.Empty && roundState == GameRunLevel.InRound) + stringbuilder.Append($" **{roundTime}**"); stringbuilder.Append($" **{username}:** "); stringbuilder.Append(message); return stringbuilder.ToString(); -- 2.51.2