aboutsummaryrefslogtreecommitdiff
path: root/src/game/Level1.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-08 18:47:27 -0500
committermegamage <none@none>2009-05-08 18:47:27 -0500
commite85e4c386b76e345cf615c743a3268408d72bffb (patch)
tree59cc055dd1497363fbaff40a8996287080a73af8 /src/game/Level1.cpp
parent6fbebffbafc123b4948ad23303743e2b10f2ded4 (diff)
[7796] Implement .lookup taxinode and .go taxinode commands. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src/game/Level1.cpp')
-rw-r--r--src/game/Level1.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 963e79f8829..832f2ada5e3 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -2753,6 +2753,51 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
return true;
}
+bool ChatHandler::HandleGoTaxinodeCommand(const char* args)
+{
+ Player* _player = m_session->GetPlayer();
+
+ if (!*args)
+ return false;
+
+ char* cNodeId = extractKeyFromLink((char*)args,"Htaxinode");
+ if (!cNodeId)
+ return false;
+
+ int32 i_nodeId = atoi(cNodeId);
+ if (!i_nodeId)
+ return false;
+
+ TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i_nodeId);
+ if (!node)
+ {
+ PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND,i_nodeId);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (node->x == 0.0f && node->y == 0.0f && node->z == 0.0f ||
+ !MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z))
+ {
+ PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->m_taxi.ClearTaxiDestinations();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ _player->TeleportTo(node->map_id, node->x, node->y, node->z, _player->GetOrientation());
+ return true;
+}
+
//teleport at coordinates
bool ChatHandler::HandleGoXYCommand(const char* args)
{