MudEngine:

- Added FileManager.GetDataSpan() method. This allows developers to start at a line and collect the next 'x' number of lines after that starting line.
        Example: GetDataSpan("MyFile.txt", 5, "DoorwayArrivalRoom", true);
        This seeks MyFile.txt until it finds "DoorwayArrivalRoom" and then it stores that line and the next 4 lines for a total of 5 lines and returns the collection.
        The last argument 'true' means that the method will scan the rest of the file after the initial 5 lines and add any other lines that match the "DoorwayArrivalRoom" string as well.

 - Deleted CommandResults class as it's no longer used by the script engine.
 - Singleplayer and Multiplayer save data paths are now the same paths by default.
 - Game.Update() method now checks for auto-saving (instead of MudGame performing this check)
 - Saving and restoring of Realms, Zones, Rooms and Doorways now fully implemented.
 - GameTime now supports auto-saving
 - GameWorld.Update() now calls BaseCharacter.Update() and is ready for future update code.
 - GameWorld.AddObject and GameWorld.RemoveObject() have been removed.
 - GameWorld.AddRealm() re-added for adding Realms pre-populated with zones/rooms. Note that Zones and Rooms can be added to a Realm even after it has been added to the GameWorld.RealmCollection
 - BaseObject now contains a OnStart() event method.
 - BaseObject.Save() now saves BaseObject.DetailedDescription collection content.
 - Updated BaseCharacter to retrieve Environments by Filename rather than Object name.
 - BaseStats.Experience property added.
 - Door.RoomTravelType enum added for determining if the room is Arrival or Departure
 - Door.SetRoom() method added for restoring a Rooms Doorway link during world restoration.
 - Renamed Room.InstallPath to Room.RoomLocation. Contains a MyRealm.Realm>MyZone.Zone>MyRoom.Room path
 - Added Room.RoomLocationWithoutExtension property for returning the Rooms location without file extensions. Ex: MyRealm>MyZone>MyRoom
 - Room now saves Doorways.
 - The GameWorld now restores the link between Rooms once all Environment objects have been instanced and restored from their saved state.

MudGame:
 - Minor clean-up with MudGame loop and shutdown.
 - Updated scripts to reflect changes made to the engine.
This commit is contained in:
Scionwest_cp 2010-09-03 19:50:32 -07:00
parent 35a0c65b99
commit de82476525
16 changed files with 372 additions and 185 deletions

View file

@ -84,6 +84,79 @@ namespace MudEngine.FileSystem
return items;
}
/// <summary>
/// Gets a collection of data from a file spanning
/// </summary>
/// <param name="filename"></param>
/// <param name="startingLine"></param>
/// <param name="endingLine"></param>
/// <returns></returns>
public static List<String> GetDataSpan(String filename, Int32 linesToSpan)
{
List<String> items = new List<String>();
Int32 currentLine = 1;
foreach (String line in File.ReadAllLines(filename))
{
if (line.StartsWith(";"))
continue;
items.Add(line);
if (currentLine == linesToSpan)
break;
else
currentLine++;
}
return items;
}
public static List<String> GetDataSpan(String filename, Int32 linesToSpan, String startingValue, Boolean spanAllSimilar)
{
List<String> items = new List<String>();
String[] fileData = File.ReadAllLines(filename);
Int32 line = 0;
while (line <= fileData.Length)
{
if (fileData[line].StartsWith(";"))
continue;
else if (fileData[line].ToLower().StartsWith(startingValue.ToLower()))
{
Boolean isComplete = false;
while (!isComplete)
{
Int32 startingLine = line;
//Exception prevention first.
if (line >= fileData.Length)
{
isComplete = true;
continue;
}
if (fileData[line].ToLower().StartsWith(startingValue.ToLower()))
{
for (Int32 i = startingLine; i != (startingLine + linesToSpan); i++)
{
String[] content = fileData[i].Split('=');
items.Add(content[1]);
line++;
}
if (!spanAllSimilar)
isComplete = true;
}
}
}
line++;
}
return items;
}
/// <summary>
/// Returns the complete path to the specified data's save folder.
/// </summary>

