diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
| commit | a0e50ea35fca61447bf07fc45d93c98234ba59f7 (patch) | |
| tree | b4ee69a63866f42e466a3c03fc031ce0710ac762 /src/server/game/Tickets | |
| parent | ce67a097bf3c0c3241f4441a808e32639ddbaafb (diff) | |
Core/Entities: Use ObjectGuid class in game project
Diffstat (limited to 'src/server/game/Tickets')
| -rw-r--r-- | src/server/game/Tickets/TicketMgr.cpp | 22 | ||||
| -rw-r--r-- | src/server/game/Tickets/TicketMgr.h | 26 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index d1f45ba88bf..93e6d152800 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -32,12 +32,12 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() : _id(0), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), - _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), +GmTicket::GmTicket() : _id(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), + _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { } GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), - _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), + _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { _id = sTicketMgr->GenerateTicketId(); @@ -53,7 +53,7 @@ bool GmTicket::LoadFromDB(Field* fields) // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket uint8 index = 0; _id = fields[ index].GetUInt32(); - _playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); + _playerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32()); _playerName = fields[++index].GetString(); _message = fields[++index].GetString(); _createTime = fields[++index].GetUInt32(); @@ -62,8 +62,8 @@ bool GmTicket::LoadFromDB(Field* fields) _posY = fields[++index].GetFloat(); _posZ = fields[++index].GetFloat(); _lastModifiedTime = fields[++index].GetUInt32(); - _closedBy = fields[++index].GetInt32(); - _assignedTo = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); + _closedBy = ObjectGuid(uint64(fields[++index].GetInt32())); + _assignedTo = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32()); _comment = fields[++index].GetString(); _response = fields[++index].GetString(); _completed = fields[++index].GetBool(); @@ -80,7 +80,7 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); - stmt->setUInt32(++index, GUID_LOPART(_playerGuid)); + stmt->setUInt32(++index, _playerGuid.GetCounter()); stmt->setString(++index, _playerName); stmt->setString(++index, _message); stmt->setUInt32(++index, uint32(_createTime)); @@ -89,8 +89,8 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const stmt->setFloat (++index, _posY); stmt->setFloat (++index, _posZ); stmt->setUInt32(++index, uint32(_lastModifiedTime)); - stmt->setInt32 (++index, GUID_LOPART(_closedBy)); - stmt->setUInt32(++index, GUID_LOPART(_assignedTo)); + stmt->setInt32 (++index, int32(_closedBy.GetCounter())); + stmt->setUInt32(++index, _assignedTo.GetCounter()); stmt->setString(++index, _comment); stmt->setString(++index, _response); stmt->setBool (++index, _completed); @@ -199,7 +199,7 @@ std::string GmTicket::FormatMessageString(ChatHandler& handler, const char* szCl void GmTicket::SetUnassigned() { - _assignedTo = 0; + _assignedTo.Clear(); switch (_escalatedStatus) { case TICKET_ASSIGNED: _escalatedStatus = TICKET_UNASSIGNED; break; @@ -349,7 +349,7 @@ void TicketMgr::AddTicket(GmTicket* ticket) ticket->SaveToDB(trans); } -void TicketMgr::CloseTicket(uint32 ticketId, int64 source) +void TicketMgr::CloseTicket(uint32 ticketId, ObjectGuid source) { if (GmTicket* ticket = GetTicket(ticketId)) { diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index 8b1c8fbc0f9..d9b9b68d133 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -84,19 +84,19 @@ public: GmTicket(Player* player); ~GmTicket(); - bool IsClosed() const { return _closedBy != 0; } + bool IsClosed() const { return !_closedBy.IsEmpty(); } bool IsCompleted() const { return _completed; } - bool IsFromPlayer(uint64 guid) const { return guid == _playerGuid; } - bool IsAssigned() const { return _assignedTo != 0; } - bool IsAssignedTo(uint64 guid) const { return guid == _assignedTo; } - bool IsAssignedNotTo(uint64 guid) const { return IsAssigned() && !IsAssignedTo(guid); } + bool IsFromPlayer(ObjectGuid guid) const { return guid == _playerGuid; } + bool IsAssigned() const { return !_assignedTo.IsEmpty(); } + bool IsAssignedTo(ObjectGuid guid) const { return guid == _assignedTo; } + bool IsAssignedNotTo(ObjectGuid guid) const { return IsAssigned() && !IsAssignedTo(guid); } uint32 GetId() const { return _id; } Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); } std::string const& GetPlayerName() const { return _playerName; } std::string const& GetMessage() const { return _message; } Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); } - uint64 GetAssignedToGUID() const { return _assignedTo; } + ObjectGuid GetAssignedToGUID() const { return _assignedTo; } std::string GetAssignedToName() const { std::string name; @@ -110,7 +110,7 @@ public: GMTicketEscalationStatus GetEscalatedStatus() const { return _escalatedStatus; } void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus) { _escalatedStatus = escalatedStatus; } - void SetAssignedTo(uint64 guid, bool isAdmin) + void SetAssignedTo(ObjectGuid guid, bool isAdmin) { _assignedTo = guid; if (isAdmin && _escalatedStatus == TICKET_IN_ESCALATION_QUEUE) @@ -118,7 +118,7 @@ public: else if (_escalatedStatus == TICKET_UNASSIGNED) _escalatedStatus = TICKET_ASSIGNED; } - void SetClosedBy(int64 value) { _closedBy = value; } + void SetClosedBy(ObjectGuid value) { _closedBy = value; } void SetCompleted() { _completed = true; } void SetMessage(std::string const& message) { @@ -149,7 +149,7 @@ public: private: uint32 _id; - uint64 _playerGuid; + ObjectGuid _playerGuid; std::string _playerName; float _posX; float _posY; @@ -158,8 +158,8 @@ private: std::string _message; uint64 _createTime; uint64 _lastModifiedTime; - int64 _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it. - uint64 _assignedTo; + ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it. + ObjectGuid _assignedTo; std::string _comment; bool _completed; GMTicketEscalationStatus _escalatedStatus; @@ -196,7 +196,7 @@ public: return NULL; } - GmTicket* GetTicketByPlayer(uint64 playerGuid) + GmTicket* GetTicketByPlayer(ObjectGuid playerGuid) { for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr) if (itr->second && itr->second->IsFromPlayer(playerGuid) && !itr->second->IsClosed()) @@ -215,7 +215,7 @@ public: } void AddTicket(GmTicket* ticket); - void CloseTicket(uint32 ticketId, int64 source = -1); + void CloseTicket(uint32 ticketId, ObjectGuid source); void RemoveTicket(uint32 ticketId); bool GetStatus() const { return _status; } |
