Display the administrator's title in ahelp and ahelp relay (#30075)

* Adding the admin prefix to the ahelp

* Updating the admin prefix

* The second update of the admin prefix

* Configuration correction
This commit is contained in:
to4no_fix
2024-08-03 06:59:20 +03:00
committed by GitHub
parent 893180038f
commit 64273cb914
4 changed files with 50 additions and 5 deletions

View File

@@ -565,16 +565,23 @@ namespace Content.Server.Administration.Systems
var escapedText = FormattedMessage.EscapeText(message.Text);
string bwoinkText;
string adminPrefix = "";
//Getting an administrator position
if (_config.GetCVar(CCVars.AhelpAdminPrefix) && senderAdmin is not null && senderAdmin.Title is not null)
{
adminPrefix = $"[bold]\\[{senderAdmin.Title}\\][/bold] ";
}
if (senderAdmin is not null &&
senderAdmin.Flags ==
AdminFlags.Adminhelp) // Mentor. Not full admin. That's why it's colored differently.
{
bwoinkText = $"[color=purple]{senderSession.Name}[/color]";
bwoinkText = $"[color=purple]{adminPrefix}{senderSession.Name}[/color]";
}
else if (senderAdmin is not null && senderAdmin.HasFlag(AdminFlags.Adminhelp))
{
bwoinkText = $"[color=red]{senderSession.Name}[/color]";
bwoinkText = $"[color=red]{adminPrefix}{senderSession.Name}[/color]";
}
else
{
@@ -597,6 +604,13 @@ namespace Content.Server.Administration.Systems
RaiseNetworkEvent(msg, channel);
}
string adminPrefixWebhook = "";
if (_config.GetCVar(CCVars.AhelpAdminPrefixWebhook) && senderAdmin is not null && senderAdmin.Title is not null)
{
adminPrefixWebhook = $"[bold]\\[{senderAdmin.Title}\\][/bold] ";
}
// Notify player
if (_playerManager.TryGetSessionById(message.UserId, out var session))
{
@@ -611,11 +625,11 @@ namespace Content.Server.Administration.Systems
senderAdmin.Flags ==
AdminFlags.Adminhelp) // Mentor. Not full admin. That's why it's colored differently.
{
overrideMsgText = $"[color=purple]{_overrideClientName}[/color]";
overrideMsgText = $"[color=purple]{adminPrefixWebhook}{_overrideClientName}[/color]";
}
else if (senderAdmin is not null && senderAdmin.HasFlag(AdminFlags.Adminhelp))
{
overrideMsgText = $"[color=red]{_overrideClientName}[/color]";
overrideMsgText = $"[color=red]{adminPrefixWebhook}{_overrideClientName}[/color]";
}
else
{