* Move account related functions from ObjectMgr to AccountMgr and drop duplicate function also.

This commit is contained in:
VladimirMangos 2008-10-20 07:30:59 +04:00
parent fc79aa717a
commit ad5f559dad
7 changed files with 41 additions and 53 deletions

View file

@ -37,6 +37,7 @@
#include "GameEvent.h"
#include "Spell.h"
#include "Chat.h"
#include "AccountMgr.h"
#include "InstanceSaveMgr.h"
#include "SpellAuras.h"
#include "Util.h"
@ -317,7 +318,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
else
{
bidder_accId = GetPlayerAccountIdByGUID(bidder_guid);
bidder_security = GetSecurityByAccount(bidder_accId);
bidder_security = accmgr.GetSecurity(bidder_accId);
if(bidder_security > SEC_PLAYER ) // not do redundant DB requests
{
@ -1295,46 +1296,6 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
return 0;
}
uint32 ObjectMgr::GetSecurityByAccount(uint32 acc_id) const
{
QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
if(result)
{
uint32 sec = (*result)[0].GetUInt32();
delete result;
return sec;
}
return 0;
}
bool ObjectMgr::GetAccountNameByAccount(uint32 acc_id, std::string &name) const
{
QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
if(result)
{
name = (*result)[0].GetCppString();
delete result;
return true;
}
return false;
}
uint32 ObjectMgr::GetAccountByAccountName(std::string name) const
{
loginDatabase.escape_string(name);
QueryResult *result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", name.c_str());
if(result)
{
uint32 id = (*result)[0].GetUInt32();
delete result;
return id;
}
return 0;
}
void ObjectMgr::LoadAuctions()
{
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");