aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2015-07-19 03:16:30 +0200
committerDDuarte <dnpd.dd@gmail.com>2015-07-26 01:21:13 +0100
commitfd26c3c87c5e75952d5af033a66c9a28c9af29b9 (patch)
treee18e05dd16ccfb6d258e634e64c688276a2ed359
parent4476f6c8671f279d78d5e784c501139917891ef2 (diff)
Core/Misc: Added new error logs for gameobject_questitem / creature_questitem tables
(cherry picked from commit 2fcab335df301a98269e427c955418fd98c3fd86)
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 9e923c8dffc..5699dba7cb4 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -9141,8 +9141,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)
{
@@ -9156,7 +9156,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);
@@ -9171,8 +9186,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)
{
@@ -9186,7 +9201,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);