View file

@ -1,30 +0,0 @@
//Microsoft .NET Framework
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudEngine.GameManagement
{
public class CommandResults
{
/// <summary>
/// Result of the command.
/// </summary>
public object[] Result { get; set; }
public CommandResults()
{
}
public CommandResults(object[] Result)
{
this.Result = Result;
}
public CommandResults(String message)
{
this.Result = new object[] { message };
}
}
}

View file

@ -219,7 +219,7 @@ namespace MudEngine.GameManagement
PlayerCollection[i] = new BaseCharacter(this);
AutoSave = true;
AutoSaveInterval = 30;
AutoSaveInterval = 1;
MinimumPasswordSize = 6;
}
@ -266,7 +266,7 @@ namespace MudEngine.GameManagement
}
else //Not multiplayer so we change the save locations
{
SaveDataPaths paths = new SaveDataPaths("World", "Saved");
SaveDataPaths paths = new SaveDataPaths("World", "Player");
DataPaths = paths;
PlayerCollection[0].Initialize();
}
@ -302,28 +302,9 @@ namespace MudEngine.GameManagement
public virtual void Update()
{
DateTime serverTime = new DateTime();
DateTime systemTime = DateTime.Now;
Int32 lastSaveGap = 0;
WorldTime.Update();
if (lastSaveGap == AutoSaveInterval)
{
if (AutoSave)
Save();
lastSaveGap = 0;
}
//ServerTime holds the last minute prior to our current minute.
if (serverTime.Minute != DateTime.Now.Minute)
{
serverTime = DateTime.Now;
lastSaveGap++;
}
World.Update();
if (IsMultiplayer)
{
@ -383,6 +364,11 @@ namespace MudEngine.GameManagement
FileManager.WriteLine(filename, this.Version, "Version");
FileManager.WriteLine(filename, this.Website, "Website");
foreach (Realm r in World.RealmCollection)
{
FileManager.WriteLine(filename, r.Filename, "RealmCollection");
}
//TODO: Save WorldTime
//TODO: Save Story
//TODO: Save Server Information
@ -430,7 +416,6 @@ namespace MudEngine.GameManagement
}
//Restore the world.
Log.Write("Restoring World Environments...");
World.Load();
Log.Write("Game Restore complete.");

View file

@ -97,6 +97,8 @@ namespace MudEngine.GameManagement
/// </summary>
public Time InitialGameTime { get; set; }
private Int32 _LastSavedTime = 0;
public GameTime(Game game)
{
ActiveGame = game;
@ -172,6 +174,23 @@ namespace MudEngine.GameManagement
IncrementSecond(amount);
//Log.Write(GetCurrentWorldTime());
}
DateTime systemTime = DateTime.Now;
if (_LastSavedTime == ActiveGame.AutoSaveInterval)
{
if (ActiveGame.AutoSave)
ActiveGame.Save();
_LastSavedTime = 0;
}
//ServerTime holds the last minute prior to our current minute.
if (CurrentSystemTime.Minute != DateTime.Now.Minute)
{
_LastSavedTime++;
}
CurrentSystemTime = DateTime.Now;
}
public void IncrementSecond(Int32 amount)

View file

