#region Arthea License
/***********************************************************************
*  Arthea MUD by R. Jennings (2007)      http://arthea.googlecode.com/ *
*  By using this code you comply with the Artistic and GPLv2 Licenses. *
***********************************************************************/
#endregion
using Arthea.Connections.Colors;
using Arthea.Connections.Players;
namespace Arthea.Commands.Communication
{
    /// <summary>
    /// Implementation of a say command.
    /// </summary>
    public class SayCommand : Command
    {
        #region [rgn] Constructors (1)
        /// <summary>
        /// Initializes a new instance of the <see cref="SayCommand"/> class.
        /// </summary>
        public SayCommand() : base("say", "speaks a message to the room")
        {
            Alias = "'";
        }
        #endregion [rgn]
        #region [rgn] Methods (1)
        // [rgn] Public Methods (1)
        /// <summary>
        /// Processes the command for a player.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="argument">The argument.</param>
        public override void Process(Player player, String argument)
        {
            if (!argument)
            {
                player.WriteLine("Say what?");
                return;
            }
            // should somehow centralize this
            player.Act(null, null, Act.ToPlayer,
                       CustomColor.Say + "You say '" + CustomColor.SayText + "{0}" + CustomColor.Say + "'~X",
                       argument);
            player.Act(null, null, Act.ToRoom,
                       CustomColor.Say + "{0} says '" + CustomColor.SayText + "{1}" + CustomColor.Say + "'~X",
                       player.Name,
                       argument);
        }
        #endregion [rgn]
    }
}