Core/Commands: Slightly improve output of bnetaccount create command
Ref #18002
This commit is contained in:
@@ -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');
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user