diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2015-07-19 03:16:30 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2015-07-19 03:16:30 +0200 |
commit | 2fcab335df301a98269e427c955418fd98c3fd86 (patch) | |
tree | 72a9f835a932b758e44f41e6947d2df371d9296a /src | |
parent | dd8f301e16f45cc1028cf40cbce4baf04c9e044f (diff) |
Core/Misc: Added new error logs for gameobject_questitem / creature_questitem tables
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 2b1fd4187b8..c8565e4d454 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -9269,8 +9269,8 @@ void ObjectMgr::LoadGameObjectQuestItems() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId FROM gameobject_questitem ORDER BY Idx ASC"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId, Idx FROM gameobject_questitem ORDER BY Idx ASC"); if (!result) { @@ -9284,7 +9284,22 @@ void ObjectMgr::LoadGameObjectQuestItems() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); - uint32 item = fields[1].GetUInt32(); + uint32 item = fields[1].GetUInt32(); + uint32 idx = fields[2].GetUInt32(); + + GameObjectTemplate const* goInfo = GetGameObjectTemplate(entry); + if (!goInfo) + { + TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has data for nonexistent gameobject (entry: %u, idx: %u), skipped", entry, idx); + continue; + }; + + ItemEntry const* db2Data = sItemStore.LookupEntry(item); + if (!db2Data) + { + TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has nonexistent item (ID: %u) in gameobject (entry: %u, idx: %u), skipped", item, entry, idx); + continue; + }; _gameObjectQuestItemStore[entry].push_back(item); @@ -9299,8 +9314,8 @@ void ObjectMgr::LoadCreatureQuestItems() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId FROM creature_questitem ORDER BY Idx ASC"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId, Idx FROM creature_questitem ORDER BY Idx ASC"); if (!result) { @@ -9314,7 +9329,22 @@ void ObjectMgr::LoadCreatureQuestItems() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); - uint32 item = fields[1].GetUInt32(); + uint32 item = fields[1].GetUInt32(); + uint32 idx = fields[2].GetUInt32(); + + CreatureTemplate const* creatureInfo = GetCreatureTemplate(entry); + if (!creatureInfo) + { + TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has data for nonexistent creature (entry: %u, idx: %u), skipped", entry, idx); + continue; + }; + + ItemEntry const* db2Data = sItemStore.LookupEntry(item); + if (!db2Data) + { + TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has nonexistent item (ID: %u) in creature (entry: %u, idx: %u), skipped", item, entry, idx); + continue; + }; _creatureQuestItemStore[entry].push_back(item); |