TrinityCore
TicketHandler.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 "WorldSession.h"
19#include "Common.h"
20#include "DatabaseEnv.h"
21#include "SupportMgr.h"
22#include "TicketPackets.h"
23
25{
26 // TODO: Implement GmCase and handle this packet properly
28 SendPacket(status.Write());
29}
30
32{
33 // Note: This only disables the ticket UI at client side and is not fully reliable
34 // Note: This disables the whole customer support UI after trying to send a ticket in disabled state (MessageBox: "GM Help Tickets are currently unavaiable."). UI remains disabled until the character relogs.
37 SendPacket(response.Write());
38}
39
41{
42 if (userFeedback.IsSuggestion)
43 {
44 if (!sSupportMgr->GetSuggestionSystemStatus())
45 return;
46
48 ticket->SetPosition(userFeedback.Header.MapID, userFeedback.Header.Position);
49 ticket->SetFacing(userFeedback.Header.Facing);
50 ticket->SetNote(userFeedback.Note);
51
52 sSupportMgr->AddTicket(ticket);
53 }
54 else
55 {
56 if (!sSupportMgr->GetBugSystemStatus())
57 return;
58
59 BugTicket* ticket = new BugTicket(GetPlayer());
60 ticket->SetPosition(userFeedback.Header.MapID, userFeedback.Header.Position);
61 ticket->SetFacing(userFeedback.Header.Facing);
62 ticket->SetNote(userFeedback.Note);
63
64 sSupportMgr->AddTicket(ticket);
65 }
66}
67
69{
70 if (!sSupportMgr->GetComplaintSystemStatus())
71 return;
72
74 comp->SetPosition(packet.Header.MapID, packet.Header.Position);
75 comp->SetFacing(packet.Header.Facing);
76 comp->SetChatLog(packet.ChatLog);
78 comp->SetReportType(ReportType(packet.ReportType));
81 comp->SetNote(packet.Note);
82
83 sSupportMgr->AddTicket(comp);
84}
85
87{
88 // Note: There is no way to trigger this with standard UI except /script ReportBug("text")
89 if (!sSupportMgr->GetBugSystemStatus())
90 return;
91
93 stmt->setString(0, bugReport.Text);
94 stmt->setString(1, bugReport.DiagInfo);
95 CharacterDatabase.Execute(stmt);
96}
97
99{ // NOTE: all chat messages from this spammer are automatically ignored by the spam reporter until logout in case of chat spam.
100 // if it's mail spam - ALL mails from this spammer are automatically removed by client
101
103 result.ComplaintType = packet.ComplaintType;
104 result.Result = 0;
105 SendPacket(result.Write());
106}
@ CHAR_INS_BUG_REPORT
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
ReportMinorCategory
Definition: SupportMgr.h:55
@ GMTICKET_QUEUE_STATUS_ENABLED
Definition: SupportMgr.h:77
@ GMTICKET_QUEUE_STATUS_DISABLED
Definition: SupportMgr.h:76
#define sSupportMgr
Definition: SupportMgr.h:310
ReportType
Definition: SupportMgr.h:29
ReportMajorCategory
Definition: SupportMgr.h:47
void SetNote(std::string const &note)
Definition: SupportMgr.h:151
void SetTargetCharacterGuid(ObjectGuid targetCharacterGuid)
Definition: SupportMgr.h:177
void SetNote(std::string const &note)
Definition: SupportMgr.h:185
void SetMinorCategoryFlags(ReportMinorCategory minorCategoryFlags)
Definition: SupportMgr.h:183
void SetMajorCategory(ReportMajorCategory majorCategory)
Definition: SupportMgr.h:182
void SetChatLog(ChatLog const &log)
Definition: SupportMgr.h:184
void SetReportType(ReportType reportType)
Definition: SupportMgr.h:181
void setString(const uint8 index, const std::string &value)
void SetNote(std::string const &note)
Definition: SupportMgr.h:212
void SetFacing(float facing)
Definition: SupportMgr.h:120
void SetPosition(uint32 mapId, Position const &pos)
Definition: SupportMgr.h:115
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
void HandleBugReportOpcode(WorldPackets::Ticket::BugReport &bugReport)
void HandleSupportTicketSubmitComplaint(WorldPackets::Ticket::SupportTicketSubmitComplaint &packet)
void HandleGMTicketSystemStatusOpcode(WorldPackets::Ticket::GMTicketGetSystemStatus &packet)
Player * GetPlayer() const
void HandleGMTicketGetCaseStatusOpcode(WorldPackets::Ticket::GMTicketGetCaseStatus &packet)
void HandleSubmitUserFeedback(WorldPackets::Ticket::SubmitUserFeedback &userFeedback)
void HandleComplaint(WorldPackets::Ticket::Complaint &packet)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
TaggedPosition<::Position::XYZ > Position
Definition: TicketPackets.h:33