diff options
Diffstat (limited to 'src/server/game/Handlers/CalendarHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index dd654fb3ad0..d805b0fdc21 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -50,7 +50,7 @@ Copied events should probably have a new owner void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); time_t currTime = time(NULL); @@ -69,12 +69,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId())) { data << uint8(calendarEvent->IsGuildEvent()); - data.appendPackGUID(calendarEvent->GetCreatorGUID()); + data << calendarEvent->GetCreatorGUID().WriteAsPacked(); } else { data << uint8(0); - data.appendPackGUID((*itr)->GetSenderGUID()); + data << (*itr)->GetSenderGUID().WriteAsPacked(); } } @@ -90,7 +90,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) data.AppendPackedTime(calendarEvent->GetEventTime()); data << uint32(calendarEvent->GetFlags()); data << int32(calendarEvent->GetDungeonId()); - data.appendPackGUID(calendarEvent->GetCreatorGUID()); + data << calendarEvent->GetCreatorGUID().WriteAsPacked(); } data << uint32(currTime); // server time @@ -218,7 +218,7 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); std::string title; std::string description; @@ -253,7 +253,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) if (calendarEvent->IsGuildAnnouncement()) { // 946684800 is 01/01/2000 00:00:00 - default response time - CalendarInvite invite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); + CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind // of storage of the pointer as it will lead to memory corruption sCalendarMgr->AddInvite(calendarEvent, &invite); @@ -264,11 +264,10 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) const uint32 MaxPlayerInvites = 100; uint32 inviteCount; - uint64 invitee[MaxPlayerInvites]; + ObjectGuid invitee[MaxPlayerInvites]; uint8 status[MaxPlayerInvites]; uint8 rank[MaxPlayerInvites]; - memset(invitee, 0, sizeof(invitee)); memset(status, 0, sizeof(status)); memset(rank, 0, sizeof(rank)); @@ -278,7 +277,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { - recvData.readPackGUID(invitee[i]); + recvData >> invitee[i].ReadAsPacked(); recvData >> status[i] >> rank[i]; } } @@ -309,7 +308,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); time_t oldEventTime; uint64 eventId; @@ -365,7 +364,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; recvData >> eventId; @@ -376,7 +375,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 eventTime; @@ -420,7 +419,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE"); - uint64 playerGuid = _player->GetGUID(); + ObjectGuid playerGuid = _player->GetGUID(); uint64 eventId; uint64 inviteId; @@ -428,7 +427,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) bool isPreInvite; bool isGuildEvent; - uint64 inviteeGuid = 0; + ObjectGuid inviteeGuid; uint32 inviteeTeam = 0; uint32 inviteeGuildId = 0; @@ -449,7 +448,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); - inviteeGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); inviteeTeam = Player::TeamForRace(fields[1].GetUInt8()); inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid); } @@ -511,7 +510,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; bool tentative; @@ -537,7 +536,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 status; @@ -574,19 +573,18 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 ownerInviteId; // isn't it sender's inviteId? uint64 inviteId; - recvData.readPackGUID(invitee); + recvData >> invitee.ReadAsPacked(); recvData >> inviteId >> ownerInviteId >> eventId; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" - UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId [" - UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])", - guid, eventId, ownerInviteId, invitee, inviteId); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [%s] EventId [" UI64FMTD + "], ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" UI64FMTD "])", + guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -604,18 +602,18 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 inviteId; uint64 ownerInviteId; // isn't it sender's inviteId? uint8 status; - recvData.readPackGUID(invitee); + recvData >> invitee.ReadAsPacked(); recvData >> eventId >> inviteId >> ownerInviteId >> status; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" - UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" - UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId [" + UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" + UI64FMTD "], status %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, status); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -638,18 +636,18 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 inviteId; uint64 ownerInviteId; // isn't it sender's inviteId? uint8 rank; - recvData.readPackGUID(invitee); - recvData >> eventId >> inviteId >> ownerInviteId >> rank; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" - UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" - UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank); + recvData >> invitee.ReadAsPacked(); + recvData >> eventId >> inviteId >> ownerInviteId >> rank; + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId [" + UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" + UI64FMTD "], rank %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, rank); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -668,24 +666,23 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) void WorldSession::HandleCalendarComplain(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; - uint64 complainGUID; + ObjectGuid complainGUID; recvData >> eventId >> complainGUID; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" - UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId [" + UI64FMTD "] guid [%s]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str()); // what to do with complains? } void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint32 pending = sCalendarMgr->GetPlayerNumPending(guid); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD - "] Pending: %u", guid, pending); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [%s] Pending: %u", guid.ToString().c_str(), pending); WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); data << uint32(pending); @@ -736,9 +733,9 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) if (!save) return; - uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD - "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); + ObjectGuid guid = _player->GetGUID(); + TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u", + guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty()); time_t currTime = time(NULL); |