context: using System;
  using System.Collections.Generic;
  using Server;
  using Server.Items;
  using Server.Gumps;
  using Server.Prompts;
  using Server.Network;
  using Server.ContextMenus;
  using Server.Multis;
  
  namespace Server.Mobiles
  {
  	public class ChangeRumorMessagePrompt : Prompt
  	{
  		private PlayerBarkeeper m_Barkeeper;
  		private int m_RumorIndex;
  
  		public ChangeRumorMessagePrompt( PlayerBarkeeper barkeeper, int rumorIndex )
  		{
  			m_Barkeeper = barkeeper;
  			m_RumorIndex = rumorIndex;
  		}
  
  		public override void OnCancel( Mobile from )
  		{
  			OnResponse( from, "" );
  		}
  
  		public override void OnResponse( Mobile from, string text )
  		{
  			if( text.Length > 130 )
  				text = text.Substring( 0, 130 );
  
  			m_Barkeeper.EndChangeRumor( from, m_RumorIndex, text );
  		}
  	}
  
  	public class ChangeRumorKeywordPrompt : Prompt
  	{
  		private PlayerBarkeeper m_Barkeeper;
  		private int m_RumorIndex;
  
  		public ChangeRumorKeywordPrompt( PlayerBarkeeper barkeeper, int rumorIndex )
  		{
  			m_Barkeeper = barkeeper;
  			m_RumorIndex = rumorIndex;
  		}
  
  		public override void OnCancel( Mobile from )
  		{
  			OnResponse( from, "" );
  		}
  
  		public override void OnResponse( Mobile from, string text )
  		{
  			if( text.Length > 130 )
  				text = text.Substring( 0, 130 );
  
  			m_Barkeeper.EndChangeKeyword( from, m_RumorIndex, text );
  		}
  	}
  
  	public class ChangeTipMessagePrompt : Prompt
  	{
  		private PlayerBarkeeper m_Barkeeper;
  
  		public ChangeTipMessagePrompt( PlayerBarkeeper barkeeper )
  		{
  			m_Barkeeper = barkeeper;
  		}
  
  		public override void OnCancel( Mobile from )
  		{
  			OnResponse( from, "" );
  		}
  
  		public override void OnResponse( Mobile from, string text )
  		{
  			if ( text.Length > 130 )
  				text = text.Substring( 0, 130 );
  
  			m_Barkeeper.EndChangeTip( from, text );
  		}
  	}
  
  	public class BarkeeperRumor
  	{
  		private string m_Message;
  		private string m_Keyword;
  
  		public string Message{ get{ return m_Message; } set{ m_Message = value; } }
  		public string Keyword{ get{ return m_Keyword; } set{ m_Keyword = value; } }
  
  		public BarkeeperRumor( string message, string keyword )
  		{
  			m_Message = message;
  			m_Keyword = keyword;
  		}
  
  		public static BarkeeperRumor Deserialize( GenericReader reader )
  		{
  			if ( !reader.ReadBool() )
  				return null;
  
  			return new BarkeeperRumor( reader.ReadString(), reader.ReadString() );
  		}
  
  		public static void Serialize( GenericWriter writer, BarkeeperRumor rumor )
  		{
  			if ( rumor == null )
  			{
  				writer.Write( false );
  			}
  			else
  			{
  				writer.Write( true );
  				writer.Write( rumor.m_Message );
  				writer.Write( rumor.m_Keyword );
  			}
  		}
  	}
  
  	public class ManageBarkeeperEntry : ContextMenuEntry
  	{
  		private Mobile m_From;
  		private PlayerBarkeeper m_Barkeeper;
  
  		public ManageBarkeeperEntry( Mobile from, PlayerBarkeeper barkeeper ) : base( 6151, 12 )
  		{
  			m_From = from;
  			m_Barkeeper = barkeeper;
  		}
  
  		public override void OnClick()
  		{
  			m_Barkeeper.BeginManagement( m_From );
  		}
  	}
  
  	public class PlayerBarkeeper : BaseVendor
  	{
  		private Mobile m_Owner;
  		private BaseHouse m_House;
  		private string m_TipMessage;
  
  		private BarkeeperRumor[] m_Rumors;
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public Mobile Owner
  		{
  			get{ return m_Owner; }
  			set{ m_Owner = value; }
  		}
  
  		public BaseHouse House
  		{
  			get{ return m_House; }
  			set
  			{
  				if ( m_House != null )
  					m_House.PlayerBarkeepers.Remove( this );
  
  				if ( value != null )
  					value.PlayerBarkeepers.Add( this );
  
  				m_House = value;
  			}
  		}
  
  		[CommandProperty( AccessLevel.GameMaster )]
  		public string TipMessage
  		{
  			get{ return m_TipMessage; }
  			set{ m_TipMessage = value; }
  		}
  
  		public override bool IsActiveBuyer{ get{ return false; } }
  		public override bool IsActiveSeller{ get{ return ( m_SBInfos.Count > 0 ); } }
  
  		public override bool DisallowAllMoves{ get{ return true; } }
  		public override bool NoHouseRestrictions{ get{ return true; } }
  
  		public BarkeeperRumor[] Rumors{ get{ return m_Rumors; } }
  
  		public override VendorShoeType ShoeType{ get{ return Utility.RandomBool() ? VendorShoeType.ThighBoots : VendorShoeType.Boots; } }
  
  		public override bool GetGender()
  		{
  			return false; // always starts as male
  		}
  
  		public override void InitOutfit()
  		{
  			base.InitOutfit();
  
  			AddItem( new HalfApron( RandomBrightHue() ) );
  
  			Container pack = this.Backpack;
  
  			if ( pack != null )
  				pack.Delete();
  		}
  
  		public override void InitBody()
  		{
  			base.InitBody();
  
  			Hue = 0x83F4; // hue is not random
  
  			Container pack = this.Backpack;
  
  			if ( pack != null )
  				pack.Delete();
  		}
  
  		public PlayerBarkeeper( Mobile owner, BaseHouse house ) : base( "the barkeeper" )
  		{
  			m_Owner = owner;
  			House = house;
  
gt: 			m_Rumors = new BarkeeperRumor[3];