fish-station/Content.Server/Administration/Managers/IBanManager.cs
Vigers Ray 596698b387
Фикс антаг банов и наказание случайной смерти [ПОРТ] (#1088)
* Antag Bans - traitors

* Added Zombify conversion check for banned, fixed style on ban panel.

* Fix All antag selection on grouprole

* UI updates to show role and antag bans.

* Fix All antag placement

* Prevent Banned players from becoming revs. Added Random Death Smite.

* part 1 PR changes.

* Change appeal instructions to ccvar.

* more readable expirationText logic

* Remove duplicate service setups

* Add helper methods for getting role/antag bans before checking.

* Move Serverside antag Checks in to common methods on ban manager.

* dont allow banned players to return to zombie body after being forced to ghost.

* Move timer stuff in to existing gametick methods.

* Cleaner UI ban check methods

* Handle cases where a ban expires mid round and show new joining players their bans

* Fix a bunch of mismatching time stamps, some were set in UTC, some in local ☠

* Keep the exisiting ban display ui overlay for latejoiners but use the new one in job selection.

* Fix the rev conversion smite, use existing wait period for the end conditions to execute.

* This was already happening.

* Pretty sure the initial passes were false positives on this, no value keeping this on reflection.

* Fix renaming messup from merge conflict.

* Just mock the that the ban isnt real instead of going deeper with the DB stuff.

* Remove double set on cache

* Fix merge conflict

* Adds a border to Oppenhopper poster (#34219)

* border

* Update meta.json

* Update Resources/Textures/Structures/Wallmounts/posters.rsi/meta.json

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Trim trailing newlines from examine messages (#33381)

* Trim trailing newlines from examine messages

* TrimTrailingNewlines -> TrimEnd

* фиксы

* упс

---------

Co-authored-by: Repo <47093363+Titian3@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Spessmann <156740760+Spessmann@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: SpaceManiac <tad@platymuus.com>
2025-01-11 05:07:34 +03:00

103 lines
5.4 KiB
C#

using System.Collections.Immutable;
using System.Net;
using System.Threading.Tasks;
using Content.Shared.Database;
using Content.Shared.Roles;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Managers;
public interface IBanManager
{
public void Initialize();
public void Restart();
/// <summary>
/// Bans the specified target, address range and / or HWID. One of them must be non-null
/// </summary>
/// <param name="target">Target user, username or GUID, null for none</param>
/// <param name="banningAdmin">The person who banned our target</param>
/// <param name="addressRange">Address range, null for none</param>
/// <param name="hwid">H</param>
/// <param name="minutes">Number of minutes to ban for. 0 and null mean permanent</param>
/// <param name="severity">Severity of the resulting ban note</param>
/// <param name="reason">Reason for the ban</param>
public void CreateServerBan(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, uint? minutes, NoteSeverity severity, string reason);
public HashSet<string>? GetRoleBans(NetUserId playerUserId);
public HashSet<ProtoId<JobPrototype>> GetJobBans(NetUserId playerUserId);
/// <summary>
/// Retrieves a set of antagonist bans for the specified player. By Default only active bans.
/// </summary>
/// <param name="playerUserId">The user ID of the player.</param>
/// <returns>
/// A set of antagonist prototype IDs representing the banned antagonist roles for the player,
/// or null if the player has no antagonist bans.
/// </returns>
public HashSet<ProtoId<AntagPrototype>> GetAntagBans(NetUserId playerUserId);
/// <summary>
/// Checks if the player is banned from a specific antagonist role.
/// Will also return true if they are banned on the All antagonists condition.
/// </summary>
/// <param name="userId">Player's user ID.</param>
/// <param name="antag">Antagonist role ID to check for ban.</param>
/// <returns>True if the player is banned from the specified antagonist role, false otherwise.</returns>
public bool IsAntagBanned(NetUserId userId, string antag);
/// <summary>
/// Checks if the player is banned from any of the specified antagonist roles.
/// Will also return true if they are banned on the All antagonists condition.
/// </summary>
/// <param name="userId">Player's user ID.</param>
/// <param name="antags">Antagonist role IDs to check for ban.</param>
/// <returns>True if the player is banned from any of the specified antagonist roles, false otherwise.</returns>
public bool IsAntagBanned(NetUserId userId, IEnumerable<string> antags);
/// <summary>
/// Checks if the player is banned from any of the specified antagonist roles.
/// Will also return true if they are banned on the All antagonists condition.
/// </summary>
/// <param name="userId">Player's user ID.</param>
/// <param name="antags">Antagonist role IDs to check for ban as ProtoId<AntagPrototype>.</param>
/// <returns>True if the player is banned from any of the specified antagonist roles, false otherwise.</returns>
public bool IsAntagBanned(NetUserId userId, IEnumerable<ProtoId<AntagPrototype>> antags);
/// <summary>
/// Checks if the player is banned from a specific role.
/// </summary>
/// <param name="userId">Player's user ID.</param>
/// <param name="roles">Role IDs to check for ban.</param>
/// <returns>True if the player is banned from any of the specified roles, false otherwise.</returns>
public bool IsRoleBanned(NetUserId userId, IEnumerable<string> roles);
/// <summary>
/// Creates a job ban for the specified target, username or GUID
/// </summary>
/// <param name="target">Target user, username or GUID, null for none</param>
/// <param name="role">Role to be banned from</param>
/// <param name="severity">Severity of the resulting ban note</param>
/// <param name="reason">Reason for the ban</param>
/// <param name="minutes">Number of minutes to ban for. 0 and null mean permanent</param>
/// <param name="timeOfBan">Time when the ban was applied, used for grouping role bans</param>
public void CreateRoleBan(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, string role, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan);
public void WebhookUpdateRoleBans(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, IReadOnlyCollection<string> roles, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan);
/// <summary>
/// Pardons a role ban for the specified target, username or GUID
/// </summary>
/// <param name="banId">The id of the role ban to pardon.</param>
/// <param name="unbanningAdmin">The admin, if any, that pardoned the role ban.</param>
/// <param name="unbanTime">The time at which this role ban was pardoned.</param>
public Task<string> PardonRoleBan(int banId, NetUserId? unbanningAdmin, DateTimeOffset unbanTime);
/// <summary>
/// Sends role bans to the target
/// </summary>
/// <param name="pSession">Player's session</param>
public void SendRoleBans(ICommonSession pSession);
}