TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ComplaintTicket Class Reference

#include <SupportMgr.h>

Public Member Functions

 ComplaintTicket ()
 
 ComplaintTicket (Player *player)
 
 ~ComplaintTicket ()
 
ObjectGuid GetTargetCharacterGuid () const
 
GMSupportComplaintType GetComplaintType () const
 
std::string constGetNote () const
 
void SetFacing (float facing)
 
void SetTargetCharacterGuid (ObjectGuid targetCharacterGuid)
 
void SetComplaintType (GMSupportComplaintType type)
 
void SetChatLog (ChatLog const &log)
 
void SetNote (std::string const &note)
 
void LoadFromDB (Field *fields) override
 
void LoadChatLineFromDB (Field *fields)
 
void SaveToDB () const override
 
void DeleteFromDB () override
 
std::string FormatViewMessageString (ChatHandler &handler, bool detailed=false) const override
 
- Public Member Functions inherited from Ticket
 Ticket ()
 
 Ticket (Player *player)
 
virtual ~Ticket ()
 
bool IsClosed () const
 
bool IsFromPlayer (ObjectGuid guid) const
 
bool IsAssigned () const
 
bool IsAssignedTo (ObjectGuid guid) const
 
bool IsAssignedNotTo (ObjectGuid guid) const
 
uint32 GetId () const
 
ObjectGuid GetPlayerGuid () const
 
PlayerGetPlayer () const
 
std::string GetPlayerName () const
 
PlayerGetAssignedPlayer () const
 
ObjectGuid GetAssignedToGUID () const
 
std::string GetAssignedToName () const
 
std::string constGetComment () const
 
virtual void SetAssignedTo (ObjectGuid guid, bool=false)
 
virtual void SetUnassigned ()
 
void SetClosedBy (ObjectGuid value)
 
void SetComment (std::string const &comment)
 
void SetPosition (uint32 mapId, G3D::Vector3 &pos)
 
void TeleportTo (Player *player) const
 
virtual std::string FormatViewMessageString (ChatHandler &handler, const char *szClosedName, const char *szAssignedToName, const char *szUnassignedName, const char *szDeletedName) const
 

Private Attributes

float _facing
 
ObjectGuid _targetCharacterGuid
 
GMSupportComplaintType _complaintType
 
ChatLog _chatLog
 
std::string _note
 

Additional Inherited Members

- Protected Attributes inherited from Ticket
uint32 _id
 
ObjectGuid _playerGuid
 
uint16 _mapId
 
G3D::Vector3 _pos
 
uint64 _createTime
 
ObjectGuid _closedBy
 
ObjectGuid _assignedTo
 
std::string _comment
 

Constructor & Destructor Documentation

ComplaintTicket::ComplaintTicket ( )
Definition: SupportMgr.h:36
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174
float _facing
Definition: SupportMgr.h:172
ComplaintTicket::ComplaintTicket ( Player player)
143 {
144  _id = sSupportMgr->GenerateComplaintId();
145 }
uint32 _id
Definition: SupportMgr.h:109
Definition: SupportMgr.h:36
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174
Ticket()
Definition: SupportMgr.cpp:24
#define sSupportMgr
Definition: SupportMgr.h:296
float _facing
Definition: SupportMgr.h:172
ComplaintTicket::~ComplaintTicket ( )
147 { }

Member Function Documentation

void ComplaintTicket::DeleteFromDB ( )
overridevirtual

Implements Ticket.

232 {
234  stmt->setUInt32(0, _id);
236 
238  stmt->setUInt32(0, _id);
240 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 _id
Definition: SupportMgr.h:109
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:307
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: CharacterDatabase.h:310
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

std::string ComplaintTicket::FormatViewMessageString ( ChatHandler handler,
bool  detailed = false 
) const
overridevirtual

Implements Ticket.

243 {
244  time_t curTime = time(nullptr);
245 
246  std::stringstream ss;
249  ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(curTime - _createTime, true, false)).c_str());
250 
251  if (!_assignedTo.IsEmpty())
253 
254  if (detailed)
255  {
256  ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, _note.c_str());
257  if (!_comment.empty())
259  }
260  return ss.str();
261 }
Definition: Language.h:1054
uint32 _id
Definition: SupportMgr.h:109
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition: Util.cpp:109
std::string PGetParseString(uint32 entry, Args &&...args) const
Definition: Chat.h:84
ObjectGuid _assignedTo
Definition: SupportMgr.h:115
std::string _note
Definition: SupportMgr.h:176
Definition: Language.h:1058
std::string GetPlayerName() const
Definition: SupportMgr.h:69
uint64 _createTime
Definition: SupportMgr.h:113
Definition: Language.h:1060
std::string _comment
Definition: SupportMgr.h:116
Definition: Language.h:1057
Definition: Language.h:1055
Definition: Language.h:1053
bool IsEmpty() const
Definition: ObjectGuid.h:242
std::string GetAssignedToName() const
Definition: SupportMgr.h:79

