Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Admin] Синхронизация цвета имени администратора с настройками OOC чата #929

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Content.Server/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Robust.Shared.Player;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Server.Preferences.Managers;

namespace Content.Server.Administration.Systems
{
Expand All @@ -43,6 +44,7 @@ public sealed partial class BwoinkSystem : SharedBwoinkSystem
[Dependency] private readonly IAfkManager _afkManager = default!;
[Dependency] private readonly IServerDbManager _dbManager = default!;
[Dependency] private readonly PlayerRateLimitManager _rateLimit = default!;
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!;

[GeneratedRegex(@"^https://discord\.com/api/webhooks/(\d+)/((?!.*/).*)$")]
private static partial Regex DiscordRegex();
Expand Down Expand Up @@ -669,7 +671,24 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
}
else if (senderAdmin is not null && senderAdmin.HasFlag(AdminFlags.Adminhelp))
{
bwoinkText = $"[color=red]{adminPrefix}{senderSession.Name}[/color]";
// ADT-Tweak-Start: Теперь цвета установленные setadminooc также будут красить ник с префиксом в ф1
Color? colorOverride = null;
var prefs = _preferencesManager.GetPreferences(senderSession.UserId);
colorOverride = prefs.AdminOOCColor;
if (colorOverride.HasValue)
{
var colorString = $"#"
+ $"{(int)(colorOverride.Value.R * 255):X2}"
+ $"{(int)(colorOverride.Value.G * 255):X2}"
+ $"{(int)(colorOverride.Value.B * 255):X2}"
+ $"{(int)(colorOverride.Value.A * 255):X2}"; // Color -> переводим в #RGBAFORMAT
bwoinkText = $"[color={colorString}]{adminPrefix}{senderSession.Name}[/color]";
}
else
{
bwoinkText = $"[color=red]{adminPrefix}{senderSession.Name}[/color]";
}
// ADT-Tweak-End
}
else
{
Expand Down
Loading