@ -83,7 +83,7 @@ namespace MudEngine.GameManagement
//return false;
}
else
Log.Write("Initial Location loaded-> " + _Game.InitialRealm.Name + "." + _Game.InitialRealm.InitialZone.Name + "." + _Game.InitialRealm.InitialZone.InitialRoom.Name);
Log.Write("Initial Location loaded: " + _Game.InitialRealm.InitialZone.InitialRoom.RoomLocationWithoutExtension);
}
@ -100,83 +100,56 @@ namespace MudEngine.GameManagement
{
String filename = _Game.GameTitle + ".ini";
//Restore initial realm
//Get the Initial Realm information from saved file.
String realmFile = FileManager.GetData(filename, "InitialRealm");
String realmFolder = Path.GetFileNameWithoutExtension(realmFile);
String realmPath = Path.Combine(_Game.DataPaths.Environment, realmFolder, realmFile);
Log.Write("Restoring Game World...");
//Loop through each RealmCollection data entry stored in the _Game saved file.
foreach (String realm in FileManager.GetCollectionData(filename, "RealmCollection"))
{
Log.Write("Restoring Realm " + realm);
Realm r = new Realm(_Game);
r.Load(Path.Combine(realmPath, realm));
//Restore the Realm objects properties from file.
r.Load(Path.Combine(_Game.DataPaths.Environment, Path.GetFileNameWithoutExtension(realm), realm));
//Loop through each of the Realm objects instanced during startup and find one matching the loaded filename
for (int x = 0; x != RealmCollection.Count; x++)
{
//If the filenames match, then overwrite the pre-loaded Realm with the restored Realm with the saved data.
if (RealmCollection[x].Filename == r.Filename)
{
RealmCollection[x] = r;
break;
}
}
}
foreach (Realm r in RealmCollection)
{
if (r.IsInitialRealm)
{
_Game.InitialRealm = r;
break;
}
}
}
/// <summary>
/// Adds a object to the game world. Any Game Object can be supplied as a parameter.
/// </summary>
/// <param name="worldObject"></param>
public Boolean AddObject(dynamic worldObject)
foreach (Zone z in r.ZoneCollection)
{
//Check if this object is a Realm
if (worldObject is Realm)
{
///Add it to the Worlds Realm collection
this.RealmCollection.Add(worldObject);
}
//Check if this object is a Zone
else if (worldObject is Zone)
{
//Query the Realm collection to find the Realm this Zone belongs to.
var realmQuery =
from r in RealmCollection
where r.Filename == worldObject.Realm
select r;
//Add the zone to the Realm we found
if (realmQuery.FirstOrDefault() != null)
realmQuery.FirstOrDefault().AddZone(worldObject);
else
{
Log.Write("Error: Attempted to add Zone " + worldObject.Filename + " to a unspecified Realm.");
return false;
Log.Write("Restoring Zone: " + z.Filename);
z.RestoreLinkedRooms();
}
}
else if (worldObject is Room)
{
var realmQuery =
from r in RealmCollection
where r.Filename == worldObject.Realm
select r;
var zoneQuery =
from z in realmQuery.FirstOrDefault().ZoneCollection
where z.Filename == worldObject.Zone
select z;
if (zoneQuery.FirstOrDefault() != null)
zoneQuery.FirstOrDefault().AddRoom(worldObject);
else
{
Log.Write("Error: Attempted to add Room " + worldObject.Filename + " to a unspecified Realm and/or Zone");
return false;
}
}
return true;
}
/// <summary>
/// Adds a Realm to the Games current list of Realms.
/// </summary>
/// <param name="realm"></param>
private void AddRealm(Realm realm)
public void AddRealm(Realm realm)
{
//If this Realm is set as Initial then we need to disable any previously
//set Realms to avoid conflict.
@ -200,48 +173,12 @@ namespace MudEngine.GameManagement
RealmCollection.Add(realm);
}
/// <summary>
/// Returs a reference to an object that matches the supplied Type and filename.
/// Object MUST inherit from BaseObject or one of its child classes in order to be found.
/// </summary>
/// <param name="objectType">Determins the Type of object to perform the search for. Using Standard will search for objects that inherit from BaseObject, but none of BaseObjects child Types.</param>
/// <param name="filename"></param>
/// <returns></returns>
public BaseObject GetObject(ObjectTypes objectType, String filename)
{
BaseObject obj = new BaseObject(_Game);
switch (objectType)
{
case ObjectTypes.Standard:
break;
case ObjectTypes.Character:
break;
case ObjectTypes.Item:
break;
case ObjectTypes.Realm:
obj = GetRealm(filename);
break;
case ObjectTypes.Zone:
break;
case ObjectTypes.Room:
break;
}
return obj;
}
/// <summary>
/// Returns a reference to the Realm contained within the Realms collection if it exists.
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
private Realm GetRealm(String filename)
public Realm GetRealm(String filename)
{
foreach (Realm r in RealmCollection)
{
@ -251,5 +188,13 @@ namespace MudEngine.GameManagement
return null;
}
public virtual void Update()
{
foreach (BaseCharacter character in Characters)
{
character.Update();
}
}
}
}

