#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 System.Text;
namespace Arthea.Environment
{
/// <summary>
/// Holds global variables
/// </summary>
public struct Globals
{
#region Fields (3)
/// <summary>
/// The default room
/// </summary>
public const uint Limbo = 1;
private static bool lockDown = false;
/// <summary>
/// The port number
/// </summary>
public static short PortNumber = 4000;
#endregion
#region Properties (1)
/// <summary>
/// Gets the encoding.
/// </summary>
/// <value>The encoding.</value>
public static Encoding Encoding
{
get { return Encoding.UTF8; }
}
/// <summary>
/// Gets or sets a value indicating whether [lock down].
/// </summary>
/// <value><c>true</c> if [lock down]; otherwise, <c>false</c>.</value>
public static bool LockDown
{
get { return lockDown; }
set
{
if (lockDown && value == false)
{
Log.Warn("Connections allowed once again...");
}
lockDown = value;
if (value)
{
Log.Warn("Blocking new connections...");
}
}
}
#endregion
#region Methods (1)
/// <summary>
/// Saves this instance.
/// </summary>
public static void Save()
{
Lists.Save();
}
#endregion
}
/// <summary>
/// The level the server is running at.
/// </summary>
public enum ServerState
{
/// <summary>
/// The server is booting
/// </summary>
Booting,
/// <summary>
/// The server is rebooting
/// </summary>
Rebooting,
/// <summary>
/// The server is running
/// </summary>
Running,
/// <summary>
/// The server is shutting down
/// </summary>
Stopping
}
/// <summary>
/// Implementation of randomizer.
/// </summary>
public struct Randomizer
{
#region Fields (1)
/// <summary>
/// Random number generator
/// </summary>
private static readonly Random randomizer = new Random();
#endregion
#region Methods (3)
/// <summary>
/// Gets a random number.
/// </summary>
/// <returns>a random number</returns>
public static int Next()
{
return randomizer.Next();
}
/// <summary>
/// Gets a random number less than a max value.
/// </summary>
/// <param name="maxValue">The max value.</param>
/// <returns>a random number</returns>
public static int Next(int maxValue)
{
return randomizer.Next(maxValue);
}
/// <summary>
/// Gets a random number specified by a range.
/// </summary>
/// <param name="minValue">The min value.</param>
/// <param name="maxValue">The max value.</param>
/// <returns>a random number</returns>
public static int Next(int minValue, int maxValue)
{
return randomizer.Next(minValue, maxValue);
}
#endregion
}
}