diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapedEventArgs.cs
index 0dcecd1b8..d2d55bba3 100644
--- a/EXILED/Exiled.Events/EventArgs/Player/EscapedEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Player/EscapedEventArgs.cs
@@ -8,9 +8,11 @@
namespace Exiled.Events.EventArgs.Player
{
using System;
+ using System.Collections.Generic;
using Exiled.API.Enums;
using Exiled.API.Features;
+ using Exiled.API.Features.Roles;
using Exiled.Events.EventArgs.Interfaces;
using PlayerRoles;
using Respawning;
@@ -25,14 +27,16 @@ public class EscapedEventArgs : IPlayerEvent
///
///
///
- public EscapedEventArgs(Player player, EscapeScenario escapeScenario)
+ ///
+ /// , .
+ public EscapedEventArgs(Player player, EscapeScenario escapeScenario, Role role, KeyValuePair kvp)
{
Player = player;
EscapeScenario = escapeScenario;
- Team = EscapeScenario is EscapeScenario.Scientist or EscapeScenario.CuffedClassD ? SpawnableTeamType.NineTailedFox : SpawnableTeamType.ChaosInsurgency;
- Tickets = Team == SpawnableTeamType.ChaosInsurgency ? 4 : 3;
- OldRole = EscapeScenario is EscapeScenario.Scientist or EscapeScenario.CuffedScientist ? RoleTypeId.Scientist : RoleTypeId.ClassD;
- EscapeTime = (int)Math.Ceiling(player.Role.ActiveTime.TotalSeconds);
+ Team = kvp.Key;
+ Tickets = kvp.Value;
+ OldRole = role.Type;
+ EscapeTime = (int)Math.Ceiling(role.ActiveTime.TotalSeconds);
}
///
@@ -51,7 +55,7 @@ public EscapedEventArgs(Player player, EscapeScenario escapeScenario)
///
/// Gets the amount of tickets gained for this escape.
///
- public int Tickets { get; }
+ public float Tickets { get; }
///
/// Gets the previous role for this player.
diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
index 80142a639..a05c12fec 100644
--- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
@@ -9,7 +9,6 @@ namespace Exiled.Events.Patches.Events.Player
{
#pragma warning disable SA1402 // File may only contain a single type
#pragma warning disable IDE0060
-
using System;
using System.Collections.Generic;
using System.Linq;
@@ -19,11 +18,10 @@ namespace Exiled.Events.Patches.Events.Player
using API.Enums;
using API.Features;
using API.Features.Pools;
-
using EventArgs.Player;
+ using Exiled.API.Features.Roles;
using Exiled.Events.Attributes;
using HarmonyLib;
-
using Respawning;
using static HarmonyLib.AccessTools;
@@ -44,6 +42,7 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset;
@@ -102,16 +101,35 @@ private static IEnumerable Transpiler(IEnumerable x.Is(OpCodes.Stfld, Field(typeof(Escape.EscapeMessage), nameof(Escape.EscapeMessage.EscapeTime)))) + offset;
+
+ newInstructions.InsertRange(index, new CodeInstruction[]
+ {
+ // role = ev.Player.Role
+ new(OpCodes.Ldloc_S, ev.LocalIndex),
+ new(OpCodes.Callvirt, PropertyGetter(typeof(EscapingEventArgs), nameof(EscapingEventArgs.Player))),
+ new(OpCodes.Callvirt, PropertyGetter(typeof(Player), nameof(Player.Role))),
+ new(OpCodes.Stloc_S, role.LocalIndex),
+ });
+
newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[]
{
// ev.Player
new(OpCodes.Ldloc_S, ev.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(EscapingEventArgs), nameof(EscapingEventArgs.Player))),
- // ev.EscapeScenario
+ // escapeScenario
new(OpCodes.Ldloc_1),
- // EscapedEventArgs ev2 = new(ev.Player, ev.EscapeScenario);
+ // role
+ new(OpCodes.Ldloc_S, role.LocalIndex),
+
+ // ev.RespawnTickets.Key
+ new(OpCodes.Ldloc_S, ev.LocalIndex),
+ new(OpCodes.Callvirt, PropertyGetter(typeof(EscapingEventArgs), nameof(EscapingEventArgs.RespawnTickets))),
+
+ // EscapedEventArgs ev2 = new(ev.Player, ev.EscapeScenario, role, float, SpawnableTeamType);
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(EscapedEventArgs))[0]),
// Handlers.Player.OnEscaped(ev);
@@ -138,6 +156,7 @@ private static void GrantAllTickets(EscapingEventArgs ev)
/// Replaces last returned to .
///
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Escaping))]
+ [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Escaped))]
[HarmonyPatch(typeof(Escape), nameof(Escape.ServerGetScenario))]
internal static class GetScenario
{
@@ -165,4 +184,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions);
}
}
-}
+}
\ No newline at end of file