AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
CalendarMgr Class Reference

#include "CalendarMgr.h"

Public Member Functions

void LoadFromDB ()
 
CalendarEventGetEvent (uint64 eventId)
 
CalendarEventStore const & GetEvents () const
 
CalendarEventStore GetEventsCreatedBy (ObjectGuid guid, bool includeGuildEvents=false)
 
CalendarEventStore GetPlayerEvents (ObjectGuid guid)
 
CalendarEventStore GetGuildEvents (uint32 guildId)
 
CalendarInviteGetInvite (uint64 inviteId) const
 
CalendarEventInviteStore const & GetInvites () const
 
CalendarInviteStore const & GetEventInvites (uint64 eventId)
 
CalendarInviteStore GetPlayerInvites (ObjectGuid guid)
 
void FreeEventId (uint64 id)
 
uint64 GetFreeEventId ()
 
void FreeInviteId (uint64 id)
 
uint64 GetFreeInviteId ()
 
void DeleteOldEvents ()
 
uint32 GetPlayerNumPending (ObjectGuid guid)
 
void AddEvent (CalendarEvent *calendarEvent, CalendarSendEventType sendType)
 
void RemoveEvent (uint64 eventId, ObjectGuid remover)
 
void RemoveEvent (CalendarEvent *calendarEvent, ObjectGuid remover)
 
void UpdateEvent (CalendarEvent *calendarEvent)
 
void AddInvite (CalendarEvent *calendarEvent, CalendarInvite *invite, CharacterDatabaseTransaction trans=nullptr)
 
void RemoveInvite (uint64 inviteId, uint64 eventId, ObjectGuid remover)
 
void RemoveInvite (uint64 inviteId, uint64 eventId, uint64 remover)
 
void UpdateInvite (CalendarInvite *invite, CharacterDatabaseTransaction trans=nullptr)
 
void RemoveAllPlayerEventsAndInvites (ObjectGuid guid)
 
void RemovePlayerGuildEventsAndSignups (ObjectGuid guid, uint32 guildId)
 
void SendCalendarEvent (ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarSendEventType sendType)
 
void SendCalendarEventInvite (CalendarInvite const &invite)
 
