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

@@ -78,7 +78,9 @@ void CalendarMgr::LoadFromDB()
uint32 guildId = 0;
if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
guildId = Player::GetGuildIdFromStorage(creatorGUID.GetCounter());
{
guildId = sCharacterCache->GetCharacterGuildIdByGuid(creatorGUID);
}
CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
_events.insert(calendarEvent);
@@ -479,7 +481,7 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
ObjectGuid invitee = invite.GetInviteeGUID();
Player* player = ObjectAccessor::FindConnectedPlayer(invitee);
uint8 level = player ? player->getLevel() : Player::GetLevelFromStorage(invitee.GetCounter());
uint8 level = player ? player->getLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
data << invitee.WriteAsPacked();
@@ -624,8 +626,8 @@ void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calend
ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
Player* invitee = ObjectAccessor::FindConnectedPlayer(inviteeGuid);
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromStorage(inviteeGuid.GetCounter());
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromStorage(inviteeGuid.GetCounter());
uint8 inviteeLevel = invitee ? invitee->getLevel() : sCharacterCache->GetCharacterLevelByGuid(inviteeGuid);
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(inviteeGuid);
data << inviteeGuid.WriteAsPacked();
data << uint8(inviteeLevel);