[7493] Move .gobject functions in one place, update/fix security levels in code and mangos.sql.

This commit is contained in:
VladimirMangos 2009-03-19 12:46:01 +03:00
parent bfa67880f2
commit a63977d767
7 changed files with 557 additions and 547 deletions

View file

@ -2368,47 +2368,6 @@ bool ChatHandler::HandleListObjectCommand(const char* args)
return true;
}
bool ChatHandler::HandleGameObjectNearCommand(const char* args)
{
float distance = (!*args) ? 10 : atol(args);
uint32 count = 0;
Player* pl = m_session->GetPlayer();
QueryResult *result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, "
"(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ "
"FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_",
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),
pl->GetMapId(),pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),distance*distance);
if (result)
{
do
{
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
float z = fields[4].GetFloat();
int mapid = fields[5].GetUInt16();
GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry);
if(!gInfo)
continue;
PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid);
++count;
} while (result->NextRow());
delete result;
}
PSendSysMessage(LANG_COMMAND_NEAROBJMESSAGE,distance,count);
return true;
}
bool ChatHandler::HandleListCreatureCommand(const char* args)
{
if(!*args)