diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index ed334f5196..fb06a1b860 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -61,6 +61,12 @@ public static class Round /// public static bool IsLobby => !(IsEnded || IsStarted); + /// + /// Gets a value indicating the last ClassList. + /// + /// this value is only updated when Round is and not . + public static RoundSummary.SumInfo_ClassList LastClassList { get; internal set; } + /// /// Gets or sets a value indicating the amount of Chaos Targets remaining. /// @@ -121,6 +127,7 @@ public static int Kills public static int SurvivingSCPs { get => RoundSummary.SurvivingSCPs; + [Obsolete("This value is rewritten by NW every time it's used", true)] set => RoundSummary.SurvivingSCPs = value; } diff --git a/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs index 6536962f86..c481036833 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs @@ -49,5 +49,10 @@ public RoundEndedEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassLi /// Gets or sets the time to restart the next round. /// public int TimeToRestart { get; set; } + + /// + /// Gets or sets a value indicating whether Round Summary will be sent to all players. + /// + public bool ShowRoundSummary { get; set; } = true; } } \ 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 fff92653a3..53d47f633a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -20,6 +20,7 @@ namespace Exiled.Events.Patches.Events.Server using PlayerRoles; using static HarmonyLib.AccessTools; + using static RoundSummary; /// /// Patches . @@ -131,6 +132,17 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Stfld && x.operand == (object)Field(typeof(SumInfo_ClassList), nameof(SumInfo_ClassList.warhead_kills))) + offset; + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldflda, Field(PrivateType, NewList)), + new(OpCodes.Call, PropertySetter(typeof(Round), nameof(Round.LastClassList))), + }); + + Label skip = generator.DefineLabel(); + offset = 7; index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldstr && x.operand == (object)"auto_round_restart_time") + offset; @@ -153,6 +165,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Call && x.operand == (object)Method(typeof(RoundSummary), nameof(RoundSummary.RpcShowRoundSummary))) + offset; + newInstructions[index].labels.Add(skip); + for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z];