add and fix a lot

This commit is contained in:
2025-06-05 01:11:30 +02:00
parent 9bf05f87aa
commit 17c654d889
23 changed files with 1235 additions and 65 deletions
+23
View File
@@ -0,0 +1,23 @@
using LabApi.Events.Handlers;
using LabApi.Features;
using LabApi.Loader.Features.Plugins;
namespace ScpSwap;
public class ScpSwap : Plugin
{
public override string Name => "ScpSwap";
public override string Author => "HoherGeist, Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Swap SCPs.";
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
public override void Enable()
{
}
public override void Disable()
{
}
}
+43
View File
@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>true</Optimize>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\dependencies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\dependencies\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\dependencies\Mirror.dll</HintPath>
</Reference>
<Reference Include="Pooling">
<HintPath>..\dependencies\Pooling.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\dependencies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>
+81
View File
@@ -0,0 +1,81 @@
using CommandSystem;
using LabApi.Features.Wrappers;
using PlayerRoles;
namespace ScpSwap;
[CommandHandler(typeof(ClientCommandHandler))]
public class SwapCommand : ICommand
{
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
if (arguments.Count != 1)
{
response = "Usage: .scpswap <SCP_NUMBER>";
return false;
}
if (!Player.TryGet(sender, out var player))
{
response = "You must be a player to use this command!";
return false;
}
if (Round.Duration.TotalSeconds > 120)
{
response = "You can't swap SCPs during a round!";
return false;
}
if (!player.IsSCP)
{
response = "You must be an SCP to use this command!";
return false;
}
List<string> validScp =
[
"049",
"079",
"096",
"106",
"173",
"939",
];
var arg = arguments.First();
if (!validScp.Contains(arg))
{
response = "Invalid SCP number.";
return false;
}
if (Player.List.Where(x=>x.IsSCP).Select(x=>x.RoleBase).Any(playerRole => playerRole.RoleName == "SCP-" + arg))
{
response = "Already exists";
return false;
}
var role = arg switch
{
"049" => RoleTypeId.Scp049,
"079" => RoleTypeId.Scp079,
"096" => RoleTypeId.Scp096,
"106" => RoleTypeId.Scp106,
"173" => RoleTypeId.Scp173,
"939" => RoleTypeId.Scp939,
_ => throw new ArgumentOutOfRangeException()
};
player.SetRole(role);
response = "Swapping...";
return true;
}
public string Command { get; } = "scpswap";
public string[] Aliases { get; } = ["ss"];
public string Description { get; } = "Swaps SCPs";
}