context: using System;
  using System.Collections;
  using System.IO;
  using System.Text;
  using Server;
  using Server.Items;
  using Server.Mobiles;
  using Server.Network;
  using Server.Gumps;
  using Server.Commands;
  
  namespace Server.Commands
  {
  	public enum EmotePage 
  	{ 
  		P1,
  		P2,
  		P3,
  		P4,
  	}
  	public class Emote
  	{	
  		public static void Initialize()
  		{
  			CommandSystem.Register( "emote", AccessLevel.Player, new CommandEventHandler( Emote_OnCommand ) );
  			CommandSystem.Register( "e", AccessLevel.Player, new CommandEventHandler( Emote_OnCommand ) );
  		}
  
  	  	[Usage( "<sound>" )] 
  	      	[Description( "Emote with sounds, words, and possibly an animation with one command!")] 
  		public static void Emote_OnCommand( CommandEventArgs e )
  		{
  			Mobile pm = e.Mobile;
          	 	string em = e.ArgString.Trim();
  			int SoundInt;
  			switch( em )
  			{
  				case "ah":
  					SoundInt = 1;
  					break;
  				case "ahha":
  					SoundInt = 2;
  					break;					
  				case "applaud":
  					SoundInt = 3;
  					break;				
  				case "blownose":
  					SoundInt = 4;
  					break;					
  				case "bow":
  					SoundInt = 5;
  					break;
  				case "bscough":
  					SoundInt = 6;
  					break;
  				case "burp":
  					SoundInt = 7;
  					break;
  				case "clearthroat":
  					SoundInt = 8;
  					break;
  				case "cough":
  					SoundInt = 9;
  					break;
  				case "cry":
  					SoundInt = 10;
  					break;
  				case "faint":					
  					SoundInt = 11;
  					break;
  				case "fart":
  					SoundInt = 12;
  					break;
  				case "gasp":
  					SoundInt = 13;
  					break;
  				case "giggle":
  					SoundInt = 14;
  					break;
  				case "groan":
  					SoundInt = 15;
  					break;
  				case "growl":
  					SoundInt = 16;
  					break;
  				case "hey":
  					SoundInt = 17;
  					break;
  				case "hiccup":
  					SoundInt = 18;
  					break;
  				case "huh":
  					SoundInt = 19;
  					break;
  				case "kiss":
  					SoundInt = 20;
  					break;
  				case "laugh":
  					SoundInt = 21;
  					break;
  				case "no":
  					SoundInt = 22;
  					break;
  				case "oh":
  					SoundInt = 23;
  					break;
  				case "oooh":
  					SoundInt = 24;
  					break;
  				case "oops":
  					SoundInt = 25;
  					break;
  				case "puke":
  					SoundInt = 26;
  					break;
  				case "punch": 					
  					SoundInt = 27;
  					break;
  				case "scream":
  					SoundInt = 28;
  					break;
  				case "shush":
  					SoundInt = 29;
  					break;
  				case "sigh":
  					SoundInt = 30;
  					break;
  				case "slap":
  					SoundInt = 31;
  					break;
  				case "sneeze":
  					SoundInt = 32;
  					break;
  				case "sniff":
  					SoundInt = 33;
  					break;
  				case "snore":
  					SoundInt = 34;
  					break;
  				case "spit":
  					SoundInt = 35;
  					break;
  				case "stickouttongue":
  					SoundInt = 36;
  					break;
  				case "tapfoot":
  					SoundInt = 37;
  					break;
  				case "whistle":
  					SoundInt = 38;
  					break;
  				case "woohoo":
  					SoundInt = 39;
  					break;
  				case "yawn":
  					SoundInt = 40;
  					break;
  				case "yea":
  					SoundInt = 41;
  					break;
  				case "yell":
  					SoundInt = 42;
  					break;				
  				default:
  					SoundInt = 0;
  					e.Mobile.SendGump( new EmoteGump( e.Mobile, EmotePage.P1) );
  					break;
  			}
  			if ( SoundInt > 0 )
  				new ESound( pm, SoundInt );
  		} 
  	}
  	public class EmoteGump : Gump 
  	{ 
  		private Mobile m_From; 
  		private EmotePage m_Page; 
  		private const int Blanco = 0xFFFFFF; 
  		private const int Azul = 0x8080FF; 
  		public void AddPageButton( int x, int y, int buttonID, string text, EmotePage page, params EmotePage[] subpage ) 
  		{ 
  			bool seleccionado = ( m_Page == page ); 
  			for ( int i = 0; !seleccionado && i < subpage.Length; ++i ) 
  			seleccionado = ( m_Page == subpage[i] ); 
  			AddButton( x, y - 1, seleccionado ? 4006 : 4005, 4007, buttonID, GumpButtonType.Reply, 0 ); 
  			AddHtml( x + 35, y, 200, 20, Color( text, seleccionado ? Azul : Blanco ), false, false ); 
  		} 
  		public void AddButtonLabeled( int x, int y, int buttonID, string text ) 
  		{ 
  			AddButton( x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0 ); 
  			AddHtml( x + 35, y, 240, 20, Color( text, Blanco ), false, false ); 
  		} 
  		public int GetButtonID( int type, int index ) 
  		{ 
  			return 1 + (index * 15) + type; 
  		} 
  		public string Color( string text, int color ) 
  		{ 
  			return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text ); 
  		} 
  		public EmoteGump ( Mobile from, EmotePage page) : base ( 600, 50 ) 
  		{ 
  			from.CloseGump( typeof( EmoteGump ) ); 
  			m_From = from; 
  			m_Page = page; 
  			Closable = true; 
  			Dragable = true; 
  			AddPage( 0 );
  			AddBackground( 0, 65, 130, 360, 5054);
  			AddAlphaRegion( 10, 70, 110, 350 );
  			AddImageTiled( 10, 70, 110, 20, 9354);
  			AddLabel( 13, 70, 200, "Emote List");
  			AddImage( 100, 0, 10410);
  			AddImage( 100, 305, 10412);
  			AddImage( 100, 150, 10411);
  			switch ( page ) 
  			{
  				case EmotePage.P1:
  				{
  					AddButtonLabeled( 10, 90, GetButtonID( 1, 1 ), "Ah");
  					AddButtonLabeled( 10, 115, GetButtonID( 1, 2 ), "Ah-ha");
  					AddButtonLabeled( 10, 140, GetButtonID( 1, 3 ), "Applaud");
  					AddButtonLabeled( 10, 165, GetButtonID( 1, 4 ), "Blows Nose");
  					AddButtonLabeled( 10, 190, GetButtonID( 1, 5 ), "Bows");
  					AddButtonLabeled( 10, 215, GetButtonID( 1, 6 ), "BS Cough");
  					AddButtonLabeled( 10, 240, GetButtonID( 1, 7 ), "Burp");
  					AddButtonLabeled( 10, 265, GetButtonID( 1, 8 ), "Clear Throat");
  					AddButtonLabeled( 10, 290, GetButtonID( 1, 9 ), "Cough");
  					AddButtonLabeled( 10, 315, GetButtonID( 1, 10 ), "Cry");
  					AddButtonLabeled( 10, 340, GetButtonID( 1, 11 ), "Faints");
  					AddButtonLabeled( 10, 365, GetButtonID( 1, 12 ), "Fart");
  					AddButton( 70, 380, 4502, 0504, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
  					break; 
  				}
  				case EmotePage.P2:
  				{ 
  					AddButtonLabeled( 10, 90, GetButtonID( 1, 13 ), "Gasp");
  					AddButtonLabeled( 10, 115, GetButtonID( 1, 14 ), "Giggle");
  					AddButtonLabeled( 10, 140, GetButtonID( 1, 15 ), "Groan");
  					AddButtonLabeled( 10, 165, GetButtonID( 1, 16 ), "Growl");
  					AddButtonLabeled( 10, 190, GetButtonID( 1, 17 ), "Hey");
  					AddButtonLabeled( 10, 215, GetButtonID( 1, 18 ), "Hiccup");
  					AddButtonLabeled( 10, 240, GetButtonID( 1, 19 ), "Huh");
  					AddButtonLabeled( 10, 265, GetButtonID( 1, 20 ), "Kiss");
  					AddButtonLabeled( 10, 290, GetButtonID( 1, 21 ), "Laughs");
  					AddButtonLabeled( 10, 315, GetButtonID( 1, 22 ), "No");
  					AddButtonLabeled( 10, 340, GetButtonID( 1, 23 ), "Oh");
  					AddButtonLabeled( 10, 365, GetButtonID( 1, 24 ), "Oooh");
  					AddButton( 10, 380, 4506, 4508, GetButtonID( 0,1 ), GumpButtonType.Reply, 0 );
  					AddButton( 70, 380, 4502, 0504, GetButtonID( 0,3 ), GumpButtonType.Reply, 0 );
  					break; 
  				} 
  				case EmotePage.P3:
  				{
  					AddButtonLabeled( 10, 90, GetButtonID( 1, 25 ), "Oops");
  					AddButtonLabeled( 10, 115, GetButtonID( 1, 26 ), "Puke");
  					AddButtonLabeled( 10, 140, GetButtonID( 1, 27 ), "Punch");
  					AddButtonLabeled( 10, 165, GetButtonID( 1, 28 ), "Scream");
  					AddButtonLabeled( 10, 190, GetButtonID( 1, 29 ), "Shush");
  					AddButtonLabeled( 10, 215, GetButtonID( 1, 30 ), "Sigh");
  					AddButtonLabeled( 10, 240, GetButtonID( 1, 31 ), "Slap");
  					AddButtonLabeled( 10, 265, GetButtonID( 1, 32 ), "Sneeze");
  					AddButtonLabeled( 10, 290, GetButtonID( 1, 33 ), "Sniff");
  					AddButtonLabeled( 10, 315, GetButtonID( 1, 34 ), "Snore");
  					AddButtonLabeled( 10, 340, GetButtonID( 1, 35 ), "Spit");
  					AddButtonLabeled( 10, 365, GetButtonID( 1, 36 ), "Sticks Tongue");
  					AddButton( 10, 380, 4506, 4508, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
  					AddButton( 70, 380, 4502, 0504, GetButtonID( 0,4 ), GumpButtonType.Reply, 0 );
  					break; 
  				} 
  				case EmotePage.P4:
  				{
  					AddButtonLabeled( 10, 90, GetButtonID( 1, 37 ), "Taps Foot");
  
gt: 					AddButtonLabeled( 10, 115, GetButtonID( 1, 38 ), "Whistle");