/**********************************************************
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\ScrollOfGreaterKnowledge.cs
Lines of code: 263
***********************************************************/


using System;
using Server;
using Server.Targeting;

namespace Server.Items
{

	public class ScrollOfGreaterKnowledge : Item
	{
		public int dmg1; 
			
		[Constructable]
		public ScrollOfGreaterKnowledge() : base( 5357 )
		{
			Name = "Scroll of Greater Knowledge";
			Hue = 1152;
			Weight = 1.0;

			//Pick a random skill

			switch ( Utility.Random( 55 ) )
			{
				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;
				case 34: dmg1 = 34;break;
				case 35: dmg1 = 35;break;
				case 36: dmg1 = 36;break;
				case 37: dmg1 = 37;break;
				case 38: dmg1 = 38;break;
				case 39: dmg1 = 39;break;
				case 40: dmg1 = 40;break;
				case 41: dmg1 = 41;break;
				case 42: dmg1 = 42;break;
				case 43: dmg1 = 43;break;
				case 44: dmg1 = 44;break;
				case 45: dmg1 = 45;break;
				case 46: dmg1 = 46;break;
				case 47: dmg1 = 47;break;
				case 48: dmg1 = 48;break;
				case 49: dmg1 = 49;break;
				case 50: dmg1 = 50;break;
				case 51: dmg1 = 51;break;
				case 52: dmg1 = 52;break;
				case 53: dmg1 = 53;break;
				case 54: dmg1 = 54;break;			
			}	
		}
		
		private void GetDmgString(ref string prop1)
		{
			//Stores a string according to the skill variable. This is used to inform the player
			//which skill the item contains 
			switch ( dmg1 )
			{
				default:
				case 0: prop1 = "Magery";break;
				case 1: prop1 = "MagicResist";break;
				case 2: prop1 = "Tactics";break;
				case 3: prop1 = "Evaluating Intelligence";break;
				case 4: prop1 = "Spirit Speak";break;
				case 5: prop1 = "Tailoring";break;
				case 6: prop1 = "Anatomy";break;
				case 7: prop1 = "Necromancy";break;
				case 8: prop1 = "Meditation";break;
				case 9: prop1 = "Animal Taming";break;
				case 10: prop1 = "Healing";break;
				case 11: prop1 = "Animal Lore";break;
				case 12: prop1 = "Blacksmithing";break;
				case 13: prop1 = "Swordsmanship";break;
				case 14: prop1 = "Veterinary";break;
				case 15: prop1 = "Musicianship";break;
				case 16: prop1 = "Archery";break;
				case 17: prop1 = "Inscription";break;
				case 18: prop1 = "Hiding";break;
				case 19: prop1 = "Peacemaking";break;
				case 20: prop1 = "Chivalry";break;
				case 21: prop1 = "Mining";break;
				case 22: prop1 = "Parrying";break;
				case 23: prop1 = "Tinkering";break;
				case 24: prop1 = "Focus";break;
				case 25: prop1 = "Fencing";break;
				case 26: prop1 = "Poisoning";break;
				case 27: prop1 = "Wrestling";break;
				case 28: prop1 = "Ninjitsu";break;
				case 29: prop1 = "Stealth";break;
				case 30: prop1 = "Stealing";break;
				case 31: prop1 = "Discordance";break;
				case 32: prop1 = "Carpentry";break;
				case 33: prop1 = "Bushido";break;
				case 34: prop1 = "Lockpicking";break;
				case 35: prop1 = "Mace Fighting";break;
				case 36: prop1 = "Fletching";break;
				case 37: prop1 = "Alchemy";break;
				case 38: prop1 = "Cartography";break;
				case 39: prop1 = "Detect Hidden";break;
				case 40: prop1 = "Lumberjacking";break;
				case 41: prop1 = "Remove Trap";break;
				case 42: prop1 = "Provocation";break;
				case 43: prop1 = "Snooping";break;
				case 44: prop1 = "Arms Lore";break;
				case 45: prop1 = "Fishing";break;
				case 46: prop1 = "Tracking";break;
				case 47: prop1 = "Camping";break;
				case 48: prop1 = "Begging";break;
				case 49: prop1 = "Cooking";break;
				case 50: prop1 = "Forensic Evaluation";break;
				case 51: prop1 = "Item Identification";break;
				case 52: prop1 = "Spellweaving";break;
				case 53: prop1 = "Taste Identification";break;
				case 54: prop1 = "Herding";break;
			}			
		}

