diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-05-18 23:52:58 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-05-18 23:53:25 +0200 |
| commit | c5d3dd90bea3889ef5fcd33c9ef0d59d7c544f8a (patch) | |
| tree | aa7fde6f924fc39da54908bd6eeeb0be422e5fc3 /src/server/game/Support | |
| parent | 74456703146194de72424ec98c4ea76402077be6 (diff) | |
Core/Game: Include cleanup
* Mostly aimed at removing Log/DatabaseEnv includes from other headers
* Fix most packet headers including other packet headers - moved common structures such as ItemInstance to their own files
* Moved SAI function definitions to source files (massive or requiring many different dependencies)
Diffstat (limited to 'src/server/game/Support')
| -rw-r--r-- | src/server/game/Support/SupportMgr.cpp | 71 | ||||
| -rw-r--r-- | src/server/game/Support/SupportMgr.h | 39 |
2 files changed, 70 insertions, 40 deletions
diff --git a/src/server/game/Support/SupportMgr.cpp b/src/server/game/Support/SupportMgr.cpp index cc358436bec..2d213fe61e5 100644 --- a/src/server/game/Support/SupportMgr.cpp +++ b/src/server/game/Support/SupportMgr.cpp @@ -15,9 +15,17 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "SupportMgr.h" #include "Chat.h" +#include "DatabaseEnv.h" #include "Language.h" -#include "SupportMgr.h" +#include "Log.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "Timer.h" +#include "World.h" +#include <sstream> inline time_t GetAge(uint64 t) { return (time(nullptr) - t) / DAY; } @@ -30,6 +38,34 @@ Ticket::Ticket(Player* player) : _id(0), _mapId(0), _createTime(time(nullptr)) Ticket::~Ticket() { } +Player* Ticket::GetPlayer() const +{ + return ObjectAccessor::FindConnectedPlayer(_playerGuid); +} + +std::string Ticket::GetPlayerName() const +{ + std::string name; + if (!_playerGuid.IsEmpty()) + ObjectMgr::GetPlayerNameByGUID(_playerGuid, name); + + return name; +} + +Player* Ticket::GetAssignedPlayer() const +{ + return ObjectAccessor::FindConnectedPlayer(_assignedTo); +} + +std::string Ticket::GetAssignedToName() const +{ + std::string name; + if (!_assignedTo.IsEmpty()) + ObjectMgr::GetPlayerNameByGUID(_assignedTo, name); + + return name; +} + void Ticket::TeleportTo(Player* player) const { player->TeleportTo(_mapId, _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), 0.0f, 0); @@ -368,15 +404,6 @@ SupportMgr* SupportMgr::instance() return &instance; } -void SupportMgr::Initialize() -{ - SetSupportSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_ENABLED)); - SetTicketSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_TICKETS_ENABLED)); - SetBugSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_BUGS_ENABLED)); - SetComplaintSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_COMPLAINTS_ENABLED)); - SetSuggestionSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_SUGGESTIONS_ENABLED)); -} - template<> BugTicket* SupportMgr::GetTicket<BugTicket>(uint32 bugId) { @@ -413,6 +440,25 @@ template TC_GAME_API BugTicket* SupportMgr::GetTicket<BugTicket>(uint32); template TC_GAME_API ComplaintTicket* SupportMgr::GetTicket<ComplaintTicket>(uint32); template TC_GAME_API SuggestionTicket* SupportMgr::GetTicket<SuggestionTicket>(uint32); +ComplaintTicketList SupportMgr::GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const +{ + ComplaintTicketList ret; + for (auto const& c : _complaintTicketList) + if (c.second->GetPlayerGuid() == playerGuid) + ret.insert(c); + + return ret; +} + +void SupportMgr::Initialize() +{ + SetSupportSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_ENABLED)); + SetTicketSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_TICKETS_ENABLED)); + SetBugSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_BUGS_ENABLED)); + SetComplaintSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_COMPLAINTS_ENABLED)); + SetSuggestionSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_SUGGESTIONS_ENABLED)); +} + template<> uint32 SupportMgr::GetOpenTicketCount<BugTicket>() const { return _openBugTicketCount; } @@ -771,3 +817,8 @@ void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler& handler) const template TC_GAME_API void SupportMgr::ShowClosedList<BugTicket>(ChatHandler&) const; template TC_GAME_API void SupportMgr::ShowClosedList<ComplaintTicket>(ChatHandler&) const; template TC_GAME_API void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler&) const; + +void SupportMgr::UpdateLastChange() +{ + _lastChange = uint64(time(nullptr)); +} diff --git a/src/server/game/Support/SupportMgr.h b/src/server/game/Support/SupportMgr.h index 9c1f9b39fd4..52b08087e05 100644 --- a/src/server/game/Support/SupportMgr.h +++ b/src/server/game/Support/SupportMgr.h @@ -18,11 +18,12 @@ #ifndef SupportMgr_h__ #define SupportMgr_h__ -#include "ObjectMgr.h" -#include "Player.h" #include "TicketPackets.h" +#include <map> class ChatHandler; +class Field; +class Player; // from blizzard lua enum GMTicketSystemStatus @@ -65,25 +66,11 @@ public: uint32 GetId() const { return _id; } ObjectGuid GetPlayerGuid() const { return _playerGuid; } - Player* GetPlayer() const { return ObjectAccessor::FindConnectedPlayer(_playerGuid); } - std::string GetPlayerName() const - { - std::string name; - if (!_playerGuid.IsEmpty()) - ObjectMgr::GetPlayerNameByGUID(_playerGuid, name); - - return name; - } - Player* GetAssignedPlayer() const { return ObjectAccessor::FindConnectedPlayer(_assignedTo); } + Player* GetPlayer() const; + std::string GetPlayerName() const; + Player* GetAssignedPlayer() const; ObjectGuid GetAssignedToGUID() const { return _assignedTo; } - std::string GetAssignedToName() const - { - std::string name; - if (!_assignedTo.IsEmpty()) - ObjectMgr::GetPlayerNameByGUID(_assignedTo, name); - - return name; - } + std::string GetAssignedToName() const; std::string const& GetComment() const { return _comment; } virtual void SetAssignedTo(ObjectGuid guid, bool /*isAdmin*/ = false) { _assignedTo = guid; } @@ -210,15 +197,7 @@ public: template<typename T> T* GetTicket(uint32 ticketId); - ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const - { - ComplaintTicketList ret; - for (auto const& c : _complaintTicketList) - if (c.second->GetPlayerGuid() == playerGuid) - ret.insert(c); - - return ret; - } + ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const; void Initialize(); @@ -263,7 +242,7 @@ public: template<typename T> void ShowClosedList(ChatHandler& handler) const; - void UpdateLastChange() { _lastChange = uint64(time(nullptr)); } + void UpdateLastChange(); uint32 GenerateBugId() { return ++_lastBugId; } uint32 GenerateComplaintId() { return ++_lastComplaintId; } |
