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:
parent
e145d57682
commit
c965d5e97a
4 changed files with 20 additions and 19 deletions
|
@ -25,6 +25,7 @@ namespace MUDGame.Environments
|
||||||
realm.Name = "Zeroth";
|
realm.Name = "Zeroth";
|
||||||
realm.Description = "The land of " + realm.Name + " is fully of large forests and dangerous creatures.";
|
realm.Description = "The land of " + realm.Name + " is fully of large forests and dangerous creatures.";
|
||||||
realm.IsInitialRealm = true;
|
realm.IsInitialRealm = true;
|
||||||
|
game.AddRealm(realm);
|
||||||
|
|
||||||
//Build Rooms.
|
//Build Rooms.
|
||||||
BuildHome();
|
BuildHome();
|
||||||
|
@ -39,26 +40,25 @@ namespace MUDGame.Environments
|
||||||
zone.IsSafe = true;
|
zone.IsSafe = true;
|
||||||
zone.StatDrain = false;
|
zone.StatDrain = false;
|
||||||
zone.IsInitialZone = true;
|
zone.IsInitialZone = true;
|
||||||
|
zone.Realm = realm.Name;
|
||||||
|
realm.AddZone(zone);
|
||||||
|
|
||||||
Room bedroom = new Room();
|
Room bedroom = new Room();
|
||||||
bedroom.Name = "Bedroom";
|
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.Zone = zone.Name;
|
||||||
bedroom.Realm = realm.Name;
|
bedroom.Realm = realm.Name;
|
||||||
bedroom.IsInitialRoom = true;
|
bedroom.IsInitialRoom = true;
|
||||||
|
zone.AddRoom(bedroom);
|
||||||
|
|
||||||
Room closet = new Room();
|
Room closet = new Room();
|
||||||
closet.Name = "Closet";
|
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.Zone = zone.Name;
|
||||||
closet.Realm = realm.Name;
|
closet.Realm = realm.Name;
|
||||||
|
zone.AddRoom(closet);
|
||||||
|
|
||||||
zone.LinkRooms(AvailableTravelDirections.West, closet, bedroom);
|
zone.LinkRooms(AvailableTravelDirections.West, closet, bedroom);
|
||||||
|
|
||||||
zone.Realm = realm.Name;
|
|
||||||
|
|
||||||
realm.AddZone(zone);
|
|
||||||
game.AddRealm(realm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,16 +46,17 @@ namespace MUDGame
|
||||||
//Create the world
|
//Create the world
|
||||||
BuildRealms();
|
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.
|
// Start the game & server.
|
||||||
game.Start();
|
game.Start();
|
||||||
|
|
||||||
if (!game.IsRunning)
|
if (!game.IsRunning)
|
||||||
Console.WriteLine("Error starting game!\nReview Log file for details.");
|
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);
|
game.PlayerCollection.Add(player);
|
||||||
|
|
||||||
//Send game info to player
|
//Send game info to player
|
||||||
|
|
|
@ -76,16 +76,16 @@ namespace MudEngine.GameObjects.Characters
|
||||||
//the command off to the command engine for execution.
|
//the command off to the command engine for execution.
|
||||||
CommandResults result = CommandEngine.ExecuteCommand(command, this);
|
CommandResults result = CommandEngine.ExecuteCommand(command, this);
|
||||||
|
|
||||||
|
if (result.Result != null)
|
||||||
if (result.Result is string[])
|
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
foreach (string item in result.Result)
|
foreach (object item in result.Result)
|
||||||
sb.AppendLine(item);
|
{
|
||||||
|
if (item is string)
|
||||||
|
sb.AppendLine(item.ToString());
|
||||||
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace MudEngine.GameObjects.Environment
|
||||||
LinkRooms(departureDirection, arrivalRoom, departureRoom, requiredLevel, false, null);
|
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 door = new Door();
|
||||||
door.ArrivalRoom = arrivalRoom;
|
door.ArrivalRoom = arrivalRoom;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue