Improve .gobject info to not use SQL query anymore. Thanks to silverice for suggesting.
--HG-- branch : trunk
This commit is contained in:
+8
-7
@@ -2126,7 +2126,7 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
|
|||||||
//show info of gameobject
|
//show info of gameobject
|
||||||
bool ChatHandler::HandleGOInfoCommand(const char* args)
|
bool ChatHandler::HandleGOInfoCommand(const char* args)
|
||||||
{
|
{
|
||||||
uint32 entry = atoi((char*)args);
|
uint32 entry = 0;
|
||||||
uint32 type = 0;
|
uint32 type = 0;
|
||||||
uint32 displayid = 0;
|
uint32 displayid = 0;
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -2136,16 +2136,17 @@ bool ChatHandler::HandleGOInfoCommand(const char* args)
|
|||||||
WorldObject * obj = getSelectedObject();
|
WorldObject * obj = getSelectedObject();
|
||||||
entry = obj->GetEntry();
|
entry = obj->GetEntry();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
entry = atoi((char*)args);
|
||||||
|
|
||||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT `type` `displayid` `name` FROM gameobject_template WHERE entry = %u", entry);
|
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
|
||||||
|
|
||||||
if(!result)
|
if(!goinfo)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Field * fields = result->Fetch();
|
type = goinfo->type;
|
||||||
type = fields[0].GetUInt32();
|
displayid = goinfo->displayId;
|
||||||
displayid = fields[1].GetUInt32();
|
name = goinfo->name;
|
||||||
name = fields[3].GetString();
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_GOINFO_ENTRY, entry);
|
PSendSysMessage(LANG_GOINFO_ENTRY, entry);
|
||||||
PSendSysMessage(LANG_GOINFO_TYPE, type);
|
PSendSysMessage(LANG_GOINFO_TYPE, type);
|
||||||
|
|||||||
Reference in New Issue
Block a user