diff --git a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index bbdce5c08..216676772 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -18,6 +18,9 @@ public class EndingRoundEventArgs : IDeniableEvent /// /// Initializes a new instance of the class. /// + /// + /// + /// /// /// /// @@ -27,10 +30,10 @@ public class EndingRoundEventArgs : IDeniableEvent /// /// /// - public EndingRoundEventArgs(RoundSummary.SumInfo_ClassList classList, bool isForceEnded, bool isAllowed) + public EndingRoundEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, bool isForceEnded, bool isAllowed) { + LeadingTeam = leadingTeam; ClassList = classList; - LeadingTeam = GetLeadingTeam(classList); IsForceEnded = isForceEnded; IsAllowed = isAllowed; } @@ -54,25 +57,5 @@ public EndingRoundEventArgs(RoundSummary.SumInfo_ClassList classList, bool isFor /// Gets or sets a value indicating whether the round is going to finish or not. /// public bool IsAllowed { get; set; } - - private LeadingTeam GetLeadingTeam(RoundSummary.SumInfo_ClassList classList) - { - // NW logic - int facilityForces = classList.mtf_and_guards + classList.scientists; - int chaosInsurgency = classList.chaos_insurgents + classList.class_ds; - int anomalies = classList.scps_except_zombies + classList.zombies; - int num4 = facilityForces > 0 ? 1 : 0; - bool flag1 = chaosInsurgency > 0; - bool flag2 = anomalies > 0; - RoundSummary.LeadingTeam leadingTeam = RoundSummary.LeadingTeam.Draw; - if (num4 != 0) - leadingTeam = RoundSummary.EscapedScientists >= RoundSummary.EscapedClassD ? RoundSummary.LeadingTeam.FacilityForces : RoundSummary.LeadingTeam.Draw; - else if (flag2 || flag2 & flag1) - leadingTeam = RoundSummary.EscapedClassD > RoundSummary.SurvivingSCPs ? RoundSummary.LeadingTeam.ChaosInsurgency : (RoundSummary.SurvivingSCPs > RoundSummary.EscapedScientists ? RoundSummary.LeadingTeam.Anomalies : RoundSummary.LeadingTeam.Draw); - else if (flag1) - leadingTeam = RoundSummary.EscapedClassD >= RoundSummary.EscapedScientists ? RoundSummary.LeadingTeam.ChaosInsurgency : RoundSummary.LeadingTeam.Draw; - - return (LeadingTeam)leadingTeam; - } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index 4eee538b2..e890ef80d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -76,16 +76,35 @@ private static IEnumerable Transpiler(IEnumerable x.StoresField(Field(PrivateType, LeadingTeam))) + offset; + int offset2 = 1; + int index2 = newInstructions.FindLastIndex(x => x.StoresField(Field(PrivateType, LeadingTeam))) + offset2; + List leadingTeamLogic = newInstructions.GetRange(index, index2 - index); + List