TrinityCore
Loading...
Searching...
No Matches
SupportMgr.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef SupportMgr_h__
19#define SupportMgr_h__
20
21#include "TicketPackets.h"
22#include <map>
23
24class ChatHandler;
25class Field;
26class Player;
27
28enum class ReportType : int32
29{
30 Chat = 0,
31 InWorld = 1,
36 ClubMember = 6,
37 GroupMember = 7,
38 Friend = 8,
39 Pet = 9,
40 BattlePet = 10,
41 Calendar = 11,
42 Mail = 12,
43 PvP = 13,
44 PvPScoreboard = 14,
45 PvPGroupMember = 15,
46 CraftingOrder = 16,
47 RecentAlly = 17
48};
49
57
59{
60 TextChat = 0x00000001,
61 Boosting = 0x00000002,
62 Spam = 0x00000004,
63 Afk = 0x00000008,
64 IntentionallyFeeding = 0x00000010,
65 BlockingProgress = 0x00000020,
66 Hacking = 0x00000040,
67 Botting = 0x00000080,
68 Advertisement = 0x00000100,
69 BTag = 0x00000200,
70 GroupName = 0x00000400,
71 CharacterName = 0x00000800,
72 GuildName = 0x00001000,
73 Description = 0x00002000,
74 Name = 0x00004000,
75 ChinaHarmfulMinors = 0x00008000,
76 Disruption = 0x00010000,
79};
80
81// from blizzard lua
87
94
96
98{
99public:
100 Ticket();
101 Ticket(Player* player);
102 Ticket(Ticket const&) = delete;
103 Ticket(Ticket&&) = delete;
104 Ticket& operator=(Ticket const&) = delete;
105 Ticket& operator=(Ticket&&) = delete;
106 virtual ~Ticket();
107
108 bool IsClosed() const { return !_closedBy.IsEmpty(); }
109 bool IsFromPlayer(ObjectGuid guid) const { return guid == _playerGuid; }
110 bool IsAssigned() const { return !_assignedTo.IsEmpty(); }
111 bool IsAssignedTo(ObjectGuid guid) const { return guid == _assignedTo; }
112 bool IsAssignedNotTo(ObjectGuid guid) const { return IsAssigned() && !IsAssignedTo(guid); }
113
114 uint32 GetId() const { return _id; }
115 ObjectGuid GetPlayerGuid() const { return _playerGuid; }
116 Player* GetPlayer() const;
117 std::string GetPlayerName() const;
118 Player* GetAssignedPlayer() const;
119 ObjectGuid GetAssignedToGUID() const { return _assignedTo; }
120 std::string GetAssignedToName() const;
121 std::string const& GetComment() const { return _comment; }
122
123 virtual void SetAssignedTo(ObjectGuid guid, bool /*isAdmin*/ = false) { _assignedTo = guid; }
124 virtual void SetUnassigned() { _assignedTo.Clear(); }
125 void SetClosedBy(ObjectGuid value) { _closedBy = value; }
126 void SetComment(std::string const& comment) { _comment = comment; }
127 void SetPosition(uint32 mapId, Position const& pos)
128 {
129 _mapId = mapId;
130 _pos = pos;
131 }
132 void SetFacing(float facing) { _pos.SetOrientation(facing); }
133
134 virtual void LoadFromDB(Field* fields) = 0;
135 virtual void SaveToDB() const = 0;
136 virtual void DeleteFromDB() = 0;
137
138 void TeleportTo(Player* player) const;
139
140 virtual std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const = 0;
141 virtual std::string FormatViewMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const;
142
143protected:
149 ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it.
151 std::string _comment;
152};
153
155{
156public:
157 BugTicket();
158 BugTicket(Player* player);
159 ~BugTicket();
160
161 std::string const& GetNote() const { return _note; }
162
163 void SetNote(std::string const& note) { _note = note; }
164
165 void LoadFromDB(Field* fields) override;
166 void SaveToDB() const override;
167 void DeleteFromDB() override;
168
170 std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
171
172private:
173 std::string _note;
174};
175
177{
178public:
180 ComplaintTicket(Player* player);
182
183 ObjectGuid GetTargetCharacterGuid() const { return _targetCharacterGuid; }
184 ReportType GetReportType() const { return _reportType; }
185 ReportMajorCategory GetMajorCategory() const { return _majorCategory; }
186 ReportMinorCategory GetMinorCategoryFlags() const { return _minorCategoryFlags; }
187 std::string const& GetNote() const { return _note; }
188
189 void SetTargetCharacterGuid(ObjectGuid targetCharacterGuid)
190 {
191 _targetCharacterGuid = targetCharacterGuid;
192 }
193 void SetReportType(ReportType reportType) { _reportType = reportType; }
194 void SetMajorCategory(ReportMajorCategory majorCategory) { _majorCategory = majorCategory; }
195 void SetMinorCategoryFlags(ReportMinorCategory minorCategoryFlags) { _minorCategoryFlags = minorCategoryFlags; }
196 void SetChatLog(ChatLog const& log) { _chatLog = log; }
197 void SetNote(std::string const& note) { _note = note; }
198
199 void LoadFromDB(Field* fields) override;
200 void LoadChatLineFromDB(Field* fields);
201 void SaveToDB() const override;
202 void DeleteFromDB() override;
203
205 std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
206
207private:
213 std::string _note;
214};
215
217{
218public:
220 SuggestionTicket(Player* player);
222
223 std::string const& GetNote() const { return _note; }
224 void SetNote(std::string const& note) { _note = note; }
225
226 void LoadFromDB(Field* fields) override;
227 void SaveToDB() const override;
228 void DeleteFromDB() override;
229
231 std::string FormatViewMessageString(ChatHandler& handler, bool detailed = false) const override;
232
233private:
234 std::string _note;
235};
236
237typedef std::map<uint32, BugTicket*> BugTicketList;
238typedef std::map<uint32, ComplaintTicket*> ComplaintTicketList;
239typedef std::map<uint32, SuggestionTicket*> SuggestionTicketList;
240
242{
243private:
244 SupportMgr();
245 ~SupportMgr();
246
247public:
248 SupportMgr(SupportMgr const&) = delete;
250 SupportMgr& operator=(SupportMgr const&) = delete;
252
253 static SupportMgr* instance();
254
255 template<typename T>
256 T* GetTicket(uint32 ticketId);
257
258 ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const;
259
260 void Initialize();
261
262 bool GetSupportSystemStatus() const { return _supportSystemStatus; }
263 bool GetTicketSystemStatus() const { return _supportSystemStatus && _ticketSystemStatus; }
264 bool GetBugSystemStatus() const { return _supportSystemStatus && _bugSystemStatus; }
265 bool GetComplaintSystemStatus() const { return _supportSystemStatus && _complaintSystemStatus; }
266 bool GetSuggestionSystemStatus() const { return _supportSystemStatus && _suggestionSystemStatus; }
267 uint64 GetLastChange() const { return _lastChange; }
268 template<typename T>
270
271 void SetSupportSystemStatus(bool status) { _supportSystemStatus = status; }
272 void SetTicketSystemStatus(bool status) { _ticketSystemStatus = status; }
273 void SetBugSystemStatus(bool status) { _bugSystemStatus = status; }
274 void SetComplaintSystemStatus(bool status) { _complaintSystemStatus = status; }
275 void SetSuggestionSystemStatus(bool status) { _suggestionSystemStatus = status; }
276
277 void LoadBugTickets();
278 void LoadComplaintTickets();
279 void LoadSuggestionTickets();
280
281 void AddTicket(BugTicket* ticket);
282 void AddTicket(ComplaintTicket* ticket);
283 void AddTicket(SuggestionTicket* ticket);
284
285 template<typename T>
286 void RemoveTicket(uint32 ticketId);
287
288 template<typename T>
289 void CloseTicket(uint32 ticketId, ObjectGuid closedBy);
290
291 template<typename T>
293
294 template<typename T>
295 void ShowList(ChatHandler& handler) const;
296
297 template<typename T>
298 void ShowList(ChatHandler& handler, bool onlineOnly) const;
299
300 template<typename T>
301 void ShowClosedList(ChatHandler& handler) const;
302
303 void UpdateLastChange();
304
305 uint32 GenerateBugId() { return ++_lastBugId; }
306 uint32 GenerateComplaintId() { return ++_lastComplaintId; }
307 uint32 GenerateSuggestionId() { return ++_lastSuggestionId; }
308
309private:
325};
326
327#define sSupportMgr SupportMgr::instance()
328
329#endif // SupportMgr_h__
#define TC_GAME_API
Definition Define.h:129
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
ReportMinorCategory
Definition SupportMgr.h:59
SupportSpamType
Definition SupportMgr.h:89
@ SUPPORT_SPAM_TYPE_CHAT
Definition SupportMgr.h:91
@ SUPPORT_SPAM_TYPE_CALENDAR
Definition SupportMgr.h:92
@ SUPPORT_SPAM_TYPE_MAIL
Definition SupportMgr.h:90
GMTicketSystemStatus
Definition SupportMgr.h:83
@ GMTICKET_QUEUE_STATUS_ENABLED
Definition SupportMgr.h:85
@ GMTICKET_QUEUE_STATUS_DISABLED
Definition SupportMgr.h:84
std::map< uint32, ComplaintTicket * > ComplaintTicketList
Definition SupportMgr.h:238
ReportType
Definition SupportMgr.h:29
@ GroupFinderApplicant
@ GroupFinderPosting
@ ClubFinderApplicant
std::map< uint32, SuggestionTicket * > SuggestionTicketList
Definition SupportMgr.h:239
ReportMajorCategory
Definition SupportMgr.h:51
std::map< uint32, BugTicket * > BugTicketList
Definition SupportMgr.h:237
void SetNote(std::string const &note)
Definition SupportMgr.h:163
std::string const & GetNote() const
Definition SupportMgr.h:161
std::string _note
Definition SupportMgr.h:173
void SetTargetCharacterGuid(ObjectGuid targetCharacterGuid)
Definition SupportMgr.h:189
ReportMajorCategory _majorCategory
Definition SupportMgr.h:210
ObjectGuid GetTargetCharacterGuid() const
Definition SupportMgr.h:183
void SetNote(std::string const &note)
Definition SupportMgr.h:197
ReportMinorCategory _minorCategoryFlags
Definition SupportMgr.h:211
std::string const & GetNote() const
Definition SupportMgr.h:187
void SetMinorCategoryFlags(ReportMinorCategory minorCategoryFlags)
Definition SupportMgr.h:195
ReportType GetReportType() const
Definition SupportMgr.h:184
ReportType _reportType
Definition SupportMgr.h:209
ReportMinorCategory GetMinorCategoryFlags() const
Definition SupportMgr.h:186
std::string _note
Definition SupportMgr.h:213
ObjectGuid _targetCharacterGuid
Definition SupportMgr.h:208
ReportMajorCategory GetMajorCategory() const
Definition SupportMgr.h:185
void SetMajorCategory(ReportMajorCategory majorCategory)
Definition SupportMgr.h:194
void SetChatLog(ChatLog const &log)
Definition SupportMgr.h:196
void SetReportType(ReportType reportType)
Definition SupportMgr.h:193
Class used to access individual fields of database query result.
Definition Field.h:94
Definition Pet.h:40
void SetNote(std::string const &note)
Definition SupportMgr.h:224
std::string _note
Definition SupportMgr.h:234
std::string const & GetNote() const
Definition SupportMgr.h:223
void ShowList(ChatHandler &handler) const
bool _suggestionSystemStatus
Definition SupportMgr.h:314
void ResetTickets()
uint32 _openBugTicketCount
Definition SupportMgr.h:322
SupportMgr & operator=(SupportMgr const &)=delete
uint32 _openSuggestionTicketCount
Definition SupportMgr.h:324
bool GetComplaintSystemStatus() const
Definition SupportMgr.h:265
uint32 _lastComplaintId
Definition SupportMgr.h:319
void CloseTicket(uint32 ticketId, ObjectGuid closedBy)
SupportMgr(SupportMgr &&)=delete
bool GetTicketSystemStatus() const
Definition SupportMgr.h:263
void ShowClosedList(ChatHandler &handler) const
uint64 _lastChange
Definition SupportMgr.h:321
ComplaintTicketList _complaintTicketList
Definition SupportMgr.h:316
SupportMgr(SupportMgr const &)=delete
uint32 GetOpenTicketCount() const
bool GetBugSystemStatus() const
Definition SupportMgr.h:264
T * GetTicket(uint32 ticketId)
bool _ticketSystemStatus
Definition SupportMgr.h:311
SuggestionTicketList _suggestionTicketList
Definition SupportMgr.h:317
SupportMgr & operator=(SupportMgr &&)=delete
void SetBugSystemStatus(bool status)
Definition SupportMgr.h:273
bool GetSuggestionSystemStatus() const
Definition SupportMgr.h:266
void SetSuggestionSystemStatus(bool status)
Definition SupportMgr.h:275
void RemoveTicket(uint32 ticketId)
void SetTicketSystemStatus(bool status)
Definition SupportMgr.h:272
bool _complaintSystemStatus
Definition SupportMgr.h:313
uint32 _lastBugId
Definition SupportMgr.h:318
bool _bugSystemStatus
Definition SupportMgr.h:312
uint32 _openComplaintTicketCount
Definition SupportMgr.h:323
bool _supportSystemStatus
Definition SupportMgr.h:310
uint32 GenerateComplaintId()
Definition SupportMgr.h:306
uint32 GenerateBugId()
Definition SupportMgr.h:305
void SetSupportSystemStatus(bool status)
Definition SupportMgr.h:271
uint64 GetLastChange() const
Definition SupportMgr.h:267
uint32 GenerateSuggestionId()
Definition SupportMgr.h:307
bool GetSupportSystemStatus() const
Definition SupportMgr.h:262
uint32 _lastSuggestionId
Definition SupportMgr.h:320
void ShowList(ChatHandler &handler, bool onlineOnly) const
void SetComplaintSystemStatus(bool status)
Definition SupportMgr.h:274
BugTicketList _bugTicketList
Definition SupportMgr.h:315
bool IsClosed() const
Definition SupportMgr.h:108
uint16 _mapId
Definition SupportMgr.h:146
ObjectGuid GetAssignedToGUID() const
Definition SupportMgr.h:119
Ticket & operator=(Ticket &&)=delete
std::string _comment
Definition SupportMgr.h:151
virtual void SetUnassigned()
Definition SupportMgr.h:124
uint32 GetId() const
Definition SupportMgr.h:114
bool IsAssigned() const
Definition SupportMgr.h:110
bool IsAssignedTo(ObjectGuid guid) const
Definition SupportMgr.h:111
bool IsFromPlayer(ObjectGuid guid) const
Definition SupportMgr.h:109
uint64 _createTime
Definition SupportMgr.h:148
void SetClosedBy(ObjectGuid value)
Definition SupportMgr.h:125
ObjectGuid _closedBy
Definition SupportMgr.h:149
void SetFacing(float facing)
Definition SupportMgr.h:132
uint32 _id
Definition SupportMgr.h:144
void SetComment(std::string const &comment)
Definition SupportMgr.h:126
virtual void LoadFromDB(Field *fields)=0
virtual void SetAssignedTo(ObjectGuid guid, bool=false)
Definition SupportMgr.h:123
Position _pos
Definition SupportMgr.h:147
std::string const & GetComment() const
Definition SupportMgr.h:121
bool IsAssignedNotTo(ObjectGuid guid) const
Definition SupportMgr.h:112
void SetPosition(uint32 mapId, Position const &pos)
Definition SupportMgr.h:127
virtual std::string FormatViewMessageString(ChatHandler &handler, bool detailed=false) const =0
ObjectGuid GetPlayerGuid() const
Definition SupportMgr.h:115
ObjectGuid _playerGuid
Definition SupportMgr.h:145
Ticket(Ticket const &)=delete
virtual void SaveToDB() const =0
Ticket & operator=(Ticket const &)=delete
ObjectGuid _assignedTo
Definition SupportMgr.h:150
virtual void DeleteFromDB()=0
Ticket(Ticket &&)=delete
Definition Mail.h:175