diff --git a/Exiled.Events/Patches/Fixes/FixOnAddedBeingCallAfterOnRemoved.cs b/Exiled.Events/Patches/Fixes/FixOnAddedBeingCallAfterOnRemoved.cs index 6a59cc7ad1..b039cfd279 100644 --- a/Exiled.Events/Patches/Fixes/FixOnAddedBeingCallAfterOnRemoved.cs +++ b/Exiled.Events/Patches/Fixes/FixOnAddedBeingCallAfterOnRemoved.cs @@ -20,7 +20,7 @@ namespace Exiled.Events.Patches.Fixes using static HarmonyLib.AccessTools; /// - /// Patches . + /// Patches . /// Fix than NW call before for AmmoItem. /// [HarmonyPatch(typeof(InventoryExtensions), nameof(InventoryExtensions.ServerAddItem))] diff --git a/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs b/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs index 4e6ceecb96..56c907e325 100644 --- a/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs +++ b/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs @@ -37,7 +37,7 @@ private static IEnumerable Transpiler(IEnumerable Math.Abs(d.TimeToDetonate - ConfigFile.ServerConfig.GetInt("warhead_tminus_start_duration", 90))).First()); + networkInfo.ScenarioId = (byte)Array.IndexOf(AlphaWarheadController.Singleton._startScenarios, AlphaWarheadController.Singleton._startScenarios.OrderBy(d => Math.Abs(d.TimeToDetonate - ConfigFile.ServerConfig.GetInt("warhead_tminus_start_duration", 90))).First()); AlphaWarheadController.Singleton.NetworkInfo = networkInfo; return; diff --git a/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs index 366a531d74..df02235c2e 100644 --- a/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs +++ b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.Patches.Fixes using System.Reflection.Emit; using API.Features.Core.Generic.Pools; + using Footprinting; using HarmonyLib; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; @@ -20,7 +21,7 @@ namespace Exiled.Events.Patches.Fixes using static HarmonyLib.AccessTools; /// - /// Patches the delegate. + /// Patches the delegate. /// Fixes open doors getting easily broke. /// Bug reported to NW (https://trello.com/c/6Nz7Isjm/4637-scp096-easily-breaking-opened-doors). /// @@ -32,7 +33,7 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); Label ret = generator.DefineLabel(); - int offset = -4; + const int offset = -5; int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(IDamageableDoor), nameof(IDamageableDoor.ServerDamage))) + offset; newInstructions.InsertRange(index, new[] @@ -44,8 +45,8 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } diff --git a/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs b/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs deleted file mode 100644 index dfd304d2a5..0000000000 --- a/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs +++ /dev/null @@ -1,102 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Fixes -{ - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features.Core.Generic.Pools; - - using HarmonyLib; - - using InventorySystem.Items.Firearms.Attachments; - - using static HarmonyLib.AccessTools; - - /// - /// Patches . - /// Fixes if a plugin gives you an weapon that you do not have ammo for, your attachments will not correctly appear on said weapon. - /// - [HarmonyPatch(typeof(AttachmentsServerHandler), nameof(AttachmentsServerHandler.SetupProvidedWeapon))] - internal static class WeaponAttachmentDesyncFix - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - Label skipLabel = generator.DefineLabel(); - Label skipLabel2 = generator.DefineLabel(); - Label insertLabel = generator.DefineLabel(); - - LocalBuilder flagLocal = generator.DeclareLocal(typeof(bool)); - - const int offset = -1; - int ifIndex = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ldloc_3) + offset; - - newInstructions[ifIndex].operand = insertLabel; - - // if (ply.inventory.UserInventory.ReserveAmmo.TryGetValue(firearm.AmmoType, out num2)) - // { - // Execute base game code - // } - // else - // { - // bool isFlaghLightEnabled = firearm.CombinedAttachments.AdditionalPros.HasFlagFast(AttachmentDescriptiveAdvantages.Flashlight); - // firearm.Status = new FirearmStatus(0, isFlaghLightEnabled ? (FirearmStatusFlags.MagazineInserted | FirearmStatusFlags.FlashlightEnabled) : FirearmStatusFlags.MagazineInserted, num); - // } - newInstructions.AddRange( - new[] - { - // bool isFlaghLightEnabled = firearm.CombinedAttachments.AdditionalPros.HasFlagFast(AttachmentDescriptiveAdvantages.Flashlight) - new CodeInstruction(OpCodes.Ldloc_0).WithLabels(insertLabel), - new(OpCodes.Ldfld, Field(typeof(InventorySystem.Items.Firearms.Firearm), nameof(InventorySystem.Items.Firearms.Firearm.Attachments))), - new(OpCodes.Ldfld, Field(typeof(AttachmentSettings), nameof(AttachmentSettings.AdditionalPros))), - new(OpCodes.Ldc_I4_2), - new(OpCodes.Call, Method(typeof(AttachmentsUtils), nameof(AttachmentsUtils.HasFlagFast), new[] { typeof(AttachmentDescriptiveAdvantages), typeof(AttachmentDescriptiveAdvantages) })), - new(OpCodes.Stloc_S, flagLocal.LocalIndex), - - // firearm - new(OpCodes.Ldloc_0), - - // 0 (ammo) - new(OpCodes.Ldc_I4_0), - - // if (flagLocal) - // goto skipLabel; - new(OpCodes.Ldloc_S, flagLocal.LocalIndex), - new(OpCodes.Brtrue_S, skipLabel), - - // FirearmStatusFlags.MagazineInserted - // - // goto skipLabel2 - new(OpCodes.Ldc_I4_4), - new(OpCodes.Br_S, skipLabel2), - - // skipLabel: - // - // FirearmStatusFlags.MagazineInserted | FirearmStatusFlags.FlashlightEnabled - new CodeInstruction(OpCodes.Ldc_I4_S, 12).WithLabels(skipLabel), - - // skiplabel2: - // - // num (attachments) - new CodeInstruction(OpCodes.Ldloc_2).WithLabels(skipLabel2), - - // firearm.Status = new FirearmStatus(byte, FirearmStatusFlags, uint) - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InventorySystem.Items.Firearms.FirearmStatus))[0]), - new(OpCodes.Call, PropertySetter(typeof(InventorySystem.Items.Firearms.Firearm), nameof(InventorySystem.Items.Firearms.Firearm.Status))), - new(OpCodes.Ret), - }); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } -} \ No newline at end of file diff --git a/Exiled.Events/Patches/Generic/LiftList.cs b/Exiled.Events/Patches/Generic/LiftList.cs index ade3c06a0c..e4c37302ed 100644 --- a/Exiled.Events/Patches/Generic/LiftList.cs +++ b/Exiled.Events/Patches/Generic/LiftList.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Generic using Interactables.Interobjects; /// - /// Patches . + /// Patches . /// [HarmonyPatch(typeof(ElevatorManager), nameof(ElevatorManager.SpawnAllChambers))] internal class LiftList