muddesigner/MudEngine/Commands/CommandExit.cs
Scionwest_cp a52ccf8da9 MudEngine:
- Converted all Types from C# types to .NET Types (such as bool changed to Boolean, and int changed to Int32).
 - Zone no longer gets saved from within GameWorld.Save, but rather in Realm.Save()
 - Room no longer gets saved from within GameWorld.Save(), but rather in Zone.Save();
 - Added new SaveWorld command that admins only can execute to force save the world. It's not fully implemented at this time.

MudGame:
 - began work on command execution from within the server while it's running.
2010-08-14 00:20:43 -07:00

52 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using MudEngine.FileSystem;
using MudEngine.GameObjects.Characters;
using MudEngine.GameManagement;
using MudEngine.Commands;
using MudEngine.GameObjects.Environment;
namespace MudEngine.Commands
{
public class CommandExit : IGameCommand
{
public Boolean Override { get; set; }
public String Name { get; set; }
public CommandResults Execute(String command, BaseCharacter player)
{
if (player.ActiveGame.IsMultiplayer)
{
//Let other players know that the user walked in.
for (Int32 i = 0; i != player.ActiveGame.PlayerCollection.Length; i++)
{
if (player.ActiveGame.PlayerCollection[i].Name == player.Name)
continue;
String room = player.ActiveGame.PlayerCollection[i].CurrentRoom.Name;
String realm = player.ActiveGame.PlayerCollection[i].CurrentRoom.Realm;
String zone = player.ActiveGame.PlayerCollection[i].CurrentRoom.Zone;
if ((room == player.CurrentRoom.Name) && (realm == player.CurrentRoom.Realm) && (zone == player.CurrentRoom.Zone))
{
player.ActiveGame.PlayerCollection[i].Send(player.Name + " has left.");
}
}
player.Disconnect();
}
else
{
//Save the player prior to attempting to shutdown.
//Player saving is handled in the server disconnect code but not in game shutdown.
player.Save(player.ActiveGame.DataPaths.Players);
player.ActiveGame.Shutdown();
}
return new CommandResults();
}
}
}