*Add ".account addon" command, now players can change their account's expansion.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-09-27 21:23:06 -07:00
parent 7d60e2fb18
commit 77e5c0362e
6 changed files with 31 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `conte
(58, 'Using script library: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(59, 'Using creature EventAI: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(60, 'Online players: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(61, 'Up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(100, 'Global notify: ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(102, '%s is already being teleported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),

View File

@@ -0,0 +1,7 @@
DELETE FROM `command` WHERE `name` = 'account addon';
INSERT INTO `command` (`name`, `security`, `help`) VALUES ('account addon', 3, 'Syntax: .account addon #addon\nSet expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.');
DELETE FROM `trinity_string` WHERE `entry`=61;
INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
(61, 'Up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

View File

@@ -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 },

View File

@@ -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);

View File

@@ -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,

View File

@@ -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)