Compare commits

..

1 Commits

Author SHA1 Message Date
Renovate Bot
d414e14c33 Update dependency csharpier to 1.0.3 2025-07-12 19:14:50 +00:00
4 changed files with 8 additions and 149 deletions

View File

@ -1,66 +0,0 @@
using LabApi.Features.Wrappers;
using PlayerRoles.FirstPersonControl;
using Logger = LabApi.Features.Console.Logger;
using Random = System.Random;
namespace CustomClasses;
public class DisableStaminaRegenEffect : CustomPlayerEffect, IStaminaModifier
{
public bool StaminaModifierActive => IsEnabled;
public float StaminaUsageMultiplier => 1;
public float StaminaRegenMultiplier => 0;
public bool SprintingDisabled => false;
public override EffectClassification Classification => EffectClassification.Negative;
}
public class BloodFueledStaminaEffect : CustomPlayerEffect, IStaminaModifier
{
public bool StaminaModifierActive => IsEnabled;
public float StaminaUsageMultiplier => 0.1f;
public float StaminaRegenMultiplier => 1;
public bool SprintingDisabled => false;
public override EffectClassification Classification => EffectClassification.Negative;
}
public class BloodFueledManager
{
private readonly CustomClasses _plugin;
public static bool IsBloodFueled(Player player) => player.CustomInfo.Contains("Blood Fueled");
public BloodFueledManager(CustomClasses plugin)
{
_plugin = plugin;
}
}
public class BloodFueledHandler : CustomClassHandler
{
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
{
player.SendBroadcast("You are the <color=#6e2e99>Blood Fueled</color>!", CustomClasses.BroadcastDuration);
const string customInfo = "<color=#A0A0A0>Blood Fueled</color>";
if (!Player.ValidateCustomInfo(customInfo, out var reason))
{
Logger.Error($"Invalid custom info for Blood Fueled: {reason}");
}
else
{
player.CustomInfo = customInfo;
player.InfoArea |= PlayerInfoArea.CustomInfo;
}
player.MaxHumeShield = 0;
player.HumeShield = 0;
player.MaxHealth = 3500;
player.Health = 3500;
player.EnableEffect<DisableStaminaRegenEffect>(1, float.PositiveInfinity);
}
}

View File

