/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on May-15-2012 07:15:46pm
Filepath: scripts\events and scenarios\Halloween2011\Costume Collection\Rewards\BaseCostume.cs
Lines of code: 76

Description: 

***********************************************************/


using System;
using Server;

namespace Server.Items
{
	public class BaseCostume : Item
	{
		private int CostumeBodyMod;
		public int CostumeHueMod;
		private string CostumeNameMod;
	
		[Constructable]
		public BaseCostume(string CostumeName, int CostumeBody, int CostumeHue ) : base(6589)
		{
            CostumeBodyMod = CostumeBody;
			CostumeHueMod = CostumeHue;

			Name = CostumeName;
            Layer = Layer.TwoHanded;
			Weight = 4.0;
		}
	
		public BaseCostume( Serial serial ) : base( serial )
		{
		}

		public override bool OnEquip( Mobile from )
		{ 
			if ( from.Mounted == true )
			{
				from.SendMessage( "You cannot be mounted while wearing your costume!" );
				return false;
			}
			
			if ( from.BodyMod != 0 )
			{
				from.SendMessage( "You cannot wear the costume while your body is transformed!" );
				return false;
			}
			
			if(base.OnEquip( from ))
			{			
				from.BodyMod = CostumeBodyMod;
				from.HueMod = CostumeHueMod;
				from.DisplayGuildTitle = false; return true;
			}
			return false;
		}
		
		public override void OnRemoved( object parent )
        {

            if ( parent is Mobile )
			{
			    Mobile from = (Mobile)parent;
			    from.PlaySound( 0xFA );
				from.FixedEffect( 0x3728, 10, 15 );
                from.BodyMod = 0; from.NameHue = -1; from.HueMod = -1;
                from.DisplayGuildTitle = true;
			}

			if( parent is Mobile && ((Mobile)parent).Kills >= 5) ( (Mobile)parent).Criminal = true;
			
            if( parent is Mobile && ((Mobile)parent).GuildTitle != null ) ( (Mobile)parent).DisplayGuildTitle = true;          

            base.OnRemoved( parent );
        }

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 1 );
			
			writer.Write(CostumeBodyMod);
			writer.Write(CostumeHueMod);
			writer.Write(CostumeNameMod);
		}
		
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			
			if(version>=1)
			{
				CostumeBodyMod=reader.ReadInt();
				CostumeHueMod=reader.ReadInt();
				CostumeNameMod=reader.ReadString();
			}
		}
	}
}
