From fc11540c23dd88b6a5c9adc89f6d9afff33ee4b8 Mon Sep 17 00:00:00 2001 From: Shocker Date: Mon, 6 Jun 2011 16:07:07 +0300 Subject: Chat/Commands: Allow .go creature to teleport to the actual location of a creature if player is in the same map with it --- src/server/scripts/Commands/cs_go.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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)) { -- cgit v1.2.3