From e320839bb144dd9f7fcd46c1e5e251e630cdbaa1 Mon Sep 17 00:00:00 2001 From: Argalep Date: Wed, 20 Mar 2019 09:09:15 +0300 Subject: [PATCH] fix. --- .../Instruments/SnakeCharmerFlute.cs | 30 +++++++------------ Scripts/Services/Harvest/HarvestSystem.cs | 14 ++++++++- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs b/Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs index 706f21445c..626c8b9553 100644 --- a/Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs +++ b/Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs @@ -1,8 +1,9 @@ -using System; +using System; using Server; using Server.Network; using Server.Mobiles; using Server.Targeting; +using System.Linq; namespace Server.Items { @@ -131,37 +132,26 @@ protected override void OnTarget(Mobile from, object targ) private static bool IsSnake(BaseCreature bc) { - Type type = bc.GetType(); - - for (int i = 0; i < m_SnakeTypes.Length; i++) - { - if (type == m_SnakeTypes[i]) - return true; - } - - return false; + return m_SnakeTypes.Any(t => t == bc.GetType()); } private static Type[] m_SnakeTypes = new Type[] - { - typeof( LavaSnake ), typeof( Snake ), - typeof( CoralSnake ), typeof( GiantSerpent ), - typeof( SilverSerpent ) - }; + { + typeof(LavaSnake), typeof(Snake), + typeof(CoralSnake), typeof(GiantSerpent), + typeof(SilverSerpent) + }; public override void Serialize(GenericWriter writer) { base.Serialize(writer); - writer.Write((int)0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); - - /*int version = */ - reader.ReadInt(); + int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Services/Harvest/HarvestSystem.cs b/Scripts/Services/Harvest/HarvestSystem.cs index 7fbe015296..458a394429 100644 --- a/Scripts/Services/Harvest/HarvestSystem.cs +++ b/Scripts/Services/Harvest/HarvestSystem.cs @@ -5,6 +5,7 @@ using Server.Engines.Quests; using Server.Engines.Quests.Hag; using Server.Mobiles; +using System.Linq; namespace Server.Engines.Harvest { @@ -770,8 +771,19 @@ public class FurnitureAttribute : Attribute { public FurnitureAttribute() { + } + + private static bool IsNotChoppables(Item item) + { + return _NotChoppables.Any(t => t == item.GetType()); } + private static Type[] _NotChoppables = new Type[] + { + typeof(CommodityDeedBox), typeof(ChinaCabinet), typeof(PieSafe), typeof(AcademicBookCase), typeof(JewelryBox), + typeof(WoodenBookcase), typeof(Countertop), typeof(Mailbox) + }; + public static bool Check(Item item) { if (item == null) @@ -779,7 +791,7 @@ public static bool Check(Item item) return false; } - if (item is CommodityDeedBox || item is ChinaCabinet || item is PieSafe || item is AcademicBookCase || item is JewelryBox || item is WoodenBookcase || item is Countertop || item is Mailbox) + if (IsNotChoppables(item)) { return false; }