Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
TicketInfo.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SF_TICKETINFO_H
7#define SF_TICKETINFO_H
8
9#include <string>
10
11#include "ObjectMgr.h"
12
13// from blizzard lua
19
25
35
36// from Blizzard LUA:
37// GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED = 0; -- ticket is not currently assigned to a gm
38// GMTICKET_ASSIGNEDTOGM_STATUS_ASSIGNED = 1; -- ticket is assigned to a normal gm
39// GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED = 2; -- ticket is in the escalation queue
40// 3 is a custom value and should never actually be sent
48
49// from blizzard lua
51{
52 GMTICKET_OPENEDBYGM_STATUS_NOT_OPENED = 0, // ticket has never been opened by a gm
53 GMTICKET_OPENEDBYGM_STATUS_OPENED = 1 // ticket has been opened by a gm
54};
55
65
66class ChatHandler;
67
69{
70public:
71 TicketInfo();
72 TicketInfo(Player* player);
73 virtual ~TicketInfo();
74
75 bool IsClosed() const { return _closedBy; }
76 bool IsAssigned() const { return _assignedTo != 0; }
77 bool IsFromPlayer(uint64 guid) const { return guid == _playerGuid; }
78 bool IsAssignedTo(uint64 guid) const { return guid == _assignedTo; }
79 bool IsAssignedNotTo(uint64 guid) const { return IsAssigned() && !IsAssignedTo(guid); }
80
81 std::string const& GetComment() const { return _comment; }
82 std::string const& GetPlayerName() const { return _playerName; }
83 std::string GetAssignedToName() const;
84
85 uint32 GetTicketId() const { return _ticketId; }
86 uint32 GetMapId() const { return _mapId; }
87 uint64 GetPlayerGuid() const { return _playerGuid; }
89
92
93 void SetComment(std::string comment) { _comment = comment; }
94 void SetPosition(uint32 MapID, G3D::Vector3 pos);
95 void SetClosedBy(uint64 closer) { _closedBy = closer; }
96 void SetComment(std::string& comment) { _comment = comment; }
97
98 void TeleportTo(Player* player) const;
99
100 virtual void SetAssignedTo(uint64 assignedTo, bool /*isAdmin*/ = false) { _assignedTo = assignedTo; }
101 virtual void SetUnassigned() { _assignedTo = 0; }
102
103 virtual void LoadFromDB(Field* fields) = 0;
104 virtual void SaveToDB(SQLTransaction& trans) const = 0;
105 virtual void DeleteFromDB() = 0;
106
107 virtual std::string FormatMessageString(ChatHandler& handler, bool detailed = false) const = 0;
108 virtual std::string FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const;
109
110protected:
117 std::string _comment;
118 std::string _playerName;
119 G3D::Vector3 _pos;
120};
121
122class GmTicket : public TicketInfo
123{
124public:
125 GmTicket();
126 GmTicket(Player* player);
127 ~GmTicket();
128
129 void AppendResponse(std::string const& response) { _response += response; }
130 void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus) { _escalatedStatus = escalatedStatus; }
131 void SetViewed() { _viewed = true; }
132 void SetUnassigned() override;
133 void SetChatLog(std::list<uint32> time, std::string const& log);
134 void SetCompleted() { _completed = true; }
135 void SetMessage(std::string const& message);
136 void SetGmAction(bool needResponse, bool haveTicket);
137
138 bool IsCompleted() const { return _completed; }
139 bool GetViewed() const { return _viewed; }
140
141 void LoadFromDB(Field* fields) OVERRIDE;
142 void SaveToDB(SQLTransaction& trans) const OVERRIDE;
143 void DeleteFromDB() OVERRIDE;
144
145 std::string FormatMessageString(ChatHandler& handler, bool detailed = false) const override;
146 std::string FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const override;
147
148 std::string const& GetMessage() const { return _message; }
149 std::string const& GetChatLog() const { return _chatLog; }
150 std::string const& GetResponse() const { return _response; }
151
154
155private:
163 std::string _message;
164 std::string _response;
165 std::string _chatLog; // No need to store in db, will be refreshed every session client side
166};
167
168class BugTicket : public TicketInfo
169{
170public:
171 BugTicket();
172 BugTicket(Player* player, WorldPacket& bugPacket);
173 ~BugTicket();
174
175 std::string const& GetNote() const { return _bugnote; }
176
177 void SetOrientation(float Orientation) { _Orientation = Orientation; }
178 void SetNote(std::string const& bugnote) { _bugnote = bugnote; }
179
180 void LoadFromDB(Field* fields) OVERRIDE;
181 void SaveToDB(SQLTransaction& trans) const OVERRIDE;
182 void DeleteFromDB() OVERRIDE;
183
185 std::string FormatMessageString(ChatHandler& handler, bool detailed = false) const OVERRIDE;
186
187private:
189 std::string _bugnote;
190};
191
193{
194public:
196 SuggestTicket(Player* player, WorldPacket& bugPacket);
198
199 std::string const& GetNote() const { return _suggestnote; }
200
201 void SetOrientation(float Orientation) { _Orientation = Orientation; }
202 void SetNote(std::string const& suggestnote) { _suggestnote = suggestnote; }
203
204 void LoadFromDB(Field* fields) OVERRIDE;
205 void SaveToDB(SQLTransaction& trans) const OVERRIDE;
206 void DeleteFromDB() OVERRIDE;
207
209 std::string FormatMessageString(ChatHandler& handler, bool detailed = false) const OVERRIDE;
210
211private:
213 std::string _suggestnote;
214};
215
216#endif // SF_TICKETINFO_H
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
GMTicketSystemStatus
Definition TicketInfo.h:15
@ GMTICKET_QUEUE_STATUS_ENABLED
Definition TicketInfo.h:17
@ GMTICKET_QUEUE_STATUS_DISABLED
Definition TicketInfo.h:16
GMTicketEscalationStatus
Definition TicketInfo.h:42
@ TICKET_ESCALATED_ASSIGNED
Definition TicketInfo.h:46
@ TICKET_IN_ESCALATION_QUEUE
Definition TicketInfo.h:45
@ TICKET_UNASSIGNED
Definition TicketInfo.h:43
@ TICKET_ASSIGNED
Definition TicketInfo.h:44
LagReportType
Definition TicketInfo.h:57
@ LAG_REPORT_TYPE_MAIL
Definition TicketInfo.h:60
@ LAG_REPORT_TYPE_LOOT
Definition TicketInfo.h:58
@ LAG_REPORT_TYPE_SPELL
Definition TicketInfo.h:63
@ LAG_REPORT_TYPE_AUCTION_HOUSE
Definition TicketInfo.h:59
@ LAG_REPORT_TYPE_MOVEMENT
Definition TicketInfo.h:62
@ LAG_REPORT_TYPE_CHAT
Definition TicketInfo.h:61
GMTicketStatus
Definition TicketInfo.h:21
@ GMTICKET_STATUS_DEFAULT
Definition TicketInfo.h:23
@ GMTICKET_STATUS_HASTEXT
Definition TicketInfo.h:22
GMTicketResponse
Definition TicketInfo.h:27
@ GMTICKET_RESPONSE_CREATE_SUCCESS
Definition TicketInfo.h:29
@ GMTICKET_RESPONSE_TICKET_DELETED
Definition TicketInfo.h:33
@ GMTICKET_RESPONSE_CREATE_ERROR
Definition TicketInfo.h:30
@ GMTICKET_RESPONSE_UPDATE_SUCCESS
Definition TicketInfo.h:31
@ GMTICKET_RESPONSE_UPDATE_ERROR
Definition TicketInfo.h:32
@ GMTICKET_RESPONSE_ALREADY_EXIST
Definition TicketInfo.h:28
GMTicketOpenedByGMStatus
Definition TicketInfo.h:51
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
Definition Transaction.h:42
std::string _bugnote
Definition TicketInfo.h:189
void SetOrientation(float Orientation)
Definition TicketInfo.h:177
std::string const & GetNote() const
Definition TicketInfo.h:175
void SaveToDB(SQLTransaction &trans) const OVERRIDE
void DeleteFromDB() OVERRIDE
void SetNote(std::string const &bugnote)
Definition TicketInfo.h:178
void LoadFromDB(Field *fields) OVERRIDE
float _Orientation
Definition TicketInfo.h:188
std::string FormatMessageString(ChatHandler &handler, bool detailed=false) const OVERRIDE
Definition Field.h:16
void SetUnassigned() override
std::string const & GetMessage() const
Definition TicketInfo.h:148
bool GetViewed() const
Definition TicketInfo.h:139
bool _viewed
Definition TicketInfo.h:160
void SetViewed()
Definition TicketInfo.h:131
std::string _chatLog
Definition TicketInfo.h:165
bool _completed
Definition TicketInfo.h:159
void SetGmAction(bool needResponse, bool haveTicket)
GMTicketEscalationStatus _escalatedStatus
Definition TicketInfo.h:157
std::string _message
Definition TicketInfo.h:163
std::string const & GetChatLog() const
Definition TicketInfo.h:149
void SetMessage(std::string const &message)
std::string FormatMessageString(ChatHandler &handler, bool detailed=false) const override
void AppendResponse(std::string const &response)
Definition TicketInfo.h:129
std::string _response
Definition TicketInfo.h:164
void DeleteFromDB() OVERRIDE
uint64 GetLastModifiedTime() const
Definition TicketInfo.h:152
bool IsCompleted() const
Definition TicketInfo.h:138
bool _needResponse
Definition TicketInfo.h:161
void SetCompleted()
Definition TicketInfo.h:134
GMTicketOpenedByGMStatus _openedByGmStatus
Definition TicketInfo.h:158
std::string const & GetResponse() const
Definition TicketInfo.h:150
void SetChatLog(std::list< uint32 > time, std::string const &log)
bool _haveTicket
Definition TicketInfo.h:162
void LoadFromDB(Field *fields) OVERRIDE
uint64 _lastModifiedTime
Definition TicketInfo.h:156
GMTicketEscalationStatus GetEscalatedStatus() const
Definition TicketInfo.h:153
void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus)
Definition TicketInfo.h:130
void SaveToDB(SQLTransaction &trans) const OVERRIDE
static Player * FindPlayer(uint64)
std::string const & GetNote() const
Definition TicketInfo.h:199
std::string _suggestnote
Definition TicketInfo.h:213
void SetNote(std::string const &suggestnote)
Definition TicketInfo.h:202
void SetOrientation(float Orientation)
Definition TicketInfo.h:201
float _Orientation
Definition TicketInfo.h:212
virtual void SetAssignedTo(uint64 assignedTo, bool=false)
Definition TicketInfo.h:100
uint32 GetTicketId() const
Definition TicketInfo.h:85
G3D::Vector3 _pos
Definition TicketInfo.h:119
std::string const & GetPlayerName() const
Definition TicketInfo.h:82
std::string GetAssignedToName() const
bool IsAssigned() const
Definition TicketInfo.h:76
virtual std::string FormatMessageString(ChatHandler &handler, bool detailed=false) const =0
uint32 GetMapId() const
Definition TicketInfo.h:86
uint32 _mapId
Definition TicketInfo.h:113
uint64 _assignedTo
Definition TicketInfo.h:116
uint64 _playerGuid
Definition TicketInfo.h:114
void SetComment(std::string &comment)
Definition TicketInfo.h:96
bool IsFromPlayer(uint64 guid) const
Definition TicketInfo.h:77
virtual void DeleteFromDB()=0
virtual ~TicketInfo()
bool IsAssignedTo(uint64 guid) const
Definition TicketInfo.h:78
void SetComment(std::string comment)
Definition TicketInfo.h:93
void TeleportTo(Player *player) const
uint64 GetPlayerGuid() const
Definition TicketInfo.h:87
uint32 _ticketId
Definition TicketInfo.h:111
bool IsAssignedNotTo(uint64 guid) const
Definition TicketInfo.h:79
Player * GetAssignedPlayer() const
Definition TicketInfo.h:91
void SetPosition(uint32 MapID, G3D::Vector3 pos)
uint32 _ticketCreateTime
Definition TicketInfo.h:112
virtual void SetUnassigned()
Definition TicketInfo.h:101
std::string const & GetComment() const
Definition TicketInfo.h:81
Player * GetPlayer() const
Definition TicketInfo.h:90
virtual void LoadFromDB(Field *fields)=0
std::string _comment
Definition TicketInfo.h:117
bool IsClosed() const
Definition TicketInfo.h:75
virtual void SaveToDB(SQLTransaction &trans) const =0
void SetClosedBy(uint64 closer)
Definition TicketInfo.h:95
std::string _playerName
Definition TicketInfo.h:118
uint64 GetAssignedToGUID() const
Definition TicketInfo.h:88
uint64 _closedBy
Definition TicketInfo.h:115