Skip to content

Commit

Permalink
Comment transpilers
Browse files Browse the repository at this point in the history
  • Loading branch information
x3rt committed Aug 1, 2024
1 parent 1f80cd5 commit 5eae4a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/Verified.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
const int offset = 1;
int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Callvirt && x.OperandIs(Method(typeof(CharacterClassManager), nameof(CharacterClassManager.SyncServerCmdBinding)))) + offset;

// Verified.PlayerVerified(this._hub);
newInstructions.InsertRange(
index,
new[]
{
// Verified.PlayerVerified(this._hub);
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, Field(typeof(NicknameSync), nameof(NicknameSync._hub))),
new CodeInstruction(OpCodes.Call, Method(typeof(Verified), nameof(Verified.PlayerVerified))),
Expand Down
6 changes: 6 additions & 0 deletions EXILED/Exiled.Events/Patches/Generic/OfflineModeIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,22 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
index,
new[]
{
// if (Player.PlayersUserIds.ContainsKey(this.UserId)) goto skip;
new(OpCodes.Ldsfld, Field(typeof(PluginAPI.Core.Player), nameof(PluginAPI.Core.Player.PlayersUserIds))),
new(OpCodes.Ldarg_0),
new(OpCodes.Call, PropertyGetter(typeof(PlayerAuthenticationManager), nameof(PlayerAuthenticationManager.UserId))),
new(OpCodes.Callvirt, Method(typeof(Dictionary<string, IGameComponent>), nameof(Dictionary<string, IGameComponent>.ContainsKey))),
new(OpCodes.Brtrue_S, skipLabel),

// Player.PlayersUserIds.Add(this.UserId, this._hub);
new(OpCodes.Ldsfld, Field(typeof(PluginAPI.Core.Player), nameof(PluginAPI.Core.Player.PlayersUserIds))),
new(OpCodes.Ldarg_0),
new(OpCodes.Call, PropertyGetter(typeof(PlayerAuthenticationManager), nameof(PlayerAuthenticationManager.UserId))),
new(OpCodes.Ldarg_0),
new(OpCodes.Ldfld, Field(typeof(PlayerAuthenticationManager), nameof(PlayerAuthenticationManager._hub))),
new(OpCodes.Callvirt, Method(typeof(Dictionary<string, IGameComponent>), nameof(Dictionary<string, IGameComponent>.Add))),

// skip:
new CodeInstruction(OpCodes.Nop).WithLabels(skipLabel),
});

Expand Down Expand Up @@ -139,6 +144,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
index,
new[]
{
// EventManager.ExecuteEvent(new PlayerJoinedEvent(this._hub));
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, Field(typeof(NicknameSync), nameof(NicknameSync._hub))),
new CodeInstruction(OpCodes.Call, Method(typeof(OfflineModeJoin), nameof(ExecuteNwEvent))),
Expand Down

0 comments on commit 5eae4a9

Please sign in to comment.