Core/World: hold deleted characters in character store

This commit is contained in:
joschiwald
2014-11-12 19:16:14 +01:00
parent f4926e0a8c
commit 620f23d9dc
33 changed files with 228 additions and 272 deletions

View File

@@ -36,35 +36,33 @@
void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
{
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
WorldPackets::Character::PlayerNameResponse response;
response.Player = guid;
if (nameData)
if (characterInfo)
{
uint32 accountId = player ? player->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(guid);
uint32 accountId = player ? player->GetSession()->GetAccountId() : ObjectMgr::GetPlayerAccountIdByGUID(guid);
uint32 bnetAccountId = player ? player->GetSession()->GetBattlenetAccountId() : Battlenet::AccountMgr::GetIdByGameAccount(accountId);
response.Result = 0; // name known
response.Data.IsDeleted = false; // TODO: send deletes as well
response.Data.AccountID = ObjectGuid::Create<HighGuid::WowAccount>(accountId);
response.Result = RESPONSE_SUCCESS; // name known
response.Data.IsDeleted = characterInfo->IsDeleted;
response.Data.AccountID = ObjectGuid::Create<HighGuid::WowAccount>(accountId);
response.Data.BnetAccountID = ObjectGuid::Create<HighGuid::BNetAccount>(bnetAccountId);
response.Data.Name = nameData->m_name;
response.Data.Name = characterInfo->Name;
response.Data.VirtualRealmAddress = GetVirtualRealmAddress();
response.Data.Race = nameData->m_race;
response.Data.Sex = nameData->m_gender;
response.Data.ClassID = nameData->m_class;
response.Data.Level = nameData->m_level;
response.Data.Race = characterInfo->Race;
response.Data.Sex = characterInfo->Sex;
response.Data.ClassID = characterInfo->Class;
response.Data.Level = characterInfo->Level;
if (DeclinedName const* names = (player ? player->GetDeclinedNames() : nullptr))
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
response.Data.DeclinedNames.name[i] = names->name[i];
}
else
{
response.Result = 1; // name unknown
}
response.Result = RESPONSE_FAILURE; // name unknown
SendPacket(response.Write());
}