mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Use ObjectMgr/AccountMgr functions instead explici DB quaries.
This commit is contained in:
parent
42b077df0c
commit
911dbe0b29
4 changed files with 34 additions and 37 deletions
|
|
@ -4835,32 +4835,25 @@ bool ChatHandler::HandleBanInfoCommand(const char* args)
|
|||
}
|
||||
else if(type == "character")
|
||||
{
|
||||
if(!normalizePlayerName(nameOrIP))
|
||||
if (!normalizePlayerName(nameOrIP))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage (true);
|
||||
return false;
|
||||
}
|
||||
|
||||
loginDatabase.escape_string(nameOrIP);
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", nameOrIP.c_str());
|
||||
if (!result)
|
||||
accountid = objmgr.GetPlayerAccountIdByPlayerName (nameOrIP);
|
||||
if (!accountid)
|
||||
{
|
||||
PSendSysMessage(LANG_BANINFO_NOCHARACTER);
|
||||
PSendSysMessage (LANG_BANINFO_NOCHARACTER);
|
||||
return true;
|
||||
}
|
||||
fields = result->Fetch();
|
||||
accountid = fields[0].GetUInt32();
|
||||
delete result;
|
||||
result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", accountid);
|
||||
if (!result)
|
||||
|
||||
if (!accmgr.GetName (accountid,accountname))
|
||||
{
|
||||
PSendSysMessage(LANG_BANINFO_NOCHARACTER);
|
||||
PSendSysMessage (LANG_BANINFO_NOCHARACTER);
|
||||
return true;
|
||||
}
|
||||
fields = result->Fetch();
|
||||
accountname = fields[0].GetCppString();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue