Merge branch 'battle.net' into 4.3.4

This commit is contained in:
Shauren
2014-06-08 16:14:24 +02:00
63 changed files with 4346 additions and 259 deletions

View File

@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "AccountMgr.h"
#include "BattlenetAccountMgr.h"
#include "Chat.h"
#include "Language.h"
#include "Player.h"
@@ -126,10 +127,15 @@ public:
if (!accountName || !password)
return false;
AccountOpResult result = sAccountMgr->CreateAccount(std::string(accountName), std::string(password), email);
AccountOpResult result;
if (strchr(accountName, '@'))
result = Battlenet::AccountMgr::CreateBattlenetAccount(std::string(accountName), std::string(password));
else
result = sAccountMgr->CreateAccount(std::string(accountName), std::string(password), email);
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
{
@@ -139,15 +145,15 @@ public:
accountName, email.c_str());
}
break;
case AOR_NAME_TOO_LONG:
case AccountOpResult::AOR_NAME_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
case AOR_NAME_ALREADY_EXIST:
case AccountOpResult::AOR_NAME_ALREADY_EXIST:
handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
handler->SetSentErrorMessage(true);
return false;
case AOR_DB_INTERNAL_ERROR:
case AccountOpResult::AOR_DB_INTERNAL_ERROR:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName);
handler->SetSentErrorMessage(true);
return false;
@@ -173,7 +179,7 @@ public:
return false;
std::string accountName = account;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -197,14 +203,14 @@ public:
AccountOpResult result = AccountMgr::DeleteAccount(accountId);
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str());
break;
case AOR_NAME_NOT_EXIST:
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
case AOR_DB_INTERNAL_ERROR:
case AccountOpResult::AOR_DB_INTERNAL_ERROR:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
@@ -416,14 +422,14 @@ public:
AccountOpResult result = AccountMgr::ChangeEmail(handler->GetSession()->GetAccountId(), std::string(email));
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
oldEmail, email);
break;
case AOR_EMAIL_TOO_LONG:
case AccountOpResult::AOR_EMAIL_TOO_LONG:
handler->SendSysMessage(LANG_EMAIL_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
@@ -501,13 +507,13 @@ public:
AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword));
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
break;
case AOR_PASS_TOO_LONG:
case AccountOpResult::AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
@@ -586,7 +592,7 @@ public:
{
///- Convert Account name to Upper Format
accountName = account;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -656,7 +662,7 @@ public:
if (isAccountNameGiven)
{
targetAccountName = arg1;
if (!AccountMgr::normalizeString(targetAccountName))
if (!Utf8ToUpperOnlyLatin(targetAccountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str());
handler->SetSentErrorMessage(true);
@@ -744,7 +750,7 @@ public:
return false;
std::string accountName = account;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -775,14 +781,14 @@ public:
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
break;
case AOR_NAME_NOT_EXIST:
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
case AOR_PASS_TOO_LONG:
case AccountOpResult::AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
@@ -813,7 +819,7 @@ public:
}
std::string accountName = account;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -843,16 +849,16 @@ public:
AccountOpResult result = AccountMgr::ChangeEmail(targetAccountId, email);
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
TC_LOG_INFO("entities.player.character", "ChangeEmail: Account %s [Id: %u] had it's email changed to %s.",
accountName.c_str(), targetAccountId, email);
break;
case AOR_NAME_NOT_EXIST:
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
case AOR_EMAIL_TOO_LONG:
case AccountOpResult::AOR_EMAIL_TOO_LONG:
handler->SendSysMessage(LANG_EMAIL_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
@@ -889,7 +895,7 @@ public:
}
std::string accountName = account;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -919,16 +925,16 @@ public:
AccountOpResult result = AccountMgr::ChangeRegEmail(targetAccountId, email);
switch (result)
{
case AOR_OK:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
TC_LOG_INFO("entities.player.character", "ChangeRegEmail: Account %s [Id: %u] had it's Registration Email changed to %s.",
accountName.c_str(), targetAccountId, email);
break;
case AOR_NAME_NOT_EXIST:
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
return false;
case AOR_EMAIL_TOO_LONG:
case AccountOpResult::AOR_EMAIL_TOO_LONG:
handler->SendSysMessage(LANG_EMAIL_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;

View File

@@ -174,7 +174,7 @@ public:
switch (mode)
{
case BAN_ACCOUNT:
if (!AccountMgr::normalizeString(nameOrIP))
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);
@@ -245,7 +245,7 @@ public:
return false;
std::string accountName = nameStr;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
@@ -710,7 +710,7 @@ public:
switch (mode)
{
case BAN_ACCOUNT:
if (!AccountMgr::normalizeString(nameOrIP))
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);

View File

@@ -858,7 +858,7 @@ public:
return false;
std::string accountName = accountStr;
if (!AccountMgr::normalizeString(accountName))
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);

View File

@@ -1218,8 +1218,7 @@ public:
char* limitStr = strtok(NULL, " ");
int32 limit = limitStr ? atoi(limitStr) : -1;
if (!AccountMgr::normalizeString
(account))
if (!Utf8ToUpperOnlyLatin(account))
return false;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);

View File

@@ -142,7 +142,7 @@ public:
{
accountName = param1;
if (AccountMgr::normalizeString(accountName))
if (Utf8ToUpperOnlyLatin(accountName))
accountId = AccountMgr::GetId(accountName);
if (!accountId)