using System;
using System.Collections;
using Server.Network;
using Server.Targeting;
using Server.Prompts;

namespace Server.Items
{
	public class FlaskAle : Item
	{
		public FlaskAle() : this( 1 )
		{
		}

		public FlaskAle( int amount ) : base( 0x0DDF )
		{
			Stackable = true;
			Amount = amount;
			Name = "flask of ale";
			Weight = 1.0;
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) ) 
			{
				from.SendMessage( "This must be in your backpack to drink." );
				return;
			}
			else
			{
				// increase characters thirst value based on type of drink
				if ( from.Thirst < 20 )
				{
					from.Thirst += 2;
					// Send message to character about their current thirst value
					int iThirst = from.Thirst;
					if ( iThirst < 5 )
						from.SendMessage( "You drink the ale but are still extremely thirsty" );
					else if ( iThirst < 10 )
						from.SendMessage( "You drink the ale and feel less thirsty" );
					else if ( iThirst < 15 )
						from.SendMessage( "You drink the ale and feel much less thirsty" ); 
					else
						from.SendMessage( "You drink the ale and are no longer thirsty" );

					this.Consume();
					from.PlaySound( Utility.RandomList( 0x30, 0x2D6 ) );
				}
				else
				{
					from.SendMessage( "You are simply too quenched to drink anymore" );
					from.Thirst = 20;
				}
			}
		}

		public FlaskAle( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 ); // version
		}

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

	public class FlaskWine : Item
	{
		public FlaskWine() : this( 1 )
		{
		}

		public FlaskWine( int amount ) : base( 0x0DE0 )
		{
			Stackable = true;
			Amount = amount;
			Name = "flask of wine";
			Weight = 1.0;
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) ) 
			{
				from.SendMessage( "This must be in your backpack to drink." );
				return;
			}
			else
			{
				// increase characters thirst value based on type of drink
				if ( from.Thirst < 20 )
				{
					from.Thirst += 2;
					// Send message to character about their current thirst value
					int iThirst = from.Thirst;
					if ( iThirst < 5 )
						from.SendMessage( "You drink the wine but are still extremely thirsty" );
					else if ( iThirst < 10 )
						from.SendMessage( "You drink the wine and feel less thirsty" );
					else if ( iThirst < 15 )
						from.SendMessage( "You drink the wine and feel much less thirsty" ); 
					else
						from.SendMessage( "You drink the wine and are no longer thirsty" );

					this.Consume();
					from.PlaySound( Utility.RandomList( 0x30, 0x2D6 ) );
				}
				else
				{
					from.SendMessage( "You are simply too quenched to drink anymore" );
					from.Thirst = 20;
				}
			}
		}

		public FlaskWine( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 ); // version
		}

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