void SendCalendarEventInviteAlert (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarEventInviteRemove (CalendarEvent const &calendarEvent, CalendarInvite const &invite, uint32 flags)
 
void SendCalendarEventInviteRemoveAlert (ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarInviteStatus status)
 
void SendCalendarEventUpdateAlert (CalendarEvent const &calendarEvent, time_t oldEventTime)
 
void SendCalendarEventStatus (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarEventRemovedAlert (CalendarEvent const &calendarEvent)
 
void SendCalendarEventModeratorStatusAlert (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarClearPendingAction (ObjectGuid guid)
 
void SendCalendarCommandResult (ObjectGuid guid, CalendarError err, char const *param=nullptr)
 
void SendPacketToAllEventRelatives (WorldPacket packet, CalendarEvent const &calendarEvent)
 

Static Public Member Functions

static CalendarMgrinstance ()
 

Private Member Functions

 CalendarMgr ()
 
 ~CalendarMgr ()
 

Private Attributes

CalendarEventStore _events
 
CalendarEventInviteStore _invites
 
std::deque< uint64_freeEventIds
 
std::deque< uint64_freeInviteIds
 
uint64 _maxEventId
 
uint64 _maxInviteId
 

Detailed Description

Constructor & Destructor Documentation

◆ CalendarMgr()

CalendarMgr::CalendarMgr ( )
private
43: _maxEventId(0), _maxInviteId(0) { }
uint64 _maxInviteId
Definition: CalendarMgr.h:289
uint64 _maxEventId
Definition: CalendarMgr.h:288

◆ ~CalendarMgr()

CalendarMgr::~CalendarMgr ( )
private
46{
47 for (CalendarEventStore::iterator itr = _events.begin(); itr != _events.end(); ++itr)
48 delete *itr;
49
50 for (CalendarEventInviteStore::iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
51 for (CalendarInviteStore::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
52 delete *itr2;
53}
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:284
CalendarEventStore _events
Definition: CalendarMgr.h:283

References _events, and _invites.

Member Function Documentation

◆ AddEvent()

void CalendarMgr::AddEvent ( CalendarEvent calendarEvent,
CalendarSendEventType  sendType 
)
136{
137 _events.insert(calendarEvent);
138 UpdateEvent(calendarEvent);
139 SendCalendarEvent(calendarEvent->GetCreatorGUID(), *calendarEvent, sendType);
140}
ObjectGuid GetCreatorGUID() const
Definition: CalendarMgr.h:226
void UpdateEvent(CalendarEvent *calendarEvent)
Definition: CalendarMgr.cpp:247
void SendCalendarEvent(ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarSendEventType sendType)
Definition: CalendarMgr.cpp:603

References _events, CalendarEvent::GetCreatorGUID(), SendCalendarEvent(), and UpdateEvent().

◆ AddInvite()

void CalendarMgr::AddInvite ( CalendarEvent calendarEvent,
CalendarInvite invite,
CharacterDatabaseTransaction  trans = nullptr 
)
143{
144 if (!calendarEvent->IsGuildAnnouncement())
146
147 if (!calendarEvent->IsGuildEvent() || invite->GetInviteeGUID() == calendarEvent->GetCreatorGUID())
148 SendCalendarEventInviteAlert(*calendarEvent, *invite);
149
150 if (!calendarEvent->IsGuildAnnouncement())
151 {
152 _invites[invite->GetEventId()].push_back(invite);
153 UpdateInvite(invite, trans);
154 }
155}
uint64 GetEventId() const
Definition: CalendarMgr.h:163
ObjectGuid GetInviteeGUID() const
Definition: CalendarMgr.h:169
bool IsGuildAnnouncement() const
Definition: CalendarMgr.h:253
bool IsGuildEvent() const
Definition: CalendarMgr.h:252
void SendCalendarEventInviteAlert(CalendarEvent const &calendarEvent, CalendarInvite const &invite)
Definition: CalendarMgr.cpp:579
void UpdateInvite(CalendarInvite *invite, CharacterDatabaseTransaction trans=nullptr)
Definition: CalendarMgr.cpp:262
void SendCalendarEventInvite(CalendarInvite const &invite)
Definition: CalendarMgr.cpp:479

References _invites, CalendarEvent::GetCreatorGUID(), CalendarInvite::GetEventId(), CalendarInvite::GetInviteeGUID(), CalendarEvent::IsGuildAnnouncement(), CalendarEvent::IsGuildEvent(), SendCalendarEventInvite(), SendCalendarEventInviteAlert(), and UpdateInvite().

◆ DeleteOldEvents()

void CalendarMgr::DeleteOldEvents ( )
364{
365 time_t oldEventsTime = GameTime::GetGameTime().count() - CALENDAR_OLD_EVENTS_DELETION_TIME;
366
367 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end();)
368 {
369 CalendarEvent* event = *itr;
370 ++itr;
371 if (event->GetEventTime() < oldEventsTime)
373 }
374}
@ CALENDAR_OLD_EVENTS_DELETION_TIME
Definition: CalendarMgr.h:132
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: CalendarMgr.h:195
void RemoveEvent(uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:157
static ObjectGuid const Empty
Definition: ObjectGuid.h:122

References _events, CALENDAR_OLD_EVENTS_DELETION_TIME, ObjectGuid::Empty, GameTime::GetGameTime(), and RemoveEvent().

◆ FreeEventId()

void CalendarMgr::FreeEventId ( uint64  id)
328{
329 if (id == _maxEventId)
330 --_maxEventId;
331 else
332 _freeEventIds.push_back(id);
333}
std::deque< uint64 > _freeEventIds
Definition: CalendarMgr.h:286

References _freeEventIds, and _maxEventId.

◆ FreeInviteId()

void CalendarMgr::FreeInviteId ( uint64  id)
346{
347 if (id == _maxInviteId)
348 --_maxInviteId;
349 else
350 _freeInviteIds.push_back(id);
351}
std::deque< uint64 > _freeInviteIds
Definition: CalendarMgr.h:287

References _freeInviteIds, and _maxInviteId.

◆ GetEvent()

CalendarEvent * CalendarMgr::GetEvent ( uint64  eventId)
308{
309 for (CalendarEventStore::iterator itr = _events.begin(); itr != _events.end(); ++itr)
310 if ((*itr)->GetEventId() == eventId)
311 return *itr;
312
313 return nullptr;
314}

References _events.

Referenced by GetPlayerEvents(), LoadFromDB(), RemoveEvent(), RemoveInvite(), RemovePlayerGuildEventsAndSignups(), and SendCalendarEventInvite().

◆ GetEventInvites()

CalendarInviteStore const & CalendarMgr::GetEventInvites ( uint64  eventId)
421{
422 return _invites[eventId];
423}

References _invites.

◆ GetEvents()

CalendarEventStore const & CalendarMgr::GetEvents ( ) const
inline
297{ return _events; }

References _events.

◆ GetEventsCreatedBy()

CalendarEventStore CalendarMgr::GetEventsCreatedBy ( ObjectGuid  guid,
bool  includeGuildEvents = false 
)
377{
378 CalendarEventStore result;
379 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
380 if ((*itr)->GetCreatorGUID() == guid && (includeGuildEvents || (!(*itr)->IsGuildEvent() && !(*itr)->IsGuildAnnouncement())))
381 result.insert(*itr);
382
383 return result;
384}
std::unordered_set< CalendarEvent * > CalendarEventStore
Definition: CalendarMgr.h:274

References _events.

◆ GetFreeEventId()

uint64 CalendarMgr::GetFreeEventId ( )
336{
337 if (_freeEventIds.empty())
338 return ++_maxEventId;
339
340 uint64 eventId = _freeEventIds.front();
341 _freeEventIds.pop_front();
342 return eventId;
343}
std::uint64_t uint64
Definition: Define.h:107

References _freeEventIds, and _maxEventId.

◆ GetFreeInviteId()

uint64 CalendarMgr::GetFreeInviteId ( )
354{
355 if (_freeInviteIds.empty())
356 return ++_maxInviteId;
357
358 uint64 inviteId = _freeInviteIds.front();
359 _freeInviteIds.pop_front();
360 return inviteId;
361}

References _freeInviteIds, and _maxInviteId.

◆ GetGuildEvents()

CalendarEventStore CalendarMgr::GetGuildEvents ( uint32  guildId)
387{
388 CalendarEventStore result;
389
390 if (!guildId)
391 return result;
392
393 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
394 if ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement())
395 if ((*itr)->GetGuildId() == guildId)
396 result.insert(*itr);
397
398 return result;
399}

References _events.

◆ GetInvite()

CalendarInvite * CalendarMgr::GetInvite ( uint64  inviteId) const
317{
318 for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
319 for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
320 if ((*itr2)->GetInviteId() == inviteId)
321 return *itr2;
322
323 LOG_DEBUG("entities.unit", "CalendarMgr::GetInvite: [{}] not found!", inviteId);
324 return nullptr;
325}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169

References _invites, and LOG_DEBUG.

Referenced by LoadFromDB().

◆ GetInvites()

CalendarEventInviteStore const & CalendarMgr::GetInvites ( ) const
inline
303{ return _invites; }

References _invites.

◆ GetPlayerEvents()

CalendarEventStore CalendarMgr::GetPlayerEvents ( ObjectGuid  guid)
402{
404
405 for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
406 for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
407 if ((*itr2)->GetInviteeGUID() == guid)
408 if (CalendarEvent* event = GetEvent(itr->first)) // nullptr check added as attempt to fix #11512
409 events.insert(event);
410
412 if (player->GetGuildId())
413 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
414 if ((*itr)->GetGuildId() == player->GetGuildId())
415 events.insert(*itr);
416
417 return events;
418}
events
Definition: boss_sartura.cpp:43
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260
CalendarEvent * GetEvent(uint64 eventId)
Definition: CalendarMgr.cpp:307
Definition: Player.h:1056

References _events, _invites, ObjectAccessor::FindConnectedPlayer(), and GetEvent().

◆ GetPlayerInvites()

CalendarInviteStore CalendarMgr::GetPlayerInvites ( ObjectGuid  guid)
426{
427 CalendarInviteStore invites;
428
429 for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
430 for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
431 if ((*itr2)->GetInviteeGUID() == guid)
432 invites.push_back(*itr2);
433
434 return invites;
435}
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:273

References _invites.

Referenced by GetPlayerNumPending(), RemoveAllPlayerEventsAndInvites(), and RemovePlayerGuildEventsAndSignups().

◆ GetPlayerNumPending()

uint32 CalendarMgr::GetPlayerNumPending ( ObjectGuid  guid)
438{
439 CalendarInviteStore const& invites = GetPlayerInvites(guid);
440
441 uint32 pendingNum = 0;
442 for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
443 {
444 switch ((*itr)->GetStatus())
445 {
449 ++pendingNum;
450 break;
451 default:
452 break;
453 }
454 }
455
456 return pendingNum;
457}
std::uint32_t uint32
Definition: Define.h:108
@ CALENDAR_STATUS_TENTATIVE
Definition: CalendarMgr.h:84
@ CALENDAR_STATUS_NOT_SIGNED_UP
Definition: CalendarMgr.h:83
@ CALENDAR_STATUS_INVITED
Definition: CalendarMgr.h:76
CalendarInviteStore GetPlayerInvites(ObjectGuid guid)
Definition: CalendarMgr.cpp:425

References CALENDAR_STATUS_INVITED, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_STATUS_TENTATIVE, and GetPlayerInvites().

◆ instance()

CalendarMgr * CalendarMgr::instance ( )
static
56{
57 static CalendarMgr instance;
58 return &instance;
59}
Definition: CalendarMgr.h:278
static CalendarMgr * instance()
Definition: CalendarMgr.cpp:55

References instance().

Referenced by instance().

◆ LoadFromDB()

void CalendarMgr::LoadFromDB ( )
62{
63 uint32 count = 0;
64 _maxEventId = 0;
65 _maxInviteId = 0;
66
67 // 0 1 2 3 4 5 6 7 8
68 if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, time2 FROM calendar_events"))
69 do
70 {
71 Field* fields = result->Fetch();
72
73 uint64 eventId = fields[0].Get<uint64>();
74 ObjectGuid creatorGUID = ObjectGuid::Create<HighGuid::Player>(fields[1].Get<uint32>());
75 std::string title = fields[2].Get<std::string>();
76 std::string description = fields[3].Get<std::string>();
77 CalendarEventType type = CalendarEventType(fields[4].Get<uint8>());
78 int32 dungeonId = fields[5].Get<int32>();
79 uint32 eventTime = fields[6].Get<uint32>();
80 uint32 flags = fields[7].Get<uint32>();
81 uint32 timezoneTime = fields[8].Get<uint32>();
82 uint32 guildId = 0;
83
85 {
86 guildId = sCharacterCache->GetCharacterGuildIdByGuid(creatorGUID);
87 }
88
89 CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
90 _events.insert(calendarEvent);
91
92 _maxEventId = std::max(_maxEventId, eventId);
93
94 ++count;
95 } while (result->NextRow());
96
97 LOG_INFO("server.loading", ">> Loaded {} calendar events", count);
98 count = 0;
99
100 // 0 1 2 3 4 5 6 7
101 if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, `rank`, text FROM calendar_invites"))
102 do
103 {
104 Field* fields = result->Fetch();
105
106 uint64 inviteId = fields[0].Get<uint64>();
107 uint64 eventId = fields[1].Get<uint64>();
108 ObjectGuid invitee = ObjectGuid::Create<HighGuid::Player>(fields[2].Get<uint32>());
109 ObjectGuid senderGUID = ObjectGuid::Create<HighGuid::Player>(fields[3].Get<uint32>());
110 CalendarInviteStatus status = CalendarInviteStatus(fields[4].Get<uint8>());
111 uint32 statusTime = fields[5].Get<uint32>();
112 CalendarModerationRank rank = CalendarModerationRank(fields[6].Get<uint8>());
113 std::string text = fields[7].Get<std::string>();
114
115 CalendarInvite* invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, time_t(statusTime), status, rank, text);
116 _invites[eventId].push_back(invite);
117
118 _maxInviteId = std::max(_maxInviteId, inviteId);
119
120 ++count;
121 } while (result->NextRow());
122
123 LOG_INFO("server.loading", ">> Loaded {} calendar invites", count);
124 LOG_INFO("server.loading", " ");
125
126 for (uint64 i = 1; i < _maxEventId; ++i)
127 if (!GetEvent(i))
128 _freeEventIds.push_back(i);
129
130 for (uint64 i = 1; i < _maxInviteId; ++i)
131 if (!GetInvite(i))
132 _freeInviteIds.push_back(i);
133}
std::int32_t int32
Definition: Define.h:104
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
#define sCharacterCache
Definition: CharacterCache.h:83
CalendarModerationRank
Definition: CalendarMgr.h:44
@ CALENDAR_FLAG_WITHOUT_INVITES
Definition: CalendarMgr.h:39
@ CALENDAR_FLAG_GUILD_EVENT
Definition: CalendarMgr.h:40
CalendarEventType
Definition: CalendarMgr.h:58
CalendarInviteStatus
Definition: CalendarMgr.h:75
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Definition: CalendarMgr.h:136
CalendarInvite * GetInvite(uint64 inviteId) const
Definition: CalendarMgr.cpp:316
Definition: ObjectGuid.h:120

References _events, _freeEventIds, _freeInviteIds, _invites, _maxEventId, _maxInviteId, CALENDAR_FLAG_GUILD_EVENT, CALENDAR_FLAG_WITHOUT_INVITES, CharacterDatabase, Field::Get(), GetEvent(), GetInvite(), LOG_INFO, and sCharacterCache.

◆ RemoveAllPlayerEventsAndInvites()

void CalendarMgr::RemoveAllPlayerEventsAndInvites ( ObjectGuid  guid)
277{
278 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end();)
279 {
280 CalendarEvent* event = *itr;
281 ++itr;
282 if (event->GetCreatorGUID() == guid)
283 {
285 continue;
286 }
287 }
288
289 CalendarInviteStore playerInvites = GetPlayerInvites(guid);
290 for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
291 RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
292}
void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:212

References _events, ObjectGuid::Empty, GetPlayerInvites(), RemoveEvent(), and RemoveInvite().

◆ RemoveEvent() [1/2]

void CalendarMgr::RemoveEvent ( CalendarEvent calendarEvent,
ObjectGuid  remover 
)
171{
172 if (!calendarEvent)
173 {
175 return;
176 }
177
178 SendCalendarEventRemovedAlert(*calendarEvent);
179
180 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
182 MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
183
184 CalendarInviteStore& eventInvites = _invites[calendarEvent->GetEventId()];
185 for (size_t i = 0; i < eventInvites.size(); ++i)
186 {
187 CalendarInvite* invite = eventInvites[i];
188 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
189 stmt->SetData(0, invite->GetInviteId());
190 trans->Append(stmt);
191
192 // guild events only? check invite status here?
193 // When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
194 if (remover && invite->GetInviteeGUID() != remover)
195 mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED);
196
197 delete invite;
198 }
199
200 _invites.erase(calendarEvent->GetEventId());
201
202 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_EVENT);
203 stmt->SetData(0, calendarEvent->GetEventId());
204 trans->Append(stmt);
205 CharacterDatabase.CommitTransaction(trans);
206
207 delete calendarEvent;
208 _events.erase(calendarEvent);
209 return;
210}
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
@ CHAR_DEL_CALENDAR_INVITE
Definition: CharacterDatabase.h:459
@ CHAR_DEL_CALENDAR_EVENT
Definition: CharacterDatabase.h:457
@ CALENDAR_ERROR_EVENT_INVALID
Definition: CalendarMgr.h:96
@ MAIL_CHECK_MASK_COPIED
This mail was returned. Do not allow returning mail back again.
Definition: Mail.h:50
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
uint64 GetInviteId() const
Definition: CalendarMgr.h:160
std::string BuildCalendarMailSubject(ObjectGuid remover) const
Definition: CalendarMgr.cpp:459
uint64 GetEventId() const
Definition: CalendarMgr.h:223
std::string BuildCalendarMailBody() const
Definition: CalendarMgr.cpp:466
void SendCalendarEventRemovedAlert(CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:547
void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const *param=nullptr)
Definition: CalendarMgr.cpp:672
LowType GetCounter() const
Definition: ObjectGuid.h:147
Definition: Mail.h:106
Definition: Mail.h:120