View file

@ -6,6 +6,7 @@ using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using System.IO;
using System.Reflection;
//MUD Engine
using MudEngine.FileSystem;
@ -116,6 +117,10 @@ namespace MudEngine.GameObjects
return this.Name;
}
public virtual void Start()
{
}
public virtual void OnEnter()
{
}
@ -166,6 +171,9 @@ namespace MudEngine.GameObjects
FileManager.WriteLine(filename, this.Feel, "Feel");
FileManager.WriteLine(filename, this.Listen, "Listen");
FileManager.WriteLine(filename, this.Smell, "Smell");
foreach (String line in DetailedDescription)
FileManager.WriteLine(filename, line, "DetailedDescription");
}
public virtual void Load(String filename)
@ -184,6 +192,11 @@ namespace MudEngine.GameObjects
this.Listen = FileManager.GetData(filename, "Listen");
this.Smell = FileManager.GetData(filename, "Smell");
List<String> data = FileManager.GetCollectionData(filename, "DetailedDescription");
foreach (String line in data)
DetailedDescription.Add(line);
//Set the Filename property based off the physical filename, as setting this.Name sets a default filename
//which might not match that of the actual physical filename on the harddrive.
this.Filename = Path.GetFileName(filename);

View file

@ -20,12 +20,30 @@
{
public class BaseCharacter : BaseObject
{
/// <summary>
/// Password for the player's account.
/// </summary>
private String Password { get; set; }
/// <summary>
/// The last time that the AI (if IsControlled=false) performed any major changes like traversing Rooms etc.
/// </summary>
private GameTime.Time _LastUpdate;
/// <summary>
/// Gets or Sets if the AI (if IsControlled=false) cannot move from it's CurrentRoom.
/// This is used by Shop keeper type NPC's
/// </summary>
public Boolean IsStatic { get; set; }
/// <summary>
/// The current Room this Character is located at.
/// </summary>
public Room CurrentRoom { get; set; }
/// <summary>
/// Gets the complete path to the Characters current location, including Realm, Zone and Room.
/// </summary>
public String CurrentWorldLocation
{
get
@ -114,7 +132,7 @@
}
//Restore the users current Room.
Realm realm = (Realm)ActiveGame.World.GetObject(ObjectTypes.Realm, FileManager.GetData(filename, "CurrentRealm"));
Realm realm = (Realm)ActiveGame.World.GetRealm(FileManager.GetData(filename, "CurrentRealm"));
if (realm == null)
{
@ -122,7 +140,7 @@
return;
}
List<Zone> zones = realm.GetZoneByFilename(FileManager.GetData(filename, "CurrentZone"));
List<Zone> zones = realm.GetZone(FileManager.GetData(filename, "CurrentZone"));
Zone zone = new Zone(ActiveGame);
if (zones.Count == 0)
{
@ -183,6 +201,13 @@
FileManager.WriteLine(path, this.CurrentRoom.Realm, "CurrentRealm");
}
public virtual void Update()
{
//TODO: Update AI logic.
//TODO: AI Logic: Don't attack anything if CurrentRoom.IsSafe
//TODO: Add Stat modifiers for Zone and Rooms.
}
/// <summary>
/// Moves the player from one Room to another if the supplied direction contains a doorway.
/// Returns false if no doorway is available.

View file

@ -70,5 +70,11 @@ namespace MudEngine.GameObjects.Characters
/// </summary>
public Int32 Charisma { get; set; }
/// <summary>
/// Experiance is given to the player based off activities that they perform.
/// </summary>
public Int32 Experiance { get; set; }
}
}

