diff options
author | Machiavelli <none@none> | 2009-04-14 17:48:58 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-04-14 17:48:58 +0200 |
commit | ecbaf6483d453e0d80ab0b24f27232fbda1a3c4c (patch) | |
tree | ba5ec002452215e375dcb6f367adf98c57f0b46b /src/game/Level2.cpp | |
parent | e7ac066211a25d90039695badb0d9724fa610256 (diff) |
* Ticket system update;
- Add map, x, y, z coordinate data to ticket upon creation
- Add command .go ticket to teleport to the coordinates where the ticket was created
- Move InitTicketID() to the class constructor instead of at every LoadGMTickets call
- Minor code cleanup
--HG--
branch : trunk
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r-- | src/game/Level2.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 0377d299945..116fea3ac46 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -34,7 +34,7 @@ #include "SpellMgr.h" #include "PoolHandler.h" #include "AccountMgr.h" -//#include "GMTicketMgr.h" +#include "TicketMgr.h" #include "WaypointManager.h" #include "Util.h" #include <cctype> @@ -158,6 +158,48 @@ bool ChatHandler::HandleUnmuteCommand(const char* args) return true; } +bool ChatHandler::HandleGoTicketCommand(const char * args) +{ + if(!*args) + return false; + + char *cstrticket_id = strtok((char*)args, " "); + + if(!cstrticket_id) + return false; + + uint64 ticket_id = atoi(cstrticket_id); + if(!ticket_id) + return false; + + GM_Ticket *ticket = ticketmgr.GetGMTicket(ticket_id); + if(!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + float x, y, z; + int mapid; + + x = ticket->pos_x; + y = ticket->pos_y; + z = ticket->pos_z; + mapid = ticket->map; + + Player* _player = m_session->GetPlayer(); + if(_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, 1, 0); + return true; +} + bool ChatHandler::HandleGoTriggerCommand(const char* args) { Player* _player = m_session->GetPlayer(); |