diff --git a/Exiled.API/Features/Items/Item.cs b/Exiled.API/Features/Items/Item.cs index f881654b49..e4d490513c 100644 --- a/Exiled.API/Features/Items/Item.cs +++ b/Exiled.API/Features/Items/Item.cs @@ -10,7 +10,7 @@ namespace Exiled.API.Features.Items using System.Collections.Generic; using System.Linq; - using Exiled.API.Features.Core; + using Core; using Exiled.API.Features.Core.Attributes; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; diff --git a/Exiled.API/Features/Pickups/FirearmPickup.cs b/Exiled.API/Features/Pickups/FirearmPickup.cs index 4d22adbb82..64d225fc93 100644 --- a/Exiled.API/Features/Pickups/FirearmPickup.cs +++ b/Exiled.API/Features/Pickups/FirearmPickup.cs @@ -7,12 +7,15 @@ namespace Exiled.API.Features.Pickups { + using System.Linq; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features.Core.Attributes; using Exiled.API.Features.Items; using Exiled.API.Interfaces; using InventorySystem.Items; + using InventorySystem.Items.Firearms.Modules; using BaseFirearm = InventorySystem.Items.Firearms.FirearmPickup; using FirearmItem = InventorySystem.Items.Firearms.Firearm; @@ -42,8 +45,8 @@ internal FirearmPickup(ItemType type) Base = (BaseFirearm)((Pickup)this).Base; Base.OnDistributed(); - if (type is ItemType.ParticleDisruptor && Status.Ammo <= 0) - Status = new FirearmStatus(5, FirearmStatusFlags.MagazineInserted, 0); + if (type is ItemType.ParticleDisruptor && Base.Template.Modules.OfType().FirstOrDefault()!.AmmoStored <= 0) + Base.Template.Modules.OfType().FirstOrDefault()!.AmmoStored = 5; } /// @@ -63,24 +66,14 @@ internal FirearmPickup(ItemType type) [EProperty(category: nameof(FirearmPickup))] public AmmoType AmmoType { get; set; } - /// - /// Gets or sets the . - /// - [EProperty(category: nameof(FirearmPickup))] - public FirearmStatus Status - { - get => Base.NetworkStatus; - set => Base.NetworkStatus = value; - } - /// /// Gets or sets a value indicating how many ammo have this . /// [EProperty(category: nameof(FirearmPickup))] - public byte Ammo + public int Ammo { - get => Base.NetworkStatus.Ammo; - set => Base.NetworkStatus = new(value, Base.NetworkStatus.Flags, Base.NetworkStatus.Attachments); + get => Base.Template.Modules.OfType().FirstOrDefault()?.AmmoStored ?? 0; + set => Base.Template.Modules.OfType().FirstOrDefault()!.AmmoStored = value; } /// @@ -89,31 +82,21 @@ public byte Ammo [EProperty(category: nameof(FirearmPickup))] public int MaxAmmo { get; set; } - /// - /// Gets or sets the . - /// - [EProperty(category: nameof(FirearmPickup))] - public FirearmStatusFlags Flags - { - get => Base.NetworkStatus.Flags; - set => Base.NetworkStatus = new(Base.NetworkStatus.Ammo, value, Base.NetworkStatus.Attachments); - } - /// /// Gets or sets a value indicating whether the attachment code have this . /// [EProperty(category: nameof(FirearmPickup))] public uint Attachments { - get => Base.NetworkStatus.Attachments; - set => Base.NetworkStatus = new(Base.NetworkStatus.Ammo, Base.NetworkStatus.Flags, value); + get => Base.Worldmodel.AttachmentCode; + set => Base.Worldmodel.AttachmentCode = value; } /// /// Returns the FirearmPickup in a human readable format. /// /// A string containing FirearmPickup related data. - public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{IsDistributed}| -{Ammo}-"; + public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* -{Ammo}-"; /// internal override void ReadItemInfo(Item item)