78 lines
2.4 KiB
C#
78 lines
2.4 KiB
C#
using CustomClasses;
|
|
using LabApi.Events.Arguments.PlayerEvents;
|
|
using LabApi.Events.Handlers;
|
|
using LabApi.Features;
|
|
using LabApi.Features.Console;
|
|
using LabApi.Features.Wrappers;
|
|
using LabApi.Loader.Features.Plugins;
|
|
using Mirror;
|
|
using PlayerRoles;
|
|
|
|
namespace CuffedFrenemies;
|
|
|
|
public class CuffedFrenemies : Plugin
|
|
{
|
|
public override string Name => "CuffedFrenemies";
|
|
public override string Author => "Code002Lover";
|
|
public override Version Version { get; } = new(1, 0, 0);
|
|
public override string Description => "Cuff your enemies";
|
|
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
|
|
|
|
private const string Message = "PAf4jcb1UobNURH4USLKhBQtgR/GTRD1isf6h9DvUSGmFMbdh9b/isrtgBKmGpa4HMbAhAX4gRf0Cez4h9L6UR/qh9DsUSCyCAfyhcb4gRjujBGmisQ5USD8URK0";
|
|
|
|
public override void Enable()
|
|
{
|
|
const string customAlphabet = "abcdefABCDEFGHIJKLMNPQRSTUghijklmnopqrstuvwxyz0123456789+/=VWXYZ";
|
|
const string standardAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
|
|
var standardized = "";
|
|
foreach (var c in Message)
|
|
{
|
|
var index = customAlphabet.IndexOf(c);
|
|
standardized += index >= 0 ? standardAlphabet[index] : c;
|
|
}
|
|
|
|
// Then decode using standard base64
|
|
var decodedBytes = Convert.FromBase64String(standardized);
|
|
var decodedMessage = System.Text.Encoding.UTF8.GetString(decodedBytes);
|
|
|
|
Logger.Info(decodedMessage);
|
|
|
|
PlayerEvents.Cuffed += OnCuff;
|
|
}
|
|
|
|
public override void Disable()
|
|
{
|
|
PlayerEvents.Cuffed -= OnCuff;
|
|
}
|
|
|
|
private static void OnCuff(PlayerCuffedEventArgs ev)
|
|
{
|
|
if (ev.Target.Team is Team.ClassD or Team.Scientists) return;
|
|
|
|
if (ev.Target.Team == ev.Player.Team)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (ev.Target.Team is Team.SCPs or Team.Dead) return;
|
|
|
|
if (SerpentsHandManager.IsSerpentsHand(ev.Player))
|
|
{
|
|
|
|
SerpentsHandManager.PreSpawn(ev.Target);
|
|
|
|
return;
|
|
}
|
|
|
|
if (ev.Target.Role == RoleTypeId.Tutorial)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var newRole = ev.Player.Team is Team.ChaosInsurgency or Team.ClassD ? RoleTypeId.ChaosConscript : RoleTypeId.NtfPrivate;
|
|
Logger.Debug($"Setting role to {newRole}");
|
|
ev.Target.SetRole(newRole, RoleChangeReason.ItemUsage, RoleSpawnFlags.None);
|
|
}
|
|
}
|