Compare commits

..

No commits in common. "01b41461c158166cf663e08befc272b8ece3c517" and "c56e7c9dd67bb886b5c6d368fddce51875e8c86e" have entirely different histories.

20 changed files with 33 additions and 2421 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@ bin/
obj/ obj/
*.user *.user
*.dll *.dll
fuchsbau/

View File

@ -1,90 +0,0 @@
using CustomPlayerEffects;
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;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.Ragdolls;
namespace CuffedFrenemies;
public class CuffedFrenemies : Plugin
{
public override string Name => "GamblingCoin";
public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Gamble your life away";
public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion);
public override void Enable()
{
Logger.Debug("Loading");
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)
{
Logger.Debug("Same team, not changing role");
return;
}
if (ev.Target.RoleBase is Scp3114Role scp3114)
{
var stolenRole = scp3114.CurIdentity.StolenRole;
var ragdoll = scp3114.CurIdentity.Ragdoll.Info;
switch (stolenRole)
{
case RoleTypeId.ChaosConscript or RoleTypeId.ChaosMarauder or RoleTypeId.ChaosRepressor
or RoleTypeId.ChaosRifleman:
scp3114.CurIdentity.Ragdoll.Info = new RagdollData(ragdoll.OwnerHub, ragdoll.Handler, RoleTypeId.NtfPrivate, ragdoll.StartPosition, ragdoll.StartRotation, ragdoll.Nickname, ragdoll.CreationTime);
return;
case RoleTypeId.NtfPrivate or RoleTypeId.NtfCaptain or RoleTypeId.NtfSergeant
or RoleTypeId.NtfSpecialist:
scp3114.CurIdentity.Ragdoll.Info = new RagdollData(ragdoll.OwnerHub, ragdoll.Handler, RoleTypeId.ChaosConscript, ragdoll.StartPosition, ragdoll.StartRotation, ragdoll.Nickname, ragdoll.CreationTime);
return;
}
}
if (ev.Target.Team is Team.SCPs or Team.Dead)
{
return;
}
var newRole = ev.Target.Team == Team.ChaosInsurgency ? RoleTypeId.NtfPrivate : RoleTypeId.ChaosConscript;
Logger.Debug($"Setting role to {newRole}");
var newItems = new List<Item>();
ev.Target.Items.CopyTo(newItems);
newItems.Reverse();
var newPos = ev.Target.Position;
ev.Target.Inventory.UserInventory.Items.Clear();
ev.Target.SetRole(newRole);
ev.Target.ClearItems();
foreach (var newItem in newItems)
{
ev.Target.Inventory.UserInventory.Items.Add(newItem.Serial,newItem.Base);
}
ev.Target.Position = newPos;
}
}

View File

