diff options
author | Shauren <shauren.trinity@gmail.com> | 2016-09-26 17:43:33 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-09-26 17:43:33 +0200 |
commit | 660aa059ae9d537b54e043447d62afc7495e7b06 (patch) | |
tree | 105777d0f67874a56d2c52918c5e39ca45014b54 | |
parent | e22c800edd1100582238b4c505c0d2a262c0b8c7 (diff) |
Core/Commands: Slightly improve output of bnetaccount create command
Ref #18002
-rw-r--r-- | sql/updates/world/6.x/2016_09_26_00_world.sql | 4 | ||||
-rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.cpp | 7 | ||||
-rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/Language.h | 5 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_battlenet_account.cpp | 15 |
5 files changed, 25 insertions, 8 deletions
diff --git a/sql/updates/world/6.x/2016_09_26_00_world.sql b/sql/updates/world/6.x/2016_09_26_00_world.sql new file mode 100644 index 00000000000..c02a6eb776b --- /dev/null +++ b/sql/updates/world/6.x/2016_09_26_00_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (1032, 1033); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(1032, 'Battle.net account created: %s with game account %s'), +(1033, 'Battle.net account created: %s'); diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp index aa388c8ff28..c4ce8b674ac 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.cpp +++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp @@ -23,7 +23,7 @@ using GameAccountMgr = AccountMgr; -AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, std::string password, bool withGameAccount /*= true*/) +AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, std::string password, bool withGameAccount, std::string* gameAccountName) { if (utf8length(email) > MAX_BNET_EMAIL_STR) return AccountOpResult::AOR_NAME_TOO_LONG; @@ -46,7 +46,10 @@ AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, ASSERT(newAccountId); if (withGameAccount) - GameAccountMgr::instance()->CreateAccount(std::to_string(newAccountId) + "#1", password, email, newAccountId, 1); + { + *gameAccountName = std::to_string(newAccountId) + "#1"; + GameAccountMgr::instance()->CreateAccount(*gameAccountName, password, email, newAccountId, 1); + } return AccountOpResult::AOR_OK; } diff --git a/src/server/game/Accounts/BattlenetAccountMgr.h b/src/server/game/Accounts/BattlenetAccountMgr.h index 1888e782616..52b60060464 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.h +++ b/src/server/game/Accounts/BattlenetAccountMgr.h @@ -29,7 +29,7 @@ namespace Battlenet { namespace AccountMgr { - TC_GAME_API AccountOpResult CreateBattlenetAccount(std::string email, std::string password, bool withGameAccount = true); + TC_GAME_API AccountOpResult CreateBattlenetAccount(std::string email, std::string password, bool withGameAccount, std::string* gameAccountName); TC_GAME_API AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); TC_GAME_API bool CheckPassword(uint32 accountId, std::string password); TC_GAME_API AccountOpResult LinkWithGameAccount(std::string const& email, std::string const& gameAccountName); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index b675d83a9f1..4e3e49ea440 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -899,7 +899,10 @@ enum TrinityStrings LANG_SQLDRIVER_QUERY_LOGGING_DISABLED = 1028, LANG_ACCOUNT_INVALID_BNET_NAME = 1029, LANG_ACCOUNT_USE_BNET_COMMANDS = 1030, - // Room for more level 4 1031-1099 not used + LANG_ACCOUNT_PASS_TOO_LONG = 1031, + LANG_ACCOUNT_CREATED_BNET_WITH_GAME = 1032, + LANG_ACCOUNT_CREATED_BNET = 1033, + // Room for more level 4 1034-1099 not used // Level 3 (continue) LANG_ACCOUNT_SETADDON = 1100, diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp index bd063a38f98..beca60abc10 100644 --- a/src/server/scripts/Commands/cs_battlenet_account.cpp +++ b/src/server/scripts/Commands/cs_battlenet_account.cpp @@ -84,18 +84,25 @@ public: if (createGameAccountParam) createGameAccount = StringToBool(createGameAccountParam); - switch (Battlenet::AccountMgr::CreateBattlenetAccount(std::string(accountName), std::string(password), createGameAccount)) + std::string gameAccountName; + switch (Battlenet::AccountMgr::CreateBattlenetAccount(std::string(accountName), std::string(password), createGameAccount, &gameAccountName)) { case AccountOpResult::AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); + { + if (createGameAccount) + handler->PSendSysMessage(LANG_ACCOUNT_CREATED_BNET_WITH_GAME, accountName, gameAccountName.c_str()); + else + handler->PSendSysMessage(LANG_ACCOUNT_CREATED_BNET, accountName); + if (handler->GetSession()) { - TC_LOG_INFO("entities.player.character", "Battle.net account: %u (IP: %s) Character:[%s] (%s) created Account %s", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (%s) created Battle.net account %s%s%s", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(), - accountName); + accountName, createGameAccount ? " with game account " : "", createGameAccount ? gameAccountName.c_str() : ""); } break; + } case AccountOpResult::AOR_NAME_TOO_LONG: handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); handler->SetSentErrorMessage(true); |