From 56e3d62afbd1b87504c1f47d5058138be9b09c29 Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sat, 5 Jul 2025 01:04:26 +0900 Subject: [PATCH 1/6] Jailbird --- EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs | 5 ++--- EXILED/Exiled.API/Extensions/ItemExtensions.cs | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index 6abeea8a2f..5710b77cc8 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -124,12 +124,11 @@ public static class DamageTypeExtensions /// Check if a damage type is caused by a weapon. /// /// The damage type to be checked. - /// Indicates whether the MicroHid damage type should be taken into account. /// Returns whether the is caused by weapon. - public static bool IsWeapon(this DamageType type, bool checkMicro = true) => type switch + public static bool IsWeapon(this DamageType type) => type switch { DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 => true, - DamageType.MicroHid when checkMicro => true, + DamageType.MicroHid or DamageType.Jailbird or _ => false, }; diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 458fd10bc4..6dbda998fa 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -38,9 +38,8 @@ public static class ItemExtensions /// Check if an item is a weapon. /// /// The item to be checked. - /// Indicates whether the MicroHID item should be taken into account. /// Returns whether the is a weapon. - public static bool IsWeapon(this ItemType type, bool checkMicro = true) => type.GetFirearmType() is not FirearmType.None || (checkMicro && type is ItemType.MicroHID); + public static bool IsWeapon(this ItemType type) => type.GetFirearmType() is not FirearmType.None || type is ItemType.MicroHID or ItemType.Jailbird; /// /// Check if an item is an SCP. From 4c5e275a8dd05a3e55ce800f68de27c7fcc54004 Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sat, 5 Jul 2025 01:14:31 +0900 Subject: [PATCH 2/6] Update CustomWeapon.cs --- EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs index 277037494e..38f89da579 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -42,7 +42,7 @@ public override ItemType Type get => base.Type; set { - if (!value.IsWeapon(false) && value != ItemType.None) + if (!value.IsWeapon() && value != ItemType.None) throw new ArgumentOutOfRangeException($"{nameof(Type)}", value, "Invalid weapon type."); base.Type = value; From a440665edb13f36a7208a90137081e9663974117 Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sun, 6 Jul 2025 00:50:33 +0900 Subject: [PATCH 3/6] Revert "Update CustomWeapon.cs" This reverts commit 4c5e275a8dd05a3e55ce800f68de27c7fcc54004. --- EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs index 38f89da579..277037494e 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -42,7 +42,7 @@ public override ItemType Type get => base.Type; set { - if (!value.IsWeapon() && value != ItemType.None) + if (!value.IsWeapon(false) && value != ItemType.None) throw new ArgumentOutOfRangeException($"{nameof(Type)}", value, "Invalid weapon type."); base.Type = value; From fb690200c9e35d44319bb4138fe236110277391a Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sun, 6 Jul 2025 00:51:14 +0900 Subject: [PATCH 4/6] Revert "Jailbird" This reverts commit 56e3d62afbd1b87504c1f47d5058138be9b09c29. --- EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs | 5 +++-- EXILED/Exiled.API/Extensions/ItemExtensions.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index 5710b77cc8..6abeea8a2f 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -124,11 +124,12 @@ public static class DamageTypeExtensions /// Check if a damage type is caused by a weapon. /// /// The damage type to be checked. + /// Indicates whether the MicroHid damage type should be taken into account. /// Returns whether the is caused by weapon. - public static bool IsWeapon(this DamageType type) => type switch + public static bool IsWeapon(this DamageType type, bool checkMicro = true) => type switch { DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 => true, - DamageType.MicroHid or DamageType.Jailbird or + DamageType.MicroHid when checkMicro => true, _ => false, }; diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 6dbda998fa..458fd10bc4 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -38,8 +38,9 @@ public static class ItemExtensions /// Check if an item is a weapon. /// /// The item to be checked. + /// Indicates whether the MicroHID item should be taken into account. /// Returns whether the is a weapon. - public static bool IsWeapon(this ItemType type) => type.GetFirearmType() is not FirearmType.None || type is ItemType.MicroHID or ItemType.Jailbird; + public static bool IsWeapon(this ItemType type, bool checkMicro = true) => type.GetFirearmType() is not FirearmType.None || (checkMicro && type is ItemType.MicroHID); /// /// Check if an item is an SCP. From bb077cb1a0bb0b05e1346765bacb26150c5b9e59 Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sun, 6 Jul 2025 00:54:39 +0900 Subject: [PATCH 5/6] Approve Change Request --- EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs | 5 +++-- EXILED/Exiled.API/Extensions/ItemExtensions.cs | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index 6abeea8a2f..b2878a5b7a 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -125,11 +125,12 @@ public static class DamageTypeExtensions /// /// The damage type to be checked. /// Indicates whether the MicroHid damage type should be taken into account. + /// /// Indicates whether the Jailbird item should be taken into account. /// Returns whether the is caused by weapon. - public static bool IsWeapon(this DamageType type, bool checkMicro = true) => type switch + public static bool IsWeapon(this DamageType type, bool checkMicro = true, bool checkJailbird = true) => type switch { DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 => true, - DamageType.MicroHid when checkMicro => true, + DamageType.MicroHid when checkMicro => true, DamageType.Jailbird when checkJailbird => true, _ => false, }; diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 458fd10bc4..6bacd0c298 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -39,8 +39,11 @@ public static class ItemExtensions /// /// The item to be checked. /// Indicates whether the MicroHID item should be taken into account. + /// Indicates whether the Jailbird item should be taken into account. /// Returns whether the is a weapon. - public static bool IsWeapon(this ItemType type, bool checkMicro = true) => type.GetFirearmType() is not FirearmType.None || (checkMicro && type is ItemType.MicroHID); + public static bool IsWeapon(this ItemType type, bool checkMicro = true, bool checkJailbird = true) => type.GetFirearmType() is not FirearmType.None + || (checkMicro && type is ItemType.MicroHID) + || (checkJailbird && type is ItemType.Jailbird); /// /// Check if an item is an SCP. From ed46e3197012874935d20826d33fe7f6e8b03280 Mon Sep 17 00:00:00 2001 From: GoldenPig1205 <78902671+GoldenPig1205@users.noreply.github.com> Date: Sun, 6 Jul 2025 01:48:11 +0900 Subject: [PATCH 6/6] Better way --- EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs | 7 +++---- EXILED/Exiled.API/Extensions/ItemExtensions.cs | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index b2878a5b7a..eaba7fe2bd 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -124,13 +124,12 @@ public static class DamageTypeExtensions /// Check if a damage type is caused by a weapon. /// /// The damage type to be checked. - /// Indicates whether the MicroHid damage type should be taken into account. - /// /// Indicates whether the Jailbird item should be taken into account. + /// Indicates whether the MicroHid and Jailbird damage type should be taken into account. /// Returns whether the is caused by weapon. - public static bool IsWeapon(this DamageType type, bool checkMicro = true, bool checkJailbird = true) => type switch + public static bool IsWeapon(this DamageType type, bool checkNonFirearm = true) => type switch { DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 => true, - DamageType.MicroHid when checkMicro => true, DamageType.Jailbird when checkJailbird => true, + DamageType.MicroHid or DamageType.Jailbird when checkNonFirearm => true, _ => false, }; diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 6bacd0c298..1c03c97d9c 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -38,12 +38,9 @@ public static class ItemExtensions /// Check if an item is a weapon. /// /// The item to be checked. - /// Indicates whether the MicroHID item should be taken into account. - /// Indicates whether the Jailbird item should be taken into account. + /// Indicates whether the MicroHID and Jailbird item should be taken into account. /// Returns whether the is a weapon. - public static bool IsWeapon(this ItemType type, bool checkMicro = true, bool checkJailbird = true) => type.GetFirearmType() is not FirearmType.None - || (checkMicro && type is ItemType.MicroHID) - || (checkJailbird && type is ItemType.Jailbird); + public static bool IsWeapon(this ItemType type, bool checkNonFirearm = true) => type.GetFirearmType() is not FirearmType.None || (checkNonFirearm && type is ItemType.MicroHID or ItemType.Jailbird); /// /// Check if an item is an SCP.