@ -1,40 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</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>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="Pooling">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Pooling.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -27,7 +27,7 @@ namespace GamblingCoin
public class GamblingCoinMessages public class GamblingCoinMessages
{ {
public string SpawnWaveMessage { get; set; } = "Did someone just enter the Site...?"; public String SpawnWaveMessage { get; set; } = "Did someone just enter the Site...?";
public string ItemSpawnMessage { get; set; } = "*plop*"; public string ItemSpawnMessage { get; set; } = "*plop*";
public string UncommonItemSpawnMessage { get; set; } = "*bump*"; public string UncommonItemSpawnMessage { get; set; } = "*bump*";
public string RareItemSpawnMessage { get; set; } = "*badunk*"; public string RareItemSpawnMessage { get; set; } = "*badunk*";

View File

@ -1,29 +0,0 @@
using Interactables.Interobjects.DoorUtils;
using LabApi.Features.Console;
namespace KeycardButModern;
public enum DoorType
{
Normal,
Gate,
Checkpoint
}
public class DoorLockConfiguration
{
public Dictionary<DoorType, float> LockDurations { get; set; }= new()
{
{ DoorType.Normal, 5f },
{ DoorType.Gate, 8f },
{ DoorType.Checkpoint, 3f }
};
public static DoorType GetDoorType(DoorVariant door)
{
Logger.Debug("Door name: " + door.name);
if (door.name.Contains("Checkpoint"))
return DoorType.Checkpoint;
return door.name.Contains("Gate") ? DoorType.Gate : DoorType.Normal;
}
}

View File

@ -1,14 +1,8 @@
using System.Collections; using InventorySystem.Items.Keycards;
using Interactables.Interobjects;
using Interactables.Interobjects.DoorButtons;
using Interactables.Interobjects.DoorUtils;
using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers; using LabApi.Events.Handlers;
using LabApi.Features; using LabApi.Features;
using LabApi.Loader; using LabApi.Features.Console;
using UnityEngine;
using KeycardItem = InventorySystem.Items.Keycards.KeycardItem;
using Logger = LabApi.Features.Console.Logger;
namespace KeycardButModern namespace KeycardButModern
{ {
@ -20,28 +14,22 @@ namespace KeycardButModern
public override Version Version { get; } = new(1, 0, 0); public override Version Version { get; } = new(1, 0, 0);
public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion); public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion);
public DoorLockConfiguration DoorLockConfiguration;
public static Plugin Singleton;
public override void LoadConfigs()
{
base.LoadConfigs();
DoorLockConfiguration = this.LoadConfig< DoorLockConfiguration > ("door_locks.yml");
}
private void OnInteractingDoor(PlayerInteractingDoorEventArgs ev) private void OnInteractingDoor(PlayerInteractingDoorEventArgs ev)
{ {
if (ev.CanOpen) if (ev.CanOpen)
{ {
Logger.Debug("Door can be opened, no need for implant check");
return; return;
} }
if (ev.Door.IsLocked) if (ev.Door.IsLocked)
{ {
Logger.Debug("Door has active locks");
return; return;
} }
var permissions = ev.Door.Permissions;
foreach (var playerItem in ev.Player.Items) foreach (var playerItem in ev.Player.Items)
{ {
//is keycard? //is keycard?
@ -51,183 +39,28 @@ namespace KeycardButModern
continue; continue;
} }
if (!ev.Door.Base.CheckPermissions(keycardItem, out _)) continue; var keycardPermissions = keycardItem.GetPermissions(ev.Door.Base);
ev.Door.IsOpened = !ev.Door.IsOpened;
return; Logger.Debug($"Item is a keycard: {keycardPermissions} vs {permissions} = {keycardPermissions & permissions}");
}
}
private void OnInteractingGenerator(PlayerInteractingGeneratorEventArgs ev) if ((keycardPermissions & permissions) != permissions) continue;
{ ev.Door.IsOpened = true;
if (!ev.IsAllowed) Logger.Debug("Door can be opened");
{
return;
}
if (ev.Player.CurrentItem?.Base is KeycardItem keycard)
{
if (ev.Generator.Base.CheckPermissions(keycard, out _))
{
ev.Generator.IsUnlocked = true;
return;
}
}
if (ev.Generator.IsUnlocked)
{
return;
}
foreach (var playerItem in ev.Player.Items)
{
//is keycard?
if (playerItem.Type > ItemType.KeycardO5) continue;
if (playerItem.Base is not KeycardItem keycardItem)
{
continue;
}
if (!ev.Generator.Base.CheckPermissions(keycardItem, out _)) continue;
ev.Generator.IsOpen = !ev.Generator.IsOpen;
ev.Generator.IsUnlocked = true;
return;
}
}
private void OnInteractingLocker(PlayerInteractingLockerEventArgs ev)
{
if (!ev.IsAllowed)
{
return;
}
if (ev.Chamber.Base.RequiredPermissions == DoorPermissionFlags.None)
{
return;
}
if (ev.Player.CurrentItem?.Base is KeycardItem keycard)
{
if (ev.Chamber.Base.CheckPermissions(keycard, out _)) return;
}
foreach (var playerItem in ev.Player.Items)
{
//is keycard?
if (playerItem.Type > ItemType.KeycardO5) continue;
if (playerItem.Base is not KeycardItem keycardItem)
{
continue;
}
if (!ev.Chamber.Base.CheckPermissions(keycardItem, out _)) continue;
ev.Chamber.IsOpen = !ev.Chamber.IsOpen;
return;
}
}
private void OnUnlockingWarhead(PlayerUnlockingWarheadButtonEventArgs ev)
{
if (ev.IsAllowed)
{
return;
}
foreach (var playerItem in ev.Player.Items)
{
//is keycard?
if (playerItem.Type > ItemType.KeycardO5) continue;
if (playerItem.Base is not KeycardItem keycardItem)
{
continue;
}
if (!AlphaWarheadActivationPanel.Instance.CheckPermissions(keycardItem, out _)) continue;
ev.IsAllowed = true;
return;
}
}
private static void OnBulletHole(PlayerPlacedBulletHoleEventArgs ev)
{
var direction = (ev.HitPosition - ev.RaycastStart).normalized;
var distance = Vector3.Distance(ev.RaycastStart, ev.HitPosition);
var hits = Physics.RaycastAll(ev.RaycastStart, direction, distance);
foreach (var hit in hits)
{
ButtonVariant doorButton = hit.collider.GetComponent<LcdButton>();
if (!doorButton)
{
doorButton = hit.collider.GetComponent<CheckpointKeycardButton>();
}
if (!doorButton)
{
doorButton = hit.collider.GetComponent<KeycardButton>();
}
if (!doorButton)
{
doorButton = hit.collider.GetComponent<SimpleButton>();
}
if (!doorButton)
{
continue;
}
var doorVariant = DoorVariant.AllDoors.AsEnumerable()!.First(x => x.Buttons.Any(c=>c.GetInstanceID() == doorButton.GetInstanceID()));
doorVariant.ServerInteract(ev.Player.ReferenceHub, doorButton.ColliderId);
StartDoorLockCoroutine(doorVariant);
return; return;
} }
} }
public override void Enable() public override void Enable()
{ {
Logger.Debug("starting..."); Logger.Debug("starting...");
Singleton = this;
PlayerEvents.InteractingDoor += OnInteractingDoor; PlayerEvents.InteractingDoor += OnInteractingDoor;
PlayerEvents.InteractingGenerator += OnInteractingGenerator;
PlayerEvents.InteractingLocker += OnInteractingLocker;
PlayerEvents.UnlockingWarheadButton += OnUnlockingWarhead;
PlayerEvents.PlacedBulletHole += OnBulletHole;
}
private static void StartDoorLockCoroutine(DoorVariant door)
{
door.StartCoroutine(LockDoorCoroutine(door));
}
private static IEnumerator LockDoorCoroutine(DoorVariant door)
{
var doorType = DoorLockConfiguration.GetDoorType(door);
var lockDuration = Singleton.DoorLockConfiguration.LockDurations[doorType];
door.ServerChangeLock(DoorLockReason.SpecialDoorFeature, true);
yield return new WaitForSeconds(lockDuration);
door.ServerChangeLock(DoorLockReason.SpecialDoorFeature, false);
} }
public override void Disable() public override void Disable()
{ {
PlayerEvents.InteractingDoor -= OnInteractingDoor; PlayerEvents.InteractingDoor -= OnInteractingDoor;
PlayerEvents.InteractingGenerator -= OnInteractingGenerator;
PlayerEvents.InteractingLocker -= OnInteractingLocker;
PlayerEvents.UnlockingWarheadButton -= OnUnlockingWarhead;
PlayerEvents.PlacedBulletHole -= OnBulletHole;
Logger.Debug("unloading..."); Logger.Debug("unloading...");
Singleton = null;
} }
} }
} }

View File

@ -29,9 +29,6 @@
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,31 +0,0 @@
using LabApi.Events.CustomHandlers;
using LabApi.Features;
using LabApi.Loader.Features.Plugins;
namespace LogEvents
{
internal class LogPlugin : Plugin
{
public override string Name { get; } = "LogPlugin";
public override string Description { get; } = "Example Plugin that logs (almost) all events.";
public override string Author { get; } = "Northwood";
public override Version Version { get; } = new Version(1, 0, 0, 0);
public override Version RequiredApiVersion { get; } = new Version(LabApiProperties.CompiledVersion);
public MyCustomEventsHandler Events { get; } = new();
public override void Enable()
{
CustomHandlersManager.RegisterEventsHandler(Events);
}
public override void Disable()
{
CustomHandlersManager.UnregisterEventsHandler(Events);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</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>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit.Analyzers" Version="4.4.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
</ItemGroup>
<ItemGroup>
<Using Include="NUnit.Framework"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RangeBan\RangeBan.csproj" />
</ItemGroup>
</Project>

View File

@ -1,62 +0,0 @@
namespace RangeBan.Tests;
[TestFixture]
public class IpRangeTests
{
[Test]
public void IsInRange_WithNullInput_ReturnsFalse()
{
Assert.That(RangeBan.IsInRange("192.168.1.0/24", null), Is.False);
}
[Test]
public void IsInRange_WithEmptyInput_ReturnsFalse()
{
Assert.That(RangeBan.IsInRange("192.168.1.0/24", ""), Is.False);
}
[Test]
public void IsInRange_WithInvalidRange_ReturnsFalse()
{
Assert.That(RangeBan.IsInRange("invalid-range", "192.168.1.1"), Is.False);
}
[TestCase("192.168.1.0/24", "192.168.1.1", true)]
[TestCase("192.168.1.0/24", "192.168.1.254", true)]
[TestCase("192.168.1.0/24", "192.168.2.1", false)]
[TestCase("192.168.1.0/24", "10.0.0.1", false)]
[TestCase("176.2.0.0/16", "176.2.73.23", true)]
[TestCase("176.2.0.0/16", "176.2.70.50", true)]
[TestCase("176.2.0.0/16", "176.2.72.1", true)]
public void IsInRange_WithCidrNotation_ReturnsExpectedResult(string range, string ip, bool expected)
{
Assert.That(RangeBan.IsInRange(range, ip), Is.EqualTo(expected));
}
[TestCase("192.168.2.0/33")]
[TestCase("192.168.1.0/invalid")]
public void IsInRange_WithInvalidCidrNotation_ReturnsFalse(string range)
{
Assert.That(RangeBan.IsInRange(range, "192.168.1.1"), Is.False);
}
[Test]
public void IsInRange_WithInvalidIpAddress_ThrowsArgumentException()
{
Assert.Throws<ArgumentException>(() => RangeBan.IsInRange("192.168.1.0/24", "invalid.ip.address"));
}
[TestCase("192.168.1.0/24", "192.168.1")]
[TestCase("192.168.1.0/24", "192.168.1.1.1")]
[TestCase("192.168.1.0/24", "not.an.ip.address")]
public void IsInRange_WithMalformedIpAddress_ThrowsArgumentException(string range, string ip)
{
Assert.Throws<ArgumentException>(() => RangeBan.IsInRange(range, ip));
}
[Test]
public void IsInRange_WithValidPublicIp_DoesNotThrow()
{
Assert.DoesNotThrow(() => RangeBan.IsInRange("192.168.1.0/24", "8.8.8.8"));
}
}

View File

@ -1,94 +0,0 @@
using System.Runtime.Serialization;
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers;
using LabApi.Features;
using LabApi.Features.Console;
using LabApi.Loader.Features.Plugins;
namespace RangeBan;
public class RangeBan: Plugin<RangeBanConfig>
{
public override void Enable()
{
Logger.Debug("Loading...");
PlayerEvents.PreAuthenticating += OnAuth;
}
public override void Disable()
{
Logger.Debug("Disabling...");
PlayerEvents.PreAuthenticating -= OnAuth;
}
private void OnAuth(PlayerPreAuthenticatingEventArgs ev)
{
Logger.Debug($"Ranges: {string.Join(" ; ", Config!.IpRanges)}");
if (!Config!.IpRanges.Any(configIpRange => IsInRange(configIpRange, ev.IpAddress))) return;
ev.RejectCustom("Your IP belongs to a banned player, please contact the server administrator for more information.");
Logger.Warn($"Player with IP {ev.IpAddress} got kicked. UserId: {ev.UserId}");
}
public override string Name => "RangeBan";
public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Ban IP Ranges with ease";
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
public static bool IsInRange(string range, string ip)
{
if (string.IsNullOrEmpty(ip) || string.IsNullOrEmpty(range))
return false;
// Handle CIDR notation (e.g., "192.168.1.0/24")
if (!range.Contains("/"))
{
//We only handle direct IPs and CIDR
if (range.Split('.').Length != 4)
{
return false;
}
return ip == range;
};
var parts = range.Split('/');
if (parts.Length != 2 || !int.TryParse(parts[1], out var cidrBits))
return false;
if (cidrBits > 32)
{
return false;
}
var networkAddress = IPToUInt32(parts[0]);
var mask = uint.MaxValue << (32 - cidrBits);
var ipAddress = IPToUInt32(ip);
return (ipAddress & mask) == (networkAddress & mask);
}
private static uint IPToUInt32(string ipAddress)
{
var parts = ipAddress.Split('.');
if (parts.Length != 4)
throw new ArgumentException("Invalid IP address format");
uint result = 0;
for (var i = 0; i < 4; i++)
{
if (!byte.TryParse(parts[i], out var part))
throw new ArgumentException("Invalid IP address segment");
result = (result << 8) | part;
}
return result;
}
}
public class RangeBanConfig
{
public string[] IpRanges { get; set; } = {};
}

View File

@ -1,37 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</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>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -1,96 +0,0 @@
using HintServiceMeow.Core.Enum;
using HintServiceMeow.Core.Models.Hints;
using HintServiceMeow.Core.Utilities;
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers;
using LabApi.Features;
using LabApi.Features.Console;
using LabApi.Features.Wrappers;
using PlayerRoles;
using PlayerRoles.PlayableScps.Scp096;
using Timer = System.Timers.Timer;
namespace SCPTeamHint
{
public class Plugin : LabApi.Loader.Features.Plugins.Plugin
{
public override string Name => "SCPTeamHint";
public override string Author => "HoherGeist, Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Displays information about your SCP Teammates";
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
private Timer _timer;
private readonly Dictionary<Player,Hint> _spectatorHints = new();
public override void Enable()
{
Logger.Debug("Apple juice");
PlayerEvents.Joined += OnJoin;
_timer = new Timer(1000);
_timer.Elapsed += (_,_) => UpdateHints();
_timer.Start();
}
public override void Disable()
{
PlayerEvents.Joined -= OnJoin;
_timer.Stop();
}
private void UpdateHints()
{
var hintTexts = new List<string>();
foreach (var player in Player.List)
{
if (!player.IsSCP) continue;
var text = $"{player.RoleBase.RoleName} | {player.HumeShield} | {player.Health} | {player.Zone}";
if (player.RoleBase is Scp096Role scp)
{
text += "\n";
scp.SubroutineModule.TryGetSubroutine(out Scp096TargetsTracker tracker);
text += $"Targets: {tracker.Targets.Count}";
}
hintTexts.Add(text);
}
foreach (var player in Player.List.Where(x=>!x.IsHost))
{
Logger.Debug($"Updating hint for {player.DisplayName}");
UpdateHint(player, string.Join("\n", hintTexts));
}
}
private void UpdateHint(Player player, string hintText)
{
var hint = _spectatorHints[player];
Logger.Debug($"Player {player.Nickname} is on team {player.RoleBase.Team} | hide: {player.RoleBase.Team != Team.SCPs}");
hint.Hide = player.RoleBase.Team != Team.SCPs;
hint.Text = hintText;
}
private void OnJoin(PlayerJoinedEventArgs ev)
{
var hint = new Hint
{
Text = "Apfelsaft", Alignment = HintAlignment.Left, YCoordinate = 300, Hide = true
};
var playerDisplay = PlayerDisplay.Get(ev.Player);
playerDisplay.AddHint(hint);
_spectatorHints[ev.Player] = hint;
}
}
}

View File

@ -1,46 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</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="0Harmony">
<HintPath>..\dependencies\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="HintServiceMeow">
<HintPath>..\dependencies\HintServiceMeow-LabAPI.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="Pooling">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Pooling.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -6,17 +6,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeycardButModern", "Keycard
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisibleSpectators", "VisibleSpectators\VisibleSpectators.csproj", "{F320856D-6340-4DD5-89F7-EE44611DF8E8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisibleSpectators", "VisibleSpectators\VisibleSpectators.csproj", "{F320856D-6340-4DD5-89F7-EE44611DF8E8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SensitiveGrenades", "SensitiveGrenades\SensitiveGrenades.csproj", "{2EFB3C10-A917-4840-97CD-B36733D666DE}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SCPList", "SCPList\SCPList.csproj", "{2EFB3C10-A917-4840-97CD-B36733D666DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SCPTeamHint", "SCPTeamHint\SCPTeamHint.csproj", "{01A046C2-9083-4BDB-AC45-BA24966650D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogEvents", "LogEvents\LogEvents.csproj", "{2C9FD537-231C-4486-8C1B-6359E5120D19}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan", "RangeBan\RangeBan.csproj", "{17798161-3317-4E64-880D-1CD7DE0EBE56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan.Tests", "RangeBan.Tests\RangeBan.Tests.csproj", "{AA495D0E-0122-4C26-8D26-C728B65BFF12}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CuffedFrenemies", "CuffedFrenemies\CuffedFrenemies.csproj", "{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -40,25 +30,5 @@ Global
{2EFB3C10-A917-4840-97CD-B36733D666DE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2EFB3C10-A917-4840-97CD-B36733D666DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EFB3C10-A917-4840-97CD-B36733D666DE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2EFB3C10-A917-4840-97CD-B36733D666DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EFB3C10-A917-4840-97CD-B36733D666DE}.Release|Any CPU.Build.0 = Release|Any CPU {2EFB3C10-A917-4840-97CD-B36733D666DE}.Release|Any CPU.Build.0 = Release|Any CPU
{01A046C2-9083-4BDB-AC45-BA24966650D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01A046C2-9083-4BDB-AC45-BA24966650D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01A046C2-9083-4BDB-AC45-BA24966650D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01A046C2-9083-4BDB-AC45-BA24966650D7}.Release|Any CPU.Build.0 = Release|Any CPU
{2C9FD537-231C-4486-8C1B-6359E5120D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C9FD537-231C-4486-8C1B-6359E5120D19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C9FD537-231C-4486-8C1B-6359E5120D19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C9FD537-231C-4486-8C1B-6359E5120D19}.Release|Any CPU.Build.0 = Release|Any CPU
{17798161-3317-4E64-880D-1CD7DE0EBE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17798161-3317-4E64-880D-1CD7DE0EBE56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17798161-3317-4E64-880D-1CD7DE0EBE56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17798161-3317-4E64-880D-1CD7DE0EBE56}.Release|Any CPU.Build.0 = Release|Any CPU
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.Build.0 = Release|Any CPU
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,53 +0,0 @@
using InventorySystem.Items.Pickups;
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers;
using LabApi.Features;
using LabApi.Features.Wrappers;
using LabApi.Loader.Features.Plugins;
using UnityEngine;
using Logger = LabApi.Features.Console.Logger;
using TimedGrenadePickup = InventorySystem.Items.ThrowableProjectiles.TimedGrenadePickup;
namespace SensitiveGrenades
{
public class SensitiveGrenades : Plugin
{
public override string Name => "SensitiveGrenades";
public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Shoot grenades to blow them up!";
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
public override void Enable()
{
Logger.Debug("starting...");
PlayerEvents.PlacedBulletHole += ShotWeapon;
}
private static void ShotWeapon(PlayerPlacedBulletHoleEventArgs ev)
{
var direction = (ev.HitPosition - ev.RaycastStart).normalized;
var distance = Vector3.Distance(ev.RaycastStart, ev.HitPosition);
var hits = Physics.RaycastAll(ev.RaycastStart, direction, distance);
foreach (var hit in hits)
{
var itemPickup = hit.collider.GetComponent<ItemPickupBase>();
var grenade = itemPickup as TimedGrenadePickup;
if (!grenade) continue;
itemPickup.DestroySelf();
TimedGrenadeProjectile.SpawnActive(itemPickup.Position, itemPickup.Info.ItemId, ev.Player);
break;
}
}
public override void Disable()
{
Logger.Debug("unloading...");
}
}
}

View File

@ -1,44 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</LangVersion>
<RootNamespace>SensitiveGrenades</RootNamespace>
</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>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -1,5 +1,4 @@
using HintServiceMeow.Core.Enum; using HintServiceMeow.Core.Enum;
using HintServiceMeow.Core.Models.HintContent;
using HintServiceMeow.Core.Models.Hints; using HintServiceMeow.Core.Models.Hints;
using HintServiceMeow.Core.Utilities; using HintServiceMeow.Core.Utilities;
using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Arguments.PlayerEvents;
@ -9,7 +8,6 @@ using LabApi.Features.Console;
using LabApi.Features.Wrappers; using LabApi.Features.Wrappers;
using LabApi.Loader.Features.Plugins; using LabApi.Loader.Features.Plugins;
using PlayerRoles; using PlayerRoles;
using PlayerRoles.Spectating;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
namespace VisibleSpectators namespace VisibleSpectators
@ -22,7 +20,6 @@ namespace VisibleSpectators
public override string Description => "See your spectators"; public override string Description => "See your spectators";
public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion); public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion);
public int YCoordinate { get; set; } = 100;
private static Plugin _singleton; private static Plugin _singleton;
private Timer _timer; private Timer _timer;
@ -63,111 +60,12 @@ namespace VisibleSpectators
} }
} }
private void AddPlayerHint(Player player)
{
if (player == null) return;
var hint = new Hint
{
Text = $"{Config!.HeaderMessage}\n{Config!.NoSpectatorsMessage}",
Alignment = HintAlignment.Right,
YCoordinate = YCoordinate,
Hide = true
};
var playerDisplay = PlayerDisplay.Get(player);
playerDisplay.AddHint(hint);
_spectatorHints[player] = hint;
}
private static readonly Dictionary<string, string> GetColorMap = new()
{
{ "DEFAULT", "FFFFFF" },
{ "PUMPKIN", "EE7600" },
{ "ARMY_GREEN", "4B5320" },
{ "MINT", "98FB98" },
{ "NICKEL", "727472" },
{ "CARMINE", "960018" },
{ "EMERALD", "50C878" },
{ "GREEN", "228B22" },
{ "LIME", "BFFF00" },
{ "POLICE_BLUE", "002DB3" },
{ "ORANGE", "FF9966" },
{ "SILVER_BLUE", "666699" },
{ "BLUE_GREEN", "4DFFB8" },
{ "MAGENTA", "FF0090" },
{ "YELLOW", "FAFF86" },
{ "TOMATO", "FF6448" },
{ "DEEP_PINK", "FF1493" },
{ "AQUA", "00FFFF" },
{ "CYAN", "00B7EB" },
{ "CRIMSON", "DC143C" },
{ "LIGHT_GREEN", "32CD32" },
{ "SILVER", "A0A0A0" },
{ "BROWN", "944710" },
{ "RED", "C50000" },
{ "PINK", "FF96DE" },
{ "LIGHT_RED", "FD8272" },
{ "PURPLE", "8137CE" },
{ "BLUE", "005EBC" },
{ "TEAL", "008080" },
{ "GOLD", "EFC01A" }
};
private static string PlayerToDisplay(Player player)
{
if (player == null) return "";
// Default color if GroupColor is null or not found in the map
const string defaultColor = "FFFFFF";
try
{
var groupColor = player.GroupColor;
if (string.IsNullOrEmpty(groupColor))
return $"<color=#{defaultColor}FF>{player.DisplayName}</color>";
return GetColorMap.TryGetValue(groupColor.ToUpper(), out var color) ? $"<color=#{color}FF>{player.DisplayName}</color>" : $"<color=#{defaultColor}FF>{player.DisplayName}</color>";
}
catch
{
return $"<color=#{defaultColor}FF>{player.DisplayName}</color>";
}
}
private static bool IsNotOverwatch(Player player)
{
return player != null && player.Role != RoleTypeId.Overwatch;
}
private void UpdateSpectators(Player player) private void UpdateSpectators(Player player)
{ {
if (player == null) var spectators = string.Join("\n",player.CurrentSpectators.Select(x => x.DisplayName));
if (player.Role == RoleTypeId.Spectator)
{ {
return; spectators = string.Join("\n",player.CurrentlySpectating?.CurrentSpectators.Select(x => x.DisplayName) ?? Array.Empty<string>());
}
// Safety check - if player doesn't have a hint, create one
if (!_spectatorHints.ContainsKey(player))
{
AddPlayerHint(player);
}
var spectators = Config!.NoSpectatorsMessage;
try
{
spectators = string.Join("\n",player.CurrentSpectators.Where(IsNotOverwatch).Select(PlayerToDisplay));
if (player.Role == RoleTypeId.Spectator)
spectators = player.CurrentlySpectating == null
? Config!.NoSpectatorsMessage
: string.Join("\n",
player.CurrentlySpectating?.CurrentSpectators.Where(IsNotOverwatch)
.Select(PlayerToDisplay) ?? Array.Empty<string>());
} catch (Exception e)
{
Logger.Error(e);
} }
if (spectators.Length < 2) if (spectators.Length < 2)
@ -176,11 +74,9 @@ namespace VisibleSpectators
} }
_spectatorHints[player].Text = $"{Config!.HeaderMessage}\n{spectators}"; _spectatorHints[player].Text = $"{Config!.HeaderMessage}\n{spectators}\n{DateTime.UtcNow:HH:mm:ss}";
_spectatorHints[player].Hide = player.Role is RoleTypeId.Destroyed or RoleTypeId.None; _spectatorHints[player].Hide = player.Role is RoleTypeId.Overwatch or RoleTypeId.Destroyed or RoleTypeId.None;
_spectatorHints[player].YCoordinate = YCoordinate + player.CurrentSpectators.Count * 10;
} }
private static Player[] GetPlayers() private static Player[] GetPlayers()
@ -192,12 +88,22 @@ namespace VisibleSpectators
{ {
_singleton.UpdateSpectators(ev.OldTarget); _singleton.UpdateSpectators(ev.OldTarget);
_singleton.UpdateSpectators(ev.NewTarget); _singleton.UpdateSpectators(ev.NewTarget);
_singleton.UpdateSpectators(ev.Player);
} }
private void OnJoin(PlayerJoinedEventArgs ev) private void OnJoin(PlayerJoinedEventArgs ev)
{ {
AddPlayerHint(ev.Player); var hint = new Hint
{
Text = $"{Config!.HeaderMessage}\n{Config!.NoSpectatorsMessage}",
Alignment = HintAlignment.Right,
YCoordinate = 100,
Hide = true
};
var playerDisplay = PlayerDisplay.Get(ev.Player);
playerDisplay.AddHint(hint);
_spectatorHints[ev.Player] = hint;
} }
} }