From 3f32f9f87c37557d961d625652712479db119ca0 Mon Sep 17 00:00:00 2001 From: Tomeno Date: Sun, 14 Nov 2021 20:21:18 +0100 Subject: [PATCH] AHelp tweaks - colored names for admins, window name (#5335) Co-authored-by: T --- Content.Client/Administration/UI/BwoinkWindow.xaml.cs | 7 +++++-- Content.Server/Administration/BwoinkSystem.cs | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Content.Client/Administration/UI/BwoinkWindow.xaml.cs b/Content.Client/Administration/UI/BwoinkWindow.xaml.cs index 4a5ef0c91a..c3f000f6ca 100644 --- a/Content.Client/Administration/UI/BwoinkWindow.xaml.cs +++ b/Content.Client/Administration/UI/BwoinkWindow.xaml.cs @@ -7,6 +7,7 @@ using Content.Client.Administration; using Content.Shared; using Robust.Client.Credits; using Robust.Client.AutoGenerated; +using Robust.Client.Player; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -28,6 +29,7 @@ namespace Content.Client.Administration.UI public partial class BwoinkWindow : SS14Window { [Dependency] private readonly IEntitySystemManager _systemManager = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; private readonly NetUserId _channelId; @@ -36,8 +38,9 @@ namespace Content.Client.Administration.UI RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); - Title = title; + _channelId = channelId; + Title = (_playerManager.LocalPlayer?.UserId == _channelId) ? "Admin Message" : title; SenderLineEdit.OnTextEntered += Input_OnTextEntered; } @@ -56,7 +59,7 @@ namespace Content.Client.Administration.UI public void ReceiveLine(string text) { var formatted = new FormattedMessage(1); - formatted.AddText(text); + formatted.AddMarkup(text); TextOutput.AddMessage(formatted); } } diff --git a/Content.Server/Administration/BwoinkSystem.cs b/Content.Server/Administration/BwoinkSystem.cs index adb88a01b9..6f1ab75f18 100644 --- a/Content.Server/Administration/BwoinkSystem.cs +++ b/Content.Server/Administration/BwoinkSystem.cs @@ -13,6 +13,7 @@ using Robust.Shared.Network; using Robust.Shared.Localization; using Robust.Server.Player; using Robust.Shared.IoC; +using Robust.Shared.Utility; namespace Content.Server.Administration { @@ -38,7 +39,12 @@ namespace Content.Server.Administration return; } - var msg = new BwoinkTextMessage(message.ChannelId, senderSession.UserId, $"{senderSession.Name}: {message.Text}"); + var escapedText = FormattedMessage.EscapeText(message.Text); + + var bwoinkText = senderAdmin + ? $"[color=red]{senderSession.Name}[/color]: {escapedText}" + : $"{senderSession.Name}: {escapedText}"; + var msg = new BwoinkTextMessage(message.ChannelId, senderSession.UserId, bwoinkText); LogBwoink(msg);