mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
*Implemented gameobjects and creatures grouping (pools of them)
*Groups (called pools) can be also member of any game event Author: Neo2003 --HG-- branch : trunk
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "World.h"
|
||||
#include "GameEvent.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "AccountMgr.h"
|
||||
//#include "GMTicketMgr.h"
|
||||
#include "WaypointManager.h"
|
||||
@@ -204,7 +205,7 @@ bool ChatHandler::HandleTargetObjectCommand(const char* args)
|
||||
|
||||
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, "
|
||||
"(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 1",
|
||||
"LEFT OUTER JOIN game_event_gameobject on gameobject.guid=game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
|
||||
m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),eventFilter.str().c_str());
|
||||
}
|
||||
|
||||
@@ -214,16 +215,34 @@ bool ChatHandler::HandleTargetObjectCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
uint32 lowguid = fields[0].GetUInt32();
|
||||
uint32 id = fields[1].GetUInt32();
|
||||
float x = fields[2].GetFloat();
|
||||
float y = fields[3].GetFloat();
|
||||
float z = fields[4].GetFloat();
|
||||
float o = fields[5].GetFloat();
|
||||
int mapid = fields[6].GetUInt16();
|
||||
bool found = false;
|
||||
float x, y, z, o;
|
||||
uint32 lowguid, id;
|
||||
uint16 mapid, pool_id;
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
lowguid = fields[0].GetUInt32();
|
||||
id = fields[1].GetUInt32();
|
||||
x = fields[2].GetFloat();
|
||||
y = fields[3].GetFloat();
|
||||
z = fields[4].GetFloat();
|
||||
o = fields[5].GetFloat();
|
||||
mapid = fields[6].GetUInt16();
|
||||
pool_id = poolhandler.IsPartOfAPool(lowguid, TYPEID_GAMEOBJECT);
|
||||
if (!pool_id || (pool_id && poolhandler.IsSpawnedObject(pool_id, lowguid, TYPEID_GAMEOBJECT)))
|
||||
found = true;
|
||||
} while( result->NextRow() && (!found) );
|
||||
|
||||
delete result;
|
||||
|
||||
if (!found)
|
||||
{
|
||||
PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObjectInfo const* goI = objmgr.GetGameObjectInfo(id);
|
||||
|
||||
if (!goI)
|
||||
|
||||
Reference in New Issue
Block a user