From 61399d1a2494e8b8ae4ad558845d4f89854a401c Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:32:44 +0200 Subject: [PATCH 1/4] Update RoundEnd.cs --- Exiled.Events/Patches/Events/Server/RoundEnd.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index b8711cc891..5905dbf798 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -100,9 +100,7 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldstr && x.operand == (object)"auto_round_restart_time") + offset; - - LocalBuilder evEndedRound = generator.DeclareLocal(typeof(RoundEndedEventArgs)); - + newInstructions.InsertRange( index, new CodeInstruction[] @@ -121,13 +119,12 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 23 Oct 2023 16:39:50 +0200 Subject: [PATCH 2/4] Update RoundEnd.cs --- Exiled.Events/Patches/Events/Server/RoundEnd.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index 5905dbf798..35bd10d807 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -119,7 +119,6 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 23 Oct 2023 16:47:33 +0200 Subject: [PATCH 3/4] Update RoundEnd.cs --- Exiled.Events/Patches/Events/Server/RoundEnd.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index 35bd10d807..f1ff6d0f6b 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -128,8 +128,6 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 23 Oct 2023 18:27:00 +0200 Subject: [PATCH 4/4] Full Fix --- .../Patches/Events/Server/RoundEnd.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index f1ff6d0f6b..21ff8a28e4 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -43,6 +43,9 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); + const string LeadingTeam = "5__9"; + const string NewList = "5__3"; + // Replace ChaosTargetCount == 0 with ChaosTargetCount <= 0 int offset = 1; int index = newInstructions.FindIndex(x => x.Calls(PropertyGetter(typeof(RoundSummary), nameof(RoundSummary.ChaosTargetCount)))) + offset; @@ -68,11 +71,11 @@ private static IEnumerable Transpiler(IEnumerable5__9")), + new(OpCodes.Ldfld, Field(PrivateType, LeadingTeam)), // this.newList new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(PrivateType, "5__3")), + new(OpCodes.Ldfld, Field(PrivateType, NewList)), // shouldRoundEnd new(OpCodes.Ldloc_3), @@ -89,7 +92,7 @@ private static IEnumerable Transpiler(IEnumerable5__9")), + new(OpCodes.Stfld, Field(PrivateType, LeadingTeam)), // this._roundEnded = ev.IsAllowed new(OpCodes.Ldloc_1), @@ -100,21 +103,22 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldstr && x.operand == (object)"auto_round_restart_time") + offset; - + + LocalBuilder timeToRestartIndex = (LocalBuilder)newInstructions[index - 1].operand; newInstructions.InsertRange( index, new CodeInstruction[] { // this.leadingTeam new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(PrivateType, "5__9")), + new(OpCodes.Ldfld, Field(PrivateType, LeadingTeam)), // this.newList new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(PrivateType, "5__3")), + new(OpCodes.Ldfld, Field(PrivateType, NewList)), // timeToRestart - new(OpCodes.Ldloc_S, 5), + new(OpCodes.Ldloc_S, timeToRestartIndex), // RoundEndedEventArgs evEndedRound = new(RoundSummary.LeadingTeam, RoundSummary.SumInfo_ClassList, bool); new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RoundEndedEventArgs))[0]), @@ -125,7 +129,7 @@ private static IEnumerable Transpiler(IEnumerable