		public ScrollOfGreaterKnowledge( 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}", "+15 " + prop1 + " (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 ScrollOfGreaterKnowledge m_ScrollOfGreaterKnowledge;

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

					if ( wp.IsChildOf( from.Backpack ) && m_ScrollOfGreaterKnowledge.IsChildOf( from.Backpack ) && wp.MasterPiecePoints >= 15 )
					{
					
						//Wipe the previous skill	
					
						//Assign the 2 new Elemental Damages to the weapon
						switch (m_ScrollOfGreaterKnowledge.dmg1 )
						{
							default:
							case 0: wp.SkillBonuses.SetValues( 0, SkillName.Magery, 15.0 );break;
							case 1: wp.SkillBonuses.SetValues( 0, SkillName.MagicResist, 15.0 );break;
							case 2: wp.SkillBonuses.SetValues( 0, SkillName.Tactics, 15.0 );break;
							case 3: wp.SkillBonuses.SetValues( 0, SkillName.EvalInt, 15.0 );break;
							case 4: wp.SkillBonuses.SetValues( 0, SkillName.SpiritSpeak, 15.0 );break;
							case 5: wp.SkillBonuses.SetValues( 0, SkillName.Tailoring, 15.0 );break;
							case 6: wp.SkillBonuses.SetValues( 0, SkillName.Anatomy, 15.0 );break;
							case 7: wp.SkillBonuses.SetValues( 0, SkillName.Necromancy, 15.0 );break;
							case 8: wp.SkillBonuses.SetValues( 0, SkillName.Meditation, 15.0 );break;
							case 9: wp.SkillBonuses.SetValues( 0, SkillName.AnimalTaming, 15.0 );break;
							case 10: wp.SkillBonuses.SetValues( 0, SkillName.Healing, 15.0 );break;
							case 11: wp.SkillBonuses.SetValues( 0, SkillName.AnimalLore, 15.0 );break;
							case 12: wp.SkillBonuses.SetValues( 0, SkillName.Blacksmith, 15.0 );break;
							case 13: wp.SkillBonuses.SetValues( 0, SkillName.Swords, 15.0 );break;
							case 14: wp.SkillBonuses.SetValues( 0, SkillName.Veterinary, 15.0 );break;
							case 15: wp.SkillBonuses.SetValues( 0, SkillName.Musicianship, 15.0 );break;
							case 16: wp.SkillBonuses.SetValues( 0, SkillName.Archery, 15.0 );break;
							case 17: wp.SkillBonuses.SetValues( 0, SkillName.Inscribe, 15.0 );break;
							case 18: wp.SkillBonuses.SetValues( 0, SkillName.Hiding, 15.0 );break;
							case 19: wp.SkillBonuses.SetValues( 0, SkillName.Peacemaking, 15.0 );break;
							case 20: wp.SkillBonuses.SetValues( 0, SkillName.Chivalry, 15.0 );break;
							case 21: wp.SkillBonuses.SetValues( 0, SkillName.Mining, 15.0 );break;
							case 22: wp.SkillBonuses.SetValues( 0, SkillName.Parry, 15.0 );break;
							case 23: wp.SkillBonuses.SetValues( 0, SkillName.Tinkering, 15.0 );break;
							case 24: wp.SkillBonuses.SetValues( 0, SkillName.Focus, 15.0 );break;
							case 25: wp.SkillBonuses.SetValues( 0, SkillName.Fencing, 15.0 );break;
							case 26: wp.SkillBonuses.SetValues( 0, SkillName.Poisoning, 15.0 );break;
							case 27: wp.SkillBonuses.SetValues( 0, SkillName.Wrestling, 15.0 );break;
							case 28: wp.SkillBonuses.SetValues( 0, SkillName.Ninjitsu, 15.0 );break;
							case 29: wp.SkillBonuses.SetValues( 0, SkillName.Stealth, 15.0 );break;
							case 30: wp.SkillBonuses.SetValues( 0, SkillName.Stealing, 15.0 );break;
							case 31: wp.SkillBonuses.SetValues( 0, SkillName.Discordance, 15.0 );break;
							case 32: wp.SkillBonuses.SetValues( 0, SkillName.Carpentry, 15.0 );break;
							case 33: wp.SkillBonuses.SetValues( 0, SkillName.Bushido, 15.0 );break;
							case 34: wp.SkillBonuses.SetValues( 0, SkillName.Lockpicking, 15.0 );break;
							case 35: wp.SkillBonuses.SetValues( 0, SkillName.Macing, 15.0 );break;
							case 36: wp.SkillBonuses.SetValues( 0, SkillName.Fletching, 15.0 );break;
							case 37: wp.SkillBonuses.SetValues( 0, SkillName.Alchemy, 15.0 );break;
							case 38: wp.SkillBonuses.SetValues( 0, SkillName.Cartography, 15.0 );break;
							case 39: wp.SkillBonuses.SetValues( 0, SkillName.DetectHidden, 15.0 );break;
							case 40: wp.SkillBonuses.SetValues( 0, SkillName.Lumberjacking, 15.0 );break;
							case 41: wp.SkillBonuses.SetValues( 0, SkillName.RemoveTrap, 15.0 );break;
							case 42: wp.SkillBonuses.SetValues( 0, SkillName.Provocation, 15.0 );break;
							case 43: wp.SkillBonuses.SetValues( 0, SkillName.Snooping, 15.0 );break;
							case 44: wp.SkillBonuses.SetValues( 0, SkillName.ArmsLore, 15.0 );break;
							case 45: wp.SkillBonuses.SetValues( 0, SkillName.Fishing, 15.0 );break;
							case 46: wp.SkillBonuses.SetValues( 0, SkillName.Tracking, 15.0 );break;
							case 47: wp.SkillBonuses.SetValues( 0, SkillName.Camping, 15.0 );break;
							case 48: wp.SkillBonuses.SetValues( 0, SkillName.Begging, 15.0 );break;
							case 49: wp.SkillBonuses.SetValues( 0, SkillName.Cooking, 15.0 );break;
							case 50: wp.SkillBonuses.SetValues( 0, SkillName.Forensics, 15.0 );break;
							case 51: wp.SkillBonuses.SetValues( 0, SkillName.ItemID, 15.0 );break;
							case 52: wp.SkillBonuses.SetValues( 0, SkillName.Spellweaving, 15.0 );break;
							case 53: wp.SkillBonuses.SetValues( 0, SkillName.TasteID, 15.0 );break;
							case 54: wp.SkillBonuses.SetValues( 0, SkillName.Herding, 15.0 );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_ScrollOfGreaterKnowledge.GetDmgString(ref prop1);
						
						from.SendMessage( "Your weapon now increases your knowledge in "+ prop1);
						m_ScrollOfGreaterKnowledge.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();			
		}
	}
}ÿ