/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\misc\ArmorSet.cs
Lines of code: 108
***********************************************************/


using System;
using Server;

namespace Server.Items
{
	public class ArmorSet
	{
		public virtual int ArmorSetAmt {get{return 0;}} //amount of peices in the set
	
		//required parts to complete the set:
		
		//armors
		public virtual Type ArmorSet_Helm{ get { return typeof(Item); } }
		public virtual Type ArmorSet_Arms{ get { return typeof(Item); } }
		public virtual Type ArmorSet_Gloves{ get { return typeof(Item); } }
		public virtual Type ArmorSet_Neck{ get { return typeof(Item); } }
		public virtual Type ArmorSet_InnerTorso{ get { return typeof(Item); } }
		public virtual Type ArmorSet_Pants{ get { return typeof(Item); } }
		public virtual Type ArmorSet_Shoes{ get { return typeof(Item); } }

		//misc
		public virtual Type ArmorSet_Cloak{ get { return typeof(Item); } }
		public virtual Type ArmorSet_TwoHanded{ get { return typeof(Item); } }
		public virtual Type ArmorSet_OneHanded{ get { return typeof(Item); } }
	
	

		
	
		public bool CheckActivate(Mobile from,bool removing,bool ArmorSetActive,Item piece)
		{
		if(from==null || piece==null)return false;
		
		bool on=true;
		
		int matches=0;
		
		Item helm = from.FindItemOnLayer( Layer.Helm );
		if(helm==null || ArmorSet_Helm==null)on=false;
		else if(ArmorSet_Helm==typeof(Item) || helm.GetType() !=ArmorSet_Helm)on=false;	
		else matches++;
		
		Item arms = from.FindItemOnLayer( Layer.Arms );
		if(arms==null || ArmorSet_Arms==null)on=false;
		else if(ArmorSet_Arms==typeof(Item) || arms.GetType() !=ArmorSet_Arms)on=false;		
		else matches++;
		
		Item gloves = from.FindItemOnLayer( Layer.Gloves );
		if(gloves==null || ArmorSet_Gloves==null)on=false;
		else if(ArmorSet_Gloves==typeof(Item) || gloves.GetType() !=ArmorSet_Gloves)on=false;		
		else matches++;

		Item neck = from.FindItemOnLayer( Layer.Neck );
		if(neck==null || ArmorSet_Neck==null)on=false;
		else if(ArmorSet_Neck==typeof(Item) || neck.GetType() !=ArmorSet_Neck)on=false;	
		else matches++;
		
		Item itorso = from.FindItemOnLayer( Layer.InnerTorso );
		if(itorso==null || ArmorSet_InnerTorso==null)on=false;
		else if(ArmorSet_InnerTorso==typeof(Item) || itorso.GetType() !=ArmorSet_InnerTorso)on=false;	
		else matches++;
		
		Item pants = from.FindItemOnLayer( Layer.Pants );
		if(pants==null || ArmorSet_Pants==null)on=false;
		else if(ArmorSet_Pants==typeof(Item) || pants.GetType() !=ArmorSet_Pants)on=false;	
		else matches++;		
	
		Item shoes = from.FindItemOnLayer( Layer.Shoes );
		if(shoes==null || ArmorSet_Shoes==null)on=false;
		else if(ArmorSet_Shoes==typeof(Item) || shoes.GetType() !=ArmorSet_Shoes)on=false;	
		else matches++;
		
		Item cloak = from.FindItemOnLayer( Layer.Cloak );
		if(cloak==null || ArmorSet_Cloak==null)on=false;
		else if(ArmorSet_Cloak==typeof(Item) || cloak.GetType() !=ArmorSet_Cloak)on=false;	
		else matches++;
		
		Item twohanded = from.FindItemOnLayer( Layer.TwoHanded );
		if(twohanded==null || ArmorSet_TwoHanded==null)on=false;
		else if(ArmorSet_TwoHanded==typeof(Item) || twohanded.GetType() !=ArmorSet_TwoHanded)on=false;	
		else matches++;
		
		Item onehanded = from.FindItemOnLayer( Layer.OneHanded );
		if(onehanded==null || ArmorSet_OneHanded==null)on=false;
		else if(ArmorSet_OneHanded==typeof(Item) || onehanded.GetType() !=ArmorSet_OneHanded)on=false;	
		else matches++;	
		
		if(matches>=ArmorSetAmt && !removing)on=true;		
		
			//call activate/deactivate functions

			if(on && !ArmorSetActive && !removing)
			{		
			if(helm is BaseArmor)((BaseArmor)helm).ArmorSetActivateProps();
			if(arms is BaseArmor)((BaseArmor)arms).ArmorSetActivateProps();
			if(gloves is BaseArmor)((BaseArmor)gloves).ArmorSetActivateProps();
			if(neck is BaseArmor)((BaseArmor)neck).ArmorSetActivateProps();
			if(itorso is BaseArmor)((BaseArmor)itorso).ArmorSetActivateProps();
			if(pants is BaseArmor)((BaseArmor)pants).ArmorSetActivateProps();
			if(shoes is BaseArmor)((BaseArmor)shoes).ArmorSetActivateProps();
			else if(shoes is BaseClothing)((BaseClothing)shoes).ArmorSetActivateProps();
			
			if(cloak is BaseArmor)((BaseArmor)cloak).ArmorSetActivateProps();
			else if(cloak is BaseClothing)((BaseClothing)cloak).ArmorSetActivateProps();
			
			if(twohanded is BaseArmor)((BaseArmor)twohanded).ArmorSetActivateProps();
			else if(twohanded is BaseWeapon)((BaseWeapon)twohanded).ArmorSetActivateProps();
			
			if(onehanded is BaseArmor)((BaseArmor)onehanded).ArmorSetActivateProps();
			else if(onehanded is BaseWeapon)((BaseWeapon)onehanded).ArmorSetActivateProps();				
			
			if(piece is BaseArmor)((BaseArmor)piece).ArmorSetActivateProps();
			else if(piece is BaseClothing)((BaseClothing)piece).ArmorSetActivateProps();
			else if(piece is BaseWeapon)((BaseWeapon)piece).ArmorSetActivateProps();
     		}
			else if(removing)
			{			
			if(helm is BaseArmor)((BaseArmor)helm).ArmorSetDeActivateProps();
			if(arms is BaseArmor)((BaseArmor)arms).ArmorSetDeActivateProps();
			if(gloves is BaseArmor)((BaseArmor)gloves).ArmorSetDeActivateProps();
			if(neck is BaseArmor)((BaseArmor)neck).ArmorSetDeActivateProps();
			if(itorso is BaseArmor)((BaseArmor)itorso).ArmorSetDeActivateProps();
			if(pants is BaseArmor)((BaseArmor)pants).ArmorSetDeActivateProps();
			if(shoes is BaseArmor)((BaseArmor)shoes).ArmorSetDeActivateProps();		
			else if(shoes is BaseClothing)((BaseClothing)shoes).ArmorSetDeActivateProps();

			if(cloak is BaseArmor)((BaseArmor)cloak).ArmorSetDeActivateProps();
			else if(cloak is BaseClothing)((BaseClothing)cloak).ArmorSetDeActivateProps();	
			
			if(twohanded is BaseArmor)((BaseArmor)twohanded).ArmorSetDeActivateProps();
			else if(twohanded is BaseWeapon)((BaseWeapon)twohanded).ArmorSetDeActivateProps();	

			if(onehanded is BaseArmor)((BaseArmor)onehanded).ArmorSetDeActivateProps();
			else if(onehanded is BaseWeapon)((BaseWeapon)onehanded).ArmorSetDeActivateProps();				

			if(piece is BaseArmor)((BaseArmor)piece).ArmorSetDeActivateProps();
			else if(piece is BaseClothing)((BaseClothing)piece).ArmorSetDeActivateProps();
			else if(piece is BaseWeapon)((BaseWeapon)piece).ArmorSetDeActivateProps();
			}	

		
		if(removing)on=false;
					
		return on;
		}
	
	
	
	
	
	
	
	


	}

}