ban event round id + ban id (#60)

This commit is contained in:
HitPanda
2023-05-16 01:28:00 +03:00
committed by Aviu00
parent f7532478c4
commit de09df5da0
4 changed files with 24 additions and 5 deletions

View File

@@ -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<IServerDbManager>();
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<GameTicker>().RoundId,
BanId = banId
};
_utkaSockets.SendMessageToAll(utkaBanned);
//WD end

View File

@@ -318,7 +318,9 @@ public sealed class RoleBanManager
Duration = duration,
Bantype = job,
Global = global,
Reason = reason
Reason = reason,
Rid = EntitySystem.Get<GameTicker>().RoundId,
BanId = banId
};
_utkaSockets.SendMessageToAll(utkaBanned);

View File

@@ -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<GameTicker>().RoundId,
BanId = banId
};
_utkaSocketWrapper.SendMessageToAll(utkaBanned);
}

View File

@@ -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