References _events, _invites, CalendarEvent::BuildCalendarMailBody(), CalendarEvent::BuildCalendarMailSubject(), CALENDAR_ERROR_EVENT_INVALID, CHAR_DEL_CALENDAR_EVENT, CHAR_DEL_CALENDAR_INVITE, CharacterDatabase, ObjectGuid::GetCounter(), CalendarEvent::GetEventId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetInviteId(), MAIL_CHECK_MASK_COPIED, SendCalendarCommandResult(), SendCalendarEventRemovedAlert(), MailDraft::SendMailTo(), and PreparedStatementBase::SetData().

◆ RemoveEvent() [2/2]

void CalendarMgr::RemoveEvent ( uint64  eventId,
ObjectGuid  remover 
)
158{
159 CalendarEvent* calendarEvent = GetEvent(eventId);
160
161 if (!calendarEvent)
162 {
164 return;
165 }
166
167 RemoveEvent(calendarEvent, remover);
168}

References CALENDAR_ERROR_EVENT_INVALID, GetEvent(), RemoveEvent(), and SendCalendarCommandResult().

Referenced by DeleteOldEvents(), RemoveAllPlayerEventsAndInvites(), RemoveEvent(), and RemovePlayerGuildEventsAndSignups().

◆ RemoveInvite() [1/2]

