From 183bc340bd3e062a4c6df4d66cc2843582bcec94 Mon Sep 17 00:00:00 2001 From: David Athay Date: Mon, 7 Jul 2008 12:53:24 +0000 Subject: Added help for each command based on mantis bug #359, thanks to Scraggy --- src/commandhandler.cpp | 117 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 21 deletions(-) (limited to 'src/commandhandler.cpp') diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 465f572d..7e20deff 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -20,8 +20,8 @@ * * $Id$ */ - - + + #include "commandhandler.h" #include "channelmanager.h" #include "channel.h" @@ -42,7 +42,7 @@ void CommandHandler::handleCommand(const std::string &command) } else if (type == "help") { - handleHelp(); + handleHelp(args); } else if (type == "where") { @@ -56,19 +56,21 @@ void CommandHandler::handleCommand(const std::string &command) { handleMsg(args); } + /* else if (type == "channel") { handleChannel(args); } + */ else if (type == "join") { handleJoin(args); } - else if (type == "listchannels") + else if (type == "list") { handleListChannels(); } - else if (type == "listusers") + else if (type == "users") { handleListUsers(); } @@ -99,22 +101,95 @@ void CommandHandler::handleAnnounce(const std::string &args) Net::ChatServer::announce(args); } -void CommandHandler::handleHelp() +void CommandHandler::handleHelp(const std::string &args) { - chatWindow->chatLog("-- Help --"); - chatWindow->chatLog("/help > Display this help."); - chatWindow->chatLog("/announce > Global announcement (GM only)"); - chatWindow->chatLog("/where > Display map name"); - chatWindow->chatLog("/who > Display number of online users"); - chatWindow->chatLog("/msg > Send a private message to a user"); - chatWindow->chatLog("/listchannels > Display all public channels"); - chatWindow->chatLog("/listusers > Lists the users in the current channel"); - chatWindow->chatLog("/channel > Register a new channel"); - chatWindow->chatLog("/join > Join an already registered channel"); - chatWindow->chatLog("/topic > Set the topic of the current channel"); - chatWindow->chatLog("/quit > Leave a channel"); - chatWindow->chatLog("/admin > Send a command to the server (GM only)"); - chatWindow->chatLog("/clear > Clears this window"); + chatWindow->chatLog("-- Help --", BY_SERVER); + if (args == "") + { + chatWindow->chatLog("-- Help --"); + chatWindow->chatLog("/help > Display this help."); + chatWindow->chatLog("/announce > Global announcement (GM only)"); + chatWindow->chatLog("/where > Display map name"); + chatWindow->chatLog("/who > Display number of online users"); + chatWindow->chatLog("/msg > Send a private message to a user"); + chatWindow->chatLog("/list > Display all public channels"); + chatWindow->chatLog("/users > Lists the users in the current channel"); +// chatWindow->chatLog("/channel > Register a new channel"); + chatWindow->chatLog("/join > Join an already registered channel"); + chatWindow->chatLog("/topic > Set the topic of the current channel"); + chatWindow->chatLog("/quit > Leave a channel"); + chatWindow->chatLog("/admin > Send a command to the server (GM only)"); + chatWindow->chatLog("/clear > Clears this window"); + chatWindow->chatLog("For more information, type /help "); + } + else if (args == "admin") + { + chatWindow->chatLog("Command: /admin "); + chatWindow->chatLog("*** only available to a GM ***"); + chatWindow->chatLog("This command sends an admin command to the server."); + } + else if (args == "announce") + { + chatWindow->chatLog("Command: /announce "); + chatWindow->chatLog("*** only available to a GM ***"); + chatWindow->chatLog("This command sends the message to " + "all players currently online."); + } + else if (args == "clear") + { + chatWindow->chatLog("Command: /clear"); + chatWindow->chatLog("This command clears the chat log of previous chat."); + } + else if (args == "help") + { + chatWindow->chatLog("Command: /help"); + chatWindow->chatLog("This command displays a list of all commands available."); + chatWindow->chatLog("Command: /help "); + chatWindow->chatLog("This command displays help on ."); + } + else if (args == "join") + { + chatWindow->chatLog("Command: /join "); + chatWindow->chatLog("This command makes you enter ."); + } + else if (args == "list") + { + chatWindow->chatLog("Command: /list"); + chatWindow->chatLog("This command shows a list of all channels."); + } + else if (args == "msg") + { + chatWindow->chatLog("Command: /msg "); + chatWindow->chatLog("This command sends the text to ."); + chatWindow->chatLog("If the has spaces in it, enclose it in " + "double quotes (\")."); + } + else if (args == "topic") + { + chatWindow->chatLog("Command: /topic "); + chatWindow->chatLog("This command sets the topic to ."); + } + else if (args == "users") + { + chatWindow->chatLog("Command: /users "); + chatWindow->chatLog("This command shows the users in ."); + } + else if (args == "where") + { + chatWindow->chatLog("Command: /where"); + chatWindow->chatLog("This command displays the name of the current map."); + } + else if (args == "who") + { + chatWindow->chatLog("Command: /who"); + chatWindow->chatLog("This command displays the number of players currently " + "online."); + } + else + { + chatWindow->chatLog("Unknown command."); + chatWindow->chatLog("Type /help for a list of commands."); + } } void CommandHandler::handleWhere() @@ -124,7 +199,7 @@ void CommandHandler::handleWhere() void CommandHandler::handleWho() { - + } void CommandHandler::handleMsg(const std::string &args) -- cgit v1.2.3-70-g09d2