[10331] More basic chat command parsing functions and its uses.

* Commands .debug update and .modify bit removed as redundent
* Command .debug getvalue now can output values in float/int/hex/bitstring formats
* Command .debug setvalue now ca accept values in int/float/hex/bitstring formats
* Command .debug mod32value renamed to modvaue and can add int/float or apply hex mask
  (in 3 modes: |= &= &=~ ) to value in update field
* Command .debug moditemvalue added similar .debug modvalue for item case.
* Command .npc set movetype now propertly update spawned in world creature state.
* Command .modify spell renamed to .debug spellmods and restored to working state.
* Commands .account password and .account set password now allow use quoted strings
  for passwords and then now possible set from chat/console passwords with white spaces.
* Many commands converted to new functions without modify functionality
  except better error detection in some cases at wrong command syntax use.

* Also fixed warnings in reload commands after prev. chat commit. Thanks to SkirnirMaNGOS for reporting.
This commit is contained in:
VladimirMangos 2010-08-08 05:58:59 +04:00
parent fefd648d3e
commit 59e672f1bc
17 changed files with 906 additions and 814 deletions

View file

@ -193,12 +193,10 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
return false;
}
if(!*args)
return false;
char *old_pass = strtok (args, " ");
char *new_pass = strtok (NULL, " ");
char *new_pass_c = strtok (NULL, " ");
// allow or quoted string with possible spaces or literal without spaces
char *old_pass = ExtractQuotedOrLiteralArg(&args);
char *new_pass = ExtractQuotedOrLiteralArg(&args);
char *new_pass_c = ExtractQuotedOrLiteralArg(&args);
if (!old_pass || !new_pass || !new_pass_c)
return false;
@ -252,28 +250,25 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
return false;
}
if (!*args)
bool value;
if (!ExtractOnOff(&args, value))
{
SendSysMessage(LANG_USE_BOL);
return true;
SetSentErrorMessage(true);
return false;
}
std::string argstr = args;
if (argstr == "on")
if (value)
{
LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",GetAccountId());
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
return true;
}
if (argstr == "off")
else
{
LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",GetAccountId());
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
return true;
}
SendSysMessage(LANG_USE_BOL);
return true;
}