MudEngine:
- Realm, Room and Zone editing no longer closes the menu once a task is finished. Use the Exit menu option to close the editing menu - Revised how the Game checks for existing InitialLocations. If a InitialLocation does not exist, but is created during server runtime, new players will automatically be placed there without the need to restart the server. - Improved the List command.
This commit is contained in:
parent
b3238d0227
commit
304b2d07eb
7 changed files with 155 additions and 91 deletions
|
@ -21,7 +21,8 @@ namespace MudEngine.Commands
|
|||
public List<String> Help { get; set; }
|
||||
|
||||
private Realm realm;
|
||||
BaseCharacter player;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditRealm()
|
||||
{
|
||||
|
@ -63,6 +64,11 @@ namespace MudEngine.Commands
|
|||
//Otherwise, the Realm does exist and was retrieved.
|
||||
//Lets build our Editing menu's and allow for Realm Editing.
|
||||
else
|
||||
{
|
||||
//Always re-build the menu so the user doesn't need to re-enter the edit command.
|
||||
//When the user selects the exit option, the loop will end.
|
||||
isEditing = true;
|
||||
while (isEditing)
|
||||
{
|
||||
//Construct the main editing menu.
|
||||
BuildMenuMain();
|
||||
|
@ -83,6 +89,7 @@ namespace MudEngine.Commands
|
|||
|
||||
//Parse the menu option that the admin supplied.
|
||||
ParseMenuSelection(value);
|
||||
}
|
||||
//let the admin know that we have now exited the editor.
|
||||
player.Send("Editing completed.");
|
||||
}
|
||||
|
@ -238,6 +245,7 @@ namespace MudEngine.Commands
|
|||
ParseInitialSelection(entry);
|
||||
break;
|
||||
case 9:
|
||||
isEditing = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace MudEngine.Commands
|
|||
public List<String> Help { get; set; }
|
||||
|
||||
private Room room;
|
||||
BaseCharacter player;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditRoom()
|
||||
{
|
||||
|
@ -81,6 +82,10 @@ namespace MudEngine.Commands
|
|||
//Otherwise, the Room does exist and was retrieved.
|
||||
//Lets build our Editing menu's and allow for Room Editing.
|
||||
else
|
||||
{
|
||||
isEditing = true;
|
||||
|
||||
while (isEditing)
|
||||
{
|
||||
//Construct the main editing menu.
|
||||
BuildMenuMain();
|
||||
|
@ -101,6 +106,7 @@ namespace MudEngine.Commands
|
|||
|
||||
//Parse the menu option that the admin supplied.
|
||||
ParseMenuSelection(value);
|
||||
}
|
||||
//let the admin know that we have now exited the editor.
|
||||
player.Send("Editing completed.");
|
||||
}
|
||||
|
@ -120,7 +126,7 @@ namespace MudEngine.Commands
|
|||
player.Send("3: Senses");
|
||||
player.Send("4: Initial Room");
|
||||
player.Send("5: Settings");
|
||||
player.Send("6: Doorways");
|
||||
//player.Send("6: Doorways");
|
||||
player.Send("9: Exit");
|
||||
player.Send("Enter numeric selection: ", false);
|
||||
}
|
||||
|
@ -262,6 +268,7 @@ namespace MudEngine.Commands
|
|||
case 6: //Doorways
|
||||
break;
|
||||
case 9:
|
||||
isEditing = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace MudEngine.Commands
|
|||
public List<String> Help { get; set; }
|
||||
|
||||
private Zone zone;
|
||||
BaseCharacter player;
|
||||
private BaseCharacter player;
|
||||
private Boolean isEditing;
|
||||
|
||||
public CommandEditZone()
|
||||
{
|
||||
|
@ -75,6 +76,11 @@ namespace MudEngine.Commands
|
|||
//Otherwise, the Zone does exist and was retrieved.
|
||||
//Lets build our Editing menu's and allow for Zone Editing.
|
||||
else
|
||||
{
|
||||
//Always re-build the menu so the user doesn't need to re-enter the edit command.
|
||||
//When the user selects the exit option, the loop will end.
|
||||
isEditing = true;
|
||||
while (isEditing)
|
||||
{
|
||||
//Construct the main editing menu.
|
||||
BuildMenuMain();
|
||||
|
@ -95,6 +101,7 @@ namespace MudEngine.Commands
|
|||
|
||||
//Parse the menu option that the admin supplied.
|
||||
ParseMenuSelection(value);
|
||||
}
|
||||
//let the admin know that we have now exited the editor.
|
||||
player.Send("Editing completed.");
|
||||
}
|
||||
|
@ -113,7 +120,7 @@ namespace MudEngine.Commands
|
|||
player.Send("2: Names");
|
||||
player.Send("3: Senses");
|
||||
player.Send("4: Initial Zone");
|
||||
player.Send("5: Settings");
|
||||
// player.Send("5: Settings");
|
||||
player.Send("9: Exit");
|
||||
player.Send("Enter numeric selection: ", false);
|
||||
}
|
||||
|
@ -253,6 +260,7 @@ namespace MudEngine.Commands
|
|||
case 5: //Settings
|
||||
break;
|
||||
case 9:
|
||||
isEditing = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -195,6 +195,7 @@ namespace MudEngine.GameManagement
|
|||
scriptEngine = new Scripting.ScriptEngine(this);
|
||||
World = new GameWorld(this);
|
||||
WorldTime = new GameTime(this);
|
||||
InitialRealm = new Realm(this);
|
||||
|
||||
//Prepare the Save Paths for all of our Game objects.
|
||||
DataPaths = new SaveDataPaths("World", "Player");
|
||||
|
@ -279,6 +280,17 @@ namespace MudEngine.GameManagement
|
|||
//Load the game and world if it was previously saved.
|
||||
Load();
|
||||
|
||||
String[] env = InitialRealm.InitialZone.InitialRoom.RoomLocation.Split('>');
|
||||
if (env.Length == 3)
|
||||
{
|
||||
if ((String.IsNullOrEmpty(env[0])) || (String.IsNullOrEmpty(env[1])) || (String.IsNullOrEmpty(env[2])))
|
||||
{
|
||||
Log.Write("Error: No starting location defined!");
|
||||
}
|
||||
}
|
||||
else
|
||||
Log.Write("Error: No starting location defined!");
|
||||
|
||||
Log.Write("Game startup complete.");
|
||||
return true;
|
||||
}
|
||||
|
@ -429,6 +441,16 @@ namespace MudEngine.GameManagement
|
|||
//Restore the world.
|
||||
World.Load();
|
||||
|
||||
//Check if any the initial room exists or not.
|
||||
if ((this.InitialRealm == null) || (this.InitialRealm.InitialZone == null) || (this.InitialRealm.InitialZone.InitialRoom == null))
|
||||
{
|
||||
Log.Write("ERROR: No initial location defined. Game startup failed!");
|
||||
Log.Write("Players will start in the Abyss. Each player will contain their own instance of this room.");
|
||||
//return false;
|
||||
}
|
||||
else
|
||||
Log.Write("Initial Location loaded: " + this.InitialRealm.InitialZone.InitialRoom.RoomLocationWithoutExtension);
|
||||
|
||||
Log.Write("Game Restore complete.");
|
||||
}
|
||||
|
||||
|
|
|
@ -74,17 +74,6 @@ namespace MudEngine.GameManagement
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if any the initial room exists or not.
|
||||
if ((_Game.InitialRealm == null) || (_Game.InitialRealm.InitialZone == null) || (_Game.InitialRealm.InitialZone.InitialRoom == null))
|
||||
{
|
||||
Log.Write("ERROR: No initial location defined. Game startup failed!");
|
||||
Log.Write("Players will start in the Abyss. Each player will contain their own instance of this room.");
|
||||
//return false;
|
||||
}
|
||||
else
|
||||
Log.Write("Initial Location loaded: " + _Game.InitialRealm.InitialZone.InitialRoom.RoomLocationWithoutExtension);
|
||||
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MudEngine.GameObjects.Environment
|
|||
{
|
||||
get
|
||||
{
|
||||
return this.Realm + ">" + Zone + ">" + Filename;
|
||||
return this.Realm + ">" + this.Zone + ">" + this.Filename;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,20 @@ public class CommandList : IGameCommand
|
|||
switch (data[0])
|
||||
{
|
||||
case "realms":
|
||||
if (player.ActiveGame.World.RealmCollection.Count == 0)
|
||||
player.Send("There are currently no loaded Realm files.");
|
||||
else
|
||||
{
|
||||
player.Send("Currently loaded Realm files:");
|
||||
foreach (Realm r in player.ActiveGame.World.RealmCollection)
|
||||
player.Send(r.Filename + " | ", false);
|
||||
}
|
||||
break;
|
||||
case "players":
|
||||
if (System.IO.Directory.GetFiles(player.ActiveGame.DataPaths.Players, "*.character").Length == 0)
|
||||
player.Send("There are currently no characters created on this server.");
|
||||
else
|
||||
{
|
||||
player.Send("Players with created characters:");
|
||||
BaseCharacter p = new BaseCharacter(player.ActiveGame);
|
||||
foreach (String file in System.IO.Directory.GetFiles(player.ActiveGame.DataPaths.Players, "*.character"))
|
||||
|
@ -69,14 +78,35 @@ public class CommandList : IGameCommand
|
|||
p.Load(file);
|
||||
player.Send(p.Name + " | ", false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "zones":
|
||||
player.Send("Currently loaded Zones. This spans across every Realm in the world.");
|
||||
if (player.ActiveGame.World.RealmCollection.Count == 0)
|
||||
{
|
||||
player.Send("There are currently no Zones created on this server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (Realm r in player.ActiveGame.World.RealmCollection)
|
||||
{
|
||||
foreach (Zone z in r.ZoneCollection)
|
||||
{
|
||||
player.Send(System.IO.Path.GetFileNameWithoutExtension(r.Filename) + ">" + System.IO.Path.GetFileNameWithoutExtension(z.Filename));
|
||||
names.Add(System.IO.Path.GetFileNameWithoutExtension(r.Filename) + ">" + System.IO.Path.GetFileNameWithoutExtension(z.Filename));
|
||||
}
|
||||
}
|
||||
|
||||
if (names.Count == 0)
|
||||
{
|
||||
player.Send("There are currently no Zones created on this server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Send("Currently loaded Zones. This spans across every Realm in the world.");
|
||||
foreach (String name in names)
|
||||
{
|
||||
player.Send(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue