Skip to content

Commit

Permalink
Merge branch 'xmas-2024-from-xmas-2023' into Adding-TapeUsingEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 committed Dec 26, 2024
2 parents 4547fd0 + 5b31a05 commit b85aad0
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions EXILED/Exiled.API/Features/Coffee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static IEnumerable<Player> BlacklistedPlayers
/// <summary>
/// Gets the list with all available <see cref="Coffee"/> instanses.
/// </summary>
[Obsolete("This list will be empty")]
public static IReadOnlyCollection<Coffee> List => BaseToWrapper.Values;

/// <summary>
Expand Down Expand Up @@ -107,6 +108,7 @@ public string TranslationAuthor
/// </summary>
/// <param name="predicate">The condition to satisfy.</param>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="Coffee"/> matching the condition.</returns>
[Obsolete("The respond list will be empty")]
public static IEnumerable<Coffee> Get(Func<Coffee, bool> predicate) => List.Where(predicate);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Scp3114Ragdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public float RevealElapsed
}

/// <summary>
/// Gets or sets a value indicating whether or not this corpse will trigger animation.
/// Gets or sets a value indicating whether this corpse will trigger animation.
/// </summary>
public bool IsPlayingAnimation
{
Expand Down
1 change: 1 addition & 0 deletions EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static void OnMapGenerated()
PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.ChaosInsurgency] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.ChaosConscript);
PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.OtherAlive] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Tutorial);
PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.Dead] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Spectator);
PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.Flamingos] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Flamingo);

Timing.CallDelayed(1, Handlers.Map.OnGenerated);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

int offset = 2;
int offset = -5;
int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldloc_S) + offset;

Label continueLabel = generator.DefineLabel();
Expand Down
10 changes: 3 additions & 7 deletions EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldarg_0);

Label retLabel = generator.DefineLabel();

newInstructions[newInstructions.Count - 1].labels.Add(retLabel);

newInstructions.InsertRange(
index,
new CodeInstruction[]
newInstructions.InsertRange(0, new CodeInstruction[]
{
// Player.Get(this.Owner);
new(OpCodes.Ldarg_0),
Expand All @@ -62,6 +56,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Brfalse_S, retLabel),
});

newInstructions[newInstructions.Count - 1].labels.Add(retLabel);

for (int z = 0; z < newInstructions.Count; z++)
yield return newInstructions[z];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldc_I4_4);

Label retLabel = generator.DefineLabel();

LocalBuilder ev = generator.DeclareLocal(typeof(SpawningFlamingosEventArgs));

newInstructions[newInstructions.Count - 1].labels.Add(retLabel);
int offset = 0;
int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldc_I4_4) + offset;

newInstructions.InsertRange(
index,
Expand Down Expand Up @@ -72,7 +71,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Stsfld, Field(typeof(Scp1507Spawner), nameof(Scp1507Spawner._alpha))),
});

index = newInstructions.FindIndex(x => x.Is(OpCodes.Call, PropertyGetter(typeof(ReferenceHub), nameof(ReferenceHub.AllHubs))));
index = newInstructions.FindIndex(x => x.Calls(PropertyGetter(typeof(ReferenceHub), nameof(ReferenceHub.AllHubs))));

newInstructions.RemoveAt(index);

Expand All @@ -86,6 +85,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Call, Method(typeof(SpawningFlamingos), nameof(ReturnEnumerator))),
});

newInstructions[newInstructions.Count - 1].labels.Add(retLabel);

for (int z = 0; z < newInstructions.Count; z++)
yield return newInstructions[z];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Ldloc_S, ev.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(FindingPositionEventArgs), nameof(FindingPositionEventArgs.Spawnpoint))),
new(OpCodes.Stind_Ref),

new(OpCodes.Br_S, continueLabel),
});

for (int z = 0; z < newInstructions.Count; z++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
LocalBuilder ev = generator.DeclareLocal(typeof(GrantingGiftEventArgs));

int offset = -1;
int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldfld && x.operand == (object)Field(typeof(Scp2536GiftBase), nameof(Scp2536GiftBase.ObtainedBy))) + offset;
int index = newInstructions.FindLastIndex(x => x.LoadsField(Field(typeof(Scp2536GiftBase), nameof(Scp2536GiftBase.ObtainedBy)))) + offset;

newInstructions.InsertRange(index, new CodeInstruction[]
{
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
Label retLabel = generator.DefineLabel();

int offset = -3;
int index = newInstructions.FindLastIndex(x => x.operand == (object)Method(typeof(Scp2536GiftController), nameof(Scp2536GiftController.RpcSetGiftState))) + offset;
int index = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(Scp2536GiftController), nameof(Scp2536GiftController.RpcSetGiftState)))) + offset;

newInstructions.InsertRange(index, new CodeInstruction[]
{
// Player.Get(hub);
new(OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),

// true
Expand Down

0 comments on commit b85aad0

Please sign in to comment.