diff --git a/EXILED/Exiled.API/Enums/GunSoundType.cs b/EXILED/Exiled.API/Enums/GunSoundType.cs new file mode 100644 index 000000000..ce80d261e --- /dev/null +++ b/EXILED/Exiled.API/Enums/GunSoundType.cs @@ -0,0 +1,180 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- +namespace Exiled.API.Enums +{ + /// + /// Represents the type of sound a firearm can produce. + /// + /// + public enum GunSoundType + { + /// + /// Unknown or unmapped sound. + /// + Unknown, + + /// + /// Sound of a gunshot. + /// + Fire, + + /// + /// Sound of a suppressed gunshot. + /// + SuppressedFire, + + /// + /// Sound of a dry fire (trigger pulled with an empty chamber). + /// + DryFire, + + /// + /// Sound of a firearm being equipped or drawn. + /// + Equip, + + /// + /// Sound of a rare or special equip animation. + /// + EquipRare, + + /// + /// Sound of a firearm being cocked or charged. + /// + Cock, + + /// + /// Sound of an initial or special cocking animation. + /// + CockInitial, + + /// + /// Sound of a magazine being inserted. + /// + ReloadInsert, + + /// + /// Sound of a magazine being ejected. + /// + ReloadEject, + + /// + /// Sound of a general reload action (often used for revolvers or shotguns). + /// + Reload, + + /// + /// Sound of a bolt or slide being pulled back. + /// + BoltOpen, + + /// + /// Sound of a bolt or slide releasing forward. + /// + BoltClose, + + /// + /// Sound of a round being ejected from the chamber. + /// + ChamberEject, + + /// + /// Sound of a revolver's cylinder rotating. + /// + CylinderRotate, + + /// + /// Sound of a revolver's cylinder being spun playfully. + /// + CylinderSpin, + + /// + /// Sound of a gunshot using special buckshot ammunition. + /// + FireBuckshot, + + /// + /// Sound of loading buckshot ammunition into an empty firearm. + /// + ReloadBuckshotEmpty, + + /// + /// Sound of ejecting or emptying buckshot ammunition. + /// + EjectBuckshot, + + /// + /// Sound of the weapon being inspected. + /// + Inspect, + + /// + /// Sound of a single shot in Disintegrator mode. + /// + FireDisintegrator, + + /// + /// Sound of the last shot in Disintegrator mode. + /// + FireDisintegratorLast, + + /// + /// Sound of a shot in 3x Burst mode. + /// + FireBurst3x, + + /// + /// Sound of the last shot in a 3x Burst sequence. + /// + FireBurst3xLast, + + /// + /// Sound of general weapon handling, rustling, or adjusting grip. + /// + WeaponHandling, + + /// + /// Sound of a weapon's stock being extended or adjusted. + /// + StockExtend, + + /// + /// Sound of the second sequential shot, often used in double-shot shotgun modes. + /// + FireDouble, + + /// + /// Sound of a single shotgun shell being ejected during unload. + /// + ShellEject, + + /// + /// Sound indicating the completion of a shotgun unload sequence. + /// + UnloadComplete, + + /// + /// Sound of a magazine being firmly tapped or locked into the firearm. + /// + ReloadLock, + + /// + /// Sound of a drum or extended magazine being ejected. + /// + ReloadEjectDrum, + + /// + /// Sound of a drum or extended magazine being inserted. + /// + ReloadInsertDrum, + + /// + /// Sound of a drum or extended magazine being firmly tapped or locked into place. + /// + ReloadLockDrum, + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 80c77a4c3..197d7b3f8 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -345,6 +345,215 @@ public static uint GetBaseCode(this FirearmType type) /// of the specified . public static ItemCategory GetCategory(this ItemType type) => GetItemBase(type).Category; + /// + /// Gets the associated with a specific and sound index. + /// + /// The of the firearm. + /// The mapped index of the sound. + /// The mapped , or if not found. + public static GunSoundType GetSoundType(this ItemType type, int index) => type switch + { + ItemType.GunCOM15 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 4 => GunSoundType.Equip, + 5 => GunSoundType.ReloadInsert, + 6 => GunSoundType.ReloadEject, + 7 => GunSoundType.Cock, + 8 => GunSoundType.BoltOpen, + 9 => GunSoundType.BoltClose, + 11 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + ItemType.GunCOM18 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 3 => GunSoundType.Equip, + 4 => GunSoundType.ReloadInsert, + 5 => GunSoundType.ReloadEject, + 6 => GunSoundType.BoltOpen, + 7 => GunSoundType.BoltClose, + 8 => GunSoundType.ChamberEject, + 9 => GunSoundType.EquipRare, + _ => GunSoundType.Unknown + }, + + ItemType.GunRevolver => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.CylinderRotate, + 4 => GunSoundType.Fire, + 5 => GunSoundType.FireBuckshot, + 7 => GunSoundType.Equip, + 8 => GunSoundType.CylinderSpin, + 9 => GunSoundType.CockInitial, + 11 => GunSoundType.ReloadBuckshotEmpty, + 14 => GunSoundType.Reload, + 15 => GunSoundType.EquipRare, + 16 => GunSoundType.EjectBuckshot, + _ => GunSoundType.Unknown + }, + + ItemType.GunCom45 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.Equip, + 3 => GunSoundType.CockInitial, + 4 => GunSoundType.ReloadInsert, + 5 => GunSoundType.ReloadEject, + 6 => GunSoundType.BoltOpen, + 7 => GunSoundType.BoltClose, + _ => GunSoundType.Unknown + }, + + ItemType.ParticleDisruptor => index switch + { + 0 => GunSoundType.Reload, + 2 => GunSoundType.CockInitial, + 3 => GunSoundType.Inspect, + 4 => GunSoundType.Inspect, + 5 => GunSoundType.Inspect, + 6 => GunSoundType.Equip, + 7 => GunSoundType.FireDisintegrator, + 9 => GunSoundType.FireDisintegrator, + 8 => GunSoundType.FireDisintegratorLast, + 10 => GunSoundType.FireDisintegratorLast, + 11 => GunSoundType.FireBurst3x, + 13 => GunSoundType.FireBurst3x, + 12 => GunSoundType.FireBurst3xLast, + 14 => GunSoundType.FireBurst3xLast, + _ => GunSoundType.Unknown + }, + + ItemType.GunFSP9 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 3 => GunSoundType.WeaponHandling, + 4 => GunSoundType.Equip, + 5 => GunSoundType.WeaponHandling, + 7 => GunSoundType.ReloadEject, + 8 => GunSoundType.BoltOpen, + 9 => GunSoundType.StockExtend, + 11 => GunSoundType.BoltClose, + 12 => GunSoundType.ReloadInsert, + 13 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + ItemType.GunShotgun => index switch + { + 0 => GunSoundType.FireDouble, + 1 => GunSoundType.Fire, + 2 => GunSoundType.DryFire, + 3 => GunSoundType.WeaponHandling, + 4 => GunSoundType.ReloadInsert, + 5 => GunSoundType.ReloadInsert, + 6 => GunSoundType.BoltOpen, + 7 => GunSoundType.BoltClose, + 8 => GunSoundType.UnloadComplete, + 9 => GunSoundType.ShellEject, + 10 => GunSoundType.Equip, + _ => GunSoundType.Unknown + }, + + ItemType.GunFRMG0 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 5 => GunSoundType.Equip, + 7 => GunSoundType.ReloadEject, + 8 => GunSoundType.ReloadEjectDrum, + 9 => GunSoundType.Cock, + 10 => GunSoundType.ReloadInsert, + 11 => GunSoundType.ReloadInsertDrum, + 13 => GunSoundType.ReloadLock, + 14 => GunSoundType.ReloadLockDrum, + 16 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + ItemType.GunAK => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 6 => GunSoundType.Equip, + 7 => GunSoundType.ReloadEject, + 8 => GunSoundType.ReloadEjectDrum, + 10 => GunSoundType.Cock, + 11 => GunSoundType.CockInitial, + 12 => GunSoundType.ReloadInsertDrum, + 14 => GunSoundType.ReloadInsert, + 19 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + ItemType.GunA7 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.CockInitial, + 3 => GunSoundType.Equip, + 5 => GunSoundType.ReloadEject, + 6 => GunSoundType.WeaponHandling, + 7 => GunSoundType.ReloadInsert, + 8 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + ItemType.GunSCP127 => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.CockInitial, + 4 => GunSoundType.Equip, + 5 => GunSoundType.Cock, + 6 => GunSoundType.WeaponHandling, + _ => GunSoundType.Unknown + }, + + ItemType.GunLogicer => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.Equip, + 3 => GunSoundType.Cock, + 4 => GunSoundType.BoltOpen, + 5 => GunSoundType.ReloadEject, + 6 => GunSoundType.ReloadInsert, + 7 => GunSoundType.BoltClose, + 8 => GunSoundType.WeaponHandling, + _ => GunSoundType.Unknown + }, + + ItemType.GunCrossvec => index switch + { + 0 => GunSoundType.DryFire, + 1 => GunSoundType.Fire, + 2 => GunSoundType.SuppressedFire, + 4 => GunSoundType.Equip, + 5 => GunSoundType.StockExtend, + 6 => GunSoundType.BoltOpen, + 7 => GunSoundType.BoltClose, + 8 => GunSoundType.ReloadEject, + 9 => GunSoundType.ReloadInsert, + 10 => GunSoundType.WeaponHandling, + 15 => GunSoundType.ChamberEject, + _ => GunSoundType.Unknown + }, + + _ => GunSoundType.Unknown + }; + /// /// Checks if the specified has the specified . ///