diff --git a/CustomItems/CustomItems.cs b/CustomItems/CustomItems.cs index 2a6a8b9..1fafa39 100644 --- a/CustomItems/CustomItems.cs +++ b/CustomItems/CustomItems.cs @@ -6,17 +6,13 @@ // ----------------------------------------------------------------------- #pragma warning disable SA1200 -using CustomItems.Patches; - namespace CustomItems { using System; - using System.Linq; using Events; using Exiled.API.Features; using Exiled.CustomItems.API; using HarmonyLib; - using Subclass; using Server = Exiled.Events.Handlers.Server; /// @@ -31,8 +27,6 @@ public class CustomItems : Plugin private ServerHandler serverHandler; - private PlayerHandler playerHandler; - /// /// Gets the Plugin instance. /// @@ -46,7 +40,6 @@ public override void OnEnabled() { Instance = this; serverHandler = new ServerHandler(); - playerHandler = new PlayerHandler(); harmonyInstance = new Harmony($"com.{nameof(CustomItems)}.galaxy-{DateTime.Now.Ticks}"); harmonyInstance.PatchAll(); @@ -54,17 +47,6 @@ public override void OnEnabled() Config.LoadItems(); RegisterItems(); - Log.Debug("Checking for Subclassing...", Config.IsDebugEnabled); - - try - { - CheckAndPatchSubclassing(); - } - catch (Exception) - { - Log.Debug("Subclassing not installed.", Config.IsDebugEnabled); - } - Server.ReloadedConfigs += serverHandler.OnReloadingConfigs; base.OnEnabled(); @@ -76,12 +58,10 @@ public override void OnDisabled() UnregisterItems(); Server.ReloadedConfigs -= serverHandler.OnReloadingConfigs; - Events.AddClassEvent.AddClass -= playerHandler.OnAddingSubclass; harmonyInstance?.UnpatchAll(); serverHandler = null; - playerHandler = null; Instance = null; base.OnDisabled(); @@ -156,15 +136,5 @@ private void UnregisterItems() Instance.Config.ItemConfigs.AutoGuns?.Unregister(); } - - private void CheckAndPatchSubclassing() - { - if (Exiled.Loader.Loader.Plugins.All(pugin => pugin.Name != "Subclass")) - return; - - Config.ParseSubclassList(); - Instance.harmonyInstance.Patch(HarmonyLib.AccessTools.Method(typeof(TrackingAndMethods), nameof(TrackingAndMethods.AddClass)), postfix: new HarmonyMethod(HarmonyLib.AccessTools.Method(typeof(AddClass), nameof(AddClass.Postfix)))); - Events.AddClassEvent.AddClass += playerHandler.OnAddingSubclass; - } } } diff --git a/CustomItems/CustomItems.csproj b/CustomItems/CustomItems.csproj index 398b445..f06052f 100644 --- a/CustomItems/CustomItems.csproj +++ b/CustomItems/CustomItems.csproj @@ -53,43 +53,40 @@ $(EXILED_REFERENCES)\CommandSystem.Core.dll - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.API.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.API.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.Bootstrap.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.Bootstrap.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.CreditTags.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.CreditTags.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.CustomItems.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.CustomItems.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.CustomRoles.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.CustomRoles.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.Events.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.Events.dll True - - ..\..\EXILED\bin\Debug\Exiled.Example.dll - - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.Loader.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.Loader.dll True - - ..\packages\EXILED.3.0.3\lib\net472\Exiled.Permissions.dll + + ..\packages\EXILED.3.1.1\lib\net472\Exiled.Permissions.dll True - ..\packages\EXILED.3.0.3\lib\net472\Exiled.Updater.dll + ..\packages\EXILED.3.1.1\lib\net472\Exiled.Updater.dll True @@ -98,9 +95,6 @@ ..\..\References\NorthwoodLib.dll - - $(EXILED_REFERENCES)\Subclass.dll - @@ -123,10 +117,7 @@ - - - @@ -144,7 +135,6 @@ - diff --git a/CustomItems/Events/AddClassEvent.cs b/CustomItems/Events/AddClassEvent.cs deleted file mode 100644 index c249630..0000000 --- a/CustomItems/Events/AddClassEvent.cs +++ /dev/null @@ -1,29 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Galaxy119 and iopietro. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace CustomItems.Events -{ - using Exiled.Events.Extensions; - using Subclass; - - /// - /// Event for . - /// - public class AddClassEvent - { - /// - /// The event. - /// - public static event Exiled.Events.Events.CustomEventHandler AddClass; - - /// - /// The method for calling the event safely. - /// - /// . - public static void OnAddingClass(AddClassEventArgs ev) => AddClass.InvokeSafely(ev); - } -} \ No newline at end of file diff --git a/CustomItems/Events/AddClassEventArgs.cs b/CustomItems/Events/AddClassEventArgs.cs deleted file mode 100644 index 8285f26..0000000 --- a/CustomItems/Events/AddClassEventArgs.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Galaxy119 and iopietro. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace CustomItems.Events -{ - using System; - using Exiled.API.Features; - using Subclass; - - /// - /// The for the . - /// - public class AddClassEventArgs : EventArgs - { - /// - /// Initializes a new instance of the class. - /// - /// The triggering the event. - /// The being assigned. - public AddClassEventArgs(Player player, SubClass subClass) - { - Player = player; - Subclass = subClass; - } - - /// - /// Gets the . - /// - public Player Player { get; } - - /// - /// Gets the . - /// - public SubClass Subclass { get; } - } -} \ No newline at end of file diff --git a/CustomItems/Events/PlayerHandler.cs b/CustomItems/Events/PlayerHandler.cs deleted file mode 100644 index 899de1a..0000000 --- a/CustomItems/Events/PlayerHandler.cs +++ /dev/null @@ -1,38 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Galaxy119 and iopietro. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace CustomItems.Events -{ - using System; - using System.Collections.Generic; - using Exiled.CustomItems.API.Features; - using MEC; - using static CustomItems; - - /// - /// Event Handlers. - /// - public class PlayerHandler - { - /// - /// AddingClass handler. - /// - /// . - public void OnAddingSubclass(AddClassEventArgs ev) - { - if (!Instance.Config.SubclassItems.TryGetValue(ev.Subclass.Name, out List> customItems)) - return; - - foreach ((CustomItem item, float chance) in customItems) - { - int r = Instance.Rng.Next(100); - if (r <= chance) - Timing.CallDelayed(1.5f, () => item.Give(ev.Player)); - } - } - } -} \ No newline at end of file diff --git a/CustomItems/Items/Scp2818.cs b/CustomItems/Items/Scp2818.cs index 6d25e3f..9d93bbb 100644 --- a/CustomItems/Items/Scp2818.cs +++ b/CustomItems/Items/Scp2818.cs @@ -10,6 +10,7 @@ namespace CustomItems.Items using System; using System.Collections.Generic; using System.ComponentModel; + using System.Linq; using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.API.Features.Spawn; @@ -92,7 +93,7 @@ protected override void OnShooting(ShootingEventArgs ev) { try { - foreach (Item item in ev.Shooter.Items) + foreach (Item item in ev.Shooter.Items.ToList()) if (Check(item)) { Log.Debug($"SCP-2818: Found a 2818 in inventory of shooter, removing."); diff --git a/CustomItems/Patches/AddClass.cs b/CustomItems/Patches/AddClass.cs deleted file mode 100644 index 962cff5..0000000 --- a/CustomItems/Patches/AddClass.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Galaxy119 and iopietro. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace CustomItems.Patches -{ - using Events; - using Exiled.API.Features; - using Subclass; - - /// - /// Patch for . - /// - internal static class AddClass - { - /// - /// Postfix - Called after base method finishes. - /// - /// The being changed. - /// The being added. - /// Whether or not they are SCP-035. - /// Whether or not it is lite. - /// Whether or not it is an escape. - /// Whether or not the player is disguised. - public static void Postfix(Player player, SubClass subClass, bool is035 = false, bool lite = false, bool escaped = false, bool disguised = false) - { - AddClassEventArgs ev = new AddClassEventArgs(player, subClass); - AddClassEvent.OnAddingClass(ev); - } - } -} \ No newline at end of file diff --git a/CustomItems/Properties/AssemblyInfo.cs b/CustomItems/Properties/AssemblyInfo.cs index 58247d8..d918102 100644 --- a/CustomItems/Properties/AssemblyInfo.cs +++ b/CustomItems/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("4.0.2.0")] +[assembly: AssemblyFileVersion("4.0.2.0")] \ No newline at end of file diff --git a/CustomItems/packages.config b/CustomItems/packages.config index 1475abf..5bca6db 100644 --- a/CustomItems/packages.config +++ b/CustomItems/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file