Compare commits
1 Commits
6106552253
...
83a9cb9c47
Author | SHA1 | Date | |
---|---|---|---|
|
83a9cb9c47 |
@ -53,6 +53,45 @@ public sealed class CustomClasses : Plugin
|
|||||||
|
|
||||||
public const ushort BroadcastDuration = 10;
|
public const ushort BroadcastDuration = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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>
|
||||||
|
public GamblerConfig GamblerConfig { get; private set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configuration for the ShadowStepper class.
|
||||||
|
/// </summary>
|
||||||
|
public ShadowStepperConfig ShadowStepperConfig { get; private set; } = new();
|
||||||
|
|
||||||
|
public MtfDemolitionistConfig MtfDemolitionistConfig { get; private set; } = new();
|
||||||
|
public ScoutConfig ScoutConfig { get; private set; } = new();
|
||||||
|
public ExplosiveMasterConfig ExplosiveMasterConfig { get; private set; } = new();
|
||||||
|
public FlashMasterConfig FlashMasterConfig { get; private set; } = new();
|
||||||
|
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();
|
internal readonly Dictionary<Player, Hint> Hints = new();
|
||||||
|
|
||||||
public static CustomClasses Instance { get; private set; }
|
public static CustomClasses Instance { get; private set; }
|
||||||
@ -184,9 +223,9 @@ public sealed class CustomClasses : Plugin
|
|||||||
{
|
{
|
||||||
SerpentsHandManager.SpawnSerpentWave();
|
SerpentsHandManager.SpawnSerpentWave();
|
||||||
|
|
||||||
ClassManager.TryHandleSpawn(spectator, ClassManager.GetConfig<ScoutConfig>(), typeof(ScoutConfig), () =>
|
ClassManager.TryHandleSpawn(spectator, ScoutConfig, typeof(ScoutConfig), () =>
|
||||||
{
|
{
|
||||||
if (!ClassManager.ForceSpawn(spectator, ClassManager.GetConfig<SerpentsHandConfig>(), typeof(SerpentsHandConfig), PreSpawn))
|
if (!ClassManager.ForceSpawn(spectator, SerpentsHandConfig, typeof(SerpentsHandConfig), PreSpawn))
|
||||||
Logger.Error("Serpents Hand didn't spawn");
|
Logger.Error("Serpents Hand didn't spawn");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -200,7 +239,7 @@ public sealed class CustomClasses : Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClassManager.TryHandleSpawn(spectator, ClassManager.GetConfig<ScoutConfig>(), typeof(ScoutConfig), () =>
|
if (ClassManager.TryHandleSpawn(spectator, ScoutConfig, typeof(ScoutConfig), () =>
|
||||||
{
|
{
|
||||||
spectator.SetRole(ev.Wave.Faction == Faction.FoundationStaff ? RoleTypeId.NtfPrivate : RoleTypeId.ChaosConscript, RoleChangeReason.Respawn, RoleSpawnFlags.UseSpawnpoint);
|
spectator.SetRole(ev.Wave.Faction == Faction.FoundationStaff ? RoleTypeId.NtfPrivate : RoleTypeId.ChaosConscript, RoleChangeReason.Respawn, RoleSpawnFlags.UseSpawnpoint);
|
||||||
})) return;
|
})) return;
|
||||||
@ -220,7 +259,7 @@ public sealed class CustomClasses : Plugin
|
|||||||
ev.IsAllowed = false;
|
ev.IsAllowed = false;
|
||||||
foreach (var evSpawningPlayer in ev.SpawningPlayers)
|
foreach (var evSpawningPlayer in ev.SpawningPlayers)
|
||||||
{
|
{
|
||||||
if (!ClassManager.ForceSpawn(evSpawningPlayer, ClassManager.GetConfig<SerpentsHandConfig>(), typeof(SerpentsHandConfig), PreSpawn))
|
if (!ClassManager.ForceSpawn(evSpawningPlayer, SerpentsHandConfig, typeof(SerpentsHandConfig), PreSpawn))
|
||||||
Logger.Error("Serpents Hand didn't spawn");
|
Logger.Error("Serpents Hand didn't spawn");
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -241,10 +280,16 @@ public sealed class CustomClasses : Plugin
|
|||||||
{
|
{
|
||||||
ev.Player.CustomInfo = "";
|
ev.Player.CustomInfo = "";
|
||||||
|
|
||||||
if (ClassManager.Configs.Any(classManagerConfig => ClassManager.TryHandleSpawn(ev.Player, classManagerConfig.Value, classManagerConfig.Key, null)))
|
if (ClassManager.TryHandleSpawn(ev.Player, JanitorConfig, typeof(JanitorConfig), null)) return;
|
||||||
{
|
if (ClassManager.TryHandleSpawn(ev.Player, ResearchSubjectConfig, typeof(ResearchSubjectConfig), null)) return;
|
||||||
|
if (ClassManager.TryHandleSpawn(ev.Player, HeadGuardConfig, typeof(HeadGuardConfig), null)) return;
|
||||||
|
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;
|
return;
|
||||||
}
|
if (ClassManager.TryHandleSpawn(ev.Player, ExplosiveMasterConfig, typeof(ExplosiveMasterConfig), null)) return;
|
||||||
|
if (ClassManager.TryHandleSpawn(ev.Player, BloodFueledConfig, typeof(BloodFueledConfig), null)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnScp914ProcessingPickup(Scp914ProcessingPickupEventArgs ev)
|
private static void OnScp914ProcessingPickup(Scp914ProcessingPickupEventArgs ev)
|
||||||
@ -285,7 +330,6 @@ public class CustomClassManager
|
|||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
private readonly Random _random = new();
|
private readonly Random _random = new();
|
||||||
private readonly Dictionary<Type, SpawnState> _spawnStates = new();
|
private readonly Dictionary<Type, SpawnState> _spawnStates = new();
|
||||||
public Dictionary<Type, CustomClassConfig> Configs { get; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="CustomClassManager"/> class and registers all handlers.
|
/// Initializes a new instance of the <see cref="CustomClassManager"/> class and registers all handlers.
|
||||||
@ -334,30 +378,13 @@ public class CustomClassManager
|
|||||||
/// <param name="spawnState">Optional custom spawn state</param>
|
/// <param name="spawnState">Optional custom spawn state</param>
|
||||||
private void RegisterHandler<T>(ICustomClassHandler handler, [CanBeNull] SpawnState spawnState = null) where T : CustomClassConfig
|
private void RegisterHandler<T>(ICustomClassHandler handler, [CanBeNull] SpawnState spawnState = null) where T : CustomClassConfig
|
||||||
{
|
{
|
||||||
T config;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
config = Activator.CreateInstance<T>();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.Error($"Failed to create config instance for {typeof(T).Name}: {ex.Message}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
_spawnStates[typeof(T)] = spawnState ?? new SpawnState();
|
_spawnStates[typeof(T)] = spawnState ?? new SpawnState();
|
||||||
_handlers[typeof(T)] = handler;
|
_handlers[typeof(T)] = handler;
|
||||||
Configs[typeof(T)] = config;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetConfig<T>() where T : CustomClassConfig
|
|
||||||
{
|
|
||||||
return (T)Configs[typeof(T)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets all spawn states for a new round.
|
/// Resets all spawn states for a new round.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -417,13 +444,22 @@ public class NegromancerShadowHandler : CustomClassHandler
|
|||||||
{
|
{
|
||||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||||
{
|
{
|
||||||
base.HandleSpawn(player,config,random);
|
|
||||||
|
|
||||||
player.MaxHealth = 1000;
|
player.MaxHealth = 1000;
|
||||||
player.MaxHumeShield = 0;
|
player.MaxHumeShield = 0;
|
||||||
player.HumeShield = 0;
|
player.HumeShield = 0;
|
||||||
|
|
||||||
player.EnableEffect<MovementBoost>(10, float.PositiveInfinity);
|
player.EnableEffect<MovementBoost>(10, float.PositiveInfinity);
|
||||||
|
|
||||||
|
const string customInfo = "<color=#A0A0A0>Shadow</color>";
|
||||||
|
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
||||||
|
{
|
||||||
|
Logger.Error($"Invalid custom info for Shadow: {reason}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.CustomInfo = customInfo;
|
||||||
|
player.InfoArea |= PlayerInfoArea.CustomInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,32 +479,12 @@ public interface ICustomClassHandler
|
|||||||
|
|
||||||
public abstract class CustomClassHandler: ICustomClassHandler
|
public abstract class CustomClassHandler: ICustomClassHandler
|
||||||
{
|
{
|
||||||
public virtual void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
public abstract void HandleSpawn(Player player, CustomClassConfig config, Random random);
|
||||||
{
|
|
||||||
var info = config.FullCustomInfo;
|
|
||||||
|
|
||||||
if (!Player.ValidateCustomInfo(info, out var reason))
|
public virtual void HandleEscape(Player player, CustomClassConfig config)
|
||||||
{
|
|
||||||
Logger.Error($"[{GetType().Name}] Invalid custom info: {reason}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.CustomInfo = info;
|
|
||||||
player.InfoArea |= PlayerInfoArea.CustomInfo;
|
|
||||||
|
|
||||||
SendSpawnMessage(player, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void HandleEscape(Player player, CustomClassConfig config)
|
|
||||||
{
|
{
|
||||||
//Intentionally left blank
|
//Intentionally left blank
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SendSpawnMessage(Player player, CustomClassConfig config)
|
|
||||||
{
|
|
||||||
if (config.Name.IsEmpty()) return;
|
|
||||||
player.SendBroadcast($"You are a {config.FullCustomInfo}!", CustomClasses.BroadcastDuration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum JanitorSpawn
|
public enum JanitorSpawn
|
||||||
@ -627,7 +643,7 @@ public class ShadowStepperHandler : CustomClassHandler
|
|||||||
player.SendBroadcast("You're a <color=#000000>ShadowStepper</color>!", CustomClasses.BroadcastDuration);
|
player.SendBroadcast("You're a <color=#000000>ShadowStepper</color>!", CustomClasses.BroadcastDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void HandleEscape(Player player, CustomClassConfig config)
|
public override void HandleEscape(Player player, CustomClassConfig config)
|
||||||
{
|
{
|
||||||
base.HandleEscape(player, config);
|
base.HandleEscape(player, config);
|
||||||
|
|
||||||
@ -648,7 +664,6 @@ public abstract class SimpleAddItemHandler : CustomClassHandler
|
|||||||
{
|
{
|
||||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||||
{
|
{
|
||||||
base.HandleSpawn(player,config,random);
|
|
||||||
foreach (var spawnItem in config.Items)
|
foreach (var spawnItem in config.Items)
|
||||||
{
|
{
|
||||||
player.AddItem(spawnItem, ItemAddReason.StartingItem);
|
player.AddItem(spawnItem, ItemAddReason.StartingItem);
|
||||||
@ -853,11 +868,6 @@ public abstract class CustomClassConfig
|
|||||||
/// The required role for this class to be considered.
|
/// The required role for this class to be considered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual RoleTypeId RequiredRole { get; set; } = RoleTypeId.ClassD;
|
public virtual RoleTypeId RequiredRole { get; set; } = RoleTypeId.ClassD;
|
||||||
|
|
||||||
public virtual string Name { get; init; } = string.Empty;
|
|
||||||
public virtual string Color { get; init; } = "#FFFFFF";
|
|
||||||
|
|
||||||
public string FullCustomInfo => $"<color={Color}>{Name}</color>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -948,9 +958,9 @@ public sealed class FlashMasterConfig : CustomClassConfig
|
|||||||
public sealed class NegromancerConfig : CustomClassConfig
|
public sealed class NegromancerConfig : CustomClassConfig
|
||||||
{
|
{
|
||||||
public override double ChancePerPlayer { get; set; } = 0.0;
|
public override double ChancePerPlayer { get; set; } = 0.0;
|
||||||
|
public override int MaxSpawns { get; set; } = 1;
|
||||||
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp049;
|
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp049;
|
||||||
public override string Name { get; init; } = "Shadowmancer";
|
public override ItemType[] Items { get; set; } = [];
|
||||||
public override string Color { get; init; } = "#A0A0A0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NegromancerShadowConfig : CustomClassConfig
|
public sealed class NegromancerShadowConfig : CustomClassConfig
|
||||||
@ -958,8 +968,7 @@ public sealed class NegromancerShadowConfig : CustomClassConfig
|
|||||||
public override double ChancePerPlayer { get; set; } = 0.0;
|
public override double ChancePerPlayer { get; set; } = 0.0;
|
||||||
public override int MaxSpawns { get; set; } = int.MaxValue;
|
public override int MaxSpawns { get; set; } = int.MaxValue;
|
||||||
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp106;
|
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp106;
|
||||||
public override string Name { get; init; } = "Shadow";
|
public override ItemType[] Items { get; set; } = [];
|
||||||
public override string Color { get; init; } = "#A0A0A0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class BloodFueledConfig : CustomClassConfig
|
public sealed class BloodFueledConfig : CustomClassConfig
|
||||||
@ -967,6 +976,7 @@ public sealed class BloodFueledConfig : CustomClassConfig
|
|||||||
public override double ChancePerPlayer { get; set; } = 1.0;
|
public override double ChancePerPlayer { get; set; } = 1.0;
|
||||||
public override int MaxSpawns { get; set; } = int.MaxValue;
|
public override int MaxSpawns { get; set; } = int.MaxValue;
|
||||||
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp939;
|
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Scp939;
|
||||||
|
public override ItemType[] Items { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
8
CustomClasses/ExtendedClass.cs
Normal file
8
CustomClasses/ExtendedClass.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using PlayerRoles;
|
||||||
|
|
||||||
|
namespace CustomClasses;
|
||||||
|
|
||||||
|
public abstract class ExtendedClass: PlayerRoleBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Net;
|
||||||
using CustomPlayerEffects;
|
using CustomPlayerEffects;
|
||||||
using LabApi.Events.Arguments.Scp049Events;
|
using LabApi.Events.Arguments.Scp049Events;
|
||||||
using LabApi.Events.Handlers;
|
using LabApi.Events.Handlers;
|
||||||
@ -12,9 +13,19 @@ namespace CustomClasses;
|
|||||||
|
|
||||||
public class NegromancerHandler : CustomClassHandler
|
public class NegromancerHandler : CustomClassHandler
|
||||||
{
|
{
|
||||||
protected override void SendSpawnMessage(Player player, CustomClassConfig config)
|
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||||
{
|
{
|
||||||
player.SendBroadcast("You are the <color=#6e2e99>Negromancer</color>! Revived players become your <color=#3c1361>Shadow</color>.", CustomClasses.BroadcastDuration);
|
player.SendBroadcast("You are the <color=#6e2e99>Negromancer</color>! Revived players become your <color=#3c1361>Shadow</color>.", CustomClasses.BroadcastDuration);
|
||||||
|
const string customInfo = "<color=#A0A0A0>Shadowmancer</color>";
|
||||||
|
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
||||||
|
{
|
||||||
|
Logger.Error($"Invalid custom info for Negromancer: {reason}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.CustomInfo = customInfo;
|
||||||
|
player.InfoArea |= PlayerInfoArea.CustomInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,11 +153,12 @@ public class NegromancerManager
|
|||||||
private void OnScp049ResurrectedBody(Scp049ResurrectedBodyEventArgs ev)
|
private void OnScp049ResurrectedBody(Scp049ResurrectedBodyEventArgs ev)
|
||||||
{
|
{
|
||||||
var classManager = _plugin.ClassManager;
|
var classManager = _plugin.ClassManager;
|
||||||
|
// Check if the reviver is a Negromancer
|
||||||
if (classManager == null ||
|
if (classManager == null ||
|
||||||
!IsNegromancer(ev.Player)) return;
|
!IsNegromancer(ev.Player)) return;
|
||||||
|
|
||||||
ev.Target.SetRole(RoleTypeId.Scp106, RoleChangeReason.Respawn, RoleSpawnFlags.None);
|
ev.Target.SetRole(RoleTypeId.Scp106, RoleChangeReason.Respawn, RoleSpawnFlags.None);
|
||||||
classManager.ForceSpawn(ev.Target, classManager.GetConfig<NegromancerShadowConfig>(), typeof(NegromancerShadowConfig), null);
|
classManager.ForceSpawn(ev.Target, _plugin.NegromancerShadowConfig, typeof(NegromancerShadowConfig), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +0,0 @@
|
|||||||
using LabApi.Features.Wrappers;
|
|
||||||
|
|
||||||
namespace CustomClasses;
|
|
||||||
|
|
||||||
public static class PlayerExtensions
|
|
||||||
{
|
|
||||||
public static string GetExtendedClass(this Player player)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,6 +10,7 @@ using LabApi.Events.Handlers;
|
|||||||
using LabApi.Features.Permissions;
|
using LabApi.Features.Permissions;
|
||||||
using LabApi.Features.Wrappers;
|
using LabApi.Features.Wrappers;
|
||||||
using MEC;
|
using MEC;
|
||||||
|
using Mirror;
|
||||||
using PlayerRoles;
|
using PlayerRoles;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using LightSourceToy = LabApi.Features.Wrappers.LightSourceToy;
|
using LightSourceToy = LabApi.Features.Wrappers.LightSourceToy;
|
||||||
@ -109,6 +110,16 @@ public class SerpentsHandManager
|
|||||||
public static void PreSpawn(Player player)
|
public static void PreSpawn(Player player)
|
||||||
{
|
{
|
||||||
player.SetRole(RoleTypeId.Tutorial, RoleChangeReason.RespawnMiniwave, RoleSpawnFlags.None);
|
player.SetRole(RoleTypeId.Tutorial, RoleChangeReason.RespawnMiniwave, RoleSpawnFlags.None);
|
||||||
|
const string customInfo = "<color=#32CD32>SerpentsHand</color>";
|
||||||
|
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
||||||
|
{
|
||||||
|
Logger.Error($"Invalid custom info for Serpents Hand: {reason}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.CustomInfo = customInfo;
|
||||||
|
player.InfoArea |= PlayerInfoArea.CustomInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<float> UpdateSerpentsHandHint()
|
public IEnumerator<float> UpdateSerpentsHandHint()
|
||||||
@ -140,11 +151,11 @@ public class SerpentsHandManager
|
|||||||
// ReSharper disable once IteratorNeverReturns
|
// ReSharper disable once IteratorNeverReturns
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SpawnSerpentWave()
|
public void SpawnSerpentWave()
|
||||||
{
|
{
|
||||||
var state = (SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(typeof(SerpentsHandConfig));
|
var state = (SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(typeof(SerpentsHandConfig));
|
||||||
|
|
||||||
var serpentsHandConfig = CustomClasses.Instance.ClassManager.GetConfig<SerpentsHandConfig>();
|
var serpentsHandConfig = _customClasses.SerpentsHandConfig;
|
||||||
|
|
||||||
state.SetSpawned();
|
state.SetSpawned();
|
||||||
state.SetWillSpawn();
|
state.SetWillSpawn();
|
||||||
@ -233,8 +244,6 @@ public sealed class SerpentsHandConfig : CustomClassConfig
|
|||||||
public const float BaseChance = 90f;
|
public const float BaseChance = 90f;
|
||||||
|
|
||||||
public readonly Vector3[] SpawnLocations = [new(0.22f, 300.96f, -0.31f), new(123.921f, 288.792f, 20.929f)];
|
public readonly Vector3[] SpawnLocations = [new(0.22f, 300.96f, -0.31f), new(123.921f, 288.792f, 20.929f)];
|
||||||
public override string Color { get; init; } = "#32CD32";
|
|
||||||
public override string Name { get; init; } = "Serpents Hand";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SerpentsHandHandler : SimpleAddItemHandler
|
public class SerpentsHandHandler : SimpleAddItemHandler
|
||||||
@ -313,7 +322,7 @@ public class SpawnSerpentsCommand : ICommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerpentsHandManager.SpawnSerpentWave();
|
CustomClasses.Instance.SerpentsHandManager.SpawnSerpentWave();
|
||||||
|
|
||||||
response = "success";
|
response = "success";
|
||||||
return true;
|
return true;
|
||||||
|
@ -33,7 +33,10 @@ public class SetCClassCommand : ICommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find the last argument as the class name
|
||||||
var className = args[arguments.Offset + arguments.Count - 1].ToLower();
|
var className = args[arguments.Offset + arguments.Count - 1].ToLower();
|
||||||
|
|
||||||
|
// Join all arguments except the last one to get the full player name
|
||||||
var playerName = string.Join(" ", args.Skip(arguments.Offset).Take(arguments.Count - 1));
|
var playerName = string.Join(" ", args.Skip(arguments.Offset).Take(arguments.Count - 1));
|
||||||
|
|
||||||
var player = Player.ReadyList.FirstOrDefault(x => x.Nickname == playerName || x.UserId == playerName);
|
var player = Player.ReadyList.FirstOrDefault(x => x.Nickname == playerName || x.UserId == playerName);
|
||||||
@ -43,24 +46,28 @@ public class SetCClassCommand : ICommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var manager = CustomClasses.Instance.ClassManager;
|
var customClasses = CustomClasses.Instance;
|
||||||
|
var manager = new CustomClassManager();
|
||||||
|
|
||||||
var success = className switch
|
var success = className switch
|
||||||
{
|
{
|
||||||
"janitor" => manager.ForceSpawn(player, manager.GetConfig<JanitorConfig>(), typeof(JanitorConfig), null),
|
"janitor" => manager.ForceSpawn(player, customClasses.JanitorConfig, typeof(JanitorConfig), null),
|
||||||
"subject" or "researchsubject" => manager.ForceSpawn(player, manager.GetConfig<ResearchSubjectConfig>(), typeof(ResearchSubjectConfig), null),
|
"subject" or "researchsubject" => manager.ForceSpawn(player, customClasses.ResearchSubjectConfig, typeof(ResearchSubjectConfig), null),
|
||||||
"headguard" => manager.ForceSpawn(player, manager.GetConfig<HeadGuardConfig>(), typeof(HeadGuardConfig), null),
|
"headguard" => manager.ForceSpawn(player, customClasses.HeadGuardConfig, typeof(HeadGuardConfig), null),
|
||||||
"medic" => manager.ForceSpawn(player, manager.GetConfig<MedicConfig>(), typeof(MedicConfig), null),
|
"medic" => manager.ForceSpawn(player, customClasses.MedicConfig, typeof(MedicConfig), null),
|
||||||
"gambler" => manager.ForceSpawn(player, manager.GetConfig<GamblerConfig>(), typeof(GamblerConfig), null),
|
"gambler" => manager.ForceSpawn(player, customClasses.GamblerConfig, typeof(GamblerConfig), null),
|
||||||
"shadowstepper" => manager.ForceSpawn(player, manager.GetConfig<ShadowStepperConfig>(), typeof(ShadowStepperConfig), null),
|
"shadowstepper" => manager.ForceSpawn(player, customClasses.ShadowStepperConfig, typeof(ShadowStepperConfig), null),
|
||||||
"demolitionist" => manager.ForceSpawn(player, manager.GetConfig<MtfDemolitionistConfig>(), typeof(MtfDemolitionistConfig), null),
|
"demolitionist" => manager.ForceSpawn(player, customClasses.MtfDemolitionistConfig, typeof(MtfDemolitionistConfig), null),
|
||||||
"scout" => manager.ForceSpawn(player, manager.GetConfig<ScoutConfig>(), typeof(ScoutConfig), null),
|
"scout" => manager.ForceSpawn(player, customClasses.ScoutConfig, typeof(ScoutConfig), null),
|
||||||
"explosivemaster" => manager.ForceSpawn(player, manager.GetConfig<ExplosiveMasterConfig>(), typeof(ExplosiveMasterConfig), null),
|
"explosivemaster" => manager.ForceSpawn(player, customClasses.ExplosiveMasterConfig, typeof(ExplosiveMasterConfig), null),
|
||||||
"flashmaster" => manager.ForceSpawn(player, manager.GetConfig<FlashMasterConfig>(), typeof(FlashMasterConfig), null),
|
"flashmaster" => manager.ForceSpawn(player, customClasses.FlashMasterConfig, typeof(FlashMasterConfig), null),
|
||||||
"serpentshand" => manager.ForceSpawn(player, manager.GetConfig<SerpentsHandConfig>(), typeof(SerpentsHandConfig),
|
"serpentshand" => manager.ForceSpawn(player, customClasses.SerpentsHandConfig, typeof(SerpentsHandConfig),
|
||||||
() => SerpentsHandManager.PreSpawn(player)),
|
() =>
|
||||||
"negromancer" => manager.ForceSpawn(player, manager.GetConfig<NegromancerConfig>(), typeof(NegromancerConfig), null),
|
{
|
||||||
"bloodfueled" => manager.ForceSpawn(player, manager.GetConfig<BloodFueledConfig>(), typeof(BloodFueledConfig), null),
|
SerpentsHandManager.PreSpawn(player);
|
||||||
|
}),
|
||||||
|
"negromancer" => manager.ForceSpawn(player, customClasses.NegromancerConfig, typeof(NegromancerConfig), null),
|
||||||
|
"bloodfueled" => manager.ForceSpawn(player, customClasses.BloodFueledConfig, typeof(BloodFueledConfig), null),
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user