/**********************************************************
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\Rare\TotemOfEradication.cs
Lines of code: 200
***********************************************************/


using System;
using Server;
using Server.Targeting;

namespace Server.Items
{

	public class TotemOfEradication : Item
	{
		public int dmg1; 
			
		[Constructable]
		public TotemOfEradication() : base( 8707 )
		{
			Name = "Totem Of Eradication";
			Hue = 1157;
			Weight = 1.0;

			//Pick a random slayer (Stored in numbers right now)

			switch ( Utility.Random( 34 ) )
			{
				default:
				case 0: dmg1 = 0;break;
				case 1: dmg1 = 1;break;
				case 2: dmg1 = 2;break;
				case 3: dmg1 = 3;break;
				case 4: dmg1 = 4;break;
				case 5: dmg1 = 5;break;
				case 6: dmg1 = 6;break;
				case 7: dmg1 = 7;break;
				case 8: dmg1 = 8;break;
				case 9: dmg1 = 9;break;
				case 10: dmg1 = 10;break;
				case 11: dmg1 = 11;break;
				case 12: dmg1 = 12;break;
				case 13: dmg1 = 13;break;
				case 14: dmg1 = 14;break;
				case 15: dmg1 = 15;break;
				case 16: dmg1 = 16;break;
				case 17: dmg1 = 17;break;
				case 18: dmg1 = 18;break;
				case 19: dmg1 = 19;break;
				case 20: dmg1 = 20;break;
				case 21: dmg1 = 21;break;
				case 22: dmg1 = 22;break;
				case 23: dmg1 = 23;break;
				case 24: dmg1 = 24;break;
				case 25: dmg1 = 25;break;
				case 26: dmg1 = 26;break;
				case 27: dmg1 = 27;break;
				case 28: dmg1 = 28;break;
				case 29: dmg1 = 29;break;
				case 30: dmg1 = 30;break;
				case 31: dmg1 = 31;break;
				case 32: dmg1 = 32;break;
				case 33: dmg1 = 33;break;		
			}			
		}
		
		
		
		private void GetDmgString(ref string prop1)
		{
			//Stores a string according to the slayer damage variable. This is used to inform the player
			//which slayer the item contains (gargoyle, elemental, etc)
			switch ( dmg1 )
			{
				default:
				case 0: prop1 = "Lizardman";break;
				case 1: prop1 = "Orc";break;
				case 2: prop1 = "Ogre";break;
				case 3: prop1 = "Troll";break;
				case 4: prop1 = "Undead";break;
				case 5: prop1 = "Fey";break;
				case 6: prop1 = "Elemental";break;
				case 7: prop1 = "Blood Elemental";break;
				case 8: prop1 = "Earth Elemental";break;
				case 9: prop1 = "Poison Elemental";break;
				case 10: prop1 = "Fire Elemental";break;
				case 11: prop1 = "Air Elemental";break;
				case 12: prop1 = "Snow Elemental";break;
				case 13: prop1 = "Water Elemental";break;
				case 14: prop1 = "Daemon";break;
				case 15: prop1 = "Gargoyle";break;
				case 16: prop1 = "Arachnid";break;
				case 17: prop1 = "Spider";break;
				case 18: prop1 = "Scorpion";break;
				case 19: prop1 = "Tarathan";break;
				case 20: prop1 = "Reptile";break;
				case 21: prop1 = "Dragon";break;
				case 22: prop1 = "Repond";break;
				case 23: prop1 = "Snake";break;
				case 24: prop1 = "Ophidian";break;
				case 25: prop1 = "Vermin";break;
				case 26: prop1 = "Bat";break;
				case 27: prop1 = "Mage";break;
				case 28: prop1 = "Beetle";break;
				case 29: prop1 = "Bird";break;
				case 30: prop1 = "Ice";break;
				case 31: prop1 = "Flame";break;
				case 32: prop1 = "Bovine";break;
				case 33: prop1 = "Wolf";break;
			}
		}

		public TotemOfEradication( Serial serial ) : base( serial )
		{
		}
		
		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			string prop1="a";
			GetDmgString(ref prop1);			
			
			list.Add(1060658,"Masterpiece Bonus \t{0}", prop1 + " Slayer" + " (15 Points)");
		}

		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 TotemOfEradication m_TotemOfEradication;

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

					if ( wp.IsChildOf( from.Backpack ) && m_TotemOfEradication.IsChildOf( from.Backpack ) && wp.MasterPiecePoints >= 15 )
					{
						//Assign the new slayer to the weapon
						switch (m_TotemOfEradication.dmg1 )
						{
							default:
							case 0: wp.Slayer = SlayerName.LizardmanSlaughter; break;
							case 1: wp.Slayer = SlayerName.OrcSlaying; break;
							case 2: wp.Slayer = SlayerName.OgreTrashing; break;
							case 3: wp.Slayer = SlayerName.TrollSlaughter; break;
							case 4: wp.Slayer = SlayerName.Silver; break;
							case 5: wp.Slayer = SlayerName.Fey; break;
							case 6: wp.Slayer = SlayerName.ElementalBan; break;
							case 7: wp.Slayer = SlayerName.BloodDrinking; break;
							case 8: wp.Slayer = SlayerName.EarthShatter; break;
							case 9: wp.Slayer = SlayerName.ElementalHealth; break;
							case 10: wp.Slayer = SlayerName.FlameDousing; break;
							case 11: wp.Slayer = SlayerName.Vacuum; break;
							case 12: wp.Slayer = SlayerName.SummerWind; break;
							case 13: wp.Slayer = SlayerName.WaterDissipation; break;
							case 14: wp.Slayer = SlayerName.Exorcism; break;
							case 15: wp.Slayer = SlayerName.GargoylesFoe; break;
							case 16: wp.Slayer = SlayerName.ArachnidDoom; break;
							case 17: wp.Slayer = SlayerName.SpidersDeath;break;
							case 18: wp.Slayer = SlayerName.ScorpionsBane; break;
							case 19: wp.Slayer = SlayerName.Terathan; break;
							case 20: wp.Slayer = SlayerName.ReptilianDeath; break;
							case 21: wp.Slayer = SlayerName.DragonSlaying; break;
							case 22: wp.Slayer = SlayerName.Repond; break;
							case 23: wp.Slayer = SlayerName.SnakesBane; break;
							case 24: wp.Slayer = SlayerName.Ophidian; break;
							case 25: wp.Slayer = SlayerName.Vermin; break;
							case 26: wp.Slayer = SlayerName.Bear; break;
							case 27: wp.Slayer = SlayerName.Mage; break;
							case 28: wp.Slayer = SlayerName.Beetle; break;
							case 29: wp.Slayer = SlayerName.Bird; break;
							case 30: wp.Slayer = SlayerName.Ice; break;
							case 31: wp.Slayer = SlayerName.Flame; break;
							case 32: wp.Slayer = SlayerName.Bovine; break;
							case 33: wp.Slayer = SlayerName.Wolf; break;	
						}	
				
						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.MasterPiecePoints -= 15;
						
						string prop1="a";
						m_TotemOfEradication.GetDmgString(ref prop1);
						
						from.SendMessage( "Your weapon now has the ability to slay "+ prop1);
						m_TotemOfEradication.Consume();
					}
					else if (wp.MasterPiecePoints <= 14)
						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 );
			writer.Write(dmg1);	
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			dmg1=reader.ReadInt();			
		}
	}
}ÿ