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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 898 additions and 595 deletions

View file

@ -4830,7 +4830,7 @@ void Player::_LoadArenaTeamInfo()
memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32) * MAX_ARENA_SLOT * ARENA_TEAM_END);
for (auto const& itr : ArenaTeam::ArenaSlotByType)
if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUID().GetCounter(), itr.second))
if (uint32 arenaTeamId = sCharacterCache->GetCharacterArenaTeamIdByGuid(GetGUID(), itr.second))
{
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
@ -6564,12 +6564,16 @@ void Player::_LoadSpells(PreparedQueryResult result)
void Player::_LoadGroup()
{
if (uint32 groupId = GetGroupIdFromStorage(GetGUID().GetCounter()))
if (Group* group = sGroupMgr->GetGroupByGUID(groupId))
if (ObjectGuid groupId = sCharacterCache->GetCharacterGroupGuidByGuid(GetGUID()))
{
if (Group* group = sGroupMgr->GetGroupByGUID(groupId.GetCounter()))
{
if (group->GetMemberGroup(GetGUID()) <= MAX_RAID_SUBGROUPS)
{
if (group->IsLeader(GetGUID()))
{
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
}
uint8 subgroup = group->GetMemberGroup(GetGUID());
SetGroup(group, subgroup);
@ -6578,6 +6582,8 @@ void Player::_LoadGroup()
SetDungeonDifficulty(group->GetDungeonDifficulty());
SetRaidDifficulty(group->GetRaidDifficulty());
}
}
}
if (!GetGroup() || !GetGroup()->IsLeader(GetGUID()))
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);