From 518d2ffd4f6092ca6a895dcdac9600db212fc970 Mon Sep 17 00:00:00 2001 From: xRoier Date: Fri, 3 Mar 2023 07:01:44 +0100 Subject: [PATCH] Isn't this cleaner? --- Config.cs | 30 +++++++++-------------- EventHandlers.cs | 29 +++------------------- SCPSpeedBoost.csproj | 58 ++++++++++++++++++++++++-------------------- packages.config | 4 +++ 4 files changed, 51 insertions(+), 70 deletions(-) create mode 100644 packages.config diff --git a/Config.cs b/Config.cs index ffff063..415f20e 100644 --- a/Config.cs +++ b/Config.cs @@ -24,24 +24,16 @@ public class Config : IConfig [Description("Whether or not the effect will apply to the specified SCPs when you forceclass them:")] public bool EffectOnForceclass { get; set; } = true; */ - - [Description("SCP 173s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP173Boost { get; set; } = 0; - - [Description("SCP 096s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP096Boost { get; set; } = 0; - - [Description("SCP 106s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP106Boost { get; set; } = 0; - - [Description("SCP 939s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP939Boost { get; set; } = 0; - - [Description("SCP 049s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP049Boost { get; set; } = 0; - - [Description("SCP 049-2s Movement Boost percentage (up to 255). Leave 0 for no boost:")] - public byte SCP0492Boost { get; set; } = 0; - + + [Description("The speed boost for SCPs (up to 255). Leave 0 for no boost:")] + public Dictionary SpeedBoost { get; set; } = new Dictionary + { + [RoleTypeId.Scp173] = 0, + [RoleTypeId.Scp096] = 0, + [RoleTypeId.Scp106] = 0, + [RoleTypeId.Scp939] = 0, + [RoleTypeId.Scp049] = 0, + [RoleTypeId.Scp0492] = 0 + }; } } diff --git a/EventHandlers.cs b/EventHandlers.cs index f9722b9..170a876 100644 --- a/EventHandlers.cs +++ b/EventHandlers.cs @@ -12,6 +12,7 @@ using PlayerRoles; using MEC; using Exiled.Events.Handlers; +using Player = Exiled.Events.Handlers.Player; namespace SCPSpeedBoost { @@ -20,31 +21,9 @@ public static class EventHandlers { public static void ChangingRole(ChangingRoleEventArgs ev) { - switch (ev.NewRole) - { - case RoleTypeId.Scp173: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP173Boost)); - break; - case RoleTypeId.Scp096: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP096Boost)); - break; - case RoleTypeId.Scp106: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP106Boost)); - break; - case RoleTypeId.Scp939: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP939Boost)); - break; - case RoleTypeId.Scp049: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP049Boost)); - break; - case RoleTypeId.Scp0492: - Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, Plugin.plugin.Config.SCP0492Boost)); - break; - case RoleTypeId.Spectator: - ev.Player.DisableEffect(EffectType.MovementBoost); - break; - - } + if (!Plugin.plugin.Config.SpeedBoost.TryGetValue(ev.NewRole, out byte speedBoost)) return; + if (speedBoost <= 0) return; + Timing.CallDelayed(2f, () => Methods.AddEffect(ev.Player, speedBoost)); } } } diff --git a/SCPSpeedBoost.csproj b/SCPSpeedBoost.csproj index 8566234..e718492 100644 --- a/SCPSpeedBoost.csproj +++ b/SCPSpeedBoost.csproj @@ -31,35 +31,44 @@ 4 - - ..\..\..\..\Documents\EXILED\Plugins\dependencies\0Harmony.dll - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Assembly-CSharp-Publicized.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + $(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll + + + packages\EXILED.6.0.0-beta.26\lib\net48\CommandSystem.Core.dll + + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.API.dll + + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.CreditTags.dll + + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.CustomItems.dll - - ..\..\..\..\Documents\EXILED\Plugins\dependencies\Exiled.API.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.CustomRoles.dll - - ..\..\..\..\Documents\EXILED\Plugins\Exiled.CreditTags.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.Events.dll - - ..\..\..\..\Documents\EXILED\Plugins\Exiled.CustomItems.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.Loader.dll - - ..\..\..\..\Documents\EXILED\Plugins\Exiled.CustomRoles.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.Permissions.dll - - ..\..\..\..\Documents\EXILED\Plugins\Exiled.Events.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\Exiled.Updater.dll - - ..\..\..\..\Documents\SCP Secret Laboratory\PluginAPI\plugins\global\Exiled.Loader.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\NorthwoodLib.dll - - ..\..\..\..\Documents\EXILED\Plugins\Exiled.Permissions.dll + + packages\EXILED.6.0.0-beta.26\lib\net48\PluginAPI.dll @@ -69,12 +78,6 @@ - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - ..\..\..\..\Documents\EXILED\Plugins\dependencies\YamlDotNet.dll - @@ -83,5 +86,8 @@ + + + \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..cb4b663 --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file