void CalendarMgr::RemoveInvite ( uint64  inviteId,
uint64  eventId,
ObjectGuid  remover 
)
213{
214 CalendarEvent* calendarEvent = GetEvent(eventId);
215
216 if (!calendarEvent)
217 return;
218
219 CalendarInviteStore::iterator itr = _invites[eventId].begin();
220 for (; itr != _invites[eventId].end(); ++itr)
221 if ((*itr)->GetInviteId() == inviteId)
222 break;
223
224 if (itr == _invites[eventId].end())
225 return;
226
227 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
229 stmt->SetData(0, (*itr)->GetInviteId());
230 trans->Append(stmt);
231 CharacterDatabase.CommitTransaction(trans);
232
233 if (!calendarEvent->IsGuildEvent())
234 SendCalendarEventInviteRemoveAlert((*itr)->GetInviteeGUID(), *calendarEvent, CALENDAR_STATUS_REMOVED);
235
236 SendCalendarEventInviteRemove(*calendarEvent, **itr, calendarEvent->GetFlags());
237
238 // we need to find out how to use CALENDAR_INVITE_REMOVED_MAIL_SUBJECT to force client to display different mail
239 //if ((*itr)->GetInviteeGUID() != remover)
240 // MailDraft(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody())
241 // .SendMailTo(trans, MailReceiver((*itr)->GetInvitee()), calendarEvent, MAIL_CHECK_MASK_COPIED);
242
243 delete *itr;
244 _invites[eventId].erase(itr);
245}
@ CALENDAR_STATUS_REMOVED
Definition: CalendarMgr.h:85
uint32 GetFlags() const
Definition: CalendarMgr.h:247
void SendCalendarEventInviteRemove(CalendarEvent const &calendarEvent, CalendarInvite const &invite, uint32 flags)
Definition: CalendarMgr.cpp:557
void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarInviteStatus status)
Definition: CalendarMgr.cpp:649

