* 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
This commit is contained in:
Machiavelli committed 2009-04-14 17:29:54 +02:00
1 parent cebdaeb68e
commit 348339770e
8 files changed
+104 -45

No files matched your search

+75 -32
View File
@@ -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;
}