context: using System;
  using Server.Engines.Craft;
  using Server.Network;
  using System.Collections.Generic;
  
  namespace Server.Items
  {
  	public abstract class BaseHat : BaseClothing, IShipwreckedItem
  	{
  		private bool m_IsShipwreckedItem;
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public bool IsShipwreckedItem
  		{
  			get { return m_IsShipwreckedItem; }
  			set { m_IsShipwreckedItem = value; }
  		}
  
  		public BaseHat( int itemID ) : this( itemID, 0 )
  		{
  		}
  
  		public BaseHat( int itemID, int hue ) : base( itemID, Layer.Helm, hue )
  		{
  		}
  
  		public BaseHat( Serial serial ) : base( serial )
  		{
  		}
  
  		public override void Serialize( GenericWriter writer )
  		{
  			base.Serialize( writer );
  
  			writer.Write( (int) 1 ); // version
  
  			writer.Write( m_IsShipwreckedItem );
  		}
  
  		public override void Deserialize( GenericReader reader )
  		{
  			base.Deserialize( reader );
  
  			int version = reader.ReadInt();
  
  			switch ( version )
  			{
  				case 1:
  				{
  					m_IsShipwreckedItem = reader.ReadBool();
  					break;
  				}
  			}
  		}
  
  		public override void AddEquipInfoAttributes( Mobile from, List<EquipInfoAttribute> attrs )
  		{
  			base.AddEquipInfoAttributes( from, attrs );
  
  			if( m_IsShipwreckedItem )
  				attrs.Add( new EquipInfoAttribute( 1041645 ) );	// recovered from a shipwreck
  		}
  
  		public override void AddNameProperties( ObjectPropertyList list )
  		{
  			base.AddNameProperties( list );
  
  			if ( m_IsShipwreckedItem )
  				list.Add( 1041645 ); // recovered from a shipwreck
  		}
  
  		public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, Type typeRes2, BaseTool tool, CraftItem craftItem, int resHue )
  		{
  			Quality = (ClothingQuality)quality;
  
  			if( Quality == ClothingQuality.Exceptional )
  				DistributeBonuses( (tool is BaseRunicTool ? 6 : (Core.SE ? 15 : 14)) );	//BLAME OSI. (We can't confirm it's an OSI bug yet.)
  
  			return base.OnCraft( quality, makersMark, from, craftSystem, typeRes, typeRes2, tool, craftItem, resHue );
  		}
  
  	}
  	[Flipable( 0x2798, 0x27E3 )]
  	public class Kasa : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 0; } }
  		public override int BaseFireResistance{ get{ return 5; } }
  		public override int BaseColdResistance{ get{ return 9; } }
  		public override int BasePoisonResistance{ get{ return 5; } }
  		public override int BaseEnergyResistance{ get{ return 5; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public Kasa() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public Kasa( int hue ) : base( 0x2798, hue )
  		{
  			Weight = 3.0;
  		}
  
  		public Kasa( Serial serial ) : base( serial )
  		{
  		}
  
  		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();
  		}
  	}
  
  	[Flipable( 0x278F, 0x27DA )]
  	public class ClothNinjaHood : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 3; } }
  		public override int BaseFireResistance{ get{ return 3; } }
  		public override int BaseColdResistance{ get{ return 6; } }
  		public override int BasePoisonResistance{ get{ return 9; } }
  		public override int BaseEnergyResistance{ get{ return 9; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public ClothNinjaHood() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public ClothNinjaHood( int hue ) : base( 0x278F, hue )
  		{
  			Weight = 2.0;
  		}
  
  		public ClothNinjaHood( Serial serial ) : base( serial )
  		{
  		}
  
  		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();
  		}
  	}
  
  	[Flipable( 0x2306, 0x2305 )]
  	public class FlowerGarland : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 3; } }
  		public override int BaseFireResistance{ get{ return 3; } }
  		public override int BaseColdResistance{ get{ return 6; } }
  		public override int BasePoisonResistance{ get{ return 9; } }
  		public override int BaseEnergyResistance{ get{ return 9; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public FlowerGarland() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public FlowerGarland( int hue ) : base( 0x2306, hue )
  		{
  			Weight = 1.0;
  		}
  
  		public FlowerGarland( Serial serial ) : base( serial )
  		{
  		}
  
  		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();
  		}
  	}
  
  	public class FloppyHat : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 0; } }
  		public override int BaseFireResistance{ get{ return 5; } }
  		public override int BaseColdResistance{ get{ return 9; } }
  		public override int BasePoisonResistance{ get{ return 5; } }
  		public override int BaseEnergyResistance{ get{ return 5; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public FloppyHat() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public FloppyHat( int hue ) : base( 0x1713, hue )
  		{
  			Weight = 1.0;
  		}
  
  		public FloppyHat( Serial serial ) : base( serial )
  		{
  		}
  
  		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();
  		}
  	}
  
  	public class WideBrimHat : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 0; } }
  		public override int BaseFireResistance{ get{ return 5; } }
  		public override int BaseColdResistance{ get{ return 9; } }
  		public override int BasePoisonResistance{ get{ return 5; } }
  		public override int BaseEnergyResistance{ get{ return 5; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public WideBrimHat() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public WideBrimHat( int hue ) : base( 0x1714, hue )
  		{
  			Weight = 1.0;
  		}
  
  		public WideBrimHat( Serial serial ) : base( serial )
  		{
  		}
  
  		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();
  		}
  	}
  
  	public class Cap : BaseHat
  	{
  		public override int BasePhysicalResistance{ get{ return 0; } }
  		public override int BaseFireResistance{ get{ return 5; } }
  		public override int BaseColdResistance{ get{ return 9; } }
  		public override int BasePoisonResistance{ get{ return 5; } }
  		public override int BaseEnergyResistance{ get{ return 5; } }
  
  		public override int InitMinHits{ get{ return 20; } }
  		public override int InitMaxHits{ get{ return 30; } }
  
  		[Constructable]
  		public Cap() : this( 0 )
  		{
  		}
  
  		[Constructable]
  		public Cap( int hue ) : base( 0x1715, hue )
  		{
  			Weight = 1.0;
  		}
  
  		public Cap( Serial serial ) : base( serial )
  		{
  		}
  
  		public override void Serialize( GenericWriter writer )
  		{
  			base.Serialize( writer );
  
  			writer.Write( (int) 0 ); // version
  		}
  
  		public override void Deserialize( GenericReader reader )
  		{
  			base.Deserialize( reader );
  
  
gt: 			int version = reader.ReadInt();