diff --git a/EXILED/Exiled.Events/Patches/Fixes/Fix106RegenerationWithScp244.cs b/EXILED/Exiled.Events/Patches/Fixes/Fix106RegenerationWithScp244.cs index fa2f0fd0e..33c54d5ad 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/Fix106RegenerationWithScp244.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/Fix106RegenerationWithScp244.cs @@ -31,10 +31,12 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); + LocalBuilder scp106Role = generator.DeclareLocal(typeof(Scp106Role)); + Label continueLabel = generator.DefineLabel(); + int offset = 1; int index = newInstructions.FindLastIndex(x => x.operand == (object)Method(typeof(SpawnProtected), nameof(SpawnProtected.CheckPlayer))) + offset; - Label continueLabel = generator.DefineLabel(); Label skip = (Label)newInstructions[index].operand; index += offset; @@ -49,14 +51,14 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); + Label cnt = generator.DefineLabel(); + int offset = 0; - int index = newInstructions.FindIndex(x => x.operand == (object)Field(typeof(Scp2176Projectile), nameof(Scp2176Projectile.OnServerShattered))) + offset; + int index = newInstructions.FindIndex(x => x.LoadsField(Field(typeof(RoomLightController), nameof(RoomLightController.Instances)))) + offset; + + Label skip = newInstructions[index].labels[0]; - Label skip = (Label)newInstructions[index].operand; + offset = -3; + index += offset; newInstructions.InsertRange(index, new[] { @@ -44,16 +52,17 @@ private static IEnumerable Transpiler(IEnumerable x.operand == (object)Field(typeof(RoomLightController), nameof(RoomLightController.Instances))) + offset; + new(OpCodes.Brfalse_S, cnt), + + new(OpCodes.Pop), + new(OpCodes.Br_S, skip), - newInstructions[index].labels.Add(skip); + new CodeInstruction(OpCodes.Nop).WithLabels(cnt), + }); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Fixes/WarheadConfigLockGateFix.cs b/EXILED/Exiled.Events/Patches/Fixes/WarheadConfigLockGateFix.cs index be2fbff58..2c65c58a8 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/WarheadConfigLockGateFix.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/WarheadConfigLockGateFix.cs @@ -33,7 +33,7 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); // replace Contains with StartWith - int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(string), nameof(string.Contains))); + int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(string), nameof(string.Contains), new[] { typeof(string) })); newInstructions[index].operand = Method(typeof(string), nameof(string.StartsWith), new System.Type[] { typeof(string) }); for (int z = 0; z < newInstructions.Count; z++)