Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public class EscapingPocketDimensionEventArgs : IPlayerEvent, IDeniableEvent
/// <param name="pocketDimensionTeleport">
/// <inheritdoc cref="Teleporter" />
/// </param>
/// <param name="player">
/// <param name="hub">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="position">
/// <inheritdoc cref="TeleportPosition" />
/// </param>
public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, Player player, Vector3 position)
public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, ReferenceHub hub, Vector3 position)
{
Teleporter = pocketDimensionTeleport;
Player = player;
Player = Player.Get(hub);
TeleportPosition = position;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new[]
{
// pocketDimensionTeleport
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]),

// referenceHub
new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),
new CodeInstruction(OpCodes.Ldarg_1),

// Scp106PocketExitFinder.GetBestExitPosition(fpcRole)
new(OpCodes.Ldloc_0),
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/Landing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
// Player.Get(base.OwnerHub)
new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]),
new(OpCodes.Call, PropertyGetter(typeof(CharacterModel), nameof(CharacterModel.OwnerHub))),
new(OpCodes.Callvirt, PropertyGetter(typeof(CharacterModel), nameof(CharacterModel.OwnerHub))),
new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })),

// LandingEventArgs ev = new(Player)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
Label returnLabel = generator.DefineLabel();

int offset = -3;
int offset = -6;
int index = newInstructions.FindIndex(
instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerCuffingEventArgs))[0]) + offset;
instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerUncuffingEventArgs))[0]) + offset;

newInstructions.InsertRange(
index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player
using Exiled.Events.EventArgs.Player;

using HarmonyLib;

using LabApi.Features.Enums;
using RemoteAdmin;

using static HarmonyLib.AccessTools;
Expand Down Expand Up @@ -67,8 +67,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
// command
new (OpCodes.Ldloc_S, 4),

// commandtype client
new(OpCodes.Ldc_I4_2),
// CommandType.Client
new(OpCodes.Ldc_I4_S, (sbyte)CommandType.Client),

// query
new(OpCodes.Ldarg_1),
Expand Down Expand Up @@ -130,25 +130,20 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
});

offset = 1;
index = newInstructions.FindIndex(instrction => instrction.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset;
index = newInstructions.FindLastIndex(i => i.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset;
newInstructions.InsertRange(
index,
new CodeInstruction[]
{
// this
new(OpCodes.Ldarg_0),

// this._hub
new(OpCodes.Ldfld, Field(typeof(QueryProcessor), nameof(QueryProcessor._hub))),

// Player.Get(Hub)
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(ReferenceHub) })),
// Player.Get(sender)
new(OpCodes.Ldloc_0),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })),

// command
new(OpCodes.Ldloc_1),
new(OpCodes.Ldloc_S, 4),

// commandtype CLIENT
new(OpCodes.Ldc_I4_2),
// CommandType.Client
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.Client),

// query
new(OpCodes.Ldarg_1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player
using Exiled.Events.EventArgs.Player;

using HarmonyLib;

using LabApi.Features.Enums;
using RemoteAdmin;

using static HarmonyLib.AccessTools;
Expand Down Expand Up @@ -66,8 +66,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
// command
new (OpCodes.Ldloc_2),

// commandtype
new (OpCodes.Ldc_I4_4),
// CommandType.RemoteAdmin
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.RemoteAdmin),

// query
new (OpCodes.Ldarg_0),
Expand Down Expand Up @@ -128,22 +128,22 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
});

offset = 1;
index = newInstructions.FindIndex(instrction => instrction.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset;
index = newInstructions.FindIndex(i => i.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset;
newInstructions.InsertRange(
index,
new CodeInstruction[]
new[]
{
// sender
new (OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),

// Player.get(sender)
new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(CommandSender) })),
new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })),

// command
new (OpCodes.Ldloc_2),

// commandtype
new (OpCodes.Ldc_I4_4),
// CommandType.RemoteAdmin
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.RemoteAdmin),

// query
new (OpCodes.Ldarg_0),
Expand Down
Loading