From 660aa059ae9d537b54e043447d62afc7495e7b06 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 26 Sep 2016 17:43:33 +0200 Subject: Core/Commands: Slightly improve output of bnetaccount create command Ref #18002 --- src/server/game/Accounts/BattlenetAccountMgr.cpp | 7 +++++-- src/server/game/Accounts/BattlenetAccountMgr.h | 2 +- src/server/game/Miscellaneous/Language.h | 5 ++++- src/server/scripts/Commands/cs_battlenet_account.cpp | 15 +++++++++++---- 4 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') 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); -- cgit v1.2.3