[7494] Add gameobject entry shift-link support into .gobject target and .gobject add commands.

Now for example shift-link from .lookup object results can be used in .gobject add.
This commit is contained in:
VladimirMangos 2009-03-19 14:42:03 +03:00
parent a63977d767
commit f80d13066d
2 changed files with 13 additions and 6 deletions

View file

@ -416,13 +416,19 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList(); GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList();
if(*args) if(*args)
{ {
int32 id = atoi((char*)args); // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
if(!cId)
return false;
uint32 id = atol(cId);
if(id) if(id)
result = WorldDatabase.PQuery("SELECT 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 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, (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",
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),id); pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),id);
else else
{ {
std::string name = args; std::string name = cId;
WorldDatabase.escape_string(name); WorldDatabase.escape_string(name);
result = WorldDatabase.PQuery( result = WorldDatabase.PQuery(
"SELECT 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_ " "SELECT 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_ "
@ -704,11 +710,12 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
if (!*args) if (!*args)
return false; return false;
char* pParam1 = strtok((char*)args, " "); // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
if (!pParam1) char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
if(!cId)
return false; return false;
uint32 id = atoi((char*)pParam1); uint32 id = atol(cId);
if(!id) if(!id)
return false; return false;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7493" #define REVISION_NR "7494"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__