View file

@ -8,6 +8,7 @@ using System.ComponentModel;
//MUD Engine
using MudEngine.GameObjects.Items;
using MudEngine.GameManagement;
namespace MudEngine.GameObjects.Environment
{
@ -15,6 +16,12 @@ namespace MudEngine.GameObjects.Environment
[Serializable]
public class Door
{
public enum RoomTravelType
{
Arrival,
Departure
}
[Category("Door Settings")]
[DefaultValue(false)]
public Boolean IsLocked
@ -52,11 +59,68 @@ namespace MudEngine.GameObjects.Environment
/// </summary>
public Room DepartureRoom { get; set; }
private Game _Game;
public Door(GameManagement.Game game)
{
LevelRequirement = 0;
IsLocked = false;
RequiredKey = new BaseItem(game);
_Game = game;
}
public Boolean SetRoom(RoomTravelType roomType, String roomPath)
{
String[] path = roomPath.Split('>');
if (path.Length > 3)
{
Log.Write("Error in Door.SetRoom(" + roomType.ToString() + ", " + roomPath + ") does not contain a full Room Path.");
return false;
}
//TODO: Load the Realm via Game.World if it isn't loaded yet. Ensures that the Realm is only ever loaded once.
if (_Game.World.GetRealm(path[0]) != null)
{
Realm r = _Game.World.GetRealm(path[0]);
//TODO: Load the Zone via Game.World.GetRealm(). Ensures that only 1 instance of the Realm is loaded.
if (r.GetZone(path[1]) != null)
{
List<Zone> zlist = r.GetZone(path[1]);
Zone z = zlist[0];
//TODO: Load the Room via Game.World.GetRealm().GetZone(). Ensures that the Room is only loaded once in memory.
if (z.GetRoomByFilename(path[2]) != null)
{
List<Room> rlist = z.GetRoomByFilename(path[2]);
if (roomType == RoomTravelType.Arrival)
ArrivalRoom = rlist[0];
else
DepartureRoom = rlist[0];
return true;
}
else
{
Log.Write("Error in Door.SetRoom(" + roomType.ToString() + ", " + roomPath + ") does not contain a valid Room");
return false;
}//GetRoom
}//GetZone
else
{
Log.Write("Error in Door.SetRoom(" + roomType.ToString() + ", " + roomPath + ") does not contain a valid zone.");
return false;
}
}//GetRealm
else
{
Log.Write("Error in Door.SetRoom(" + roomType.ToString() + ", " + roomPath + ") does not contain a valid Realm");
return false;
}
}
}
}

View file

