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.
This commit is contained in:
parent
f51e17af7b
commit
386d90df19
22 changed files with 678 additions and 114 deletions
35
MudGame/Scripts/CommandHelp.cs
Normal file
35
MudGame/Scripts/CommandHelp.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue