diff options
Diffstat (limited to 'src/server/game/Handlers/CalendarHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 114 |
1 files changed, 55 insertions, 59 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index a7de4491a85..954b4483f62 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -50,8 +50,8 @@ Copied events should probably have a new owner void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { - uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); + ObjectGuid guid = _player->GetGUID(); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str()); 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(); } } @@ -184,8 +184,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) uint64 eventId; recvData >> eventId; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [" - UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [%s] Event [" UI64FMTD "]", _player->GetGUID().ToString().c_str(), eventId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET); @@ -195,7 +194,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) { - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [%s]", _player->GetGUID().ToString().c_str()); uint32 minLevel; uint32 maxLevel; @@ -211,7 +210,7 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) { - TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [%s]", _player->GetGUID().ToString().c_str()); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -222,7 +221,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; @@ -257,7 +256,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); @@ -268,11 +267,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)); @@ -282,7 +280,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]; } } @@ -313,7 +311,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); time_t oldEventTime; uint64 eventId; @@ -341,10 +339,10 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) return; } - TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD + TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [%s] EventId [" UI64FMTD "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u " "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u " - "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(), + "Time2 %u, Flags %u", guid.ToString().c_str(), eventId, inviteId, title.c_str(), description.c_str(), type, repetitionType, maxInvites, dungeonId, eventPackedTime, timeZoneTime, flags); @@ -369,7 +367,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; recvData >> eventId; @@ -380,15 +378,15 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 eventTime; recvData >> eventId >> inviteId; recvData.ReadPackedTime(eventTime); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD - "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD + "] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime); // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack @@ -424,7 +422,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; @@ -432,7 +430,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) bool isPreInvite; bool isGuildEvent; - uint64 inviteeGuid = 0; + ObjectGuid inviteeGuid; uint32 inviteeTeam = 0; uint32 inviteeGuildId = 0; @@ -453,7 +451,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); } @@ -471,7 +469,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) return; } - if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid)) + if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = %u AND friend = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter())) { Field* fields = result->Fetch(); if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED) @@ -515,12 +513,12 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; bool tentative; recvData >> eventId >> tentative; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [%s] EventId [" UI64FMTD "] Tentative %u", guid.ToString().c_str(), eventId, tentative); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -541,14 +539,14 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 status; recvData >> eventId >> inviteId >> status; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD "] EventId [" - UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId, + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [%s] EventId [" + UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid.ToString().c_str(), eventId, inviteId, status); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) @@ -578,19 +576,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)) { @@ -608,18 +605,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)) { @@ -642,18 +639,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)) { @@ -672,25 +669,24 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) void WorldSession::HandleCalendarComplain(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; - uint64 complainGUID; + ObjectGuid complainGUID; uint64 inviteId; recvData >> complainGUID >> eventId >> inviteId; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" - UI64FMTD "] guid [" UI64FMTD "] InviteId [" UI64FMTD "]", guid, eventId, complainGUID, inviteId); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId [" + UI64FMTD "] guid [%s] InviteId [" UI64FMTD "]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str(), inviteId); // 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); @@ -741,9 +737,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); |