TrinityCore
SupportMgr.cpp
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#include "SupportMgr.h"
19#include "CharacterCache.h"
20#include "Chat.h"
21#include "DatabaseEnv.h"
22#include "GameTime.h"
23#include "Language.h"
24#include "Log.h"
25#include "ObjectAccessor.h"
26#include "Player.h"
27#include "Timer.h"
28#include "World.h"
29#include <sstream>
30
31inline time_t GetAge(uint64 t) { return (GameTime::GetGameTime() - t) / DAY; }
32
33Ticket::Ticket() : _id(0), _mapId(0), _createTime(0) { }
34
35Ticket::Ticket(Player* player) : _id(0), _mapId(0), _createTime(GameTime::GetGameTime())
36{
37 _playerGuid = player->GetGUID();
38}
39
41
43{
45}
46
47std::string Ticket::GetPlayerName() const
48{
49 std::string name;
50 if (!_playerGuid.IsEmpty())
51 sCharacterCache->GetCharacterNameByGuid(_playerGuid, name);
52
53 return name;
54}
55
57{
59}
60
61std::string Ticket::GetAssignedToName() const
62{
63 std::string name;
64 if (!_assignedTo.IsEmpty())
65 sCharacterCache->GetCharacterNameByGuid(_assignedTo, name);
66
67 return name;
68}
69
70void Ticket::TeleportTo(Player* player) const
71{
73}
74
75std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* closedName, char const* assignedToName, char const* unassignedName, char const* deletedName) const
76{
77 std::stringstream ss;
80 if (closedName)
81 ss << handler.PGetParseString(LANG_COMMAND_TICKETCLOSED, closedName);
82 if (assignedToName)
83 ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, assignedToName);
84 if (unassignedName)
85 ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTUNASSIGNED, unassignedName);
86 if (deletedName)
87 ss << handler.PGetParseString(LANG_COMMAND_TICKETDELETED, deletedName);
88 return ss.str();
89}
90
92
94{
95 _id = sSupportMgr->GenerateBugId();
96}
97
99
101{
102 uint8 idx = 0;
103 _id = fields[ idx].GetUInt32();
104 _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
105 _note = fields[++idx].GetString();
106 _createTime = fields[++idx].GetInt64();
107 _mapId = fields[++idx].GetUInt16();
108 _pos.m_positionX = fields[++idx].GetFloat();
109 _pos.m_positionY = fields[++idx].GetFloat();
110 _pos.m_positionZ = fields[++idx].GetFloat();
111 _pos.SetOrientation(fields[++idx].GetFloat());
112
113 int64 closedBy = fields[++idx].GetInt64();
114 if (closedBy == 0)
116 else if (closedBy < 0)
117 _closedBy.SetRawValue(0, uint64(closedBy));
118 else
119 _closedBy = ObjectGuid::Create<HighGuid::Player>(uint64(closedBy));
120
121 uint64 assignedTo = fields[++idx].GetUInt64();
122 if (assignedTo == 0)
124 else
125 _assignedTo = ObjectGuid::Create<HighGuid::Player>(assignedTo);
126
127 _comment = fields[++idx].GetString();
128}
131{
132 uint8 idx = 0;
134 stmt->setUInt32(idx, _id);
135 stmt->setUInt64(++idx, _playerGuid.GetCounter());
136 stmt->setString(++idx, _note);
137 stmt->setInt64(++idx, _createTime);
138 stmt->setUInt16(++idx, _mapId);
139 stmt->setFloat(++idx, _pos.GetPositionX());
140 stmt->setFloat(++idx, _pos.GetPositionY());
141 stmt->setFloat(++idx, _pos.GetPositionZ());
142 stmt->setFloat(++idx, _pos.GetOrientation());
143 stmt->setInt64(++idx, _closedBy.GetCounter());
144 stmt->setUInt64(++idx, _assignedTo.GetCounter());
145 stmt->setString(++idx, _comment);
146
147 CharacterDatabase.Execute(stmt);
148}
149
151{
153 stmt->setUInt32(0, _id);
154 CharacterDatabase.Execute(stmt);
155}
156
157std::string BugTicket::FormatViewMessageString(ChatHandler& handler, bool detailed) const
158{
159 time_t curTime = GameTime::GetGameTime();
160
161 std::stringstream ss;
165
166 if (!_assignedTo.IsEmpty())
168
169 if (detailed)
170 {
172 if (!_comment.empty())
174 }
175 return ss.str();
176}
177
179 _minorCategoryFlags(ReportMinorCategory::TextChat)
180{
181}
182
184 _minorCategoryFlags(ReportMinorCategory::TextChat)
185{
186 _id = sSupportMgr->GenerateComplaintId();
187}
188
190
192{
193 uint8 idx = 0;
194 _id = fields[ idx].GetUInt32();
195 _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
196 _note = fields[++idx].GetString();
197 _createTime = fields[++idx].GetInt64();
198 _mapId = fields[++idx].GetUInt16();
199 _pos.m_positionX = fields[++idx].GetFloat();
200 _pos.m_positionY = fields[++idx].GetFloat();
201 _pos.m_positionZ = fields[++idx].GetFloat();
202 _pos.SetOrientation(fields[++idx].GetFloat());
203 _targetCharacterGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
204 _reportType = ReportType(fields[++idx].GetInt32());
205 _majorCategory = ReportMajorCategory(fields[++idx].GetInt32());
206 _minorCategoryFlags = ReportMinorCategory(fields[++idx].GetInt32());
207 int32 reportLineIndex = fields[++idx].GetInt32();
208 if (reportLineIndex != -1)
209 _chatLog.ReportLineIndex = reportLineIndex;
210
211 int64 closedBy = fields[++idx].GetInt64();
212 if (closedBy == 0)
214 else if (closedBy < 0)
215 _closedBy.SetRawValue(0, uint64(closedBy));
216 else
217 _closedBy = ObjectGuid::Create<HighGuid::Player>(uint64(closedBy));
218
219 uint64 assignedTo = fields[++idx].GetUInt64();
220 if (assignedTo == 0)
222 else
223 _assignedTo = ObjectGuid::Create<HighGuid::Player>(assignedTo);
224
225 _comment = fields[++idx].GetString();
226}
227
229{
230 _chatLog.Lines.emplace_back(fields[0].GetInt64(), fields[1].GetString());
231}
232
234{
235 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
236
237 uint8 idx = 0;
239 stmt->setUInt32(idx, _id);
240 stmt->setUInt64(++idx, _playerGuid.GetCounter());
241 stmt->setString(++idx, _note);
242 stmt->setInt64(++idx, _createTime);
243 stmt->setUInt16(++idx, _mapId);
244 stmt->setFloat(++idx, _pos.GetPositionX());
245 stmt->setFloat(++idx, _pos.GetPositionY());
246 stmt->setFloat(++idx, _pos.GetPositionZ());
247 stmt->setFloat(++idx, _pos.GetOrientation());
253 stmt->setInt32(++idx, *_chatLog.ReportLineIndex);
254 else
255 stmt->setInt32(++idx, -1); // empty ReportLineIndex
256 stmt->setInt64(++idx, _closedBy.GetCounter());
257 stmt->setUInt64(++idx, _assignedTo.GetCounter());
258 stmt->setString(++idx, _comment);
259 trans->Append(stmt);
260
261 uint32 lineIndex = 0;
262 for (auto const& c : _chatLog.Lines)
263 {
264 idx = 0;
265 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_COMPLAINT_CHATLINE);
266 stmt->setUInt32(idx, _id);
267 stmt->setUInt32(++idx, lineIndex);
268 stmt->setInt64(++idx, c.Timestamp);
269 stmt->setString(++idx, c.Text);
270
271 trans->Append(stmt);
272 ++lineIndex;
273 }
274
275 CharacterDatabase.CommitTransaction(trans);
276}
277
279{
281 stmt->setUInt32(0, _id);
282 CharacterDatabase.Execute(stmt);
283
284 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GM_COMPLAINT_CHATLOG);
285 stmt->setUInt32(0, _id);
286 CharacterDatabase.Execute(stmt);
287}
288
289std::string ComplaintTicket::FormatViewMessageString(ChatHandler& handler, bool detailed) const
290{
291 time_t curTime = GameTime::GetGameTime();
292
293 std::stringstream ss;
297
298 if (!_assignedTo.IsEmpty())
300
301 if (detailed)
302 {
304 if (!_comment.empty())
306 }
307 return ss.str();
308}
309
311
313{
314 _id = sSupportMgr->GenerateSuggestionId();
315}
316
318
320{
321 uint8 idx = 0;
322 _id = fields[ idx].GetUInt32();
323 _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
324 _note = fields[++idx].GetString();
325 _createTime = fields[++idx].GetInt64();
326 _mapId = fields[++idx].GetUInt16();
327 _pos.m_positionX = fields[++idx].GetFloat();
328 _pos.m_positionY = fields[++idx].GetFloat();
329 _pos.m_positionZ = fields[++idx].GetFloat();
330 _pos.SetOrientation(fields[++idx].GetFloat());
331
332 int64 closedBy = fields[++idx].GetInt64();
333 if (closedBy == 0)
335 else if (closedBy < 0)
336 _closedBy.SetRawValue(0, uint64(closedBy));
337 else
338 _closedBy = ObjectGuid::Create<HighGuid::Player>(uint64(closedBy));
339
340 uint64 assignedTo = fields[++idx].GetUInt64();
341 if (assignedTo == 0)
343 else
344 _assignedTo = ObjectGuid::Create<HighGuid::Player>(assignedTo);
345
346 _comment = fields[++idx].GetString();
347}
348
350{
351 uint8 idx = 0;
353 stmt->setUInt32(idx, _id);
354 stmt->setUInt64(++idx, _playerGuid.GetCounter());
355 stmt->setString(++idx, _note);
356 stmt->setInt64(++idx, _createTime);
357 stmt->setUInt16(++idx, _mapId);
358 stmt->setFloat(++idx, _pos.GetPositionX());
359 stmt->setFloat(++idx, _pos.GetPositionY());
360 stmt->setFloat(++idx, _pos.GetPositionZ());
361 stmt->setFloat(++idx, _pos.GetOrientation());
362 stmt->setInt64(++idx, _closedBy.GetCounter());
363 stmt->setUInt64(++idx, _assignedTo.GetCounter());
364 stmt->setString(++idx, _comment);
365
366 CharacterDatabase.Execute(stmt);
367}
368
370{
372 stmt->setUInt32(0, _id);
373 CharacterDatabase.Execute(stmt);
374}
375
376std::string SuggestionTicket::FormatViewMessageString(ChatHandler& handler, bool detailed) const
377{
378 time_t curTime = GameTime::GetGameTime();
379
380 std::stringstream ss;
384
385 if (!_assignedTo.IsEmpty())
387
388 if (detailed)
389 {
391 if (!_comment.empty())
393 }
394 return ss.str();
395}
396
397SupportMgr::SupportMgr() : _supportSystemStatus(false), _ticketSystemStatus(false), _bugSystemStatus(false), _complaintSystemStatus(false), _suggestionSystemStatus(false),
398_lastBugId(0), _lastComplaintId(0), _lastSuggestionId(0), _lastChange(0),
399_openBugTicketCount(0), _openComplaintTicketCount(0), _openSuggestionTicketCount(0) { }
400
402{
403 for (auto const& b : _bugTicketList)
404 delete b.second;
405
406 for (auto const& c : _complaintTicketList)
407 delete c.second;
408
409 for (auto const& s : _suggestionTicketList)
410 delete s.second;
411}
412
414{
415 static SupportMgr instance;
416 return &instance;
417}
418
419template<>
420TC_GAME_API BugTicket* SupportMgr::GetTicket<BugTicket>(uint32 bugId)
421{
422 BugTicketList::const_iterator itr = _bugTicketList.find(bugId);
423 if (itr != _bugTicketList.end())
424 return itr->second;
425
426 return nullptr;
427
428}
429
430template<>
431TC_GAME_API ComplaintTicket* SupportMgr::GetTicket<ComplaintTicket>(uint32 complaintId)
432{
433 ComplaintTicketList::const_iterator itr = _complaintTicketList.find(complaintId);
434 if (itr != _complaintTicketList.end())
435 return itr->second;
436
437 return nullptr;
438}
439
440template<>
441TC_GAME_API SuggestionTicket* SupportMgr::GetTicket<SuggestionTicket>(uint32 suggestionId)
442{
443 SuggestionTicketList::const_iterator itr = _suggestionTicketList.find(suggestionId);
444 if (itr != _suggestionTicketList.end())
445 return itr->second;
446
447 return nullptr;
448
449}
450
452{
454 for (auto const& c : _complaintTicketList)
455 if (c.second->GetPlayerGuid() == playerGuid)
456 ret.insert(c);
457
458 return ret;
459}
460
462{
468}
469
470template<>
471TC_GAME_API uint32 SupportMgr::GetOpenTicketCount<BugTicket>() const { return _openBugTicketCount; }
472
473template<>
474TC_GAME_API uint32 SupportMgr::GetOpenTicketCount<ComplaintTicket>() const { return _openComplaintTicketCount; }
475
476template<>
477TC_GAME_API uint32 SupportMgr::GetOpenTicketCount<SuggestionTicket>() const { return _openSuggestionTicketCount; }
478
480{
481 uint32 oldMSTime = getMSTime();
482
483 for (auto const& c : _bugTicketList)
484 delete c.second;
485 _bugTicketList.clear();
486
487 _lastBugId = 0;
489
491 PreparedQueryResult result = CharacterDatabase.Query(stmt);
492 if (!result)
493 {
494 TC_LOG_INFO("server.loading", ">> Loaded 0 GM bugs. DB table `gm_bug` is empty!");
495 return;
496 }
497
498 uint32 count = 0;
499 do
500 {
501 Field* fields = result->Fetch();
502 BugTicket* bug = new BugTicket();
503 bug->LoadFromDB(fields);
504
505 if (!bug->IsClosed())
507
508 uint32 id = bug->GetId();
509 if (_lastBugId < id)
510 _lastBugId = id;
511
512 _bugTicketList[id] = bug;
513 ++count;
514 } while (result->NextRow());
515
516 TC_LOG_INFO("server.loading", ">> Loaded {} GM bugs in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
517}
518
520{
521 uint32 oldMSTime = getMSTime();
522
523 for (auto const& c : _complaintTicketList)
524 delete c.second;
525 _complaintTicketList.clear();
526
529
531 PreparedQueryResult result = CharacterDatabase.Query(stmt);
532 if (!result)
533 {
534 TC_LOG_INFO("server.loading", ">> Loaded 0 GM complaints. DB table `gm_complaint` is empty!");
535 return;
536 }
537
538 uint32 count = 0;
540 PreparedQueryResult chatLogResult;
541 do
542 {
543 Field* fields = result->Fetch();
544 ComplaintTicket* complaint = new ComplaintTicket();
545 complaint->LoadFromDB(fields);
546
547 if (!complaint->IsClosed())
549
550 uint32 id = complaint->GetId();
551 if (_lastComplaintId < id)
552 _lastComplaintId = id;
553
554 chatLogStmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_COMPLAINT_CHATLINES);
555 chatLogStmt->setUInt32(0, id);
556 chatLogResult = CharacterDatabase.Query(chatLogStmt);
557
558 if (chatLogResult)
559 {
560 do
561 {
562 Field* chatLineFields = chatLogResult->Fetch();
563 complaint->LoadChatLineFromDB(chatLineFields);
564 } while (chatLogResult->NextRow());
565 }
566
567 _complaintTicketList[id] = complaint;
568 ++count;
569 } while (result->NextRow());
570
571 TC_LOG_INFO("server.loading", ">> Loaded {} GM complaints in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
572}
573
575{
576 uint32 oldMSTime = getMSTime();
577
578 for (auto const& c : _suggestionTicketList)
579 delete c.second;
580 _suggestionTicketList.clear();
581
584
586 PreparedQueryResult result = CharacterDatabase.Query(stmt);
587 if (!result)
588 {
589 TC_LOG_INFO("server.loading", ">> Loaded 0 GM suggestions. DB table `gm_suggestion` is empty!");
590 return;
591 }
592
593 uint32 count = 0;
594 do
595 {
596 Field* fields = result->Fetch();
597 SuggestionTicket* suggestion = new SuggestionTicket();
598 suggestion->LoadFromDB(fields);
599
600 if (!suggestion->IsClosed())
602
603 uint32 id = suggestion->GetId();
604 if (_lastSuggestionId < id)
606
607 _suggestionTicketList[id] = suggestion;
608 ++count;
609 } while (result->NextRow());
610
611 TC_LOG_INFO("server.loading", ">> Loaded {} GM suggestions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
612}
613
615{
616 _bugTicketList[ticket->GetId()] = ticket;
617 if (!ticket->IsClosed())
619
620 ticket->SaveToDB();
621}
622
624{
625 _complaintTicketList[ticket->GetId()] = ticket;
626 if (!ticket->IsClosed())
628
629 ticket->SaveToDB();
630}
631
633{
634 _suggestionTicketList[ticket->GetId()] = ticket;
635 if (!ticket->IsClosed())
637
638 ticket->SaveToDB();
639}
640
641template<>
642TC_GAME_API void SupportMgr::RemoveTicket<BugTicket>(uint32 ticketId)
643{
644 if (BugTicket* ticket = GetTicket<BugTicket>(ticketId))
645 {
646 ticket->DeleteFromDB();
647 _bugTicketList.erase(ticketId);
648 delete ticket;
649 }
650}
651
652template<>
653TC_GAME_API void SupportMgr::RemoveTicket<ComplaintTicket>(uint32 ticketId)
654{
655 if (ComplaintTicket* ticket = GetTicket<ComplaintTicket>(ticketId))
656 {
657 ticket->DeleteFromDB();
658 _complaintTicketList.erase(ticketId);
659 delete ticket;
660 }
661}
662
663template<>
664TC_GAME_API void SupportMgr::RemoveTicket<SuggestionTicket>(uint32 ticketId)
665{
666 if (SuggestionTicket* ticket = GetTicket<SuggestionTicket>(ticketId))
667 {
668 ticket->DeleteFromDB();
669 _suggestionTicketList.erase(ticketId);
670 delete ticket;
671 }
672}
673
674template<>
675TC_GAME_API void SupportMgr::CloseTicket<BugTicket>(uint32 ticketId, ObjectGuid closedBy)
676{
677 if (BugTicket* ticket = GetTicket<BugTicket>(ticketId))
678 {
679 ticket->SetClosedBy(closedBy);
680 if (!closedBy.IsEmpty())
682 ticket->SaveToDB();
683 }
684}
685
686template<>
687TC_GAME_API void SupportMgr::CloseTicket<ComplaintTicket>(uint32 ticketId, ObjectGuid closedBy)
688{
689 if (ComplaintTicket* ticket = GetTicket<ComplaintTicket>(ticketId))
690 {
691 ticket->SetClosedBy(closedBy);
692 if (!closedBy.IsEmpty())
694 ticket->SaveToDB();
695 }
696}
697
698template<>
699TC_GAME_API void SupportMgr::CloseTicket<SuggestionTicket>(uint32 ticketId, ObjectGuid closedBy)
700{
701 if (SuggestionTicket* ticket = GetTicket<SuggestionTicket>(ticketId))
702 {
703 ticket->SetClosedBy(closedBy);
704 if (!closedBy.IsEmpty())
706 ticket->SaveToDB();
707 }
708}
709
710template<>
711TC_GAME_API void SupportMgr::ResetTickets<BugTicket>()
712{
713 for (auto const& c : _bugTicketList)
714 delete c.second;
715 _bugTicketList.clear();
716
717 _lastBugId = 0;
718
720 CharacterDatabase.Execute(stmt);
721}
722
723template<>
724TC_GAME_API void SupportMgr::ResetTickets<ComplaintTicket>()
725{
726 for (auto const& c : _complaintTicketList)
727 delete c.second;
728 _complaintTicketList.clear();
729
731
732 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
733 trans->Append(CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GM_COMPLAINTS));
734 trans->Append(CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GM_COMPLAINT_CHATLOGS));
735 CharacterDatabase.CommitTransaction(trans);
736}
737
738template<>
739TC_GAME_API void SupportMgr::ResetTickets<SuggestionTicket>()
740{
741 for (auto const& c : _suggestionTicketList)
742 delete c.second;
743 _suggestionTicketList.clear();
744
746
748 CharacterDatabase.Execute(stmt);
749}
750
751template<>
752TC_GAME_API void SupportMgr::ShowList<BugTicket>(ChatHandler& handler) const
753{
755 for (BugTicketList::const_iterator itr = _bugTicketList.begin(); itr != _bugTicketList.end(); ++itr)
756 if (!itr->second->IsClosed())
757 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
758}
759
760template<>
761TC_GAME_API void SupportMgr::ShowList<ComplaintTicket>(ChatHandler& handler) const
762{
764 for (ComplaintTicketList::const_iterator itr = _complaintTicketList.begin(); itr != _complaintTicketList.end(); ++itr)
765 if (!itr->second->IsClosed())
766 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
767}
768
769template<>
770TC_GAME_API void SupportMgr::ShowList<SuggestionTicket>(ChatHandler& handler) const
771{
773 for (SuggestionTicketList::const_iterator itr = _suggestionTicketList.begin(); itr != _suggestionTicketList.end(); ++itr)
774 if (!itr->second->IsClosed())
775 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
776}
777
778template<>
779TC_GAME_API void SupportMgr::ShowClosedList<BugTicket>(ChatHandler& handler) const
780{
782 for (BugTicketList::const_iterator itr = _bugTicketList.begin(); itr != _bugTicketList.end(); ++itr)
783 if (itr->second->IsClosed())
784 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
785}
786
787template<>
788TC_GAME_API void SupportMgr::ShowClosedList<ComplaintTicket>(ChatHandler& handler) const
789{
791 for (ComplaintTicketList::const_iterator itr = _complaintTicketList.begin(); itr != _complaintTicketList.end(); ++itr)
792 if (itr->second->IsClosed())
793 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
794}
795
796template<>
797TC_GAME_API void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler& handler) const
798{
800 for (SuggestionTicketList::const_iterator itr = _suggestionTicketList.begin(); itr != _suggestionTicketList.end(); ++itr)
801 if (itr->second->IsClosed())
802 handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
803}
804
806{
808}
#define sCharacterCache
@ CHAR_DEL_ALL_GM_COMPLAINTS
@ CHAR_REP_GM_SUGGESTION
@ CHAR_SEL_GM_COMPLAINTS
@ CHAR_DEL_ALL_GM_BUGS
@ CHAR_DEL_ALL_GM_COMPLAINT_CHATLOGS
@ CHAR_SEL_GM_SUGGESTIONS
@ CHAR_DEL_ALL_GM_SUGGESTIONS
@ CHAR_DEL_GM_BUG
@ CHAR_REP_GM_BUG
@ CHAR_INS_GM_COMPLAINT_CHATLINE
@ CHAR_SEL_GM_BUGS
@ CHAR_DEL_GM_COMPLAINT
@ CHAR_SEL_GM_COMPLAINT_CHATLINES
@ CHAR_DEL_GM_COMPLAINT_CHATLOG
@ CHAR_DEL_GM_SUGGESTION
@ CHAR_REP_GM_COMPLAINT
@ DAY
Definition: Common.h:31
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
@ LANG_COMMAND_TICKETLISTGUID
Definition: Language.h:1039
@ LANG_COMMAND_TICKETSHOWLIST
Definition: Language.h:1031
@ LANG_COMMAND_TICKETCLOSED
Definition: Language.h:1025
@ LANG_COMMAND_TICKETDELETED
Definition: Language.h:1026
@ LANG_COMMAND_TICKETLISTCOMMENT
Definition: Language.h:1045
@ LANG_COMMAND_TICKETLISTASSIGNEDTO
Definition: Language.h:1042
@ LANG_COMMAND_TICKETLISTAGECREATE
Definition: Language.h:1047
@ LANG_COMMAND_TICKETLISTUNASSIGNED
Definition: Language.h:1043
@ LANG_COMMAND_TICKETSHOWCLOSEDLIST
Definition: Language.h:1033
@ LANG_COMMAND_TICKETLISTMESSAGE
Definition: Language.h:1044
@ LANG_COMMAND_TICKETLISTNAME
Definition: Language.h:1040
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:159
time_t GetAge(uint64 t)
Definition: SupportMgr.cpp:31
ReportMinorCategory
Definition: SupportMgr.h:55
std::map< uint32, ComplaintTicket * > ComplaintTicketList
Definition: SupportMgr.h:226
#define sSupportMgr
Definition: SupportMgr.h:310
ReportType
Definition: SupportMgr.h:29
ReportMajorCategory
Definition: SupportMgr.h:47
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:57
uint32 getMSTime()
Definition: Timer.h:33
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
Definition: Util.cpp:115
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition: Util.h:491
void SaveToDB() const override
Definition: SupportMgr.cpp:130
void DeleteFromDB() override
Definition: SupportMgr.cpp:150
std::string _note
Definition: SupportMgr.h:161
std::string FormatViewMessageString(ChatHandler &handler, bool detailed=false) const override
Definition: SupportMgr.cpp:157
void LoadFromDB(Field *fields) override
Definition: SupportMgr.cpp:100
std::string PGetParseString(uint32 entry, Args &&... args) const
Definition: Chat.h:69
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:113
void LoadChatLineFromDB(Field *fields)
Definition: SupportMgr.cpp:228
ReportMajorCategory _majorCategory
Definition: SupportMgr.h:198
void DeleteFromDB() override
Definition: SupportMgr.cpp:278
void LoadFromDB(Field *fields) override
Definition: SupportMgr.cpp:191
ReportMinorCategory _minorCategoryFlags
Definition: SupportMgr.h:199
ReportType _reportType
Definition: SupportMgr.h:197
void SaveToDB() const override
Definition: SupportMgr.cpp:233
std::string _note
Definition: SupportMgr.h:201
ObjectGuid _targetCharacterGuid
Definition: SupportMgr.h:196
ChatLog _chatLog
Definition: SupportMgr.h:200
std::string FormatViewMessageString(ChatHandler &handler, bool detailed=false) const override
Definition: SupportMgr.cpp:289
Class used to access individual fields of database query result.
Definition: Field.h:90
std::string GetString() const
Definition: Field.cpp:118
int64 GetInt64() const
Definition: Field.cpp:86
uint64 GetUInt64() const
Definition: Field.cpp:78
uint16 GetUInt16() const
Definition: Field.cpp:46
float GetFloat() const
Definition: Field.cpp:94
uint32 GetUInt32() const
Definition: Field.cpp:62
int32 GetInt32() const
Definition: Field.cpp:70
LowType GetCounter() const
Definition: ObjectGuid.h:293
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
bool IsEmpty() const
Definition: ObjectGuid.h:319
void SetRawValue(std::vector< uint8 > const &guid)
Definition: ObjectGuid.cpp:584
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={})
Definition: Player.cpp:1250
void setInt32(const uint8 index, const int32 value)
void setFloat(const uint8 index, const float value)
void setInt64(const uint8 index, const int64 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt16(const uint8 index, const uint16 value)
void setString(const uint8 index, const std::string &value)
void setUInt64(const uint8 index, const uint64 value)
void LoadFromDB(Field *fields) override
Definition: SupportMgr.cpp:319
void SaveToDB() const override
Definition: SupportMgr.cpp:349
void DeleteFromDB() override
Definition: SupportMgr.cpp:369
std::string _note
Definition: SupportMgr.h:222
std::string FormatViewMessageString(ChatHandler &handler, bool detailed=false) const override
Definition: SupportMgr.cpp:376
uint32 _openBugTicketCount
Definition: SupportMgr.h:305
uint32 _openSuggestionTicketCount
Definition: SupportMgr.h:307
ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const
Definition: SupportMgr.cpp:451
uint32 _lastComplaintId
Definition: SupportMgr.h:302
void UpdateLastChange()
Definition: SupportMgr.cpp:805
uint64 _lastChange
Definition: SupportMgr.h:304
ComplaintTicketList _complaintTicketList
Definition: SupportMgr.h:299
static SupportMgr * instance()
Definition: SupportMgr.cpp:413
SuggestionTicketList _suggestionTicketList
Definition: SupportMgr.h:300
void SetBugSystemStatus(bool status)
Definition: SupportMgr.h:256
void LoadComplaintTickets()
Definition: SupportMgr.cpp:519
void SetSuggestionSystemStatus(bool status)
Definition: SupportMgr.h:258
void SetTicketSystemStatus(bool status)
Definition: SupportMgr.h:255
uint32 _lastBugId
Definition: SupportMgr.h:301
uint32 _openComplaintTicketCount
Definition: SupportMgr.h:306
void Initialize()
Definition: SupportMgr.cpp:461
void SetSupportSystemStatus(bool status)
Definition: SupportMgr.h:254
void LoadBugTickets()
Definition: SupportMgr.cpp:479
void AddTicket(BugTicket *ticket)
Definition: SupportMgr.cpp:614
void LoadSuggestionTickets()
Definition: SupportMgr.cpp:574
uint32 _lastSuggestionId
Definition: SupportMgr.h:303
void SetComplaintSystemStatus(bool status)
Definition: SupportMgr.h:257
BugTicketList _bugTicketList
Definition: SupportMgr.h:298
Player * GetAssignedPlayer() const
Definition: SupportMgr.cpp:56
virtual ~Ticket()
Definition: SupportMgr.cpp:40
bool IsClosed() const
Definition: SupportMgr.h:96
void TeleportTo(Player *player) const
Definition: SupportMgr.cpp:70
uint16 _mapId
Definition: SupportMgr.h:134
std::string _comment
Definition: SupportMgr.h:139
uint32 GetId() const
Definition: SupportMgr.h:102
uint64 _createTime
Definition: SupportMgr.h:136
ObjectGuid _closedBy
Definition: SupportMgr.h:137
uint32 _id
Definition: SupportMgr.h:132
Position _pos
Definition: SupportMgr.h:135
virtual std::string FormatViewMessageString(ChatHandler &handler, bool detailed=false) const =0
Player * GetPlayer() const
Definition: SupportMgr.cpp:42
ObjectGuid _playerGuid
Definition: SupportMgr.h:133
std::string GetPlayerName() const
Definition: SupportMgr.cpp:47
ObjectGuid _assignedTo
Definition: SupportMgr.h:138
std::string GetAssignedToName() const
Definition: SupportMgr.cpp:61
#define sWorld
Definition: World.h:931
@ CONFIG_SUPPORT_COMPLAINTS_ENABLED
Definition: World.h:158
@ CONFIG_SUPPORT_BUGS_ENABLED
Definition: World.h:157
@ CONFIG_SUPPORT_SUGGESTIONS_ENABLED
Definition: World.h:159
@ CONFIG_SUPPORT_TICKETS_ENABLED
Definition: World.h:156
@ CONFIG_SUPPORT_ENABLED
Definition: World.h:155
time_t GetGameTime()
Definition: GameTime.cpp:44
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
constexpr void SetOrientation(float orientation)
Definition: Position.h:71
constexpr float GetPositionX() const
Definition: Position.h:76
float m_positionZ
Definition: Position.h:55
constexpr float GetPositionY() const
Definition: Position.h:77
float m_positionX
Definition: Position.h:53
float m_positionY
Definition: Position.h:54
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
Array< SupportTicketChatLine, 255 > Lines