aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2015-04-05 20:55:49 +0200
committerRat <gmstreetrat@gmail.com>2015-04-05 20:55:49 +0200
commitf8c9784dbf9016a0f37d996a6f6c7ef3e4190c41 (patch)
treec3c28b178ec1c9ea6a0a3152e59f4c7dff2e94a1 /src
parent832c3d7a09f4e184e7156a73aafac6e58de2269b (diff)
Core/Commands: fixed crash in gobject target command
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 36876a9be34..7d356949d48 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -243,14 +243,14 @@ public:
uint32 objectId = atoul(id);
if (objectId)
- result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
+ result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, PhaseId, PhaseGroup, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), objectId);
else
{
std::string name = id;
WorldDatabase.EscapeString(name);
result = WorldDatabase.PQuery(
- "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
+ "SELECT guid, id, position_x, position_y, position_z, orientation, map, PhaseId, PhaseGroup, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
"FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_" " _CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
}
@@ -277,7 +277,7 @@ public:
else
eventFilter << ')';
- result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseMask, "
+ result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, PhaseId, PhaseGroup, "
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
"LEFT OUTER JOIN game_event_gameobject on gameobject.guid = game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
handler->GetSession()->GetPlayer()->GetPositionX(), handler->GetSession()->GetPlayer()->GetPositionY(), handler->GetSession()->GetPlayer()->GetPositionZ(),
@@ -293,21 +293,22 @@ public:
bool found = false;
float x, y, z, o;
ObjectGuid::LowType guidLow;
- uint32 id, phase;
+ uint32 id, phaseId, phaseGroup;
uint16 mapId;
uint32 poolId;
do
{
Field* fields = result->Fetch();
- guidLow = fields[0].GetUInt64();
- id = fields[1].GetUInt32();
- x = fields[2].GetFloat();
- y = fields[3].GetFloat();
- z = fields[4].GetFloat();
- o = fields[5].GetFloat();
- mapId = fields[6].GetUInt16();
- phase = fields[7].GetUInt32();
+ guidLow = fields[0].GetUInt64();
+ id = fields[1].GetUInt32();
+ x = fields[2].GetFloat();
+ y = fields[3].GetFloat();
+ z = fields[4].GetFloat();
+ o = fields[5].GetFloat();
+ mapId = fields[6].GetUInt16();
+ phaseId = fields[7].GetUInt32();
+ phaseGroup = fields[8].GetUInt32();
poolId = sPoolMgr->IsPartOfAPool<GameObject>(guidLow);
if (!poolId || sPoolMgr->IsSpawnedObject<GameObject>(guidLow))
found = true;
@@ -329,7 +330,7 @@ public:
GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(mapId, id, guidLow));
- handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);
+ handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phaseId, phaseGroup);
if (target)
{