diff options
Diffstat (limited to 'src/server/game/Handlers/CalendarHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 116 |
1 files changed, 56 insertions, 60 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index dd654fb3ad0..6d0caf9c072 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(); } } @@ -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 @@ -180,8 +180,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); @@ -191,7 +190,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; @@ -207,7 +206,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; @@ -218,7 +217,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 +252,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 +263,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 +276,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 +307,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); time_t oldEventTime; uint64 eventId; @@ -337,10 +335,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); @@ -365,7 +363,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; recvData >> eventId; @@ -376,15 +374,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 @@ -420,7 +418,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 +426,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) bool isPreInvite; bool isGuildEvent; - uint64 inviteeGuid = 0; + ObjectGuid inviteeGuid; uint32 inviteeTeam = 0; uint32 inviteeGuildId = 0; @@ -449,7 +447,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); } @@ -467,7 +465,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) @@ -511,12 +509,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)) { @@ -537,14 +535,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)) @@ -574,19 +572,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 +601,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 +635,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 +665,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 +732,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); |