fix(Core/Item): Reduce amount of excessive logging for enforeDBCAttributes (#16508)

bypass code block if enforceDBCAttributes is set to false
This commit is contained in:
Matthew M Dean
2023-09-17 12:00:37 -07:00
committed by GitHub
parent 1621da00da
commit bc6a744538

View File

@@ -2863,47 +2863,43 @@ void ObjectMgr::LoadItemTemplates()
if (dbcitem) if (dbcitem)
{ {
if (itemTemplate.Class != dbcitem->ClassID) if (enforceDBCAttributes)
{ {
LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); if (itemTemplate.Class != dbcitem->ClassID)
if (enforceDBCAttributes) {
LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID);
itemTemplate.Class = dbcitem->ClassID; itemTemplate.Class = dbcitem->ClassID;
} }
if (itemTemplate.SubClass != dbcitem->SubclassID) 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); LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID);
if (enforceDBCAttributes)
itemTemplate.SubClass = dbcitem->SubclassID; itemTemplate.SubClass = dbcitem->SubclassID;
} }
if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID)
{ {
LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass); LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclassID);
if (enforceDBCAttributes)
itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID;
} }
if (itemTemplate.Material != dbcitem->Material) if (itemTemplate.Material != dbcitem->Material)
{ {
LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material);
if (enforceDBCAttributes)
itemTemplate.Material = dbcitem->Material; itemTemplate.Material = dbcitem->Material;
} }
if (itemTemplate.InventoryType != dbcitem->InventoryType) if (itemTemplate.InventoryType != dbcitem->InventoryType)
{ {
LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType);
if (enforceDBCAttributes)
itemTemplate.InventoryType = dbcitem->InventoryType; itemTemplate.InventoryType = dbcitem->InventoryType;
} }
if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) 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); LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID);
if (enforceDBCAttributes)
itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID;
} }
if (itemTemplate.Sheath != dbcitem->SheatheType) if (itemTemplate.Sheath != dbcitem->SheatheType)
{ {
LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType);
if (enforceDBCAttributes)
itemTemplate.Sheath = dbcitem->SheatheType; itemTemplate.Sheath = dbcitem->SheatheType;
}
} }
} }
else else