blob: a2d2dc2ffb7ecc7b29f66416d50176102b625e52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_CALENDAR_H
#define TRINITY_CALENDAR_H
#include "Errors.h"
#include "SharedDefines.h"
#include <map>
class CalendarInvite
{
public:
CalendarInvite() : _inviteId(0) { Init(); }
explicit CalendarInvite(uint64 inviteId) : _inviteId(inviteId) { Init(); }
~CalendarInvite() { }
void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
uint64 GetInviteId() const { return _inviteId; }
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
uint64 GetSenderGUID() const { return _senderGUID; }
void SetInvitee(uint64 guid) { _invitee = guid; }
uint64 GetInvitee() const { return _invitee; }
void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; }
uint32 GetStatusTime() const { return _statusTime; }
void SetText(std::string text) { _text = text; }
std::string GetText() const { return _text; }
void SetStatus(CalendarInviteStatus status) { _status = status; }
CalendarInviteStatus GetStatus() const { return _status; }
void SetRank(CalendarModerationRank rank) { _rank = rank; }
CalendarModerationRank GetRank() const { return _rank; }
std::string GetDebugString() const;
private:
void Init();
uint64 _inviteId;
uint64 _eventId;
uint64 _invitee;
uint64 _senderGUID;
uint32 _statusTime;
CalendarInviteStatus _status;
CalendarModerationRank _rank;
std::string _text;
};
typedef std::set<uint64> CalendarInviteIdList;
class CalendarEvent
{
public:
CalendarEvent() : _eventId(0) { Init(); }
explicit CalendarEvent(uint64 eventId) : _eventId(eventId) { Init(); }
~CalendarEvent() { }
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
uint64 GetCreatorGUID() const { return _creatorGUID; }
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
void SetTitle(std::string title) { _title = title; }
std::string GetTitle() const { return _title; }
void SetDescription(std::string description) { _description = description; }
std::string GetDescription() const { return _description; }
void SetType(CalendarEventType type) { _type = type; }
CalendarEventType GetType() const { return _type; }
void SetMaxInvites(uint32 limit) { _maxInvites = limit; }
uint32 GetMaxInvites() const { return _maxInvites; }
void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
int32 GetDungeonId() const { return _dungeonId; }
void SetTime(uint32 eventTime) { _eventTime = eventTime; }
uint32 GetTime() const { return _eventTime; }
void SetFlags(uint32 flags) { _flags = flags; }
uint32 GetFlags() const { return _flags; }
void SetRepeatable(bool repeatable) { _repeatable = repeatable; }
bool GetRepeatable() const { return _repeatable; }
void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; }
uint32 GetTimeZoneTime() const { return _timezoneTime; }
void AddInvite(uint64 inviteId)
{
if (inviteId)
_invites.insert(inviteId);
}
void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); }
bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); }
CalendarInviteIdList const& GetInviteIdList() const { return _invites; }
void SetInviteIdList(CalendarInviteIdList const& list) { _invites = list; }
void ClearInviteIdList() { _invites.clear(); }
std::string GetDebugString() const;
private:
void Init();
uint64 _eventId;
uint64 _creatorGUID;
uint32 _guildId;
CalendarEventType _type;
int32 _dungeonId;
uint32 _maxInvites;
uint32 _eventTime;
uint32 _flags;
bool _repeatable;
uint32 _timezoneTime;
std::string _title;
std::string _description;
CalendarInviteIdList _invites;
};
typedef std::set<uint64> CalendarEventIdList;
typedef std::map<uint64, CalendarInviteIdList> CalendarPlayerInviteIdMap;
typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap;
typedef std::map<uint64, CalendarInvite> CalendarInviteMap;
typedef std::map<uint64, CalendarEvent> CalendarEventMap;
class Player;
struct CalendarAction
{
CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _inviteId(0), _data(0)
{
}
void SetAction(CalendarActionData data) { _action = data; }
CalendarActionData GetAction() const { return _action; }
void SetPlayer(Player* player) { ASSERT(player); _player = player; }
Player* GetPlayer() const { return _player; }
void SetInviteId(uint64 id) { _inviteId = id; }
uint64 GetInviteId() const { return _inviteId; }
void SetExtraData(uint32 data) { _data = data; }
uint32 GetExtraData() const { return _data; }
CalendarEvent Event;
CalendarInvite Invite;
std::string GetDebugString() const;
private:
CalendarActionData _action;
Player* _player;
uint64 _inviteId;
uint32 _data;
};
#endif
|