diff options
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r-- | src/game/Level2.cpp | 107 |
1 files changed, 75 insertions, 32 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index f79b8d9f04c..a52e94cc1f1 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -43,6 +43,7 @@ #include <fstream> #include <map> #include "GlobalEvents.h" +#include "TicketMgr.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand @@ -344,6 +345,48 @@ bool ChatHandler::HandleGoObjectCommand(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(); @@ -4054,36 +4097,36 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args) return true; } -bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 linkguid = (uint32) atoi((char*)args);
-
- Creature* pCreature = getSelectedCreature();
-
- if(!pCreature)
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if(!pCreature->GetDBTableGUIDLow())
- {
- PSendSysMessage("Selected creature isn't in `creature` table", pCreature->GetGUIDLow());
- SetSentErrorMessage(true);
- return false;
- }
-
- if(!objmgr.SetCreatureLinkedRespawn(pCreature->GetDBTableGUIDLow(), linkguid))
- {
- PSendSysMessage("Selected creature can't link with guid '%u'", linkguid);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, pCreature->GetDBTableGUIDLow());
- return true;
+bool ChatHandler::HandleNpcSetLinkCommand(const char* args) +{ + if (!*args) + return false; + + uint32 linkguid = (uint32) atoi((char*)args); + + Creature* pCreature = getSelectedCreature(); + + if(!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if(!pCreature->GetDBTableGUIDLow()) + { + PSendSysMessage("Selected creature isn't in `creature` table", pCreature->GetGUIDLow()); + SetSentErrorMessage(true); + return false; + } + + if(!objmgr.SetCreatureLinkedRespawn(pCreature->GetDBTableGUIDLow(), linkguid)) + { + PSendSysMessage("Selected creature can't link with guid '%u'", linkguid); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, pCreature->GetDBTableGUIDLow()); + return true; }
\ No newline at end of file |