References _invites, CALENDAR_STATUS_REMOVED, CHAR_DEL_CALENDAR_INVITE, CharacterDatabase, GetEvent(), CalendarEvent::GetFlags(), CalendarEvent::IsGuildEvent(), SendCalendarEventInviteRemove(), SendCalendarEventInviteRemoveAlert(), and PreparedStatementBase::SetData().

Referenced by RemoveAllPlayerEventsAndInvites(), and RemovePlayerGuildEventsAndSignups().

◆ RemoveInvite() [2/2]

void CalendarMgr::RemoveInvite ( uint64  inviteId,
uint64  eventId,
uint64  remover 
)

◆ RemovePlayerGuildEventsAndSignups()

void CalendarMgr::RemovePlayerGuildEventsAndSignups ( ObjectGuid  guid,
uint32  guildId 
)
295{
296 for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
297 if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
298 RemoveEvent((*itr)->GetEventId(), guid);
299
300 CalendarInviteStore playerInvites = GetPlayerInvites(guid);
301 for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
302 if (CalendarEvent* calendarEvent = GetEvent((*itr)->GetEventId()))
303 if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == guildId)
304 RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
305}

References _events, GetEvent(), GetPlayerInvites(), RemoveEvent(), and RemoveInvite().

◆ SendCalendarClearPendingAction()

void CalendarMgr::SendCalendarClearPendingAction ( ObjectGuid  guid)
664{
666 {
668 player->SendDirectMessage(&data);
669 }
670}
@ SMSG_CALENDAR_CLEAR_PENDING_ACTION
Definition: Opcodes.h:1241
Definition: WorldPacket.h:27

References ObjectAccessor::FindConnectedPlayer(), and SMSG_CALENDAR_CLEAR_PENDING_ACTION.

◆ SendCalendarCommandResult()

void CalendarMgr::SendCalendarCommandResult ( ObjectGuid  guid,
CalendarError  err,
char const *  param = nullptr 
)
673{
675 {
677 data << uint32(0);
678 data << uint8(0);
679 switch (err)
680 {
684 data << param;
685 break;
686 default:
687 data << uint8(0);
688 break;
689 }
690
691 data << uint32(err);
692
693 player->SendDirectMessage(&data);
694 }
695}
std::uint8_t uint8
Definition: Define.h:110
@ CALENDAR_ERROR_OTHER_INVITES_EXCEEDED
Definition: CalendarMgr.h:94
@ CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S
Definition: CalendarMgr.h:100
@ CALENDAR_ERROR_IGNORING_YOU_S
Definition: CalendarMgr.h:103
@ SMSG_CALENDAR_COMMAND_RESULT
Definition: Opcodes.h:1115

References CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S, CALENDAR_ERROR_IGNORING_YOU_S, CALENDAR_ERROR_OTHER_INVITES_EXCEEDED, ObjectAccessor::FindConnectedPlayer(), and SMSG_CALENDAR_COMMAND_RESULT.

Referenced by RemoveEvent().

◆ SendCalendarEvent()

