aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorShocker <shocker@freakz.ro>2011-06-06 16:07:07 +0300
committerShocker <shocker@freakz.ro>2011-06-06 16:07:07 +0300
commitfc11540c23dd88b6a5c9adc89f6d9afff33ee4b8 (patch)
tree319cfeadb86b749ebd5506c8242e606515e30835 /src/server/scripts
parenta1ed5628aa91288aa718b2effaa879c9bfa8ea27 (diff)
Chat/Commands: Allow .go creature to teleport to the actual location of a creature if player is in the same map with it
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_go.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 1dbc4236bff..fc46ffec497 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -123,7 +123,7 @@ public:
}
//sLog->outError("DEBUG: %s", whereClause.c_str());
- QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map FROM creature %s", whereClause.str().c_str());
+ QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map, guid, id FROM creature %s", whereClause.str().c_str());
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
@@ -139,6 +139,17 @@ public:
float z = fields[2].GetFloat();
float ort = fields[3].GetFloat();
int mapid = fields[4].GetUInt16();
+ uint32 guid = fields[5].GetUInt32();
+ uint32 id = fields[6].GetUInt32();
+
+ // if creature is in same map with caster go at its current location
+ if (Creature * creature = sObjectAccessor->GetCreature(*_player, MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT)))
+ {
+ x = creature->GetPositionX();
+ y = creature->GetPositionY();
+ z = creature->GetPositionZ();
+ ort = creature->GetOrientation();
+ }
if (!MapManager::IsValidMapCoord(mapid, x, y, z, ort))
{