diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs index 4e972b1ea..bbe2df585 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs @@ -33,7 +33,7 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = 2; + int offset = -5; int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldloc_S) + offset; Label continueLabel = generator.DefineLabel(); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs index 87ae36385..e9efe18fb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs @@ -31,15 +31,9 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldarg_0); - Label retLabel = generator.DefineLabel(); - newInstructions[newInstructions.Count - 1].labels.Add(retLabel); - - newInstructions.InsertRange( - index, - new CodeInstruction[] + newInstructions.InsertRange(0, new CodeInstruction[] { // Player.Get(this.Owner); new(OpCodes.Ldarg_0), @@ -62,6 +56,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldfld && x.operand == (object)Field(typeof(Scp2536GiftBase), nameof(Scp2536GiftBase.ObtainedBy))) + offset; + int index = newInstructions.FindLastIndex(x => x.LoadsField(Field(typeof(Scp2536GiftBase), nameof(Scp2536GiftBase.ObtainedBy)))) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { diff --git a/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs b/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs index 4f11ebd0f..9c18800f6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs @@ -34,12 +34,12 @@ private static IEnumerable Transpiler(IEnumerable x.operand == (object)Method(typeof(Scp2536GiftController), nameof(Scp2536GiftController.RpcSetGiftState))) + offset; + int index = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(Scp2536GiftController), nameof(Scp2536GiftController.RpcSetGiftState)))) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { // Player.Get(hub); - new(OpCodes.Ldarg_1), + new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // true