MudEngine:
- Fixed FileManager.GetDataSpan Index out of bounds exception. - Game.Save no long invokes the BaseCharacter.ExecuteCommand("Save"); rather it now just directly invokes BaseCharacter.Save(). This fixes the client typing bug where a new command line was printed to the screen everytime the game world saved. - GameWorld now supports storing and saving dynamically created Realms. - Renamed BaseCharacter.GetRoomByFilename() to just GetRoom() as all Get() named Methods require a filename. - Optimized the loading and saving of Realms, Zones and Rooms some. - Room now Loads and Saves the RoomLocation property instead of the Room's Zone and Realm properties individually. - GameWorld.GetRealm(), Realm.GetZone() and Zone.GetRoom() now perform case-insensitive checking when scanning for content. MudGame: - Re-wrote the 'Create' command script from the ground up. 50% less code and much better approach to creating content. Now to create content you will use the same formatting as the Room.RoomLocation property. Example: Creating a Realm is done with 'Create MyRealm' Example: Creating a Zone is done with 'Create MyRealm>MyZone' Example: Creating a Room is done with 'Create MyRealm>MyZone>MyRoom' If the Realm or Zone does not exist when creating a Room or Zone, then the parent will be created automatically for you. - Fixed a bug in the WorldCalifornia script were it was saving the Hallway Room with a Zone file extension, preventing it from working correctly during restoration.
This commit is contained in:
parent
de82476525
commit
de38cbf272
11 changed files with 204 additions and 300 deletions
|
@ -99,13 +99,15 @@ namespace MudEngine.GameObjects.Environment
|
|||
FileManager.WriteLine(filename, this.Realm, "Realm");
|
||||
FileManager.WriteLine(filename, this.StatDrain.ToString(), "StatDrain");
|
||||
FileManager.WriteLine(filename, this.StatDrainAmount.ToString(), "StatDrainAmount");
|
||||
FileManager.WriteLine(filename, this.InitialRoom.Filename, "InitialRoom");
|
||||
|
||||
if (this.InitialRoom.Name != "New Room")
|
||||
FileManager.WriteLine(filename, this.InitialRoom.Filename, "InitialRoom");
|
||||
|
||||
String roomPath = Path.Combine(path, "Rooms");
|
||||
foreach (Room r in RoomCollection)
|
||||
{
|
||||
FileManager.WriteLine(filename, r.Filename, "RoomCollection");
|
||||
r.Save(roomPath);
|
||||
r.Save(roomPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,28 +121,16 @@ namespace MudEngine.GameObjects.Environment
|
|||
this.StatDrain = Convert.ToBoolean(FileManager.GetData(filename, "StatDrain"));
|
||||
this.StatDrainAmount = Convert.ToInt32(FileManager.GetData(filename, "StatDrainAmount"));
|
||||
|
||||
//Load the InitialRoom
|
||||
String roomFile = FileManager.GetData(filename, "InitialRoom");
|
||||
String realmPath = Path.Combine(ActiveGame.DataPaths.Environment, Path.GetFileNameWithoutExtension(this.Realm));
|
||||
String zonePath = Path.Combine(realmPath, "Zones", Path.GetFileNameWithoutExtension(this.Filename));
|
||||
String roomPath = Path.Combine(zonePath, "Rooms");
|
||||
|
||||
//Now get the rooms in the zone
|
||||
foreach (String room in FileManager.GetCollectionData(filename, "RoomCollection"))
|
||||
{
|
||||
Room r = new Room(ActiveGame);
|
||||
r.Load(Path.Combine(roomPath, room));
|
||||
String path = Path.Combine(ActiveGame.DataPaths.Environment, Path.GetFileNameWithoutExtension(this.Realm), "Zones", Path.GetFileNameWithoutExtension(this.Filename), "Rooms");
|
||||
r.Load(Path.Combine(path, room));
|
||||
RoomCollection.Add(r);
|
||||
}
|
||||
|
||||
//Set the initial Room.
|
||||
foreach (Room r in RoomCollection)
|
||||
{
|
||||
if (r.IsInitialRoom)
|
||||
{
|
||||
InitialRoom = r;
|
||||
break;
|
||||
}
|
||||
this.InitialRoom = r;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,14 +162,14 @@ namespace MudEngine.GameObjects.Environment
|
|||
room.Realm = Realm;
|
||||
}
|
||||
|
||||
public List<Room> GetRoomByFilename(String filename)
|
||||
public List<Room> GetRoom(String filename)
|
||||
{
|
||||
|
||||
List<Room> rooms = new List<Room>();
|
||||
|
||||
foreach (Room r in RoomCollection)
|
||||
{
|
||||
if (r.Filename == filename)
|
||||
if (r.Filename.ToLower() == filename.ToLower())
|
||||
{
|
||||
rooms.Add(r);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue