OOC sent by an admin will have a different color (#3117)

* Admin OOC is sent with a different color than regular OOC

- Also adds the OOC color to the database

* Command to set the color

* Ooc -> OOC

* Change default color to Red (`#ff0000`)

* Outdated namespace
This commit is contained in:
Leo
2021-02-14 11:59:56 -03:00
committed by GitHub
parent 54f48aa6a9
commit a3d0e3f6a7
17 changed files with 1324 additions and 30 deletions

View File

@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Observer;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
@@ -47,6 +48,7 @@ namespace Content.Server.Chat
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IMoMMILink _mommiLink = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!;
public void Initialize()
{
@@ -187,7 +189,7 @@ namespace Content.Server.Chat
public void SendOOC(IPlayerSession player, string message)
{
// Check if message exceeds the character limi
// Check if message exceeds the character limit
if (message.Length > MaxMessageLength)
{
DispatchServerMessage(player, Loc.GetString(MaxLengthExceededMessage, MaxMessageLength));
@@ -198,6 +200,12 @@ namespace Content.Server.Chat
msg.Channel = ChatChannel.OOC;
msg.Message = message;
msg.MessageWrap = $"OOC: {player.Name}: {{0}}";
if (_adminManager.HasAdminFlag(player, AdminFlags.Admin))
{
var prefs = _preferencesManager.GetPreferences((player.UserId));
msg.MessageColorOverride = prefs.AdminOOCColor;
}
//TODO: player.Name color, this will need to change the structure of the MsgChatMessage
_netManager.ServerSendToAll(msg);
_mommiLink.SendOOCMessage(player.Name, message);