From fbe0f4ea2baa436102af5aa5c42f302690a84b23 Mon Sep 17 00:00:00 2001 From: p0wer Date: Tue, 2 Mar 2010 17:40:26 -0600 Subject: Improve .gobject info to not use SQL query anymore. Thanks to silverice for suggesting. --HG-- branch : trunk --- src/game/Level2.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') 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); -- cgit v1.2.3