@ -38,16 +38,12 @@ public sealed class CustomClasses : Plugin
/// <inheritdoc/>
public override string Name => "CustomClasses";
/// <inheritdoc/>
public override string Author => "Code002Lover";
/// <inheritdoc/>
public override Version Version { get; } = new(1, 0, 0);
/// <inheritdoc/>
public override string Description => "Adds custom classes to the game";
/// <inheritdoc/>
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
@ -57,22 +53,18 @@ public sealed class CustomClasses : Plugin
/// Configuration for the Janitor class.
/// </summary>
public JanitorConfig JanitorConfig { get; private set; } = new();
/// <summary>
/// Configuration for the Research Subject class.
/// </summary>
public ResearchSubjectConfig ResearchSubjectConfig { get; private set; } = new();
/// <summary>
/// Configuration for the Head Guard class.
/// </summary>
public HeadGuardConfig HeadGuardConfig { get; private set; } = new();
/// <summary>
/// Configuration for the Medic class.
/// </summary>
public MedicConfig MedicConfig { get; private set; } = new();
/// <summary>
/// Configuration for the Gambler class.
/// </summary>
@ -90,7 +82,6 @@ public sealed class CustomClasses : Plugin
public SerpentsHandConfig SerpentsHandConfig { get; private set; } = new();
public NegromancerConfig NegromancerConfig { get; private set; } = new();
public NegromancerShadowConfig NegromancerShadowConfig { get; private set; } = new();
public BloodFueledConfig BloodFueledConfig { get; private set; } = new();
internal readonly Dictionary<Player, Hint> Hints = new();
@ -116,8 +107,6 @@ public sealed class CustomClasses : Plugin
Logger.Info(decodedMessage);
CustomPlayerEffect.Initialize();
PlayerEvents.Spawned += OnPlayerSpawned;
ServerEvents.RoundEnded += OnRoundEnded;
Scp914Events.ProcessingPickup += OnScp914ProcessingPickup;
@ -287,10 +276,9 @@ public sealed class CustomClasses : Plugin
if (ClassManager.TryHandleSpawn(ev.Player, MedicConfig, typeof(MedicConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, GamblerConfig, typeof(GamblerConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, ShadowStepperConfig, typeof(ShadowStepperConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, MtfDemolitionistConfig, typeof(MtfDemolitionistConfig), null))
return;
if (ClassManager.TryHandleSpawn(ev.Player, MtfDemolitionistConfig, typeof(MtfDemolitionistConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, ExplosiveMasterConfig, typeof(ExplosiveMasterConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, BloodFueledConfig, typeof(BloodFueledConfig), null)) return;
if (ClassManager.TryHandleSpawn(ev.Player, FlashMasterConfig, typeof(FlashMasterConfig), null)) return;
}
private static void OnScp914ProcessingPickup(Scp914ProcessingPickupEventArgs ev)
@ -350,7 +338,6 @@ public class CustomClassManager
RegisterHandler<SerpentsHandConfig>(new SerpentsHandHandler(), new SerpentsHandState());
RegisterHandler<NegromancerConfig>(new NegromancerHandler());
RegisterHandler<NegromancerShadowConfig>(new NegromancerShadowHandler());
RegisterHandler<BloodFueledConfig>(new BloodFueledHandler());
}
public SpawnState GetSpawnState(Type configType)
@ -972,14 +959,6 @@ public sealed class NegromancerShadowConfig : CustomClassConfig
public override ItemType[] Items { get; set; } = [];
}
public sealed class BloodFueledConfig : CustomClassConfig
{
public override double ChancePerPlayer { get; set; } = 1.0;
public override int MaxSpawns { get; set; } = int.MaxValue;
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp939;
public override ItemType[] Items { get; set; } = [];
}
/// <summary>
/// Tracks the spawn state for a custom class.
/// </summary>

View File

@ -1,53 +0,0 @@
using CustomPlayerEffects;
using LabApi.Features.Wrappers;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
using Logger = LabApi.Features.Console.Logger;
namespace CustomClasses;
public abstract class CustomPlayerEffect : StatusEffectBase
{
private static bool _isLoaded;
public Player Owner { get; private set; } = null!;
protected override void Start()
{
Owner = Player.Get(Hub);
base.Start();
}
public override string ToString() => $"{GetType().Name}: Owner ({Owner}) - Intensity ({Intensity}) - Duration {Duration}";
internal static void Initialize()
{
SceneManager.sceneLoaded += (_, _) =>
{
if (_isLoaded)
return;
_isLoaded = true;
Type[] toLoad =
[
typeof(DisableStaminaRegenEffect),
typeof(BloodFueledStaminaEffect)
];
var playerEffects = NetworkManager.singleton.playerPrefab.GetComponent<ReferenceHub>().playerEffectsController.effectsGameObject.transform;
foreach (var type in toLoad)
{
if (!typeof(StatusEffectBase).IsAssignableFrom(type))
{
Logger.Error($"[CustomPlayerEffect.Initialize] {type.FullName} is not a valid StatusEffectBase and thus could not be registered!");
return;
}
// register effect into prefab
new GameObject(type.Name, type).transform.parent = playerEffects;
}
};
}
}

View File

@ -67,7 +67,6 @@ public class SetCClassCommand : ICommand
SerpentsHandManager.PreSpawn(player);
}),
"negromancer" => manager.ForceSpawn(player, customClasses.NegromancerConfig, typeof(NegromancerConfig), null),
"bloodfueled" => manager.ForceSpawn(player, customClasses.BloodFueledConfig, typeof(BloodFueledConfig), null),
_ => false
};