aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorp0wer <none@none>2010-03-02 17:40:26 -0600
committerp0wer <none@none>2010-03-02 17:40:26 -0600
commitfbe0f4ea2baa436102af5aa5c42f302690a84b23 (patch)
treeb2049cd0daaee930672cf21370da262d76dbe0b9 /src
parent70e77a796ddbf5457ef259627101e0b0f80e7a33 (diff)
Improve .gobject info to not use SQL query anymore. Thanks to silverice for suggesting.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Level2.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 56b28aabd9b..c7a9bcd89c6 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -2126,7 +2126,7 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
//show info of gameobject
bool ChatHandler::HandleGOInfoCommand(const char* args)
{
- uint32 entry = atoi((char*)args);
+ uint32 entry = 0;
uint32 type = 0;
uint32 displayid = 0;
std::string name;
@@ -2136,16 +2136,17 @@ bool ChatHandler::HandleGOInfoCommand(const char* args)
WorldObject * obj = getSelectedObject();
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;
- Field * fields = result->Fetch();
- type = fields[0].GetUInt32();
- displayid = fields[1].GetUInt32();
- name = fields[3].GetString();
+ type = goinfo->type;
+ displayid = goinfo->displayId;
+ name = goinfo->name;
PSendSysMessage(LANG_GOINFO_ENTRY, entry);
PSendSysMessage(LANG_GOINFO_TYPE, type);