- Updated to work with ScriptingEngine changes. MudEngine: - Game.PlayerCollection changed to a List<>. Server obtains a array version of it within Server.initialize() via players = pbs.ToArray(). - All BaseObject classes now require a reference to the Game and contain a property called ActiveGame. - Player.Game removed and now uses it's parent objects ActiveGame property. - Player.Role property added. Uses the new SecurityRoles enum that specifies what level of access the player has. - ScriptEngine now loads all libraries found within the specified ScriptsPath directory, instances the scripts and places them into a collection. - Custom character script instancing is now supported, but not fully implemented throughout the engine. They can be loaded, but not used during runtime at this time.
37 lines
No EOL
1.2 KiB
C#
37 lines
No EOL
1.2 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 bool Override { get; set; }
|
|
|
|
public CommandResults Execute(string command, BaseCharacter player)
|
|
{
|
|
if (player.Role == SecurityRoles.Admin)
|
|
{
|
|
for (int i = 0; i < player.ActiveGame.PlayerCollection.Count/*Length*/; i++)
|
|
player.ActiveGame.PlayerCollection[i].Save(player.ActiveGame.PlayerCollection[i].Name + ".dat");
|
|
player.ActiveGame.Server.EndServer();
|
|
player.ActiveGame.Server.Initialize(555, ref player.ActiveGame.PlayerCollection);
|
|
return new CommandResults("Server Restarted.");
|
|
}
|
|
return new CommandResults("Access Denied.");
|
|
}
|
|
}
|
|
} |