void CalendarMgr::SendCalendarEvent ( ObjectGuid  guid,
CalendarEvent const &  calendarEvent,
CalendarSendEventType  sendType 
)
604{
606 if (!player)
607 return;
608
609 CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()];
610
611 WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
612 data << uint8(sendType);
613 data << calendarEvent.GetCreatorGUID().WriteAsPacked();
614 data << uint64(calendarEvent.GetEventId());
615 data << calendarEvent.GetTitle();
616 data << calendarEvent.GetDescription();
617 data << uint8(calendarEvent.GetType());
618 data << uint8(CALENDAR_REPEAT_NEVER); // repeatable
620 data << int32(calendarEvent.GetDungeonId());
621 data << uint32(calendarEvent.GetFlags());
622 data.AppendPackedTime(calendarEvent.GetEventTime());
623 data.AppendPackedTime(calendarEvent.GetTimeZoneTime());
624 data << uint32(calendarEvent.GetGuildId());
625
626 data << uint32(eventInviteeList.size());
627 for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
628 {
629 CalendarInvite const* calendarInvite = (*itr);
630 ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
631 Player* invitee = ObjectAccessor::FindConnectedPlayer(inviteeGuid);
632
633 uint8 inviteeLevel = invitee ? invitee->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(inviteeGuid);
634 uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(inviteeGuid);
635
636 data << inviteeGuid.WriteAsPacked();
637 data << uint8(inviteeLevel);
638 data << uint8(calendarInvite->GetStatus());
639 data << uint8(calendarInvite->GetRank());
640 data << uint8(calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId);
641 data << uint64(calendarInvite->GetInviteId());
642 data.AppendPackedTime(calendarInvite->GetStatusTime());
643 data << calendarInvite->GetText();
644 }
645
646 player->SendDirectMessage(&data);
647}
@ CALENDAR_REPEAT_NEVER
Definition: CalendarMgr.h:68
@ CALENDAR_MAX_INVITES
Definition: CalendarMgr.h:130
@ SMSG_CALENDAR_SEND_EVENT
Definition: Opcodes.h:1109
CalendarModerationRank GetRank() const
Definition: CalendarMgr.h:181
CalendarInviteStatus GetStatus() const
Definition: CalendarMgr.h:178
time_t GetStatusTime() const
Definition: CalendarMgr.h:172
std::string GetText() const
Definition: CalendarMgr.h:175
PackedGuid WriteAsPacked() const
Definition: ObjectGuid.h:318
uint32 GetGuildId() const
Definition: Player.h:1864
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5607
uint8 GetLevel() const
Definition: Unit.h:1432

References _invites, ByteBuffer::AppendPackedTime(), CALENDAR_MAX_INVITES, CALENDAR_REPEAT_NEVER, ObjectAccessor::FindConnectedPlayer(), CalendarEvent::GetCreatorGUID(), CalendarEvent::GetDescription(), CalendarEvent::GetDungeonId(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), CalendarEvent::GetGuildId(), Player::GetGuildId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetInviteId(), Unit::GetLevel(), CalendarInvite::GetRank(), CalendarInvite::GetStatus(), CalendarInvite::GetStatusTime(), CalendarInvite::GetText(), CalendarEvent::GetTimeZoneTime(), CalendarEvent::GetTitle(), CalendarEvent::GetType(), CalendarEvent::IsGuildEvent(), sCharacterCache, Player::SendDirectMessage(), SMSG_CALENDAR_SEND_EVENT, and ObjectGuid::WriteAsPacked().

Referenced by AddEvent().

◆ SendCalendarEventInvite()

void CalendarMgr::SendCalendarEventInvite ( CalendarInvite const &  invite)
480{
481 CalendarEvent* calendarEvent = GetEvent(invite.GetEventId());
482 time_t statusTime = invite.GetStatusTime();
483 bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
484
485 ObjectGuid invitee = invite.GetInviteeGUID();
487
488 uint8 level = player ? player->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee);
489
490 WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
491 data << invitee.WriteAsPacked();
492 data << uint64(invite.GetEventId());
493 data << uint64(invite.GetInviteId());
494 data << uint8(level);
495 data << uint8(invite.GetStatus());
496 data << uint8(hasStatusTime);
497 if (hasStatusTime)
498 data.AppendPackedTime(statusTime);
499 data << uint8(invite.GetSenderGUID() != invite.GetInviteeGUID()); // false only if the invite is sign-up
500
501 if (!calendarEvent) // Pre-invite
502 {
503 if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetSenderGUID()))
504 player->SendDirectMessage(&data);
505 }
506 else
507 {
508 if (calendarEvent->GetCreatorGUID() != invite.GetInviteeGUID()) // correct?
509 SendPacketToAllEventRelatives(data, *calendarEvent);
510 }
511}
@ SMSG_CALENDAR_EVENT_INVITE
Definition: Opcodes.h:1112
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:697

References ByteBuffer::AppendPackedTime(), ObjectAccessor::FindConnectedPlayer(), CalendarEvent::GetCreatorGUID(), GetEvent(), CalendarInvite::GetEventId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetInviteId(), Unit::GetLevel(), CalendarInvite::GetSenderGUID(), CalendarInvite::GetStatus(), CalendarInvite::GetStatusTime(), sCharacterCache, Player::SendDirectMessage(), SendPacketToAllEventRelatives(), SMSG_CALENDAR_EVENT_INVITE, and ObjectGuid::WriteAsPacked().

Referenced by AddInvite().

◆ SendCalendarEventInviteAlert()

void CalendarMgr::SendCalendarEventInviteAlert ( CalendarEvent const &  calendarEvent,
CalendarInvite const &  invite 
)
580{
582 data << uint64(calendarEvent.GetEventId());
583 data << calendarEvent.GetTitle();
584 data.AppendPackedTime(calendarEvent.GetEventTime());
585 data << uint32(calendarEvent.GetFlags());
586 data << uint32(calendarEvent.GetType());
587 data << int32(calendarEvent.GetDungeonId());
588 data << uint64(invite.GetInviteId());
589 data << uint8(invite.GetStatus());
590 data << uint8(invite.GetRank());
591 data << calendarEvent.GetCreatorGUID().WriteAsPacked();
592 data << invite.GetSenderGUID().WriteAsPacked();
593
594 if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
595 {
596 if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
597 guild->BroadcastPacket(&data);
598 }
599 else if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetInviteeGUID()))
600 player->SendDirectMessage(&data);
601}
#define sGuildMgr
Definition: GuildMgr.h:51
@ SMSG_CALENDAR_EVENT_INVITE_ALERT
Definition: Opcodes.h:1118
Definition: Guild.h:295

