muddesigner/Mud Designer/MudEngine/GameCommands/CommandWalk.cs
Scionwest_cp f79a5d482b Engine:
- Removed the ManagedScripting Engine from the project. Scripting will be implemented at a later time using a custom build engine.
 - Room.Load was re-wrote to allow for loading a supplied room name (not a full filename). The Room will load the supplied Roomname by checking within it's current Zone. Rooms within different Zones can be loaded by supplying a Zone name as one of the optional parameters. Same goes for loading Rooms within a different Realm
 - All classes using the original Room.Load code have been tweaked to use the new code. Cuts the needed code used by each individual class by 80%.
 - Room.InstallPath Property added for returning the full filename and location of the Room where it's currently installed.

Designer:
 - Room Designer now supports deleting Rooms.
 - Doorway Editor no longer fails when attempting to change doorway Traveling Directions.

Runtime:
 - No longer prints blank lines if the object does not contain any text to print.
 - Added a 2nd Print method with a boolean argument for printing blank lines by force if needed.

Note: Room Deleting and Room.Load code was only tested using Rooms within Root Zones. Rooms contained within a Zone owned by a Realm was not tested.
2010-02-06 20:56:15 -08:00

51 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.FileSystem;
namespace MudDesigner.MudEngine.GameCommands
{
public class CommandWalk : IGameCommand
{
public string Name { get; set; }
public bool Override { get; set; }
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
{
string[] words = command.Split(' ');
List<string> directions = new List<string>();
if (words.Length == 1)
return new CommandResults("No direction supplied");
else
{
foreach (Door door in room.Doorways)
{
AvailableTravelDirections direction = TravelDirections.GetTravelDirectionValue(words[1]);
if (door.TravelDirection == direction)
{
room = (Room)room.Load(door.ConnectedRoom);
CommandResults cmd = CommandEngine.ExecuteCommand("Look", player, project, room, "Look");
string lookValue = "";
if (cmd.Result.Length != 0)
lookValue = cmd.Result[0].ToString();
return new CommandResults(new object[] { lookValue, room });
}
}
}
return new CommandResults("Unable to travel in that direction.");
}
}
}