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

#include <SupportMgr.h>

Public Member Functions

 SuggestionTicket ()
 
 SuggestionTicket (Player *player)
 
 ~SuggestionTicket ()
 
std::string constGetNote () const
 
void SetNote (std::string const &note)
 
void SetFacing (float facing)
 
void LoadFromDB (Field *fields) override
 
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
 
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

SuggestionTicket::SuggestionTicket ( )
263 : _facing(0.0f) { }
float _facing
Definition: SupportMgr.h:199
SuggestionTicket::SuggestionTicket ( Player player)
265  : Ticket(player), _facing(0.0f)
266 {
267  _id = sSupportMgr->GenerateSuggestionId();
268 }
uint32 _id
Definition: SupportMgr.h:109
float _facing
Definition: SupportMgr.h:199
Ticket()
Definition: SupportMgr.cpp:24
#define sSupportMgr
Definition: SupportMgr.h:296
SuggestionTicket::~SuggestionTicket ( )
270 { }

Member Function Documentation

void SuggestionTicket::DeleteFromDB ( )
overridevirtual

Implements Ticket.

322 {
324  stmt->setUInt32(0, _id);
326 }
Definition: CharacterDatabase.h:316
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 _id
Definition: SupportMgr.h:109
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
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 SuggestionTicket::FormatViewMessageString ( ChatHandler handler,
bool  detailed = false 
) const
overridevirtual

Implements Ticket.

329 {
330  time_t curTime = time(nullptr);
331 
332  std::stringstream ss;
335  ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(curTime - _createTime, true, false)).c_str());
336 
337  if (!_assignedTo.IsEmpty())
339 
340  if (detailed)
341  {
342  ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, _note.c_str());
343  if (!_comment.empty())
345  }
346  return ss.str();
347 }
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:200
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:

std::string const& SuggestionTicket::GetNote ( ) const
inline
186 { return _note; }
std::string _note
Definition: SupportMgr.h:200
void SuggestionTicket::LoadFromDB ( Field fields)
overridevirtual

Implements Ticket.

273 {
274  uint8 idx = 0;
275  _id = fields[ idx].GetUInt32();
276  _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++idx].GetUInt64());
277  _note = fields[++idx].GetString();
278  _createTime = fields[++idx].GetUInt32();
279  _mapId = fields[++idx].GetUInt16();
280  _pos.x = fields[++idx].GetFloat();
281  _pos.y = fields[++idx].GetFloat();
282  _pos.z = fields[++idx].GetFloat();
283  _facing = fields[++idx].GetFloat();
284 
285  int64 closedBy = fields[++idx].GetInt64();
286  if (closedBy == 0)
288  else if (closedBy < 0)
289  _closedBy.SetRawValue(0, uint64(closedBy));
290  else
291  _closedBy = ObjectGuid::Create<HighGuid::Player>(uint64(closedBy));
292 
293  uint64 assignedTo = fields[++idx].GetUInt64();
294  if (assignedTo == 0)
296  else
297  _assignedTo = ObjectGuid::Create<HighGuid::Player>(assignedTo);
298 
299  _comment = fields[++idx].GetString();
300 }
uint32 _id
Definition: SupportMgr.h:109
float x
Definition: Vector3.h:62
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
float _facing
Definition: SupportMgr.h:199
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
float y
Definition: Vector3.h:62
std::string _note
Definition: SupportMgr.h:200
uint64 _createTime
Definition: SupportMgr.h:113
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
float z
Definition: Vector3.h:62
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
std::string GetString() const
Definition: Field.h:276
G3D::Vector3 _pos
Definition: SupportMgr.h:112

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SuggestionTicket::SaveToDB ( ) const
overridevirtual

Implements Ticket.

303 {
304  uint8 idx = 0;
306  stmt->setUInt32(idx, _id);
307  stmt->setUInt64(++idx, _playerGuid.GetCounter());
308  stmt->setString(++idx, _note);
309  stmt->setUInt16(++idx, _mapId);
310  stmt->setFloat(++idx, _pos.x);
311  stmt->setFloat(++idx, _pos.y);
312  stmt->setFloat(++idx, _pos.z);
313  stmt->setFloat(++idx, _facing);
314  stmt->setInt64(++idx, _closedBy.GetCounter());
315  stmt->setUInt64(++idx, _assignedTo.GetCounter());
316  stmt->setString(++idx, _comment);
317 
319 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 _id
Definition: SupportMgr.h:109
float x
Definition: Vector3.h:62
float _facing
Definition: SupportMgr.h:199
ObjectGuid _closedBy
Definition: SupportMgr.h:114
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
ObjectGuid _assignedTo
Definition: SupportMgr.h:115
Definition: PreparedStatement.h:74
float y
Definition: Vector3.h:62
std::string _note
Definition: SupportMgr.h:200
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
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 setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
float z
Definition: Vector3.h:62
void setFloat(const uint8 index, const float value)
Definition: PreparedStatement.cpp:169
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: CharacterDatabase.h:315
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
G3D::Vector3 _pos
Definition: SupportMgr.h:112
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SuggestionTicket::SetFacing ( float  facing)
inline
189 { _facing = facing; }
float _facing
Definition: SupportMgr.h:199

+ Here is the caller graph for this function:

void SuggestionTicket::SetNote ( std::string const note)
inline
187 { _note = note; }
std::string _note
Definition: SupportMgr.h:200

+ Here is the caller graph for this function:

Member Data Documentation

float SuggestionTicket::_facing
private
std::string SuggestionTicket::_note
private

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