// remove all events and invite of player related to a specific guild // used when player quit a guild void CalendarMgr::RemoveGuildCalendar(ObjectGuid const& playerGuid, uint32 GuildId) { CalendarEventStore::iterator itr = m_EventStore.begin(); while (itr != m_EventStore.end()) { CalendarEvent* event = &itr->second; if (event->CreatorGuid == playerGuid && (event->IsGuildEvent() || event->IsGuildAnnouncement())) { // all invite will be automaticaly deleted m_EventStore.erase(itr++); // itr already incremented so go recheck event owner continue; } // event not owned by playerGuid but an guild invite can still be found if (event->GuildId != GuildId || !(event->IsGuildEvent() || event->IsGuildAnnouncement())) { ++itr; continue; } event->RemoveInviteByGuid(playerGuid); ++itr; } }
void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEvent const& calendarEvent) { // Send packet to all guild members if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement()) if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId())) guild->BroadcastPacket(&packet); // Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them) CalendarInviteStore invites = _invites[calendarEvent.GetEventId()]; for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr) if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID())) if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId()) player->SendDirectMessage(&packet); }
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/) { CalendarEvent* calendarEvent = GetEvent(eventId); if (!calendarEvent) return; CalendarInviteStore::iterator itr = _invites[eventId].begin(); for (; itr != _invites[eventId].end(); ++itr) if ((*itr)->GetInviteId() == inviteId) break; if (itr == _invites[eventId].end()) return; SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE); stmt->setUInt64(0, (*itr)->GetInviteId()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); if (!calendarEvent->IsGuildEvent()) SendCalendarEventInviteRemoveAlert((*itr)->GetInviteeGUID(), *calendarEvent, CALENDAR_STATUS_REMOVED); SendCalendarEventInviteRemove(*calendarEvent, **itr, calendarEvent->GetFlags()); // we need to find out how to use CALENDAR_INVITE_REMOVED_MAIL_SUBJECT to force client to display different mail //if ((*itr)->GetInviteeGUID() != remover) // MailDraft(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody()) // .SendMailTo(trans, MailReceiver((*itr)->GetInvitee()), calendarEvent, MAIL_CHECK_MASK_COPIED); delete *itr; _invites[eventId].erase(itr); }
void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite) { WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT); data << uint64(calendarEvent.GetEventId()); data << calendarEvent.GetTitle(); data.AppendPackedTime(calendarEvent.GetEventTime()); data << uint32(calendarEvent.GetFlags()); data << uint32(calendarEvent.GetType()); data << int32(calendarEvent.GetDungeonId()); data << uint64(invite.GetInviteId()); Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()); data << uint64(guild ? guild->GetGUID() : 0); data << uint8(invite.GetStatus()); data << uint8(invite.GetRank()); data.appendPackGUID(calendarEvent.GetCreatorGUID()); data.appendPackGUID(invite.GetSenderGUID()); if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement()) { if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId())) guild->BroadcastPacket(&data); } else if (Player* player = ObjectAccessor::FindPlayer(invite.GetInviteeGUID())) player->SendDirectMessage(&data); }
// fill all player events in provided CalendarEventsList void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList& calEventList) { uint32 guildId = 0; Player* player = sObjectMgr.GetPlayer(guid); if (player) guildId = player->GetGuildId(); else guildId = Player::GetGuildIdFromDB(guid); for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr) { CalendarEvent* event = &itr->second; // add own event and same guild event or announcement if ((event->CreatorGuid == guid) || ((event->IsGuildAnnouncement() || event->IsGuildEvent()) && event->GuildId == guildId)) { calEventList.push_back(event); continue; } // add all event where player is invited if (event->GetInviteByGuid(guid)) calEventList.push_back(event); } }
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) { uint64 guid = _player->GetGUID(); std::string title; std::string description; uint8 type; uint8 repeatable; uint32 maxInvites; int32 dungeonId; uint32 eventPackedTime; uint32 unkPackedTime; uint32 flags; recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId; recvData.ReadPackedTime(eventPackedTime); recvData.ReadPackedTime(unkPackedTime); recvData >> flags; CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId, time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description); if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement()) if (Player* creator = ObjectAccessor::FindPlayer(guid)) calendarEvent->SetGuildId(creator->GetGuildId()); if (calendarEvent->IsGuildAnnouncement()) { // 946684800 is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); sCalendarMgr->AddInvite(calendarEvent, invite); } else { uint32 inviteCount; recvData >> inviteCount; for (uint32 i = 0; i < inviteCount; ++i) { uint64 invitee = 0; uint8 status = 0; uint8 rank = 0; recvData.readPackGUID(invitee); recvData >> status >> rank; // 946684800 is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), ""); sCalendarMgr->AddInvite(calendarEvent, invite); } } sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD); }
void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType) { Player* player = ObjectAccessor::FindPlayer(guid); if (!player) return; CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()]; WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32); data << uint8(sendType); data.appendPackGUID(calendarEvent.GetCreatorGUID()); data << uint64(calendarEvent.GetEventId()); data << calendarEvent.GetTitle(); data << calendarEvent.GetDescription(); data << uint8(calendarEvent.GetType()); data << uint8(CALENDAR_REPEAT_NEVER); // repeatable data << uint32(CALENDAR_MAX_INVITES); data << int32(calendarEvent.GetDungeonId()); data << uint32(calendarEvent.GetFlags()); data.AppendPackedTime(calendarEvent.GetEventTime()); data.AppendPackedTime(calendarEvent.GetTimeZoneTime()); Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()); data << uint64(guild ? guild->GetGUID() : 0); data << uint32(eventInviteeList.size()); for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr) { CalendarInvite const* calendarInvite = (*itr); uint64 inviteeGuid = calendarInvite->GetInviteeGUID(); Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid); uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid); uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid); data.appendPackGUID(inviteeGuid); data << uint8(inviteeLevel); data << uint8(calendarInvite->GetStatus()); data << uint8(calendarInvite->GetRank()); data << uint8(calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId); data << uint64(calendarInvite->GetInviteId()); data.AppendPackedTime(calendarInvite->GetStatusTime()); data << calendarInvite->GetText(); } player->SendDirectMessage(&data); }
void WorldSession::HandleCalendarAddEvent(WorldPackets::Calendar::CalendarAddEvent& calendarAddEvent) { ObjectGuid guid = _player->GetGUID(); // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (calendarAddEvent.EventInfo.Time < (time(NULL) - time_t(86400L))) return; CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, UI64LIT(0), CalendarEventType(calendarAddEvent.EventInfo.EventType), calendarAddEvent.EventInfo.TextureID, calendarAddEvent.EventInfo.Time, calendarAddEvent.EventInfo.Flags, calendarAddEvent.EventInfo.Title, calendarAddEvent.EventInfo.Description, time_t(0)); if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement()) if (Player* creator = ObjectAccessor::FindPlayer(guid)) calendarEvent->SetGuildId(creator->GetGuildId()); if (calendarEvent->IsGuildAnnouncement()) { CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, CALENDAR_DEFAULT_RESPONSE_TIME, 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); } else { SQLTransaction trans; if (calendarAddEvent.EventInfo.Invites.size() > 1) trans = CharacterDatabase.BeginTransaction(); for (uint32 i = 0; i < calendarAddEvent.EventInfo.Invites.size(); ++i) { CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), calendarAddEvent.EventInfo.Invites[i].Guid, guid, CALENDAR_DEFAULT_RESPONSE_TIME, CalendarInviteStatus(calendarAddEvent.EventInfo.Invites[i].Status), CalendarModerationRank(calendarAddEvent.EventInfo.Invites[i].Moderator), ""); sCalendarMgr->AddInvite(calendarEvent, invite, trans); } if (calendarAddEvent.EventInfo.Invites.size() > 1) CharacterDatabase.CommitTransaction(trans); } sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD); }
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) { ObjectGuid guid = _player->GetGUID(); std::string title; std::string description; uint8 type; uint8 repeatable; uint32 maxInvites; int32 dungeonId; uint32 eventPackedTime; uint32 unkPackedTime; uint32 flags; recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId; recvData.ReadPackedTime(eventPackedTime); recvData.ReadPackedTime(unkPackedTime); recvData >> flags; // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L))) { recvData.rfinish(); return; } CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId, time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description); if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement()) if (Player* creator = ObjectAccessor::FindPlayer(guid)) calendarEvent->SetGuildId(creator->GetGuildId()); if (calendarEvent->IsGuildAnnouncement()) { // 946684800 is 01/01/2000 00:00:00 - default response time 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); } else { // client limits the amount of players to be invited to 100 const uint32 MaxPlayerInvites = 100; uint32 inviteCount; ObjectGuid invitee[MaxPlayerInvites]; uint8 status[MaxPlayerInvites]; uint8 rank[MaxPlayerInvites]; memset(status, 0, sizeof(status)); memset(rank, 0, sizeof(rank)); try { recvData >> inviteCount; for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { recvData >> invitee[i].ReadAsPacked(); recvData >> status[i] >> rank[i]; } } catch (ByteBufferException const&) { delete calendarEvent; calendarEvent = NULL; throw; } SQLTransaction trans; if (inviteCount > 1) trans = CharacterDatabase.BeginTransaction(); for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { // 946684800 is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee[i], guid, 946684800, CalendarInviteStatus(status[i]), CalendarModerationRank(rank[i]), ""); sCalendarMgr->AddInvite(calendarEvent, invite, trans); } if (inviteCount > 1) CharacterDatabase.CommitTransaction(trans); } sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD); }
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { uint64 guid = _player->GetGUID(); TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); time_t currTime = time(NULL); uint32 counter = 0; CalendarInviteStore invites = sCalendarMgr->GetPlayerInvites(guid); CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid); ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap(); ByteBuffer lockoutInfoBuffer; ByteBuffer invitesInfoBuffer; ByteBuffer eventsInfoBuffer; WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance size_t resetPos = data.bitwpos(); data.WriteBits(0, 20); // Reset placeholder data.WriteBits(0, 16); // Holidays -> f**k that shit... Necessary to find out when this should be sent size_t lockoutPos = data.bitwpos(); data.WriteBits(0, 20); // Lockout placeholder for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i)); for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr) { if (itr->second.perm) { InstanceSave const* save = itr->second.save; ObjectGuid guid = save->GetInstanceId(); data.WriteBit(guid[6]); data.WriteBit(guid[7]); data.WriteBit(guid[2]); data.WriteBit(guid[1]); data.WriteBit(guid[5]); data.WriteBit(guid[4]); data.WriteBit(guid[0]); data.WriteBit(guid[3]); lockoutInfoBuffer << uint32(save->GetDifficulty()); lockoutInfoBuffer.WriteByteSeq(guid[3]); lockoutInfoBuffer.WriteByteSeq(guid[0]); lockoutInfoBuffer.WriteByteSeq(guid[1]); lockoutInfoBuffer.WriteByteSeq(guid[5]); lockoutInfoBuffer << uint32(save->GetResetTime() - currTime); lockoutInfoBuffer << uint32(save->GetMapId()); lockoutInfoBuffer.WriteByteSeq(guid[2]); lockoutInfoBuffer.WriteByteSeq(guid[7]); lockoutInfoBuffer.WriteByteSeq(guid[6]); lockoutInfoBuffer.WriteByteSeq(guid[4]); ++counter; } } } data.WriteBits(invites.size(), 19); for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) { CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()); ObjectGuid guid = (*itr)->GetSenderGUID(); data.WriteBit(guid[1]); data.WriteBit(guid[2]); data.WriteBit(guid[6]); data.WriteBit(guid[7]); data.WriteBit(guid[3]); data.WriteBit(guid[0]); data.WriteBit(guid[4]); data.WriteBit(guid[5]); invitesInfoBuffer.WriteByteSeq(guid[2]); invitesInfoBuffer << uint64((*itr)->GetInviteId()); invitesInfoBuffer << uint8((*itr)->GetStatus()); invitesInfoBuffer.WriteByteSeq(guid[6]); invitesInfoBuffer.WriteByteSeq(guid[3]); invitesInfoBuffer.WriteByteSeq(guid[4]); invitesInfoBuffer.WriteByteSeq(guid[1]); invitesInfoBuffer.WriteByteSeq(guid[0]); invitesInfoBuffer << uint64((*itr)->GetEventId()); invitesInfoBuffer.WriteByteSeq(guid[7]); invitesInfoBuffer.WriteByteSeq(guid[5]); invitesInfoBuffer << uint8((*itr)->GetRank()); invitesInfoBuffer << uint8((calendarEvent && calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == _player->GetGuildId()) ? 1 : 0); } data.WriteBits(playerEvents.size(), 19); for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr) { CalendarEvent* calendarEvent = *itr; Guild* guild = sGuildMgr->GetGuildById(calendarEvent->GetGuildId()); ObjectGuid guildGuid = guild ? guild->GetGUID() : 0; ObjectGuid creatorGuid = calendarEvent->GetCreatorGUID(); data.WriteBit(creatorGuid[2]); data.WriteBit(guildGuid[1]); data.WriteBit(guildGuid[7]); data.WriteBit(creatorGuid[4]); data.WriteBit(guildGuid[5]); data.WriteBit(guildGuid[6]); data.WriteBit(guildGuid[3]); data.WriteBit(guildGuid[4]); data.WriteBit(creatorGuid[7]); data.WriteBits(calendarEvent->GetTitle().size(), 8); data.WriteBit(creatorGuid[1]); data.WriteBit(guildGuid[2]); data.WriteBit(guildGuid[0]); data.WriteBit(creatorGuid[0]); data.WriteBit(creatorGuid[3]); data.WriteBit(creatorGuid[6]); data.WriteBit(creatorGuid[5]); eventsInfoBuffer.WriteByteSeq(creatorGuid[5]); eventsInfoBuffer.WriteByteSeq(guildGuid[3]); eventsInfoBuffer.WriteString(calendarEvent->GetTitle()); eventsInfoBuffer.WriteByteSeq(guildGuid[7]); eventsInfoBuffer << int32(calendarEvent->GetDungeonId()); eventsInfoBuffer.WriteByteSeq(creatorGuid[0]); eventsInfoBuffer.WriteByteSeq(creatorGuid[4]); eventsInfoBuffer.WriteByteSeq(guildGuid[2]); eventsInfoBuffer.WriteByteSeq(creatorGuid[7]); eventsInfoBuffer.WriteByteSeq(creatorGuid[2]); eventsInfoBuffer.AppendPackedTime(calendarEvent->GetEventTime()); eventsInfoBuffer.WriteByteSeq(creatorGuid[3]); eventsInfoBuffer.WriteByteSeq(creatorGuid[1]); eventsInfoBuffer.WriteByteSeq(guildGuid[6]); eventsInfoBuffer.WriteByteSeq(guildGuid[1]); eventsInfoBuffer.WriteByteSeq(creatorGuid[6]); eventsInfoBuffer << uint32(calendarEvent->GetFlags()); eventsInfoBuffer.WriteByteSeq(guildGuid[4]); eventsInfoBuffer.WriteByteSeq(guildGuid[5]); eventsInfoBuffer.WriteByteSeq(guildGuid[0]); eventsInfoBuffer << uint64(calendarEvent->GetEventId()); eventsInfoBuffer << uint8(calendarEvent->GetType()); } data.FlushBits(); data.PutBits(lockoutPos, counter, 20); data.append(eventsInfoBuffer); data.append(lockoutInfoBuffer); data.append(invitesInfoBuffer); data.AppendPackedTime(currTime); // zone time counter = 0; std::set<uint32> sentMaps; for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr) { uint32 mapId = PAIR32_LOPART(itr->first); if (sentMaps.find(mapId) != sentMaps.end()) continue; MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsRaid()) continue; sentMaps.insert(mapId); data << int32(mapId); data << int32(itr->second - currTime); data << int32(0); // offset => found it different only once counter++; } data.PutBits(resetPos, counter, 20); data << uint32(1135753200); // Constant date, unk (28.12.2005 07:00) data << uint32(currTime); // server time SendPacket(&data); }
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) { uint64 guid = _player->GetGUID(); std::string title; std::string description; uint8 type; int32 dungeonId; uint32 eventPackedTime; uint32 maxInvites; // always 100, necesary? Not find the way how to change it uint32 flags; uint32 inviteeCount; uint16 descriptionLength, titleLength; recvData >> maxInvites >> flags >> dungeonId; recvData.ReadPackedTime(eventPackedTime); recvData >> type; inviteeCount = recvData.ReadBits(22); descriptionLength = recvData.ReadBits(11); std::list<CalendarInvitePacketInfo> calendarInviteList; for (uint32 i = 0; i < inviteeCount; i++) { CalendarInvitePacketInfo info; info.Guid[7] = recvData.ReadBit(); info.Guid[2] = recvData.ReadBit(); info.Guid[6] = recvData.ReadBit(); info.Guid[3] = recvData.ReadBit(); info.Guid[5] = recvData.ReadBit(); info.Guid[1] = recvData.ReadBit(); info.Guid[0] = recvData.ReadBit(); info.Guid[4] = recvData.ReadBit(); calendarInviteList.push_back(info); } titleLength = recvData.ReadBits(8); for (std::list<CalendarInvitePacketInfo>::iterator iter = calendarInviteList.begin(); iter != calendarInviteList.end(); ++iter) { recvData.ReadByteSeq(iter->Guid[4]); recvData.ReadByteSeq(iter->Guid[2]); recvData.ReadByteSeq(iter->Guid[3]); recvData.ReadByteSeq(iter->Guid[1]); recvData.ReadByteSeq(iter->Guid[0]); recvData.ReadByteSeq(iter->Guid[6]); recvData.ReadByteSeq(iter->Guid[7]); recvData >> iter->Status; recvData.ReadByteSeq(iter->Guid[5]); recvData >> iter->ModerationRank; } title = recvData.ReadString(titleLength); description = recvData.ReadString(descriptionLength); CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId, time_t(eventPackedTime), flags, title, description); if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement()) if (Player* creator = ObjectAccessor::FindPlayer(guid)) calendarEvent->SetGuildId(creator->GetGuildId()); if (calendarEvent->IsGuildAnnouncement()) { // DEFAULT_STATUS_TIME is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, DEFAULT_STATUS_TIME, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); sCalendarMgr->AddInvite(calendarEvent, invite); } else { for (std::list<CalendarInvitePacketInfo>::const_iterator iter = calendarInviteList.begin(); iter != calendarInviteList.end(); ++iter) { // DEFAULT_STATUS_TIME is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), (uint64)iter->Guid, guid, DEFAULT_STATUS_TIME, CalendarInviteStatus(iter->Status), CalendarModerationRank(iter->ModerationRank), ""); sCalendarMgr->AddInvite(calendarEvent, invite); } } sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD); }