diff --git a/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs index 0e1c8fbed..fad3ec0b5 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs @@ -38,17 +38,13 @@ public class ChangingAttachmentsEventArgs : IPlayerEvent, IDeniableEvent, IFirea /// /// /// - public ChangingAttachmentsEventArgs( - Player player, - Firearm firearm, - uint code, - bool isAllowed = true) + public ChangingAttachmentsEventArgs(Player player, InventorySystem.Items.Firearms.Firearm firearm, uint code, bool isAllowed = true) { Player = player; - Firearm = firearm; - CurrentAttachmentIdentifiers = firearm.AttachmentIdentifiers; - NewAttachmentIdentifiers = firearm.FirearmType.GetAttachmentIdentifiers(code).ToList(); - CurrentCode = firearm.Base.GetCurrentAttachmentsCode(); + Firearm = Item.Get(firearm); + CurrentAttachmentIdentifiers = Firearm.AttachmentIdentifiers; + NewAttachmentIdentifiers = Firearm.FirearmType.GetAttachmentIdentifiers(code).ToList(); + CurrentCode = firearm.GetCurrentAttachmentsCode(); NewCode = code; IsAllowed = isAllowed; } diff --git a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs index 0cd597092..17394e444 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs @@ -68,10 +68,8 @@ private static IEnumerable Transpiler(IEnumerable !x.IsGenericMethod && x.Name is nameof(Item.Get) && x.GetParameters().Length is 1 && x.GetParameters()[0].ParameterType == typeof(InventorySystem.Items.ItemBase))), - new(OpCodes.Castclass, typeof(Firearm)), // AttachmentsChangeRequest::AttachmentsCode new(OpCodes.Ldarg_1), @@ -80,7 +78,7 @@ private static IEnumerable Transpiler(IEnumerable