refactor(Core/Cache): move the GlobalPlayerCache to its own class (#9166)

This commit is contained in:
Skjalf
2021-11-18 12:53:36 -03:00
committed by GitHub
parent 00dc369cb6
commit 731d256420
47 changed files with 898 additions and 595 deletions

View File

@@ -19,6 +19,7 @@
#include "ArenaTeamMgr.h"
#include "BattlegroundMgr.h"
#include "CellImpl.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "GameGraveyard.h"
#include "GridNotifiers.h"
@@ -1869,7 +1870,7 @@ public:
ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(atol((char*)args));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID.GetCounter(), targetName))
if (sCharacterCache->GetCharacterNameByGuid(parseGUID, targetName))
{
target = ObjectAccessor::FindConnectedPlayer(parseGUID);
targetGuid = parseGUID;
@@ -2317,7 +2318,7 @@ public:
}
Player* target = player->GetConnectedPlayer();
uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(player->GetGUID().GetCounter());
uint32 accountId = target ? target->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID());
// find only player from same account if any
if (!target)
@@ -2393,7 +2394,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid.GetCounter());
uint32 accountId = target ? target->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(targetGuid);
// find only player from same account if any
if (!target)
@@ -3193,7 +3194,7 @@ public:
}
else if (targetName)
{
if (ObjectGuid playerGUID = sWorld->GetGlobalPlayerGUID(name))
if (ObjectGuid playerGUID = sCharacterCache->GetCharacterGuidByName(name))
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
stmt->setUInt32(0, playerGUID.GetCounter());
@@ -3315,7 +3316,7 @@ public:
ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(atol((char*)args));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID.GetCounter(), nameTarget))
if (sCharacterCache->GetCharacterNameByGuid(parseGUID, nameTarget))
{
playerTarget = ObjectAccessor::FindConnectedPlayer(parseGUID);
guidTarget = parseGUID;
@@ -3328,8 +3329,12 @@ public:
groupTarget = playerTarget->GetGroup();
if (!groupTarget && guidTarget)
if (uint32 groupGUID = Player::GetGroupIdFromStorage(guidTarget.GetCounter()))
groupTarget = sGroupMgr->GetGroupByGUID(groupGUID);
{
if (ObjectGuid groupGUID = sCharacterCache->GetCharacterGroupGuidByGuid(guidTarget))
{
groupTarget = sGroupMgr->GetGroupByGUID(groupGUID.GetCounter());
}
}
if (groupTarget)
{