References ByteBuffer::AppendPackedTime(), ObjectAccessor::FindConnectedPlayer(), CalendarEvent::GetCreatorGUID(), CalendarEvent::GetDungeonId(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), CalendarEvent::GetGuildId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetInviteId(), CalendarInvite::GetRank(), CalendarInvite::GetSenderGUID(), CalendarInvite::GetStatus(), CalendarEvent::GetTitle(), CalendarEvent::GetType(), CalendarEvent::IsGuildAnnouncement(), CalendarEvent::IsGuildEvent(), sGuildMgr, SMSG_CALENDAR_EVENT_INVITE_ALERT, and ObjectGuid::WriteAsPacked().

Referenced by AddInvite().

◆ SendCalendarEventInviteRemove()

void CalendarMgr::SendCalendarEventInviteRemove ( CalendarEvent const &  calendarEvent,
CalendarInvite const &  invite,
uint32  flags 
)
558{
560 data<< invite.GetInviteeGUID().WriteAsPacked();
561 data << uint64(invite.GetEventId());
562 data << uint32(flags);
563 data << uint8(1); // FIXME
564
565 SendPacketToAllEventRelatives(data, calendarEvent);
566}
@ SMSG_CALENDAR_EVENT_INVITE_REMOVED
Definition: Opcodes.h:1113

References CalendarInvite::GetEventId(), CalendarInvite::GetInviteeGUID(), SendPacketToAllEventRelatives(), SMSG_CALENDAR_EVENT_INVITE_REMOVED, and ObjectGuid::WriteAsPacked().

Referenced by RemoveInvite().

◆ SendCalendarEventInviteRemoveAlert()

void CalendarMgr::SendCalendarEventInviteRemoveAlert ( ObjectGuid  guid,
CalendarEvent const &  calendarEvent,
CalendarInviteStatus  status 
)
650{
652 {
654 data << uint64(calendarEvent.GetEventId());
655 data.AppendPackedTime(calendarEvent.GetEventTime());
656 data << uint32(calendarEvent.GetFlags());
657 data << uint8(status);
658
659 player->SendDirectMessage(&data);
660 }
661}
@ SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT
Definition: Opcodes.h:1119

References ByteBuffer::AppendPackedTime(), ObjectAccessor::FindConnectedPlayer(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), and SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT.

Referenced by RemoveInvite().

◆ SendCalendarEventModeratorStatusAlert()

void CalendarMgr::SendCalendarEventModeratorStatusAlert ( CalendarEvent const &  calendarEvent,
CalendarInvite const &  invite 
)
569{
571 data << invite.GetInviteeGUID().WriteAsPacked();
572 data << uint64(invite.GetEventId());
573 data << uint8(invite.GetRank());
574 data << uint8(1); // Unk boolean - Display to client?
575
576 SendPacketToAllEventRelatives(data, calendarEvent);
577}
@ SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT
Definition: Opcodes.h:1123

References CalendarInvite::GetEventId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetRank(), SendPacketToAllEventRelatives(), SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, and ObjectGuid::WriteAsPacked().

◆ SendCalendarEventRemovedAlert()

void CalendarMgr::SendCalendarEventRemovedAlert ( CalendarEvent const &  calendarEvent)
548{
550 data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING)
551 data << uint64(calendarEvent.GetEventId());
552 data.AppendPackedTime(calendarEvent.GetEventTime());
553
554 SendPacketToAllEventRelatives(data, calendarEvent);
555}
@ SMSG_CALENDAR_EVENT_REMOVED_ALERT
Definition: Opcodes.h:1121

References ByteBuffer::AppendPackedTime(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), SendPacketToAllEventRelatives(), and SMSG_CALENDAR_EVENT_REMOVED_ALERT.

Referenced by RemoveEvent().

◆ SendCalendarEventStatus()

void CalendarMgr::SendCalendarEventStatus ( CalendarEvent const &  calendarEvent,
CalendarInvite const &  invite 
)
534{
535 WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
536 data << invite.GetInviteeGUID().WriteAsPacked();
537 data << uint64(calendarEvent.GetEventId());
538 data.AppendPackedTime(calendarEvent.GetEventTime());
539 data << uint32(calendarEvent.GetFlags());
540 data << uint8(invite.GetStatus());
541 data << uint8(invite.GetRank());
542 data.AppendPackedTime(invite.GetStatusTime());
543
544 SendPacketToAllEventRelatives(data, calendarEvent);
545}
@ SMSG_CALENDAR_EVENT_STATUS
Definition: Opcodes.h:1114