@ -51,16 +51,12 @@ namespace MudEngine.GameObjects.Environment
{
Zone z = new Zone(ActiveGame);
z.Load(Path.Combine(zonePath, zone));
}
//Set the initial zone.
foreach (Zone z in ZoneCollection)
{
//Check if this is the initial Zone.
if (z.IsInitialZone)
{
InitialZone = z;
break;
}
ZoneCollection.Add(z);
}
}
@ -83,7 +79,7 @@ namespace MudEngine.GameObjects.Environment
}
}
public List<Zone> GetZoneByFilename(String filename)
public List<Zone> GetZone(String filename)
{
List<Zone> zones = new List<Zone>();

View file

@ -51,26 +51,6 @@ namespace MudEngine.GameObjects.Environment
set;
}
[Browsable(false)]
public String InstallPath
{
get
{
String zonePath = "";
if (this.Realm == null || this.Realm == "No Realm Associated.")
{
zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
zonePath = Path.Combine(zonePath, this.Zone);
}
else
zonePath = FileManager.GetDataPath(this.Realm, this.Zone);
String roomPath = Path.Combine(zonePath, "Rooms");
String filename = Path.Combine(roomPath, this.Filename);
return filename;
}
}
/// <summary>
/// Gets or Sets if this is the starting room for the Zone that contains it.
/// </summary>
@ -82,6 +62,30 @@ namespace MudEngine.GameObjects.Environment
set;
}
/// <summary>
/// Gets the current complete location for this Room, including Realm and Zone paths.
/// This includes the objects Filenames.
/// </summary>
public String RoomLocation
{
get
{
return this.Realm + ">" + Zone + ">" + Filename;
}
}
/// <summary>
/// Gets the current complete location for this Room, including Realm and Zone paths.
/// This includes the objects Filenames without their file extension.
/// </summary>
public String RoomLocationWithoutExtension
{
get
{
return Path.GetFileNameWithoutExtension(Realm) + ">" + Path.GetFileNameWithoutExtension(Zone) + ">" + Path.GetFileNameWithoutExtension(Filename);
}
}
public Room(Game game) :base(game)
{
Doorways = new List<Door>();
@ -89,6 +93,11 @@ namespace MudEngine.GameObjects.Environment
IsSafe = false;
}
/// <summary>
/// Saves the Room to file within the Game.DataPath.Environment path.
/// Room is saved within a Realm/Zone/Room directory structure
/// </summary>
/// <param name="path"></param>
public override void Save(String path)
{
base.Save(path);
@ -99,6 +108,34 @@ namespace MudEngine.GameObjects.Environment
FileManager.WriteLine(filename, this.IsSafe.ToString(), "IsSafe");
FileManager.WriteLine(filename, this.Realm, "Realm");
FileManager.WriteLine(filename, this.Zone, "Zone");
FileManager.WriteLine(filename, Doorways.Count.ToString(), "DoorwayCount");
foreach (Door d in Doorways)
{
FileManager.WriteLine(filename, d.ArrivalRoom.RoomLocation, "DoorwayArrivalRoom");
FileManager.WriteLine(filename, d.DepartureRoom.RoomLocation, "DoorwayDepartureRoom");
FileManager.WriteLine(filename, d.IsLocked.ToString(), "DoorwayIsLocked");
FileManager.WriteLine(filename, d.LevelRequirement.ToString(), "DoorwayLevelRequirement");
FileManager.WriteLine(filename, d.TravelDirection.ToString(), "DoorwayTravelDirection");
//TODO: Save Doorway Keys
}
}
public override void Load(string filename)
{
base.Load(filename);
this.IsInitialRoom = Convert.ToBoolean(FileManager.GetData(filename, "IsInitialRoom"));
this.IsSafe = Convert.ToBoolean(FileManager.GetData(filename, "IsSafe"));
this.Realm = FileManager.GetData(filename, "Realm");
this.Zone = FileManager.GetData(filename, "Zone");
//SetRoomToDoorNorth
//SetRoomToDoorEast
//etc...
//Restoring Doorways performed by Zone.RestoreLinkedRooms() Called via GameWorld.Load();
}
/// <summary>

View file