+ Here is the call graph for this function:

GMSupportComplaintType ComplaintTicket::GetComplaintType ( ) const
inline
151 { return _complaintType; }
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174
std::string const& ComplaintTicket::GetNote ( ) const
inline
152 { return _note; }
std::string _note
Definition: SupportMgr.h:176
ObjectGuid ComplaintTicket::GetTargetCharacterGuid ( ) const
inline
150 { return _targetCharacterGuid; }
ObjectGuid _targetCharacterGuid
Definition: SupportMgr.h:173
void ComplaintTicket::LoadChatLineFromDB ( Field fields)
185 {
186  _chatLog.Lines.emplace_back(fields[0].GetUInt32(), fields[1].GetString());
187 }
ChatLog _chatLog
Definition: SupportMgr.h:175
std::vector< SupportTicketChatLine > Lines
Definition: TicketPackets.h:130

+ Here is the caller graph for this function:

void ComplaintTicket::LoadFromDB ( Field fields)
overridevirtual

Implements Ticket.

150 {
151  uint8 idx = 0;
152  _id = fields[ idx].GetUInt32();
153  _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
154  _note = fields[++idx].GetString();
155  _createTime = fields[++idx].GetUInt32();
156  _mapId = fields[++idx].GetUInt16();
157  _pos.x = fields[++idx].GetFloat();
158  _pos.y = fields[++idx].GetFloat();
159  _pos.z = fields[++idx].GetFloat();
160  _facing = fields[++idx].GetFloat();
161  _targetCharacterGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
162  _complaintType = GMSupportComplaintType(fields[++idx].GetUInt8());
163  int32 reportLineIndex = fields[++idx].GetInt32();
164  if (reportLineIndex != -1)
165  _chatLog.ReportLineIndex = reportLineIndex;
166 
167  int64 closedBy = fields[++idx].GetInt64();
168  if (closedBy == 0)
170  else if (closedBy < 0)
171  _closedBy.SetRawValue(0, uint64(closedBy));
172  else
173  _closedBy = ObjectGuid::Create<HighGuid::Player>(uint64(closedBy));
174 
175  uint64 assignedTo = fields[++idx].GetUInt64();
176  if (assignedTo == 0)
178  else
179  _assignedTo = ObjectGuid::Create<HighGuid::Player>(assignedTo);
180 
181  _comment = fields[++idx].GetString();
182 }
uint32 _id
Definition: SupportMgr.h:109
float x
Definition: Vector3.h:62
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
uint64 GetUInt64() const
Definition: Field.h:184
float GetFloat() const
Definition: Field.h:222
int64_t int64
Definition: Define.h:145
ObjectGuid _closedBy
Definition: SupportMgr.h:114
int64 GetInt64() const
Definition: Field.h:203
uint64_t uint64
Definition: g3dmath.h:170
ObjectGuid _assignedTo
Definition: SupportMgr.h:115
std::string _note
Definition: SupportMgr.h:176
float y
Definition: Vector3.h:62
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174
uint64 _createTime
Definition: SupportMgr.h:113
int32_t int32
Definition: Define.h:146
void SetRawValue(std::vector< uint8 > const &guid)
Definition: ObjectGuid.cpp:134
uint64_t uint64
Definition: Define.h:149
uint16 _mapId
Definition: SupportMgr.h:111
ObjectGuid _playerGuid
Definition: SupportMgr.h:110
uint16 GetUInt16() const
Definition: Field.h:108
std::string _comment
Definition: SupportMgr.h:116
int32 GetInt32() const
Definition: Field.h:165
float _facing
Definition: SupportMgr.h:172
float z
Definition: Vector3.h:62
Optional< uint32 > ReportLineIndex
Definition: TicketPackets.h:131
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
ChatLog _chatLog
Definition: SupportMgr.h:175
GMSupportComplaintType
Definition: SupportMgr.h:34
std::string GetString() const
Definition: Field.h:276
G3D::Vector3 _pos
Definition: SupportMgr.h:112
ObjectGuid _targetCharacterGuid
Definition: SupportMgr.h:173

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ComplaintTicket::SaveToDB ( ) const
overridevirtual

Implements Ticket.