References ByteBuffer::AppendPackedTime(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetRank(), CalendarInvite::GetStatus(), CalendarInvite::GetStatusTime(), SendPacketToAllEventRelatives(), SMSG_CALENDAR_EVENT_STATUS, and ObjectGuid::WriteAsPacked().

◆ SendCalendarEventUpdateAlert()

void CalendarMgr::SendCalendarEventUpdateAlert ( CalendarEvent const &  calendarEvent,
time_t  oldEventTime 
)
514{
515 WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
516 calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
517 data << uint8(1); // unk
518 data << uint64(calendarEvent.GetEventId());
519 data.AppendPackedTime(oldEventTime);
520 data << uint32(calendarEvent.GetFlags());
521 data.AppendPackedTime(calendarEvent.GetEventTime());
522 data << uint8(calendarEvent.GetType());
523 data << int32(calendarEvent.GetDungeonId());
524 data << calendarEvent.GetTitle();
525 data << calendarEvent.GetDescription();
526 data << uint8(CALENDAR_REPEAT_NEVER); // repeatable
528 data << uint32(0); // unk
529
530 SendPacketToAllEventRelatives(data, calendarEvent);
531}
@ SMSG_CALENDAR_EVENT_UPDATED_ALERT
Definition: Opcodes.h:1122

References ByteBuffer::AppendPackedTime(), CALENDAR_MAX_INVITES, CALENDAR_REPEAT_NEVER, CalendarEvent::GetDescription(), CalendarEvent::GetDungeonId(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), CalendarEvent::GetTitle(), CalendarEvent::GetType(), SendPacketToAllEventRelatives(), and SMSG_CALENDAR_EVENT_UPDATED_ALERT.

◆ SendPacketToAllEventRelatives()

void CalendarMgr::SendPacketToAllEventRelatives ( WorldPacket  packet,
CalendarEvent const &  calendarEvent 
)
698{
699 // Send packet to all guild members
700 if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
701 if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
702 guild->BroadcastPacket(&packet);
703
704 // Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
705 CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
706 for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
707 if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID()))
708 if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId())
709 player->SendDirectMessage(&packet);
710}

References _invites, ObjectAccessor::FindConnectedPlayer(), CalendarEvent::GetEventId(), CalendarEvent::GetGuildId(), CalendarEvent::IsGuildAnnouncement(), CalendarEvent::IsGuildEvent(), and sGuildMgr.

Referenced by SendCalendarEventInvite(), SendCalendarEventInviteRemove(), SendCalendarEventModeratorStatusAlert(), SendCalendarEventRemovedAlert(), SendCalendarEventStatus(), and SendCalendarEventUpdateAlert().

◆ UpdateEvent()

void CalendarMgr::UpdateEvent ( CalendarEvent calendarEvent)
248{
250 stmt->SetData(0, calendarEvent->GetEventId());
251 stmt->SetData(1, calendarEvent->GetCreatorGUID().GetCounter());
252 stmt->SetData(2, calendarEvent->GetTitle());
253 stmt->SetData(3, calendarEvent->GetDescription());
254 stmt->SetData(4, calendarEvent->GetType());
255 stmt->SetData(5, calendarEvent->GetDungeonId());
256 stmt->SetData(6, uint32(calendarEvent->GetEventTime()));
257 stmt->SetData(7, calendarEvent->GetFlags());
258 stmt->SetData(8, (int64)calendarEvent->GetTimeZoneTime()); // correct?
259 CharacterDatabase.Execute(stmt);
260}
std::int64_t int64
Definition: Define.h:103
@ CHAR_REP_CALENDAR_EVENT
Definition: CharacterDatabase.h:456
CalendarEventType GetType() const
Definition: CalendarMgr.h:238
time_t GetTimeZoneTime() const
Definition: CalendarMgr.h:250
int32 GetDungeonId() const
Definition: CalendarMgr.h:241
std::string GetTitle() const
Definition: CalendarMgr.h:232
time_t GetEventTime() const
Definition: CalendarMgr.h:244
std::string GetDescription() const
Definition: CalendarMgr.h:235

References CHAR_REP_CALENDAR_EVENT, CharacterDatabase, ObjectGuid::GetCounter(), CalendarEvent::GetCreatorGUID(), CalendarEvent::GetDescription(), CalendarEvent::GetDungeonId(), CalendarEvent::GetEventId(), CalendarEvent::GetEventTime(), CalendarEvent::GetFlags(), CalendarEvent::GetTimeZoneTime(), CalendarEvent::GetTitle(), CalendarEvent::GetType(), and PreparedStatementBase::SetData().

Referenced by AddEvent().

◆ UpdateInvite()

void CalendarMgr::UpdateInvite ( CalendarInvite invite,
CharacterDatabaseTransaction  trans = nullptr 
)
263{
265 stmt->SetData(0, invite->GetInviteId());
266 stmt->SetData(1, invite->GetEventId());
267 stmt->SetData(2, invite->GetInviteeGUID().GetCounter());
268 stmt->SetData(3, invite->GetSenderGUID().GetCounter());
269 stmt->SetData(4, invite->GetStatus());
270 stmt->SetData(5, uint32(invite->GetStatusTime()));
271 stmt->SetData(6, invite->GetRank());
272 stmt->SetData(7, invite->GetText());
273 CharacterDatabase.ExecuteOrAppend(trans, stmt);
274}
@ CHAR_REP_CALENDAR_INVITE
Definition: CharacterDatabase.h:458
ObjectGuid GetSenderGUID() const
Definition: CalendarMgr.h:166

References CHAR_REP_CALENDAR_INVITE, CharacterDatabase, ObjectGuid::GetCounter(), CalendarInvite::GetEventId(), CalendarInvite::GetInviteeGUID(), CalendarInvite::GetInviteId(), CalendarInvite::GetRank(), CalendarInvite::GetSenderGUID(), CalendarInvite::GetStatus(), CalendarInvite::GetStatusTime(), CalendarInvite::GetText(), and PreparedStatementBase::SetData().

Referenced by AddInvite().

Member Data Documentation

◆ _events

◆ _freeEventIds

std::deque<uint64> CalendarMgr::_freeEventIds
private

◆ _freeInviteIds

std::deque<uint64> CalendarMgr::_freeInviteIds
private

◆ _invites

◆ _maxEventId

uint64 CalendarMgr::_maxEventId
private

◆ _maxInviteId

uint64 CalendarMgr::_maxInviteId
private