MudEngine:

- Fixed BaseCharacter not returning content to the game loop
 - Fixed Zone.LinkRooms linking rooms backwards.

MudGame:
 - Minor tweaks to the BuildRealms method
 - Minor tweaks to the Program.Main method.
This commit is contained in:
Scionwest_cp 2010-07-25 22:29:24 -07:00
parent e145d57682
commit c965d5e97a
4 changed files with 20 additions and 19 deletions

View file

@ -25,6 +25,7 @@ namespace MUDGame.Environments
realm.Name = "Zeroth";
realm.Description = "The land of " + realm.Name + " is fully of large forests and dangerous creatures.";
realm.IsInitialRealm = true;
game.AddRealm(realm);
//Build Rooms.
BuildHome();
@ -39,26 +40,25 @@ namespace MUDGame.Environments
zone.IsSafe = true;
zone.StatDrain = false;
zone.IsInitialZone = true;
zone.Realm = realm.Name;
realm.AddZone(zone);
Room bedroom = new Room();
bedroom.Name = "Bedroom";
bedroom.Description = "This is your bedroom, it's small but comfortable. You have a bed, a book shelf and a rug on the floor.";
bedroom.Description = "This is your bedroom, it's small but comfortable. You have a bed, a book shelf and a rug on the floor.\nYou may walk to the WEST to find you Closet.";
bedroom.Zone = zone.Name;
bedroom.Realm = realm.Name;
bedroom.IsInitialRoom = true;
zone.AddRoom(bedroom);
Room closet = new Room();
closet.Name = "Closet";
closet.Description = "Your closet contains clothing and some shoes.";
closet.Description = "Your closet contains clothing and some shoes.\nYou may walk to your EAST to find your Room.";
closet.Zone = zone.Name;
closet.Realm = realm.Name;
zone.AddRoom(closet);
zone.LinkRooms(AvailableTravelDirections.West, closet, bedroom);
zone.Realm = realm.Name;
realm.AddZone(zone);
game.AddRealm(realm);
}
}
}

View file

@ -46,16 +46,17 @@ namespace MUDGame
//Create the world
BuildRealms();
//Player must be instanced AFTER BuildRealms as it needs Game.InitialRealm.InitialZone.InitialRoom
//property so that it can set it's starting room correctly.
player = new BaseCharacter(game);
// Start the game & server.
game.Start();
if (!game.IsRunning)
Console.WriteLine("Error starting game!\nReview Log file for details.");
//Player must be instanced AFTER BuildRealms as it needs Game.InitialRealm.InitialZone.InitialRoom
//property so that it can set it's starting room correctly.
player = new BaseCharacter(game);
//Add the player to the game.
//Note once the server is fully implemented the player will be generated automatically by Game.
game.PlayerCollection.Add(player);
//Send game info to player

View file

@ -76,16 +76,16 @@ namespace MudEngine.GameObjects.Characters
//the command off to the command engine for execution.
CommandResults result = CommandEngine.ExecuteCommand(command, this);
if (result.Result is string[])
if (result.Result != null)
{
StringBuilder sb = new StringBuilder();
foreach (string item in result.Result)
sb.AppendLine(item);
foreach (object item in result.Result)
{
if (item is string)
sb.AppendLine(item.ToString());
}
return sb.ToString();
}
return "";
}

View file

@ -134,7 +134,7 @@ namespace MudEngine.GameObjects.Environment
LinkRooms(departureDirection, arrivalRoom, departureRoom, requiredLevel, false, null);
}
public void LinkRooms(AvailableTravelDirections departureDirection, Room departureRoom, Room arrivalRoom, Int32 requiredLevel, Boolean isLocked, BaseItem requiredKey)
public void LinkRooms(AvailableTravelDirections departureDirection, Room arrivalRoom, Room departureRoom, Int32 requiredLevel, Boolean isLocked, BaseItem requiredKey)
{
Door door = new Door();
door.ArrivalRoom = arrivalRoom;