aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2011_08_21_00_world_command.sql3
-rw-r--r--src/server/scripts/Commands/cs_go.cpp87
2 files changed, 34 insertions, 56 deletions
diff --git a/sql/updates/world/2011_08_21_00_world_command.sql b/sql/updates/world/2011_08_21_00_world_command.sql
new file mode 100644
index 00000000000..f0b91cd3dfe
--- /dev/null
+++ b/sql/updates/world/2011_08_21_00_world_command.sql
@@ -0,0 +1,3 @@
+DELETE FROM `command` WHERE `name` = 'go xyz';
+INSERT INTO `command` VALUES
+('go xyz',1,'Syntax: .go xyz #x #y [#z [#mapid [#orientation]]]\r\n\r\nTeleport player to point with (#x,#y,#z) coordinates at map #mapid with orientation #orientation. If z is not provided, ground/water level will be used. If mapid is not provided, the current map will be used. If #orientation is not provided, the current orientation will be used.');
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 1fa697f3f44..a551e8293d5 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -44,7 +44,6 @@ public:
{ "taxinode", SEC_MODERATOR, false, &HandleGoTaxinodeCommand, "", NULL },
{ "trigger", SEC_MODERATOR, false, &HandleGoTriggerCommand, "", NULL },
{ "zonexy", SEC_MODERATOR, false, &HandleGoZoneXYCommand, "", NULL },
- { "xy", SEC_MODERATOR, false, &HandleGoXYCommand, "", NULL },
{ "xyz", SEC_MODERATOR, false, &HandleGoXYZCommand, "", NULL },
{ "ticket", SEC_MODERATOR, false, &HandleGoTicketCommand, "", NULL },
{ "", SEC_MODERATOR, false, &HandleGoXYZCommand, "", NULL },
@@ -477,8 +476,8 @@ public:
return true;
}
- //teleport at coordinates
- static bool HandleGoXYCommand(ChatHandler* handler, const char* args)
+ //teleport at coordinates, including Z and orientation
+ static bool HandleGoXYZCommand(ChatHandler* handler, const char* args)
{
if (!*args)
return false;
@@ -487,75 +486,51 @@ public:
char* px = strtok((char*)args, " ");
char* py = strtok(NULL, " ");
+ char* pz = strtok(NULL, " ");
char* pmapid = strtok(NULL, " ");
+ char* port = strtok(NULL, " ");
if (!px || !py)
return false;
float x = (float)atof(px);
float y = (float)atof(py);
+ float z;
+ float ort;
uint32 mapid;
+
if (pmapid)
mapid = (uint32)atoi(pmapid);
else
mapid = _player->GetMapId();
-
- if (!MapManager::IsValidMapCoord(mapid, x, y))
- {
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // stop flight if need
- if (_player->isInFlight())
+
+ if( port )
+ ort = (float)atof(port);
+ else
+ ort = _player->GetOrientation();
+
+ if( pz )
{
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
+ if (!MapManager::IsValidMapCoord(mapid, x, y, z))
+ {
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ z = (float)atof(pz);
}
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- Map const *map = sMapMgr->CreateBaseMap(mapid);
- float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
-
- _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
-
- return true;
- }
- //teleport at coordinates, including Z
- static bool HandleGoXYZCommand(ChatHandler* handler, const char* args)
- {
- if (!*args)
- return false;
-
- Player* _player = handler->GetSession()->GetPlayer();
-
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
- char* pmapid = strtok(NULL, " ");
-
- if (!px || !py || !pz)
- return false;
-
- float x = (float)atof(px);
- float y = (float)atof(py);
- float z = (float)atof(pz);
- uint32 mapid;
- if (pmapid)
- mapid = (uint32)atoi(pmapid);
else
- mapid = _player->GetMapId();
-
- if (!MapManager::IsValidMapCoord(mapid, x, y, z))
{
- handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
- handler->SetSentErrorMessage(true);
- return false;
+ if (!MapManager::IsValidMapCoord(mapid, x, y))
+ {
+ handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapid);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ Map const *map = sMapMgr->CreateBaseMap(mapid);
+ z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
}
-
+
// stop flight if need
if (_player->isInFlight())
{
@@ -566,7 +541,7 @@ public:
else
_player->SaveRecallPosition();
- _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
+ _player->TeleportTo(mapid, x, y, z, ort);
return true;
}