Core/Calendar:

- Fix build
- Use enums where possible
- Renaming
This commit is contained in:
Nay
2012-02-25 04:00:32 +00:00
parent 28310f0938
commit d6c0a67a7c
7 changed files with 170 additions and 166 deletions
+3 -3
View File
@@ -40,8 +40,8 @@ void CalendarInvite::Init()
_invitee = 0; _invitee = 0;
_senderGUID = 0; _senderGUID = 0;
_statusTime = 0; _statusTime = 0;
_status = 0; _status = CALENDAR_STATUS_INVITED; // default (0)?
_rank = 0; _rank = CALENDAR_RANK_PLAYER;
_text = ""; _text = "";
} }
@@ -74,7 +74,7 @@ void CalendarEvent::Init()
_dungeonId = -1; _dungeonId = -1;
_maxInvites = 0; _maxInvites = 0;
_eventTime = 0; _eventTime = 0;
_flags = 0; _flags = (CalendarFlags) 0;
_repeatable = false; _repeatable = false;
_timezoneTime = 0; _timezoneTime = 0;
_title = ""; _title = "";
+21 -79
View File
@@ -20,67 +20,9 @@
#define TRINITY_CALENDAR_H #define TRINITY_CALENDAR_H
#include "Errors.h" #include "Errors.h"
#include "SharedDefines.h"
#include <map> #include <map>
enum CalendarFlags
{
CALENDAR_FLAG_ALL_ALLOWED = 0x001,
CALENDAR_FLAG_INVITES_LOCKED = 0x010,
CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
CALENDAR_FLAG_GUILD_ONLY = 0x400,
};
enum CalendarActionData
{
CALENDAR_ACTION_NONE,
CALENDAR_ACTION_ADD_EVENT,
CALENDAR_ACTION_MODIFY_EVENT,
CALENDAR_ACTION_REMOVE_EVENT,
CALENDAR_ACTION_COPY_EVENT,
CALENDAR_ACTION_ADD_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE,
CALENDAR_ACTION_REMOVE_EVENT_INVITE,
CALENDAR_ACTION_SIGNUP_TO_EVENT,
};
enum CalendarRanks
{
CALENDAR_RANK_PLAYER,
CALENDAR_RANK_MODERATOR,
CALENDAR_RANK_OWNER,
};
enum CalendarSendEventType
{
CALENDAR_SENDTYPE_GET,
CALENDAR_SENDTYPE_ADD,
CALENDAR_SENDTYPE_COPY,
};
enum CalendarEventType
{
CALENDAR_TYPE_RAID,
CALENDAR_TYPE_DUNGEON,
CALENDAR_TYPE_PVP,
CALENDAR_TYPE_MEETING,
CALENDAR_TYPE_OTHER,
};
enum CalendarInviteStatus
{
CALENDAR_STATUS_INVITED,
CALENDAR_STATUS_ACCEPTED,
CALENDAR_STATUS_DECLINED,
CALENDAR_STATUS_TENTATIVE,
CALENDAR_STATUS_OUT,
CALENDAR_STATUS_STANDBY,
CALENDAR_STATUS_CONFIRMED,
CALENDAR_STATUS_NO_OWNER,
CALENDAR_STATUS_8,
CALENDAR_STATUS_9,
};
class CalendarInvite class CalendarInvite
{ {
public: public:
@@ -107,11 +49,11 @@ class CalendarInvite
void SetText(std::string text) { _text = text; } void SetText(std::string text) { _text = text; }
std::string GetText() const { return _text; } std::string GetText() const { return _text; }
void SetStatus(uint8 status) { _status = status; } void SetStatus(CalendarInviteStatus status) { _status = status; }
uint8 GetStatus() const { return _status; } CalendarInviteStatus GetStatus() const { return _status; }
void SetRank(uint8 rank) { _rank = rank; } void SetRank(CalendarModerationRank rank) { _rank = rank; }
uint8 GetRank() const { return _rank; } CalendarModerationRank GetRank() const { return _rank; }
std::string GetDebugString() const; std::string GetDebugString() const;
@@ -123,12 +65,12 @@ class CalendarInvite
uint64 _invitee; uint64 _invitee;
uint64 _senderGUID; uint64 _senderGUID;
uint32 _statusTime; uint32 _statusTime;
uint8 _status; CalendarInviteStatus _status;
uint8 _rank; CalendarModerationRank _rank;
std::string _text; std::string _text;
}; };
typedef std::set<uint64> CalendarinviteIdList; typedef std::set<uint64> CalendarInviteIdList;
class CalendarEvent class CalendarEvent
{ {
@@ -153,8 +95,8 @@ class CalendarEvent
void SetDescription(std::string description) { _description = description; } void SetDescription(std::string description) { _description = description; }
std::string GetDescription() const { return _description; } std::string GetDescription() const { return _description; }
void SetType(uint8 type) { _type = type; } void SetType(CalendarEventType type) { _type = type; }
uint8 GetType() const { return _type; } CalendarEventType GetType() const { return _type; }
void SetMaxInvites(uint32 limit) { _maxInvites = limit; } void SetMaxInvites(uint32 limit) { _maxInvites = limit; }
uint32 GetMaxInvites() const { return _maxInvites; } uint32 GetMaxInvites() const { return _maxInvites; }
@@ -165,11 +107,11 @@ class CalendarEvent
void SetTime(uint32 eventTime) { _eventTime = eventTime; } void SetTime(uint32 eventTime) { _eventTime = eventTime; }
uint32 GetTime() const { return _eventTime; } uint32 GetTime() const { return _eventTime; }
void SetFlags(uint32 flags) { _flags = flags; } void SetFlags(CalendarFlags flags) { _flags = flags; }
uint32 GetFlags() const { return _flags; } CalendarFlags GetFlags() const { return _flags; }
void SetRepeatable(bool repeatable) { _repeatable = repeatable; } void SetRepeatable(bool repeatable) { _repeatable = repeatable; }
uint8 GetRepeatable() const { return _repeatable; } bool GetRepeatable() const { return _repeatable; }
void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; } void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; }
uint32 GetTimeZoneTime() const { return _timezoneTime; } uint32 GetTimeZoneTime() const { return _timezoneTime; }
@@ -182,8 +124,8 @@ class CalendarEvent
void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); } void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); }
bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); } bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); }
CalendarinviteIdList const& GetInviteIdList() const { return _invites; } CalendarInviteIdList const& GetInviteIdList() const { return _invites; }
void SetInviteIdList(CalendarinviteIdList const& list) { _invites = list; } void SetInviteIdList(CalendarInviteIdList const& list) { _invites = list; }
void ClearInviteIdList() { _invites.clear(); } void ClearInviteIdList() { _invites.clear(); }
std::string GetDebugString() const; std::string GetDebugString() const;
@@ -194,20 +136,20 @@ class CalendarEvent
uint64 _eventId; uint64 _eventId;
uint64 _creatorGUID; uint64 _creatorGUID;
uint32 _guildId; uint32 _guildId;
uint8 _type; CalendarEventType _type;
int32 _dungeonId; int32 _dungeonId;
uint32 _maxInvites; uint32 _maxInvites;
uint32 _eventTime; uint32 _eventTime;
uint32 _flags; CalendarFlags _flags;
uint8 _repeatable; bool _repeatable;
uint32 _timezoneTime; uint32 _timezoneTime;
std::string _title; std::string _title;
std::string _description; std::string _description;
CalendarinviteIdList _invites; CalendarInviteIdList _invites;
}; };
typedef std::set<uint64> CalendarEventIdList; typedef std::set<uint64> CalendarEventIdList;
typedef std::map<uint64, CalendarinviteIdList> CalendarPlayerinviteIdMap; typedef std::map<uint64, CalendarInviteIdList> CalendarPlayerInviteIdMap;
typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap; typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap;
typedef std::map<uint64, CalendarInvite> CalendarInviteMap; typedef std::map<uint64, CalendarInvite> CalendarInviteMap;
typedef std::map<uint64, CalendarEvent> CalendarEventMap; typedef std::map<uint64, CalendarEvent> CalendarEventMap;
@@ -216,7 +158,7 @@ class Player;
struct CalendarAction struct CalendarAction
{ {
CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _guid(0), _inviteId(0), _data(0) CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _inviteId(0), _data(0)
{ {
} }
+15 -15
View File
@@ -67,12 +67,12 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
if (!guid) if (!guid)
return 0; return 0;
CalendarPlayerinviteIdMap::const_iterator itr = _playerInvites.find(guid); CalendarPlayerInviteIdMap::const_iterator itr = _playerInvites.find(guid);
if (itr == _playerInvites.end()) if (itr == _playerInvites.end())
return 0; return 0;
uint32 pendingNum = 0; uint32 pendingNum = 0;
for (CalendarinviteIdList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) for (CalendarInviteIdList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
if (CalendarInvite* invite = GetInvite(*it)) if (CalendarInvite* invite = GetInvite(*it))
if (invite->GetRank() != CALENDAR_RANK_OWNER if (invite->GetRank() != CALENDAR_RANK_OWNER
&& invite->GetStatus() != CALENDAR_STATUS_CONFIRMED && invite->GetStatus() != CALENDAR_STATUS_CONFIRMED
@@ -83,7 +83,7 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
return pendingNum; return pendingNum;
} }
CalendarinviteIdList const& CalendarMgr::GetPlayerInvites(uint64 guid) CalendarInviteIdList const& CalendarMgr::GetPlayerInvites(uint64 guid)
{ {
return _playerInvites[guid]; return _playerInvites[guid];
} }
@@ -180,7 +180,7 @@ void CalendarMgr::LoadFromDB()
*/ */
} }
CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarRanks minRank) CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank)
{ {
if (!player) if (!player)
return NULL; // CALENDAR_ERROR_INTERNAL return NULL; // CALENDAR_ERROR_INTERNAL
@@ -251,8 +251,8 @@ void CalendarMgr::AddAction(CalendarAction const& action)
calendarEvent->SetDescription(action.Event.GetDescription()); calendarEvent->SetDescription(action.Event.GetDescription());
calendarEvent->SetMaxInvites(action.Event.GetMaxInvites()); calendarEvent->SetMaxInvites(action.Event.GetMaxInvites());
CalendarinviteIdList const& invites = calendarEvent->GetInviteIdList(); CalendarInviteIdList const& invites = calendarEvent->GetInviteIdList();
for (CalendarinviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (CalendarInvite* invite = GetInvite(*itr)) if (CalendarInvite* invite = GetInvite(*itr))
SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD); SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD);
@@ -279,8 +279,8 @@ void CalendarMgr::AddAction(CalendarAction const& action)
newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID()); newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID());
newEvent.SetGuildId(calendarEvent->GetGuildId()); newEvent.SetGuildId(calendarEvent->GetGuildId());
CalendarinviteIdList const invites = calendarEvent->GetInviteIdList(); CalendarInviteIdList const invites = calendarEvent->GetInviteIdList();
for (CalendarinviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{ {
if (CalendarInvite* invite = GetInvite(*itr)) if (CalendarInvite* invite = GetInvite(*itr))
{ {
@@ -316,8 +316,8 @@ void CalendarMgr::AddAction(CalendarAction const& action)
if (!calendarEvent) if (!calendarEvent)
return; return;
CalendarinviteIdList const& inviteIds = calendarEvent->GetInviteIdList(); CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList();
for (CalendarinviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it) for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it)
if (uint64 invitee = RemoveInvite(*it)) if (uint64 invitee = RemoveInvite(*it))
SendCalendarEventRemovedAlert(invitee, *calendarEvent); SendCalendarEventRemovedAlert(invitee, *calendarEvent);
@@ -351,7 +351,7 @@ void CalendarMgr::AddAction(CalendarAction const& action)
|| !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData()) || !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData())
return; return;
uint8 status = action.Invite.GetStatus(); CalendarInviteStatus status = action.Invite.GetStatus();
if (status == CALENDAR_STATUS_INVITED) if (status == CALENDAR_STATUS_INVITED)
status = CALENDAR_STATUS_CONFIRMED; status = CALENDAR_STATUS_CONFIRMED;
@@ -465,8 +465,8 @@ bool CalendarMgr::RemoveEvent(uint64 eventId)
bool val = true; bool val = true;
CalendarinviteIdList const& invites = itr->second.GetInviteIdList(); CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
for (CalendarinviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{ {
CalendarInvite* invite = GetInvite(*itr); CalendarInvite* invite = GetInvite(*itr);
if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId)) if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
@@ -573,13 +573,13 @@ void CalendarMgr::SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const
player->GetSession()->SendCalendarEventRemovedAlert(calendarEvent); player->GetSession()->SendCalendarEventRemovedAlert(calendarEvent);
} }
void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, uint8 status) void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{ {
if (Player* player = ObjectAccessor::FindPlayer(guid)) if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventInviteRemoveAlert(calendarEvent, status); player->GetSession()->SendCalendarEventInviteRemoveAlert(calendarEvent, status);
} }
void CalendarMgr::SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags) void CalendarMgr::SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, CalendarFlags flags)
{ {
if (Player* player = ObjectAccessor::FindPlayer(guid)) if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventInviteRemove(invite, flags); player->GetSession()->SendCalendarEventInviteRemove(invite, flags);
+5 -5
View File
@@ -34,7 +34,7 @@ class CalendarMgr
CalendarInvite* GetInvite(uint64 inviteId); CalendarInvite* GetInvite(uint64 inviteId);
CalendarEvent* GetEvent(uint64 eventId); CalendarEvent* GetEvent(uint64 eventId);
CalendarinviteIdList const& GetPlayerInvites(uint64 guid); CalendarInviteIdList const& GetPlayerInvites(uint64 guid);
CalendarEventIdList const& GetPlayerEvents(uint64 guid); CalendarEventIdList const& GetPlayerEvents(uint64 guid);
uint32 GetPlayerNumPending(uint64 guid); uint32 GetPlayerNumPending(uint64 guid);
@@ -46,15 +46,15 @@ class CalendarMgr
void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type); void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type);
void SendCalendarEventInvite(CalendarInvite const& invite, bool pending); void SendCalendarEventInvite(CalendarInvite const& invite, bool pending);
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags); void SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, CalendarFlags flags);
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, uint8 status); void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type); void SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type);
void SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent); void SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent);
void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite); void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite);
private: private:
CalendarEvent* CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarRanks minRank); CalendarEvent* CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank);
bool AddEvent(CalendarEvent const& calendarEvent); bool AddEvent(CalendarEvent const& calendarEvent);
bool RemoveEvent(uint64 eventId); bool RemoveEvent(uint64 eventId);
@@ -68,7 +68,7 @@ class CalendarMgr
CalendarEventMap _events; CalendarEventMap _events;
CalendarInviteMap _invites; CalendarInviteMap _invites;
CalendarPlayerinviteIdMap _playerInvites; CalendarPlayerInviteIdMap _playerInvites;
CalendarPlayerEventIdMap _playerEvents; CalendarPlayerEventIdMap _playerEvents;
uint64 _eventNum; uint64 _eventNum;
+21 -22
View File
@@ -21,7 +21,6 @@
SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction() SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction()
SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaildLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaildLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED
SMSG_CALENDAR_COMMAND_RESULT SendCalendarCommandResult(uint32 value) <--- Structure meanings not known using in a Hack way
----- Opcodes without Sniffs ----- ----- Opcodes without Sniffs -----
SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ] SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ]
@@ -56,9 +55,9 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Impossible to get the correct size without doing a double iteration of some elements WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Impossible to get the correct size without doing a double iteration of some elements
CalendarinviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid); CalendarInviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size()); data << uint32(invites.size());
for (CalendarinviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it) for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
{ {
CalendarInvite* invite = sCalendarMgr->GetInvite(*it); CalendarInvite* invite = sCalendarMgr->GetInvite(*it);
CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL; CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL;
@@ -261,8 +260,8 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
action.SetPlayer(_player); action.SetPlayer(_player);
action.Event.SetEventId(sCalendarMgr->GetFreeEventId()); action.Event.SetEventId(sCalendarMgr->GetFreeEventId());
action.Event.SetCreatorGUID(guid); action.Event.SetCreatorGUID(guid);
action.Event.SetType(type); action.Event.SetType((CalendarEventType) type);
action.Event.SetFlags(flags); action.Event.SetFlags((CalendarFlags) flags);
action.Event.SetTime(eventPackedTime); action.Event.SetTime(eventPackedTime);
action.Event.SetTimeZoneTime(unkPackedTime); action.Event.SetTimeZoneTime(unkPackedTime);
action.Event.SetRepeatable(repeatable); action.Event.SetRepeatable(repeatable);
@@ -275,8 +274,8 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
action.Invite.SetEventId(action.Event.GetEventId()); action.Invite.SetEventId(action.Event.GetEventId());
action.Invite.SetInviteId(inviteId); action.Invite.SetInviteId(inviteId);
action.Invite.SetInvitee(invitee); action.Invite.SetInvitee(invitee);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
action.Invite.SetRank(rank); action.Invite.SetRank((CalendarModerationRank) rank);
action.Invite.SetSenderGUID(guid); action.Invite.SetSenderGUID(guid);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
@@ -313,8 +312,8 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
action.SetPlayer(_player); action.SetPlayer(_player);
action.SetInviteId(inviteId); action.SetInviteId(inviteId);
action.Event.SetEventId(eventId); action.Event.SetEventId(eventId);
action.Event.SetType(type); action.Event.SetType((CalendarEventType) type);
action.Event.SetFlags(flags); action.Event.SetFlags((CalendarFlags) flags);
action.Event.SetTime(eventPackedTime); action.Event.SetTime(eventPackedTime);
action.Event.SetTimeZoneTime(timeZoneTime); action.Event.SetTimeZoneTime(timeZoneTime);
action.Event.SetRepeatable(repeatable); action.Event.SetRepeatable(repeatable);
@@ -342,7 +341,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
action.SetPlayer(_player); action.SetPlayer(_player);
action.SetInviteId(inviteId); action.SetInviteId(inviteId);
action.Event.SetEventId(eventId); action.Event.SetEventId(eventId);
action.Event.SetFlags(flags); action.Event.SetFlags((CalendarFlags) flags);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -423,8 +422,8 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
action.Invite.SetInviteId(sCalendarMgr->GetFreeInviteId()); action.Invite.SetInviteId(sCalendarMgr->GetFreeInviteId());
action.Invite.SetSenderGUID(_player->GetGUID()); action.Invite.SetSenderGUID(_player->GetGUID());
action.Invite.SetInvitee(invitee); action.Invite.SetInvitee(invitee);
action.Invite.SetRank(rank); action.Invite.SetRank((CalendarModerationRank) rank);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -444,7 +443,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recv_data)
action.SetPlayer(_player); action.SetPlayer(_player);
action.SetExtraData(GetPlayer()->GetGuildId()); action.SetExtraData(GetPlayer()->GetGuildId());
action.Event.SetEventId(eventId); action.Event.SetEventId(eventId);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -466,7 +465,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
action.SetInviteId(inviteId); action.SetInviteId(inviteId);
action.Invite.SetInviteId(inviteId); action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId); action.Invite.SetEventId(eventId);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -520,7 +519,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
action.Invite.SetInviteId(inviteId); action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId); action.Invite.SetEventId(eventId);
action.Invite.SetInvitee(invitee); action.Invite.SetInvitee(invitee);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -547,7 +546,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
action.Invite.SetInviteId(inviteId); action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId); action.Invite.SetEventId(eventId);
action.Invite.SetInvitee(invitee); action.Invite.SetInvitee(invitee);
action.Invite.SetStatus(status); action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action); sCalendarMgr->AddAction(action);
} }
@@ -578,7 +577,7 @@ void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recv_data*/)
// ----------------------------------- SEND ------------------------------------ // ----------------------------------- SEND ------------------------------------
void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, uint8 sendEventType) void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
{ {
uint64 guid = _player->GetGUID(); uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId(); uint64 eventId = calendarEvent.GetEventId();
@@ -601,9 +600,9 @@ void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, uint8 s
data << uint32(calendarEvent.GetTimeZoneTime()); data << uint32(calendarEvent.GetTimeZoneTime());
data << uint32(calendarEvent.GetGuildId()); data << uint32(calendarEvent.GetGuildId());
CalendarinviteIdList const& invites = calendarEvent.GetInviteIdList(); CalendarInviteIdList const& invites = calendarEvent.GetInviteIdList();
data << uint32(invites.size()); data << uint32(invites.size());
for (CalendarinviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it) for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
{ {
if (CalendarInvite* invite = sCalendarMgr->GetInvite(*it)) if (CalendarInvite* invite = sCalendarMgr->GetInvite(*it))
{ {
@@ -687,7 +686,7 @@ void WorldSession::SendCalendarEventInviteAlert(CalendarEvent const& calendarEve
SendPacket(&data); SendPacket(&data);
} }
void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, uint8 sendEventType) void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
{ {
uint64 guid = _player->GetGUID(); uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId(); uint64 eventId = calendarEvent.GetEventId();
@@ -780,7 +779,7 @@ void WorldSession::SendCalendarEventModeratorStatusAlert(CalendarInvite const& i
SendPacket(&data); SendPacket(&data);
} }
void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, uint8 status) void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{ {
uint64 guid = _player->GetGUID(); uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId(); uint64 eventId = calendarEvent.GetEventId();
@@ -799,7 +798,7 @@ void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calen
SendPacket(&data); SendPacket(&data);
} }
void WorldSession::SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags) void WorldSession::SendCalendarEventInviteRemove(CalendarInvite const& invite, CalendarFlags flags)
{ {
uint64 guid = _player->GetGUID(); uint64 guid = _player->GetGUID();
uint64 eventId = invite.GetEventId(); uint64 eventId = invite.GetEventId();
@@ -3422,4 +3422,105 @@ enum ActivateTaxiReply
ERR_TAXINOTSTANDING = 12 ERR_TAXINOTSTANDING = 12
}; };
// Calendar - start
enum CalendarFlags
{
CALENDAR_FLAG_ALL_ALLOWED = 0x001,
CALENDAR_FLAG_INVITES_LOCKED = 0x010,
CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
CALENDAR_FLAG_GUILD_ONLY = 0x400,
};
enum CalendarActionData
{
CALENDAR_ACTION_NONE,
CALENDAR_ACTION_ADD_EVENT,
CALENDAR_ACTION_MODIFY_EVENT,
CALENDAR_ACTION_REMOVE_EVENT,
CALENDAR_ACTION_COPY_EVENT,
CALENDAR_ACTION_ADD_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE,
CALENDAR_ACTION_REMOVE_EVENT_INVITE,
CALENDAR_ACTION_SIGNUP_TO_EVENT,
};
enum CalendarModerationRank
{
CALENDAR_RANK_PLAYER,
CALENDAR_RANK_MODERATOR,
CALENDAR_RANK_OWNER,
};
enum CalendarSendEventType
{
CALENDAR_SENDTYPE_GET,
CALENDAR_SENDTYPE_ADD,
CALENDAR_SENDTYPE_COPY,
};
enum CalendarEventType
{
CALENDAR_TYPE_RAID,
CALENDAR_TYPE_DUNGEON,
CALENDAR_TYPE_PVP,
CALENDAR_TYPE_MEETING,
CALENDAR_TYPE_OTHER,
};
enum CalendarInviteStatus
{
CALENDAR_STATUS_INVITED,
CALENDAR_STATUS_ACCEPTED,
CALENDAR_STATUS_DECLINED,
CALENDAR_STATUS_TENTATIVE,
CALENDAR_STATUS_OUT,
CALENDAR_STATUS_STANDBY,
CALENDAR_STATUS_CONFIRMED,
CALENDAR_STATUS_NO_OWNER,
CALENDAR_STATUS_8,
CALENDAR_STATUS_9,
};
enum CalendarError
{
CALENDAR_OK = 0,
CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4,
CALENDAR_ERROR_PERMISSIONS = 5,
CALENDAR_ERROR_EVENT_INVALID = 6,
CALENDAR_ERROR_NOT_INVITED = 7,
CALENDAR_ERROR_INTERNAL = 8,
CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
CALENDAR_ERROR_NOT_ALLIED = 12,
CALENDAR_ERROR_IGNORING_YOU_S = 13,
CALENDAR_ERROR_INVITES_EXCEEDED = 14,
CALENDAR_ERROR_INVALID_DATE = 16,
CALENDAR_ERROR_INVALID_TIME = 17,
CALENDAR_ERROR_NEEDS_TITLE = 19,
CALENDAR_ERROR_EVENT_PASSED = 20,
CALENDAR_ERROR_EVENT_LOCKED = 21,
CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
CALENDAR_ERROR_SYSTEM_DISABLED = 24,
CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
CALENDAR_ERROR_USER_SQUELCHED = 28,
CALENDAR_ERROR_NO_INVITE = 29,
CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
CALENDAR_ERROR_NO_GUILD_INVITES = 38,
CALENDAR_ERROR_INVALID_SIGNUP = 39,
CALENDAR_ERROR_NO_MODERATOR = 40
};
// Calendar - end
#endif #endif
+4 -42
View File
@@ -141,44 +141,6 @@ enum CharterTypes
ARENA_TEAM_CHARTER_5v5_TYPE = 5 ARENA_TEAM_CHARTER_5v5_TYPE = 5
}; };
enum CalendarError
{
CALENDAR_OK = 0,
CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4,
CALENDAR_ERROR_PERMISSIONS = 5,
CALENDAR_ERROR_EVENT_INVALID = 6,
CALENDAR_ERROR_NOT_INVITED = 7,
CALENDAR_ERROR_INTERNAL = 8,
CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
CALENDAR_ERROR_NOT_ALLIED = 12,
CALENDAR_ERROR_IGNORING_YOU_S = 13,
CALENDAR_ERROR_INVITES_EXCEEDED = 14,
CALENDAR_ERROR_INVALID_DATE = 16,
CALENDAR_ERROR_INVALID_TIME = 17,
CALENDAR_ERROR_NEEDS_TITLE = 19,
CALENDAR_ERROR_EVENT_PASSED = 20,
CALENDAR_ERROR_EVENT_LOCKED = 21,
CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
CALENDAR_ERROR_SYSTEM_DISABLED = 24,
CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
CALENDAR_ERROR_USER_SQUELCHED = 28,
CALENDAR_ERROR_NO_INVITE = 29,
CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
CALENDAR_ERROR_NO_GUILD_INVITES = 38,
CALENDAR_ERROR_INVALID_SIGNUP = 39,
CALENDAR_ERROR_NO_MODERATOR = 40
};
//class to deal with packet processing //class to deal with packet processing
//allows to determine if next packet is safe to be processed //allows to determine if next packet is safe to be processed
class PacketFilter class PacketFilter
@@ -920,13 +882,13 @@ class WorldSession
void HandleCalendarGetNumPending(WorldPacket& recv_data); void HandleCalendarGetNumPending(WorldPacket& recv_data);
void HandleCalendarEventSignup(WorldPacket& recv_data); void HandleCalendarEventSignup(WorldPacket& recv_data);
void SendCalendarEvent(CalendarEvent const& calendarEvent, uint8 sendEventType); void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType);
void SendCalendarEventInvite(CalendarInvite const& invite, bool pending); void SendCalendarEventInvite(CalendarInvite const& invite, bool pending);
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& calendarInvite); void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& calendarInvite);
void SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags); void SendCalendarEventInviteRemove(CalendarInvite const& invite, CalendarFlags flags);
void SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, uint8 status); void SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent); void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, uint8 sendEventType); void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType);
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite); void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite);
void SendCalendarClearPendingAction(); void SendCalendarClearPendingAction();