- Login command now supports Offline games. Skips various things that are server related only. - Added a constructor to SaveDataPaths for quickly being able to assign paths. - Game.Start is now Virtual so that scripts may override it. - Game.Start now supports single player games and initializes players within it. - Log now provides a Verbose mode so that Singleplayer games no longer gets flooded with Game startup messages. - BaseCharacter.Initialize() Initialize no longer crashes when called with IsMultiplayer set to false. - BaseCharacter.ReadInput() now supports IsMultiplayer being false. MudServer: - Now supports singleplayer and multiplayer games within a single application. - MudServer is now ready to be re-named to MudGame and will be used for both Offline and Online games.
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
|
|
using MudEngine.FileSystem;
|
|
using MudEngine.GameManagement;
|
|
using MudEngine.GameObjects;
|
|
using MudEngine.GameObjects.Characters;
|
|
|
|
namespace MudEngine.Commands
|
|
{
|
|
public class CommandSave : IGameCommand
|
|
{
|
|
public bool Override { get; set; }
|
|
public string Name { get; set; }
|
|
|
|
public CommandResults Execute(string command, BaseCharacter player)
|
|
{
|
|
string path = player.ActiveGame.DataPaths.Players;
|
|
string filename = Path.Combine(path, player.Filename);
|
|
|
|
//Temporary hack
|
|
if (player.ActiveGame.PlayerCollection.Length != 0)
|
|
{
|
|
if (player.ActiveGame.PlayerCollection[0].GetType().Name != "BaseCharacter")
|
|
{
|
|
Scripting.GameObject obj = player.ActiveGame.scriptEngine.GetObject(player.ActiveGame.PlayerCollection.GetType().Name);
|
|
|
|
obj.InvokeMethod("Save", new object[] { player.Name });
|
|
}
|
|
}
|
|
else
|
|
player.Save(filename); //Should never be called?
|
|
|
|
return new CommandResults();
|
|
}
|
|
}
|
|
}
|