42 time_t currTime = time(NULL);
52 size_t resetPos = data.
bitwpos();
55 size_t lockoutPos = data.
bitwpos();
58 for (
uint8 i = 0; i < 15; ++i)
61 for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr)
94 for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
108 invitesInfoBuffer <<
uint64((*itr)->GetInviteId());
109 invitesInfoBuffer <<
uint8((*itr)->GetStatus());
115 invitesInfoBuffer <<
uint64((*itr)->GetEventId());
119 invitesInfoBuffer <<
uint8((*itr)->GetRank());
124 for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr)
174 data.
PutBits(lockoutPos, counter, 20);
175 data.
append(eventsInfoBuffer);
176 data.
append(lockoutInfoBuffer);
177 data.
append(invitesInfoBuffer);
181 std::set<uint32> sentMaps;
182 for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
185 if (sentMaps.find(mapId) != sentMaps.end())
189 if (!mapEntry || !mapEntry->
IsRaid())
192 sentMaps.insert(mapId);
194 data <<
int32(mapId);
195 data <<
int32(itr->second - currTime);
200 data.
PutBits(resetPos, counter, 20);
201 data <<
uint32(1135753200);
212 SF_LOG_DEBUG(
"network",
"CMSG_CALENDAR_GET_EVENT. Player ["
229 recvData >> minLevel >> maxLevel >> minRank;
232 guild->MassInviteToEvent(
this, minLevel, maxLevel, minRank);
234 SF_LOG_DEBUG(
"network",
"CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank);
253 std::string description;
260 uint16 descriptionLength, titleLength;
262 recvData >> maxInvites >> flags >> dungeonId;
265 inviteeCount = recvData.
ReadBits(22);
266 descriptionLength = recvData.
ReadBits(11);
268 std::list<CalendarInvitePacketInfo> calendarInviteList;
269 for (
uint32 i = 0; i < inviteeCount; i++)
280 calendarInviteList.push_back(info);
285 for (std::list<CalendarInvitePacketInfo>::iterator iter = calendarInviteList.begin(); iter != calendarInviteList.end(); ++iter)
294 recvData >> iter->Status;
296 recvData >> iter->ModerationRank;
300 description = recvData.
ReadString(descriptionLength);
303 time_t(eventPackedTime), flags, title, description);
307 calendarEvent->
SetGuildId(creator->GetGuildId());
317 recvData >> inviteCount;
319 for (
uint32 i = 0; i < inviteCount; ++i)
325 recvData >> status >> rank;
342 std::string description;
351 recvData >> maxInvites >> dungeonId;
353 recvData >> flags >> type;
354 eventId[4] = recvData.
ReadBit();
355 eventId[5] = recvData.
ReadBit();
356 eventId[2] = recvData.
ReadBit();
357 inviteId[4] = recvData.
ReadBit();
358 eventId[7] = recvData.
ReadBit();
359 eventId[0] = recvData.
ReadBit();
360 inviteId[5] = recvData.
ReadBit();
361 inviteId[3] = recvData.
ReadBit();
362 eventId[6] = recvData.
ReadBit();
363 eventId[1] = recvData.
ReadBit();
364 inviteId[6] = recvData.
ReadBit();
365 inviteId[2] = recvData.
ReadBit();
366 inviteId[7] = recvData.
ReadBit();
367 inviteId[1] = recvData.
ReadBit();
368 inviteId[0] = recvData.
ReadBit();
369 descriptionLength = recvData.
ReadBits(11);
371 eventId[3] = recvData.
ReadBit();
387 description = recvData.
ReadString(descriptionLength);
393 "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
394 "MaxInvites %u, Dungeon ID %d, Time %u, Flags %u",
396 description.c_str(), type, maxInvites, dungeonId,
397 eventPackedTime, flags);
402 calendarEvent->SetFlags(flags);
403 calendarEvent->SetEventTime(time_t(eventPackedTime));
404 calendarEvent->SetDungeonId(dungeonId);
405 calendarEvent->SetTitle(title);
406 calendarEvent->SetDescription(description);
409 sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, calendarEvent->GetEventTime());
434 recvData >> eventId >> inviteId;
437 "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time);
445 for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
469 uint32 inviteeGuildId = 0;
471 recvData >> eventId >> inviteId;
472 isPreInvite = recvData.
ReadBit();
474 isGuildEvent = recvData.
ReadBit();
481 inviteeGuid = player->
GetGUID();
482 inviteeTeam = player->
GetTeam();
492 Field* fields = result->Fetch();
513 Field* fields = result->Fetch();
525 if (calendarEvent->GetEventTime() < time(NULL))
532 if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == inviteeGuildId)
539 sCalendarMgr->AddInvite(calendarEvent, invite,
true, player && player->
GetGuildId() != calendarEvent->GetGuildId());
547 if (isGuildEvent &&
_player->GetGuildId() == inviteeGuildId)
565 tentative = recvData.
ReadBit();
571 if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() !=
_player->GetGuildId())
593 recvData >> eventId >> inviteId >> status;
610 invite->SetStatusTime(time(NULL));
613 sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
614 sCalendarMgr->SendCalendarEventStatusAlert(*calendarEvent, *invite);
632 recvData >> inviteId >> senderId >> eventId;
637 SF_LOG_DEBUG(
"network",
"CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
640 guid, eventId, senderId, (
uint64)invitee, inviteId);
644 if (calendarEvent->GetCreatorGUID() == invitee)
665 recvData >> senderId >> eventId >> inviteId >> status;
672 UI64FMTD "], status %u", guid, eventId, senderId, (
uint64)invitee, inviteId, status);
681 sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
682 sCalendarMgr->SendCalendarEventStatusAlert(*calendarEvent, *invite);
701 recvData >> rank >> eventId >> senderId >> inviteId;
708 UI64FMTD "], rank %u", guid, eventId, senderId, (
uint64)invitee, inviteId, rank);
712 if (calendarEvent->IsGuildEvent())
722 sCalendarMgr->SendCalendarEventModeratorStatus(*calendarEvent, *invite);
738 recvData >> inviteId >> eventId;
739 recvData.
ReadGuidMask(complainGUID, 4, 6, 2, 7, 1, 5, 3, 0);
740 recvData.
ReadGuidBytes(complainGUID, 6, 7, 1, 0, 4, 2, 3, 5);
754 "] Pending: %u", guid, pending);
765 recvData >> mapId >> difficulty >> toggleExtend;
766 SF_LOG_DEBUG(
"network",
"CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, DifficultyID: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ?
"On" :
"Off");
783 SF_LOG_DEBUG(
"network",
"%s", add ?
"SMSG_CALENDAR_RAID_LOCKOUT_ADDED" :
"SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
784 time_t currTime = time(NULL);
853 time_t currTime = time(NULL);
std::set< CalendarEvent * > CalendarEventStore
@ CALENDAR_ERROR_NO_INVITE
@ CALENDAR_ERROR_EVENT_PASSED
@ CALENDAR_ERROR_EVENT_LOCKED
@ CALENDAR_ERROR_NOT_ALLIED
@ CALENDAR_ERROR_NO_GUILD_INVITES
@ CALENDAR_ERROR_DELETE_CREATOR_FAILED
@ CALENDAR_ERROR_NO_MODERATOR
@ CALENDAR_ERROR_IGNORING_YOU_S
@ CALENDAR_ERROR_PLAYER_NOT_FOUND
@ CALENDAR_ERROR_EVENT_INVALID
@ CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD
@ CALENDAR_FLAG_INVITES_LOCKED
std::vector< CalendarInvite * > CalendarInviteStore
@ CALENDAR_STATUS_TENTATIVE
@ CALENDAR_STATUS_NOT_SIGNED_UP
@ CALENDAR_STATUS_INVITED
@ CALENDAR_STATUS_SIGNED_UP
@ CALENDAR_STATUS_REMOVED
@ CHAR_SEL_GUID_RACE_ACC_BY_NAME
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
UNORDERED_MAP< uint32, time_t > ResetTimeByMapDifficultyMap
#define SF_LOG_DEBUG(filterType__,...)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
uint16 PAIR32_LOPART(uint32 x)
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
bool WriteBit(uint32 bit)
size_t bitwpos() const
Returns position of last written bit.
void WriteString(std::string const &str)
uint32 ReadBits(size_t bits)
void ReadGuidBytes(ObjectGuid &guid, Offsets... offsets)
void ReadByteSeq(uint8 &b)
std::string ReadString(size_t length)
void PutBits(size_t pos, T value, uint32 bitCount)
void ReadGuidMask(ObjectGuid &guid, Offsets... offsets)
void WriteBits(T value, size_t bits)
void AppendPackedTime(time_t time)
void WriteByteSeq(uint8 b)
void readPackGUID(uint64 &guid)
DifficultyID GetDifficulty() const
uint32 GetInstanceId() const
time_t GetResetTime() const
static Player * FindPlayer(uint64)
static uint32 GetGuildIdFromDB(uint64 guid)
uint32 GetGuildId() const
static uint32 TeamForRace(uint8 race)
UNORDERED_MAP< uint32, InstancePlayerBind > BoundInstancesMap
void setString(const uint8 index, const std::string &value)
void HandleCalendarGetEvent(WorldPacket &recvData)
void HandleCalendarEventRsvp(WorldPacket &recvData)
void HandleCalendarGetCalendar(WorldPacket &recvData)
void HandleCalendarEventInvite(WorldPacket &recvData)
void HandleCalendarEventSignup(WorldPacket &recvData)
void HandleCalendarEventModeratorStatus(WorldPacket &recvData)
void HandleCalendarUpdateEvent(WorldPacket &recvData)
void SendCalendarRaidLockoutUpdated(InstanceSave const *save)
void HandleCalendarComplain(WorldPacket &recvData)
void HandleCalendarAddEvent(WorldPacket &recvData)
void HandleCalendarEventRemoveInvite(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
void SendCalendarRaidLockout(InstanceSave const *save, bool add)
void HandleCalendarCopyEvent(WorldPacket &recvData)
void HandleSetSavedInstanceExtend(WorldPacket &recvData)
void HandleCalendarGuildFilter(WorldPacket &recvData)
void HandleCalendarRemoveEvent(WorldPacket &recvData)
void HandleCalendarGetNumPending(WorldPacket &recvData)
void HandleCalendarEventStatus(WorldPacket &recvData)
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
@ SMSG_CALENDAR_SEND_NUM_PENDING
@ SMSG_CALENDAR_SEND_CALENDAR
@ SMSG_CALENDAR_RAID_LOCKOUT_ADDED
@ SMSG_CALENDAR_RAID_LOCKOUT_UPDATED
@ SMSG_CALENDAR_RAID_LOCKOUT_REMOVED
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR
bool IsGuildAnnouncement() const
void SetGuildId(uint32 guildId)
CalendarEventType GetType() const
bool IsGuildEvent() const
void SetEventTime(time_t eventTime)
uint64 GetEventId() const
uint64 GetCreatorGUID() const
int32 GetDungeonId() const
std::string GetTitle() const
uint32 GetGuildId() const
time_t GetEventTime() const