/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\ML Peerless + misc areas\Melisande\Quest\objectives.cs
Lines of code: 85
***********************************************************/


using System;
using Server;
using Server.Mobiles;
using Server.Items;

namespace Server.Engines.Quests.FrightenedDryad
{
	public class KillDryads : QuestObjective
	{
		public override object Message
		{
			get
			{
				return "Kill 7 insane dryads and 1 Saliva";
			}
		}

		public override int MaxProgress{ get{ return 8; } }
		
		private int Dryadskilled=0;
		private int Salivaskilled=0;

		public KillDryads()
		{
		}

		public override void RenderProgress( BaseQuestGump gump )
		{
			if ( !Completed )
			{				
				//dryads
				gump.AddLabel( 70, 280, 0x64, Dryadskilled.ToString());
				gump.AddLabel( 100, 280, 0x64, "/ " );
				gump.AddLabel( 130, 280, 0x64, "7 Insane Dryads");
				
				//salivas
				gump.AddLabel( 70, 300, 0x64, Salivaskilled.ToString());
				gump.AddLabel( 100, 300, 0x64, "/ " );
				gump.AddLabel( 130, 300, 0x64, "1 Salivas" );				
			}
			else
			{
				base.RenderProgress( gump );
			}
		}

		public override void OnKill( BaseCreature creature, Container corpse )
		{
			if ( creature is InsaneDryad && Dryadskilled<7)
			{
				CurProgress++;
				Dryadskilled++;
			}
			else if(creature is Saliva && Salivaskilled<1)
			{
				CurProgress++;
				Salivaskilled++;			
			}
		}

		public override void OnComplete()
		{
			System.AddObjective( new ReturnAfterKillsObjective() );
		}
		
		public override void ChildDeserialize( GenericReader reader )
		{
			int version = reader.ReadEncodedInt();

			Dryadskilled = reader.ReadInt();
			Salivaskilled = reader.ReadInt();
		}

		public override void ChildSerialize( GenericWriter writer )
		{
			writer.WriteEncodedInt( (int) 0 ); // version

			writer.Write( (int) Dryadskilled );
			writer.Write( (int) Salivaskilled );
		}		
		
	}

	public class ReturnAfterKillsObjective : QuestObjective
	{
		public override object Message
		{
			get
			{
				return "You've completed your task of slaying the dryads and saliva.  Return to the Frightened Dryad for your reward.";
			}
		}

		public ReturnAfterKillsObjective()
		{
		}

		public override void OnComplete()
		{
			System.AddConversation( new EndConversation() );
		}
	}
}