mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[10242] Rewrite internal work chat command system.
* Use single command search function with recursion and reuse it in now more simple and consistent for execute/help/loading * Add intergiry checks for hardcoded part of commands list. Fix some cases base at it. * Fixed diff small problems in past code: - in console single symbol commands rejected (without dot start) - .help not output propertly subcommands list for not found subcommand - some other...
This commit is contained in:
parent
30a0701ca9
commit
a121f7a3e5
5 changed files with 379 additions and 229 deletions
|
|
@ -32,16 +32,15 @@
|
|||
|
||||
bool ChatHandler::HandleHelpCommand(const char* args)
|
||||
{
|
||||
char* cmd = strtok((char*)args, " ");
|
||||
if(!cmd)
|
||||
if(!*args)
|
||||
{
|
||||
ShowHelpForCommand(getCommandTable(), "help");
|
||||
ShowHelpForCommand(getCommandTable(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!ShowHelpForCommand(getCommandTable(), cmd))
|
||||
SendSysMessage(LANG_NO_HELP_CMD);
|
||||
if (!ShowHelpForCommand(getCommandTable(), args))
|
||||
SendSysMessage(LANG_NO_CMD);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -53,8 +52,12 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAccountCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleAccountCommand(const char* args)
|
||||
{
|
||||
// let show subcommands at unexpected data in args
|
||||
if (*args)
|
||||
return false;
|
||||
|
||||
AccountTypes gmlevel = GetAccessLevel();
|
||||
PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue