diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs index 50437dc5b..17c16af89 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs @@ -59,29 +59,20 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label returnLabel = generator.DefineLabel(); + Label continueLabel = generator.DefineLabel(); int offset = -5; int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpArmorEventArgs))[0]) + offset; + newInstructions[index].labels.Add(continueLabel); + newInstructions.InsertRange( index, - new CodeInstruction[] - { + [ + // this.Hub new(OpCodes.Ldarg_0), new(OpCodes.Callvirt, PropertyGetter(typeof(ArmorSearchCompletor), nameof(ArmorSearchCompletor.Hub))), @@ -62,12 +66,21 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label retLabel = generator.DefineLabel(); Label continueLabel = generator.DefineLabel(); - LocalBuilder info = generator.DeclareLocal(typeof(PickupSyncInfo)); - LocalBuilder ev = generator.DeclareLocal(typeof(PickingUpItemEventArgs)); - int offset = -4; int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpItemEventArgs))[0]) + offset; @@ -64,40 +60,27 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label returnLabel = generator.DefineLabel(); + Label continueLabel = generator.DefineLabel(); int offset = -4; int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpItemEventArgs))[0]) + offset; + List