mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Implemented gameobjects and creatures grouping (pools of them)
Groups (called pools) can be also member of any game event Signed-off-by: Neo2003 <neo.2003@hotmail.fr> Signed-off-by: freghar <compmancz@gmail.com>
This commit is contained in:
parent
1932ce1ae7
commit
7d8dc0eeef
14 changed files with 879 additions and 39 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include "World.h"
|
||||
#include "GameEvent.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "GMTicketMgr.h"
|
||||
#include "WaypointManager.h"
|
||||
|
|
@ -202,7 +203,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());
|
||||
}
|
||||
|
||||
|
|
@ -212,16 +213,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue