AccountMgr singleton converted to namespace with free functions as it has no internal state
This commit is contained in:
1 parent
e67a33eaaa
commit
eddcb8ffbf
13 files changed
+50
-55
No files matched your search
@@ -99,11 +99,11 @@ public:
|
||||
if (!szAcc || !szPassword)
|
||||
return false;
|
||||
|
||||
// normalized in sAccountMgr->CreateAccount
|
||||
// normalized in AccountMgr::CreateAccount
|
||||
std::string account_name = szAcc;
|
||||
std::string password = szPassword;
|
||||
|
||||
AccountOpResult result = sAccountMgr->CreateAccount(account_name, password);
|
||||
AccountOpResult result = AccountMgr::CreateAccount(account_name, password);
|
||||
switch(result)
|
||||
{
|
||||
case AOR_OK:
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 account_id = sAccountMgr->GetId(account_name);
|
||||
uint32 account_id = AccountMgr::GetId(account_name);
|
||||
if (!account_id)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
if (handler->HasLowerSecurityAccount (NULL, account_id, true))
|
||||
return false;
|
||||
|
||||
AccountOpResult result = sAccountMgr->DeleteAccount(account_id);
|
||||
AccountOpResult result = AccountMgr::DeleteAccount(account_id);
|
||||
switch(result)
|
||||
{
|
||||
case AOR_OK:
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sAccountMgr->CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass)))
|
||||
if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass)))
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
handler->SetSentErrorMessage(true);
|
||||
@@ -296,7 +296,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = sAccountMgr->ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass));
|
||||
AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass));
|
||||
switch(result)
|
||||
{
|
||||
case AOR_OK:
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
return false;
|
||||
|
||||
account_id = player->GetSession()->GetAccountId();
|
||||
sAccountMgr->GetName(account_id, account_name);
|
||||
AccountMgr::GetName(account_id, account_name);
|
||||
szExp = szAcc;
|
||||
}
|
||||
else
|
||||
@@ -356,7 +356,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
account_id = sAccountMgr->GetId(account_name);
|
||||
account_id = AccountMgr::GetId(account_name);
|
||||
if (!account_id)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
|
||||
@@ -429,17 +429,17 @@ public:
|
||||
}
|
||||
|
||||
// handler->getSession() == NULL only for console
|
||||
targetAccountId = (isAccountNameGiven) ? sAccountMgr->GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
|
||||
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
|
||||
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
|
||||
uint32 plSecurity;
|
||||
if (handler->GetSession())
|
||||
plSecurity = sAccountMgr->GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
|
||||
plSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
|
||||
else
|
||||
plSecurity = SEC_CONSOLE;
|
||||
|
||||
// can set security level only for target with less security and to less security that we have
|
||||
// This is also reject self apply in fact
|
||||
targetSecurity = sAccountMgr->GetSecurity(targetAccountId, gmRealmID);
|
||||
targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID);
|
||||
if (targetSecurity >= plSecurity || gm >= plSecurity)
|
||||
{
|
||||
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 targetAccountId = sAccountMgr->GetId(account_name);
|
||||
uint32 targetAccountId = AccountMgr::GetId(account_name);
|
||||
if (!targetAccountId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = sAccountMgr->ChangePassword(targetAccountId, szPassword1);
|
||||
AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, szPassword1);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user