190 {
192 
193  uint8 idx = 0;
195  stmt->setUInt32(idx, _id);
196  stmt->setUInt64(++idx, _playerGuid.GetCounter());
197  stmt->setString(++idx, _note);
198  stmt->setUInt16(++idx, _mapId);
199  stmt->setFloat(++idx, _pos.x);
200  stmt->setFloat(++idx, _pos.y);
201  stmt->setFloat(++idx, _pos.z);
202  stmt->setFloat(++idx, _facing);
203  stmt->setUInt64(++idx, _targetCharacterGuid.GetCounter());
204  stmt->setUInt8(++idx, _complaintType);
206  stmt->setInt32(++idx, *_chatLog.ReportLineIndex);
207  else
208  stmt->setInt32(++idx, -1); // empty ReportLineIndex
209  stmt->setInt64(++idx, _closedBy.GetCounter());
210  stmt->setUInt64(++idx, _assignedTo.GetCounter());
211  stmt->setString(++idx, _comment);
212  trans->Append(stmt);
213 
214  uint32 lineIndex = 0;
215  for (auto const& c : _chatLog.Lines)
216  {
217  idx = 0;
219  stmt->setUInt32(idx, _id);
220  stmt->setUInt32(++idx, lineIndex);
221  stmt->setUInt32(++idx, c.Timestamp);
222  stmt->setString(++idx, c.Text);
223 
224  trans->Append(stmt);
225  ++lineIndex;
226  }
227 
229 }
uint32 _id
Definition: SupportMgr.h:109
float x
Definition: Vector3.h:62
Definition: CharacterDatabase.h:309
ObjectGuid _closedBy
Definition: SupportMgr.h:114
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
ObjectGuid _assignedTo
Definition: SupportMgr.h:115
std::string _note
Definition: SupportMgr.h:176
Definition: PreparedStatement.h:74
float y
Definition: Vector3.h:62
Definition: CharacterDatabase.h:306
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32_t uint32
Definition: Define.h:150
void setInt64(const uint8 index, const int64 value)
Definition: PreparedStatement.cpp:160
uint16 _mapId
Definition: SupportMgr.h:111
ObjectGuid _playerGuid
Definition: SupportMgr.h:110
std::string _comment
Definition: SupportMgr.h:116
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
float _facing
Definition: SupportMgr.h:172
float z
Definition: Vector3.h:62
Optional< uint32 > ReportLineIndex
Definition: TicketPackets.h:131
void setFloat(const uint8 index, const float value)
Definition: PreparedStatement.cpp:169
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
ChatLog _chatLog
Definition: SupportMgr.h:175
std::vector< SupportTicketChatLine > Lines
Definition: TicketPackets.h:130
G3D::Vector3 _pos
Definition: SupportMgr.h:112
ObjectGuid _targetCharacterGuid
Definition: SupportMgr.h:173
LowType GetCounter() const
Definition: ObjectGuid.h:221
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ComplaintTicket::SetChatLog ( ChatLog const log)
inline
160 { _chatLog = log; }
TC_SHARED_API::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,::google::protobuf::internal::EnumTypeTraits< ::bgs::protocol::LogOption,::bgs::protocol::LogOption_IsValid >, 14, false > log
ChatLog _chatLog
Definition: SupportMgr.h:175

+ Here is the caller graph for this function:

void ComplaintTicket::SetComplaintType ( GMSupportComplaintType  type)
inline
159 { _complaintType = type; }
GMSupportComplaintType _complaintType
Definition: SupportMgr.h:174

+ Here is the caller graph for this function:

void ComplaintTicket::SetFacing ( float  facing)
inline
154 { _facing = facing; }
float _facing
Definition: SupportMgr.h:172

+ Here is the caller graph for this function:

void ComplaintTicket::SetNote ( std::string const note)
inline
161 { _note = note; }
std::string _note
Definition: SupportMgr.h:176

+ Here is the caller graph for this function:

void ComplaintTicket::SetTargetCharacterGuid ( ObjectGuid  targetCharacterGuid)
inline
156  {
157  _targetCharacterGuid = targetCharacterGuid;
158  }
ObjectGuid _targetCharacterGuid
Definition: SupportMgr.h:173

+ Here is the caller graph for this function:

Member Data Documentation

ChatLog ComplaintTicket::_chatLog
private
GMSupportComplaintType ComplaintTicket::_complaintType
private
float ComplaintTicket::_facing
private
std::string ComplaintTicket::_note
private
ObjectGuid ComplaintTicket::_targetCharacterGuid
private

The documentation for this class was generated from the following files: