/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\items\resources\Masterpiece Resources\Common\VolcanicAura.cs
Lines of code: 92
***********************************************************/


using System;
using Server;
using Server.Targeting;

namespace Server.Items
{
	public class VolcanicAura: Item
	{
	
		[Constructable]
		public VolcanicAura() : this( 1 )
		{
		}
	
		[Constructable]
		public VolcanicAura( int amount ) : base( 3983 )
		{
			Hue = 1161;
			Name = "Volcanic Aura";
			Weight = 1.0;
			Stackable = true;
			Amount = amount;
		}

		public VolcanicAura( Serial serial ) : base( serial )
		{
		}
		
		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );
			list.Add(1060658,"Masterpiece Bonus \t{0}","+2 Hit Fire Area (1 Point)");
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1060640 );
			}
			else
			{
				from.Target = new WeaponTarget( this );
				from.SendMessage( "Empower which weapon?" );
			}					
		}
		
		private class WeaponTarget : Target
		{
			private VolcanicAura m_VolcanicAura;

			public WeaponTarget( VolcanicAura powder ) : base( 2, false, TargetFlags.None )
			{
				m_VolcanicAura = powder;
			}
			
			protected override void OnTarget( Mobile from, object targeted ) 
			{ 
				if ( targeted is BaseWeapon )
				{
					BaseWeapon wp = (BaseWeapon)targeted;

					if ( wp.IsChildOf( from.Backpack ) && m_VolcanicAura.IsChildOf( from.Backpack ) && wp.MasterPiecePoints >= 1)
					{
						if( wp.WeaponAttributes.HitFireArea < 100 && wp.WeaponAttributes.HitPhysicalArea <= 0 && wp.WeaponAttributes.HitColdArea <= 0 && wp.WeaponAttributes.HitEnergyArea <= 0 && wp.WeaponAttributes.HitPoisonArea <= 0)
						{
							from.FixedParticles( 0x37C4, 1, 8, 9916, 90, 3, EffectLayer.Head );
							from.FixedParticles( 0x37C4, 1, 8, 9502, 90, 4, EffectLayer.Head );
							from.PlaySound( 0x210 );
							from.FixedParticles( 0x373A, 1, 17, 9903, 90, 4, EffectLayer.Head );
							from.PlaySound( 0x244 );
							wp.WeaponAttributes.HitFireArea += 2;
							wp.MasterPiecePoints -= 1;
							from.SendMessage( "Your weapon has been enhanced with the power of heat" );
							
							if ( wp.WeaponAttributes.HitFireArea > 100)
								wp.WeaponAttributes.HitFireArea = 100;
							
							m_VolcanicAura.Consume();
						}
						else if ( wp.WeaponAttributes.HitPhysicalArea >= 1 || wp.WeaponAttributes.HitColdArea >= 1 || wp.WeaponAttributes.HitEnergyArea >= 1 || wp.WeaponAttributes.HitPoisonArea >= 1 )
							from.SendMessage( "Your weapon can only contain one type of area hit spell" );
						else
							from.SendMessage( "That item has reached the maximum hit fire area allowed" );
					}
					else if (wp.MasterPiecePoints <= 0)
						from.SendMessage( "You either don't have enough points or the item is not a Masterpiece" );
				}
				else
					from.SendMessage( "That cannot be empowered" );
			}
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}ÿ