Skip to content

Commit 35ee723

Browse files
committed
Fix RoundEnd completelly
1 parent 3f6bea2 commit 35ee723

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,13 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
9696
newInstructions.RemoveRange(index, index2 - index);
9797

9898
// put the LeadingTeam logic before the event
99-
offset = -1;
99+
offset = 1;
100100
index = newInstructions.FindIndex(x => x.StoresField(Field(typeof(RoundSummary), nameof(RoundSummary._roundEnded)))) + offset;
101101

102102
newInstructions.InsertRange(index, leadingTeamLogic);
103103

104104
// recorect the index because of the LeadingTeamLogic that got moved
105-
offset = -1;
106-
index = newInstructions.FindIndex(x => x.StoresField(Field(typeof(RoundSummary), nameof(RoundSummary._roundEnded)))) + offset;
105+
index = leadingTeamLogic.Count + index;
107106

108107
LocalBuilder evEndingRound = generator.DeclareLocal(typeof(EndingRoundEventArgs));
109108

@@ -119,7 +118,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
119118
new(OpCodes.Ldarg_0),
120119
new(OpCodes.Ldfld, Field(PrivateType, NewList)),
121120

122-
// RoundSummary._roundEnded
121+
// this._roundEnded
122+
new(OpCodes.Ldarg_0),
123123
new(OpCodes.Ldfld, Field(typeof(RoundSummary), nameof(RoundSummary._roundEnded))),
124124

125125
// EndingRoundEventArgs evEndingRound = new(LeadingTeam, RoundSummary.SumInfo_ClassList, bool);
@@ -130,7 +130,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
130130
new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnEndingRound))),
131131
new(OpCodes.Stloc_S, evEndingRound.LocalIndex),
132132

133-
// RoundSummary._roundEnded = ev.IsAllowed
133+
// this._roundEnded = ev.IsAllowed
134+
new(OpCodes.Ldarg_0),
134135
new(OpCodes.Ldloc_S, evEndingRound.LocalIndex),
135136
new(OpCodes.Callvirt, PropertyGetter(typeof(EndingRoundEventArgs), nameof(EndingRoundEventArgs.IsAllowed))),
136137
new(OpCodes.Stfld, Field(typeof(RoundSummary), nameof(RoundSummary._roundEnded))),

0 commit comments

Comments
 (0)