diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 197812f710..884230151f 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -608,7 +608,7 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences public bool HasFlashlightModuleEnabled => CurrentItem is Firearm firearm && firearm.FlashlightEnabled; /// - /// Gets a value indicating whether the player is jumping. + /// Gets or sets a value indicating whether the player is jumping. /// public bool IsJumping { diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs index 60e5863c99..53798e1a31 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs @@ -7,8 +7,6 @@ namespace Exiled.Events.Patches.Events.Scp3114 { -#pragma warning disable SA1402 // File may only contain a single type - using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; @@ -35,7 +33,7 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Brfalse_S); + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Brfalse); Label continueLabel = generator.DefineLabel(); @@ -58,7 +56,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldc_I4_0); - ListPool.Pool.Return(newInstructions); - } - } + newInstructions.RemoveRange(index, 3); - /// - /// Patches - /// to add event. - /// - [HarmonyPatch(typeof(Scp3114Dance), nameof(Scp3114Dance.ServerWriteRpc))] - internal class ChooseDanceType - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - int offset = -4; - int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(NetworkWriter), nameof(NetworkWriter.WriteByte))) + offset; - - newInstructions.RemoveRange(index, 4); - - // replace "writer.WriteByte((byte)UnityEngine.Random.Range(0, 255))" - // with "writer.WriteByte(ChooseDanceType.DanceType)" - newInstructions.InsertRange(index, new CodeInstruction[] + newInstructions.InsertRange( + index, + new[] { - // Handle(Player.Get(this.Owner)); - new(OpCodes.Ldarg_0), - - new(OpCodes.Call, Method(typeof(ChooseDanceType), nameof(Handle))), + new CodeInstruction(OpCodes.Ldloc, ev), + new(OpCodes.Call, PropertyGetter(typeof(DancingEventArgs), nameof(DancingEventArgs.DanceType))), }); for (int z = 0; z < newInstructions.Count; z++) @@ -114,8 +91,5 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } - - private static byte Handle(Scp3114Dance scp3114Dance) - => (byte)Player.Get(scp3114Dance.Owner).Role.As().DanceType; } } \ No newline at end of file