diff options
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r-- | src/game/Level2.cpp | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 932ea2352ce..a1db396dec9 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -36,7 +36,6 @@ #include "GameEvent.h" #include "SpellMgr.h" #include "AccountMgr.h" -#include "GMTicketMgr.h" #include "WaypointManager.h" #include "Util.h" #include <cctype> @@ -1941,191 +1940,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args) return true; } -//show tickets -void ChatHandler::ShowTicket(uint64 guid, char const* text, char const* time) -{ - std::string name; - if(!objmgr.GetPlayerNameByGUID(guid,name)) - name = GetTrinityString(LANG_UNKNOWN); - - PSendSysMessage(LANG_COMMAND_TICKETVIEW, name.c_str(),time,text); -} - -//ticket commands -bool ChatHandler::HandleTicketCommand(const char* args) -{ - char* px = strtok((char*)args, " "); - - // ticket<end> - if (!px) - { - if(!m_session) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - size_t count = ticketmgr.GetTicketCount(); - - bool accept = m_session->GetPlayer()->isAcceptTickets(); - - PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, accept ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF)); - return true; - } - - // ticket on - if(strncmp(px,"on",3) == 0) - { - if(!m_session) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - m_session->GetPlayer()->SetAcceptTicket(true); - SendSysMessage(LANG_COMMAND_TICKETON); - return true; - } - - // ticket off - if(strncmp(px,"off",4) == 0) - { - if(!m_session) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - m_session->GetPlayer()->SetAcceptTicket(false); - SendSysMessage(LANG_COMMAND_TICKETOFF); - return true; - } - - // ticket #num - int num = atoi(px); - if(num > 0) - { - QueryResult *result = CharacterDatabase.PQuery("SELECT guid,ticket_text,ticket_lastchange FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_, num-1); - - if(!result) - { - PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); - SetSentErrorMessage(true); - return false; - } - - Field* fields = result->Fetch(); - - uint32 guid = fields[0].GetUInt32(); - char const* text = fields[1].GetString(); - char const* time = fields[2].GetString(); - - ShowTicket(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER),text,time); - delete result; - return true; - } - - std::string name = px; - - if(!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - uint64 guid = objmgr.GetPlayerGUIDByName(name); - - if(!guid) - return false; - - // ticket $char_name - GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(guid)); - if(!ticket) - return false; - - std::string time = TimeToTimestampStr(ticket->GetLastUpdate()); - - ShowTicket(guid, ticket->GetText(), time.c_str()); - - return true; -} - -//dell all tickets -bool ChatHandler::HandleDelTicketCommand(const char *args) -{ - char* px = strtok((char*)args, " "); - if (!px) - return false; - - // delticket all - if(strncmp(px,"all",4) == 0) - { - ticketmgr.DeleteAll(); - SendSysMessage(LANG_COMMAND_ALLTICKETDELETED); - return true; - } - - int num = (uint32)atoi(px); - - // delticket #num - if(num > 0) - { - QueryResult* result = CharacterDatabase.PQuery("SELECT guid FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_,num-1); - if(!result) - { - PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); - SetSentErrorMessage(true); - return false; - } - - Field* fields = result->Fetch(); - - uint32 guid = fields[0].GetUInt32(); - delete result; - - ticketmgr.Delete(guid); - - //notify player - if(Player* pl = objmgr.GetPlayer(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER))) - { - pl->GetSession()->SendGMTicketGetTicket(0x0A, 0); - PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, pl->GetName()); - } - else - PSendSysMessage(LANG_COMMAND_TICKETDEL); - - return true; - } - - std::string name = px; - - if(!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - uint64 guid = objmgr.GetPlayerGUIDByName(name); - - if(!guid) - return false; - - // delticket $char_name - ticketmgr.Delete(GUID_LOPART(guid)); - - // notify players about ticket deleting - if(Player* sender = objmgr.GetPlayer(guid)) - sender->GetSession()->SendGMTicketGetTicket(0x0A,0); - - PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,px); - return true; -} - //set spawn dist of creature bool ChatHandler::HandleNpcSpawnDistCommand(const char* args) { |