muddesigner/MudGame/Scripts/CommandHelp.cs
Scionwest_cp 386d90df19 MudEngine:
- All commands are now required to have a Help property.

MudGame:
 - Finished the Create command. Now allows for creating Realms, Zones and Rooms
 - Added LinkRoom command for linking Rooms. Not finished.
 - Added Help command. Typing Help prints all of the currently available commands. Typing Help 'CommandName' prints that Commands help property. Default commands print a help document.
2010-08-19 19:09:45 -07:00

35 lines
No EOL
1.2 KiB
C#

public class CommandHelp : IGameCommand
{
public Boolean Override { get; set; }
public String Name { get; set; }
public List<String> Help { get; set; }
public void Execute(String command, BaseCharacter player)
{
string topic = command.Substring("Help".Length);
//TODO: Help command should display a complete list of available commands and should have self contained help topics.
if (topic.Length == 0)
{
player.Send("Available commands: ", false);
foreach (String cmd in CommandEngine.GetCommands())
{
IGameCommand g = CommandEngine.GetCommand(cmd);
player.Send(CommandEngine.GetCommandName(g) + ", ", false);
}
player.Send("");
player.Send("Usage: Help 'Command'");
return;
}
else
topic = topic.Trim();
IGameCommand gc = CommandEngine.GetCommand("Command" + topic);
foreach (String help in gc.Help)
{
player.Send(help);
}
}
}