*Add ".account addon" command, now players can change their account's expansion.
--HG-- branch : trunk
This commit is contained in:
@@ -74,6 +74,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
|
||||
static ChatCommand accountCommandTable[] =
|
||||
{
|
||||
{ "addon", SEC_PLAYER, false, &ChatHandler::HandleAccountAddonCommand, "", NULL },
|
||||
{ "create", SEC_CONSOLE, true, &ChatHandler::HandleAccountCreateCommand, "", NULL },
|
||||
{ "delete", SEC_CONSOLE, true, &ChatHandler::HandleAccountDeleteCommand, "", NULL },
|
||||
{ "onlinelist", SEC_CONSOLE, true, &ChatHandler::HandleAccountOnlineListCommand, "", NULL },
|
||||
|
||||
@@ -101,6 +101,7 @@ class TRINITY_DLL_SPEC ChatHandler
|
||||
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);
|
||||
|
||||
bool HandleAccountCommand(const char* args);
|
||||
bool HandleAccountAddonCommand(const char* args);
|
||||
bool HandleAccountCreateCommand(const char* args);
|
||||
bool HandleAccountDeleteCommand(const char* args);
|
||||
bool HandleAccountLockCommand(const char* args);
|
||||
|
||||
+2
-1
@@ -86,7 +86,8 @@ enum TrinityStrings
|
||||
LANG_USING_SCRIPT_LIB = 58,
|
||||
LANG_USING_EVENT_AI = 59,
|
||||
LANG_CONNECTED_PLAYERS = 60,
|
||||
// Room for more level 0 61-99 not used
|
||||
LANG_ACCOUNT_ADDON = 61,
|
||||
// Room for more level 0 62-99 not used
|
||||
|
||||
// level 1 chat
|
||||
LANG_GLOBAL_NOTIFY = 100,
|
||||
|
||||
@@ -234,6 +234,25 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAccountAddonCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char *szExp = strtok((char*)args," ");
|
||||
|
||||
uint32 account_id = m_session->GetAccountId();
|
||||
|
||||
int lev=atoi(szExp); //get int anyway (0 if error)
|
||||
if(lev < 0)
|
||||
return false;
|
||||
|
||||
// No SQL injection
|
||||
loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_ADDON,lev);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAccountLockCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
|
||||
Reference in New Issue
Block a user