From 64f372fca3b6dcffc4384f9eec227033fb7a3f26 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Fri, 15 Mar 2024 20:09:10 -0300 Subject: [PATCH] chore. Avoid failures in the tests of custom items (#18519) * chore. Avoid failures in the tests of custom items * Report error but continue with the rest of the item * change LOG_ERROR for LOG_DEBUG --- src/server/game/Globals/ObjectMgr.cpp | 79 ++++++++++++++------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 12503649e..3eb3bdf2d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2868,49 +2868,50 @@ void ObjectMgr::LoadItemTemplates() // Checks ItemEntry const* dbcitem = sItemStore.LookupEntry(entry); - if (dbcitem) + if (!dbcitem) { - if (enforceDBCAttributes) + LOG_DEBUG("sql.sql", "Item (Entry: {}) does not exist in item.dbc! (not correct id?).", entry); + continue; + } + + if (enforceDBCAttributes) + { + if (itemTemplate.Class != dbcitem->ClassID) { - if (itemTemplate.Class != dbcitem->ClassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); - itemTemplate.Class = dbcitem->ClassID; - } - if (itemTemplate.SubClass != dbcitem->SubclassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID); - itemTemplate.SubClass = dbcitem->SubclassID; - } - if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclassID); - itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; - } - if (itemTemplate.Material != dbcitem->Material) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); - itemTemplate.Material = dbcitem->Material; - } - if (itemTemplate.InventoryType != dbcitem->InventoryType) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); - itemTemplate.InventoryType = dbcitem->InventoryType; - } - if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID); - itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; - } - if (itemTemplate.Sheath != dbcitem->SheatheType) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); - itemTemplate.Sheath = dbcitem->SheatheType; - } + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); + itemTemplate.Class = dbcitem->ClassID; + } + if (itemTemplate.SubClass != dbcitem->SubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID); + itemTemplate.SubClass = dbcitem->SubclassID; + } + if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclassID); + itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; + } + if (itemTemplate.Material != dbcitem->Material) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); + itemTemplate.Material = dbcitem->Material; + } + if (itemTemplate.InventoryType != dbcitem->InventoryType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); + itemTemplate.InventoryType = dbcitem->InventoryType; + } + if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID); + itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; + } + if (itemTemplate.Sheath != dbcitem->SheatheType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); + itemTemplate.Sheath = dbcitem->SheatheType; } } - else - LOG_ERROR("sql.sql", "Item (Entry: {}) does not exist in item.dbc! (not correct id?).", entry); if (itemTemplate.Quality >= MAX_ITEM_QUALITY) {