@ -9,6 +9,7 @@ using System.Xml.Serialization;
//MUD Engine
using MudEngine.FileSystem;
using MudEngine.GameManagement;
using MudEngine.GameObjects;
using MudEngine.GameObjects.Items;
@ -76,7 +77,8 @@ namespace MudEngine.GameObjects.Environment
[Category("Environment Information")]
public Room InitialRoom { get; private set; }
public Zone(GameManagement.Game game) : base(game)
public Zone(GameManagement.Game game)
: base(game)
{
RoomCollection = new List<Room>();
InitialRoom = new Room(game);
@ -128,6 +130,7 @@ namespace MudEngine.GameObjects.Environment
{
Room r = new Room(ActiveGame);
r.Load(Path.Combine(roomPath, room));
RoomCollection.Add(r);
}
//Set the initial Room.
@ -185,6 +188,63 @@ namespace MudEngine.GameObjects.Environment
return rooms;
}
public void RestoreLinkedRooms()
{
//Iterate through each Room within this Zones collection and link it with it's corresponding Room.
foreach (Room r in RoomCollection)
{
String filename = ActiveGame.DataPaths.Environment + "\\" + Path.GetFileNameWithoutExtension(r.Realm) + "\\Zones\\" + Path.GetFileNameWithoutExtension(r.Zone) + "\\" + "Rooms\\" + r.Filename;
//Get how many doors this Room contains
Int32 count = Convert.ToInt32(FileManager.GetData(filename, "DoorwayCount"));
List<String> data = new List<string>();
data = FileManager.GetDataSpan(filename, 5, "DoorwayArrivalRoom", true);
//If no doors, then skip to the next room in the collection.
if ((count == 0) || (data.Count == 0))
continue;
for (int x = 0; x < (count * 5); x += 5)
{
Door d = new Door(ActiveGame);
Int32 index = x;
//Restore the Arrival Room first.
if (!d.SetRoom(Door.RoomTravelType.Arrival, data[index]))
{
Log.Write("Error: Failed to set the Arrival Doorway for Room " + r.RoomLocationWithoutExtension);
}
if (!d.SetRoom(Door.RoomTravelType.Departure, data[index + 1]))
{
Log.Write("Error: Failed to set the departure Doorway for Room " + r.RoomLocationWithoutExtension);
}
//Restore settings.
d.IsLocked = Convert.ToBoolean(data[index + 2]);
d.LevelRequirement = Convert.ToInt32(data[index + 3]);
//Restore the travel direction enum value.
Array values = Enum.GetValues(typeof(AvailableTravelDirections));
foreach (Int32 value in values)
{
//Since enum values are not strings, we can't simply just assign the String to the enum
String displayName = Enum.GetName(typeof(AvailableTravelDirections), value);
//If the value = the String saved, then perform the needed conversion to get our data back
if (displayName.ToLower() == data[index + 4].ToLower())
{
d.TravelDirection = (AvailableTravelDirections)Enum.Parse(typeof(AvailableTravelDirections), displayName);
break;
}
}
r.Doorways.Add(d);
}
}
}
public void LinkRooms(AvailableTravelDirections departureDirection, Room arrivalRoom, Room departureRoom)
{
LinkRooms(departureDirection, arrivalRoom, departureRoom, 0);

View file

@ -55,7 +55,6 @@
<Compile Include="Commands\CommandSaveWorld.cs" />
<Compile Include="FileSystem\SaveDataPaths.cs" />
<Compile Include="GameManagement\CommandEngine.cs" />
<Compile Include="GameManagement\CommandResults.cs" />
<Compile Include="GameManagement\GameTime.cs" />
<Compile Include="GameManagement\GameWorld.cs" />
<Compile Include="GameManagement\ICommand.cs" />

View file

@ -117,8 +117,6 @@ namespace MudGame
if (game.IsMultiplayer)
Console.Title += " server running.";
List<char> buf = new List<char>();
try
{
while (game.IsRunning)
@ -131,9 +129,6 @@ namespace MudGame
{
Log.Write("Critical Error! " + ex.Message);
}
//The Game should save itself during shutdown, requiring to save it on the runtime end will
//present possible issues with 3rd party runtimes not saving if they don't know better to do so.
//game.Save();
}
}
}

View file

@ -127,7 +127,7 @@ public class CommandCreate : IGameCommand
}
}
player.ActiveGame.World.AddObject(realm);
player.ActiveGame.World.AddRealm(realm);
Log.Write(player.Name + " has created a Realm called " + realm.Name);
player.Send(realm.Name + " has been created and added to the world.");
}

View file

@ -34,7 +34,7 @@ public class WorldCalifornia
myRealm.IsInitialRealm = true;
//Add the Realm to the current Active Game World.
_Game.World.AddObject(myRealm);
_Game.World.AddRealm(myRealm);
//Get a new Instance of a Zone.
Zone myZone = new Zone(_Game);