/// <summary>
/// Dispatch the event (in a script context).
/// </summary>
/// <param name="Script">Supplies the script object.</param>
/// <param name="Database">Supplies the database connection.</param>
public void DispatchEvent(ACR_ServerCommunicator Script, ALFA.Database Database)
{
foreach (uint PlayerObject in Script.GetPlayers(true))
{
string FormattedMessage = String.Format(
"</c><c=#FFFF00>Server shutting down: {0}</c>",
Message);
NWScript.Vector3 v;
v.x = v.y = v.z = 0.0f;
Script.SendChatMessage(
CLRScriptBase.OBJECT_INVALID,
PlayerObject,
CLRScriptBase.CHAT_MODE_SERVER,
FormattedMessage,
CLRScriptBase.FALSE);
Script.FloatingTextStringOnCreature(FormattedMessage,
PlayerObject,
CLRScriptBase.FALSE,
5.0f,
CLRScriptBase.COLOR_WHITE,
CLRScriptBase.COLOR_WHITE,
0.0f,
v);
}
Script.WriteTimestampedLogEntry("Received shutdown request: " + Message);
Database.ACR_IncrementStatistic("SERVER_SHUTDOWN");
Script.SendInfrastructureIrcMessage(String.Format(
"Server '{0}' shutting down or restarting: {1}",
Script.GetName(Script.GetModule()),
Message));
Script.DelayCommand(5.0f, delegate()
{
Database.ACR_FlushAllQueryQueues();
SystemInfo.ShutdownGameServer(Script);
});
}