#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 System;
using Arthea.Connections.Enums;
using Arthea.Connections.Players;
namespace Arthea.Commands
{
/// <summary>
/// Implements a quit command.
/// </summary>
public class QuitCommand : Command
{
#region [rgn] Constructors (1)
/// <summary>
/// Initializes a new instance of the <see cref="QuitCommand"/> class.
/// </summary>
public QuitCommand() : base("quit", "Quits the game.")
{
}
#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 (player.Connection == null)
return;
Log.Info("{0} has quit.", player.Name);
player.Act(null, null, Act.ToWorld, "$n has quit.");
player.Played.Add(DateTime.Now.Subtract(player.Login));
player.Save();
player.WriteLine("Good-bye!");
player.Connection.Wait = 100;
player.Connection.State = ConnectionState.Disconnected;
}
#endregion [rgn]
}
}