From de09df5da0545f432e0979df86daa55898928f07 Mon Sep 17 00:00:00 2001 From: HitPanda <104197232+EnefFlow@users.noreply.github.com> Date: Tue, 16 May 2023 01:28:00 +0300 Subject: [PATCH] ban event round id + ban id (#60) --- .../Administration/Commands/BanCommand.cs | 14 ++++++++++++-- .../Administration/Managers/RoleBanManager.cs | 4 +++- .../UtkaIntegration/Commands/UtkaBanCommand.cs | 5 +++-- .../UtkaIntegration/UtkaCommunication.cs | 6 ++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Content.Server/Administration/Commands/BanCommand.cs b/Content.Server/Administration/Commands/BanCommand.cs index 3f978c6dad..53fcd105ba 100644 --- a/Content.Server/Administration/Commands/BanCommand.cs +++ b/Content.Server/Administration/Commands/BanCommand.cs @@ -1,9 +1,13 @@ using Content.Server.Administration.Managers; +using System.Net; +using System.Net.Sockets; +using System.Text; +using Content.Server.Database; +using Content.Server.GameTicking; using Content.Server.UtkaIntegration; using Content.Shared.Administration; using Content.Shared.CCVar; using Content.Shared.Database; -using Robust.Server.Player; using Robust.Shared.Configuration; using Robust.Shared.Console; @@ -108,6 +112,10 @@ public sealed class BanCommand : LocalizedCommands _bans.CreateServerBan(targetUid, target, player?.UserId, null, targetHWid, minutes, severity, reason, isGlobalBan); //WD start + var dbMan = IoCManager.Resolve(); + var banlist = await dbMan.GetServerBansAsync(null, targetUid, null); + var banId = banlist[^1].Id; + var utkaBanned = new UtkaBannedEvent() { Ckey = target, @@ -115,7 +123,9 @@ public sealed class BanCommand : LocalizedCommands Bantype = "server", Duration = minutes, Global = isGlobalBan, - Reason = reason + Reason = reason, + Rid = EntitySystem.Get().RoundId, + BanId = banId }; _utkaSockets.SendMessageToAll(utkaBanned); //WD end diff --git a/Content.Server/Administration/Managers/RoleBanManager.cs b/Content.Server/Administration/Managers/RoleBanManager.cs index f085ecf7ad..963b962e22 100644 --- a/Content.Server/Administration/Managers/RoleBanManager.cs +++ b/Content.Server/Administration/Managers/RoleBanManager.cs @@ -318,7 +318,9 @@ public sealed class RoleBanManager Duration = duration, Bantype = job, Global = global, - Reason = reason + Reason = reason, + Rid = EntitySystem.Get().RoundId, + BanId = banId }; _utkaSockets.SendMessageToAll(utkaBanned); diff --git a/Content.Server/UtkaIntegration/Commands/UtkaBanCommand.cs b/Content.Server/UtkaIntegration/Commands/UtkaBanCommand.cs index 50d55649a7..c67b46ee6a 100644 --- a/Content.Server/UtkaIntegration/Commands/UtkaBanCommand.cs +++ b/Content.Server/UtkaIntegration/Commands/UtkaBanCommand.cs @@ -15,7 +15,6 @@ namespace Content.Server.UtkaIntegration; public sealed class UtkaBanCommand : IUtkaCommand { [Dependency] private readonly IConfigurationManager _cfg = default!; - [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private UtkaTCPWrapper _utkaSocketWrapper = default!; private const ILocalizationManager LocalizationManager = default!; @@ -125,7 +124,9 @@ public sealed class UtkaBanCommand : IUtkaCommand Bantype = "server", Duration = message.Duration, Global = message.Global, - Reason = message.Reason + Reason = message.Reason, + Rid = EntitySystem.Get().RoundId, + BanId = banId }; _utkaSocketWrapper.SendMessageToAll(utkaBanned); } diff --git a/Content.Server/UtkaIntegration/UtkaCommunication.cs b/Content.Server/UtkaIntegration/UtkaCommunication.cs index ca4d3140a4..98cd146d3a 100644 --- a/Content.Server/UtkaIntegration/UtkaCommunication.cs +++ b/Content.Server/UtkaIntegration/UtkaCommunication.cs @@ -217,6 +217,12 @@ public sealed class UtkaBannedEvent : UtkaBaseMessage [JsonPropertyName("reason")] public string? Reason { get; set; } + + [JsonPropertyName("rid")] + public int? Rid { get; set; } + + [JsonPropertyName("ban_id")] + public int? BanId { get; set; } } public sealed class UtkaBanRequest : UtkaBaseMessage