diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs index 5064239e0..39ee240d8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs @@ -41,6 +41,7 @@ private static IEnumerable Transpiler(IEnumerable)); + LocalBuilder footprint = generator.DeclareLocal(typeof(Footprint)); ExceptionBlock beginTry = new(ExceptionBlockType.BeginExceptionBlock); ExceptionBlock beginFinally = new(ExceptionBlockType.BeginFinallyBlock); @@ -78,13 +79,23 @@ private static IEnumerable Transpiler(IEnumerable), nameof(IEnumerator.Current))), + new(OpCodes.Stloc_S, footprint), + new(OpCodes.Ldloc_S, footprint), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(Footprint) })), new(OpCodes.Ldloc_S, cause), new(OpCodes.Newobj, Constructor(typeof(AnnouncingScpTerminationEventArgs), new[] { typeof(Player), typeof(string) })), new(OpCodes.Dup), + new(OpCodes.Dup), new(OpCodes.Call, Method(typeof(Map), nameof(Map.OnAnnouncingScpTermination))), new(OpCodes.Callvirt, PropertyGetter(typeof(AnnouncingScpTerminationEventArgs), nameof(AnnouncingScpTerminationEventArgs.TerminationCause))), new(OpCodes.Stloc_S, cause), + new(OpCodes.Callvirt, PropertyGetter(typeof(AnnouncingScpTerminationEventArgs), nameof(AnnouncingScpTerminationEventArgs.IsAllowed))), + new(OpCodes.Brtrue, entryLabel), + + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(CassieScpTerminationAnnouncement), nameof(CassieScpTerminationAnnouncement._victims))), + new(OpCodes.Ldloc_S, footprint), + new(OpCodes.Callvirt, Method(typeof(List), nameof(List<>.Remove))), // entry point new CodeInstruction(OpCodes.Ldloc_S, enumerator).WithLabels(entryLabel),