- Added new Project. Mud Designer project will include the GUI elements needed for graphically building a MUD. Due to Environment creation being finalized, work on a GUI based Environment creation can start. Mud Engine: - Objects no longer require a path to be supplied when calling Object.Save() - EditRealm command now edits senses. - EditRoom now fully supports creating doorways, however editing existing doorways and linking to existing rooms is not implemented. This command only supports creating new doorways for non-existing Rooms (Rooms are generated as needed) - EditZone Now fully supports senses and implemented. - Game now supports loading of .ini files when calling Game.Load() - All objects now include a SavePath properties. Override this to supply a path for where the object needs to be saved. All Environment and BaseCharacter objects override the BaseObject.SavePath to save into ActiveGame.DataPaths.Environemnts and Players respectively. - ObjectCollection now instanced during ScriptEngine initialization to prevent exceptions during runtime. - Create command no longer converts all names to lower case. - Updated the Walk command to execute the Look command in a safe manor without injecting a command into the player Telnet console.
61 lines
No EOL
2.1 KiB
C#
61 lines
No EOL
2.1 KiB
C#
//Microsoft.NET Framework
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
|
|
//MUD Engine
|
|
using MudEngine.GameObjects.Characters;
|
|
using MudEngine.GameManagement;
|
|
using MudEngine.GameObjects.Environment;
|
|
using MudEngine.GameObjects;
|
|
using MudEngine.FileSystem;
|
|
|
|
namespace MudEngine.Commands
|
|
{
|
|
class CommandRestart : IGameCommand
|
|
{
|
|
public String Name { get; set; }
|
|
public Boolean Override { get; set; }
|
|
|
|
public List<String> Help { get; set; }
|
|
|
|
public CommandRestart()
|
|
{
|
|
Help = new List<string>();
|
|
Help.Add("Restarts the game server.");
|
|
}
|
|
|
|
public void Execute(String command, BaseCharacter player)
|
|
{
|
|
if (player.Role == SecurityRoles.Admin)
|
|
{
|
|
String path = player.ActiveGame.DataPaths.Players;
|
|
|
|
for (Int32 i = 0; i < player.ActiveGame.GetPlayerCollection().Length; i++)
|
|
{
|
|
String filename = Path.Combine(path, player.ActiveGame.GetPlayerCollection()[i].Filename);
|
|
player.ActiveGame.GetPlayerCollection()[i].Save();
|
|
}
|
|
|
|
//player.ActiveGame.Server.EndServer(); //-Handled in Game.Shutdown() below.
|
|
player.ActiveGame.Shutdown();
|
|
player.ActiveGame.Start();
|
|
/* Game.Start() calls this, do we need a reference to the GetPlayerCollection()?
|
|
* They should be unloaded anyway and re-loaded during game.start to force a clean restart of all objects.
|
|
player.ActiveGame.Server.Initialize(555, ref player.ActiveGame.GetPlayerCollection());
|
|
*/
|
|
|
|
Log.Write("Server Restart Completed.");
|
|
//This is never printed as CommandResults is no longer outputted to the player console, player.Send is used
|
|
player.Send("Server Restarted.");
|
|
return;
|
|
}
|
|
|
|
player.Send("Access Denied.");
|
|
}
|
|
}
|
|
} |