Scripts/Commands: Add tele and event commands to commandscripts system and streamlining the command selection process to ensure the correct command is run when using abbreviations
Patch by Paradox (some cleanups was needed) --HG-- branch : trunk
This commit is contained in:
1 parent
72eff3dd0d
commit
c374f3245a
17 files changed
+586
-493
No files matched your search
@@ -3577,110 +3577,6 @@ bool ChatHandler::HandleChangeWeather(const char *args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTeleCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* me = GetSession()->GetPlayer();
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = extractGameTeleFromLink((char*)args);
|
||||
|
||||
if (!tele)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me->isInCombat())
|
||||
{
|
||||
SendSysMessage(LANG_YOU_IN_COMBAT);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
MapEntry const * map = sMapStore.LookupEntry(tele->mapId);
|
||||
if (!map || map->IsBattlegroundOrArena())
|
||||
{
|
||||
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (me->isInFlight())
|
||||
{
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
me->CleanupAfterTaxiFlight();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
me->SaveRecallPosition();
|
||||
|
||||
me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTeleAddCommand(const char * args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *player=m_session->GetPlayer();
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if (sObjectMgr.GetGameTele(name))
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameTele tele;
|
||||
tele.position_x = player->GetPositionX();
|
||||
tele.position_y = player->GetPositionY();
|
||||
tele.position_z = player->GetPositionZ();
|
||||
tele.orientation = player->GetOrientation();
|
||||
tele.mapId = player->GetMapId();
|
||||
tele.name = name;
|
||||
|
||||
if (sObjectMgr.AddGameTele(tele))
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TP_ADDED);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TP_ADDEDERR);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTeleDelCommand(const char * args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if (!sObjectMgr.DeleteGameTele(name))
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_COMMAND_TP_DELETED);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
|
||||
{
|
||||
Unit *unit = getSelectedUnit();
|
||||
|
||||
Reference in new issue
Block a user