перенос файлов сервера из папки White в _White

This commit is contained in:
Remuchi
2024-01-28 18:18:54 +07:00
parent 21dbccfec9
commit 1e4ad59270
309 changed files with 450 additions and 437 deletions

View File

@@ -0,0 +1,35 @@
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.White;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
namespace Content.Server._White.Commands;
[AdminCommand(AdminFlags.Admin)]
public sealed class AntispamCommand : IConsoleCommand
{
public string Command => "setantispam";
public string Description => "Переключает антиспам систему.";
public string Help => "setantispam <bool>";
[Dependency] private readonly IConfigurationManager _cfg = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1 || !bool.TryParse(args[0], out var value))
{
shell.WriteError($"{args[0]} is not a valid boolean.");
return;
}
_cfg.SetCVar(WhiteCVars.ChatAntispam, value);
var toggle = value ? "включил" : "выключил";
var announce = $"{shell.Player?.Name} {toggle} антиспам систему";
IoCManager.Resolve<IChatManager>().DispatchServerAnnouncement(announce, Color.Red);
}
}

View File

@@ -0,0 +1,33 @@
using Content.Server.Administration;
using Content.Server._White.Administration;
using Content.Shared.Administration;
using Content.Shared.White.Administration;
using Robust.Shared.Console;
namespace Content.Server._White.Commands;
[AdminCommand(AdminFlags.Admin)]
public sealed class InvisibilityCommand : IConsoleCommand
{
public string Command => "invisibility";
public string Description => "Переключает режим невидимости.";
public string Help => "invisibility";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player == null)
shell.WriteLine("You can only toggle invisibility on a client.");
var entityManager = IoCManager.Resolve<EntityManager>();
var uid = shell.Player?.AttachedEntity;
if (uid == null
|| !entityManager.TryGetComponent<InvisibilityComponent>(uid, out var invisibilityComponent))
return;
entityManager.System<InvisibilitySystem>().ToggleInvisibility(uid.Value, invisibilityComponent);
shell.WriteLine(invisibilityComponent.Invisible
? "Теперь вы в режиме невидимости"
: "Теперь вы не в режиме невидимости");
}
}

View File

@@ -0,0 +1,43 @@
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
namespace Content.Server._White.Commands;
[AnyCommand]
internal sealed class NoticeCommand : IConsoleCommand
{
public string Command => "notice";
public string Description => "Send a chat message to self.";
public string Help => "notice <text>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;
}
if (player.Status != SessionStatus.InGame)
return;
if (player.AttachedEntity is not { } playerEntity)
{
//shell.WriteError("You don't have an entity!"); By HitPanda: Breaks test
return;
}
if (args.Length < 1)
return;
var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;
IoCManager.Resolve<IChatManager>().ChatMessageToOne(ChatChannel.Emotes, message, message, EntityUid.Invalid, false, player.ConnectedClient, recordReplay: false);
}
}

View File

@@ -0,0 +1,49 @@
using System.Linq;
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server._White.Commands;
[AdminCommand(AdminFlags.Admin)]
public sealed class PoshelnahuiCommand : IConsoleCommand
{
public string Command => "poshelnahui";
public string Description => "Close client game lol";
public string Help => "poshelnahui <ckey>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1 || string.IsNullOrEmpty(args[0]))
{
shell.WriteLine("Wrong number of arguments");
return;
}
var playerManager = IoCManager.Resolve<IPlayerManager>();
var players = playerManager.Sessions.ToList();
var player = players.Find(x => x.Name == args[0]);
if (player == null)
{
shell.WriteLine("Player not found");
return;
}
var consoleHost = IoCManager.Resolve<IConsoleHost>();
consoleHost.RemoteExecuteCommand(player, "hardquit");
shell.WriteLine("Message sent");
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) {
if (args.Length == 1)
{
var playerMgr = IoCManager.Resolve<IPlayerManager>();
var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
return CompletionResult.FromHintOptions(options, "ckey");
}
return CompletionResult.Empty;
}
}

View File

@@ -0,0 +1,23 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
namespace Content.Server._White.Commands;
[AdminCommand(AdminFlags.Round)]
sealed class SetRanomMapCommand : IConsoleCommand
{
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
public string Command => "setrandommap";
public string Description => "Устанавливает случайную карту из пула и включает ротацию карт";
public string Help => "setrandommap";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
_configurationManager.SetCVar(CCVars.GameMap, string.Empty);
shell.WriteLine("Включена ротация карт.");
}
}

View File

@@ -0,0 +1,35 @@
using Content.Server.Administration;
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Utility;
namespace Content.Server._White.Commands;
[AdminCommand(AdminFlags.Admin)]
public sealed class StealthCommand : IConsoleCommand
{
public string Command => "stealth";
public string Description => "Переключает стелс режим.";
public string Help => "stealth";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not {} player)
{
shell.WriteLine("You cannot use this command from the server console.");
return;
}
var mgr = IoCManager.Resolve<IAdminManager>();
var data = mgr.GetAdminData(player)!;
DebugTools.AssertNotNull(data);
data.Stealth = !data.Stealth;
shell.WriteLine(data.Stealth
? "Теперь вы в режиме стелс"
: "Теперь вы не в режиме стелс");
}
}