From 54f2f507cfb1588a92dc23945eda859b09c13397 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 3 Jun 2010 14:28:13 +0400 Subject: [PATCH] [10024] New LogFilter_DbStrictedCheck filter for DB devs It's enable by default (prevent show related output) but in disbled case allow show useful for DB developers different more stricted DB check output at server loading, including * Absent GO trap template referecned in some another GO template * Not set (0) unit class in creature_template * Absent disenchanting loot for items marked as disanchantble This all cases can or hard fixed in one step or show false cases y different reasons. That why filter active by default. --- src/game/ObjectMgr.cpp | 20 ++++++++++++++------ src/mangosd/mangosd.conf.dist.in | 11 +++++++++++ src/shared/Log.cpp | 1 + src/shared/Log.h | 10 +++++++++- src/shared/revision_nr.h | 2 +- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a59fc8857..ca0b9184e 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -671,7 +671,9 @@ void ObjectMgr::LoadCreatureTemplates() } // use below code for 0-checks for unit_class - if (/*!cInfo->unit_class ||*/cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) + if (!cInfo->unit_class) + ERROR_DB_STRICT_LOG("Creature (Entry: %u) not has proper unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class); + else if (((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class); if(cInfo->dmgschool >= MAX_SPELL_SCHOOL) @@ -2067,12 +2069,13 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) { - sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality); + ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality); const_cast(proto)->RequiredDisenchantSkill = -1; } else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) { - sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class); + // some wrong data in wdb for unused items + ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class); const_cast(proto)->RequiredDisenchantSkill = -1; } } @@ -2095,6 +2098,12 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->DisenchantID = 0; } } + else + { + // lot DB cases + if (proto->RequiredDisenchantSkill >= 0) + ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.",i); + } if(proto->FoodType >= MAX_PET_DIET) { @@ -5930,11 +5939,10 @@ inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32 sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", goInfo->id,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP); } - /* disable check for while (too many error reports baout not existed in trap templates else - sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.", + // too many error reports about not existed trap templates + ERROR_DB_STRICT_LOG("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.", goInfo->id,goInfo->type,N,dataN,dataN); - */ } inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N) diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 673ed2a12..f5ba807ed 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -246,6 +246,7 @@ CleanCharacterDB = 1 # LogFilter_TransportMoves # LogFilter_VisibilityChanges # LogFilter_Weather +# LogFilter_DbStrictedCheck # Log filters (active by default) # Default: 1 - not include with any log level # 0 - include in log if log level permit @@ -333,6 +334,16 @@ LogFilter_AchievementUpdates = 1 LogFilter_CreatureMoves = 1 LogFilter_TransportMoves = 1 LogFilter_VisibilityChanges = 1 +LogFilter_Weather = 1 +LogFilter_DbStrictedCheck = 1 +LogFilter_PeriodicAffects = 0 +LogFilter_PlayerMoves = 0 +LogFilter_SQLText = 0 +LogFilter_AIAndMovegens = 0 +LogFilter_PlayerStats = 0 +LogFilter_Damage = 0 +LogFilter_Combat = 0 +LogFilter_SpellCast = 0 WorldLogFile = "" WorldLogTimestamp = 0 DBErrorLogFile = "DBErrors.log" diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 05fe2525b..ebeee267d 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -47,6 +47,7 @@ LogFilterData logFilterData[LOG_FILTER_COUNT] = { "damage", "LogFilter_Damage", false }, { "combat", "LogFilter_Combat", false }, { "spell_cast", "LogFilter_SpellCast", false }, + { "db_stricted_check", "LogFilter_DbStrictedCheck", true }, }; enum LogType diff --git a/src/shared/Log.h b/src/shared/Log.h index 44dca6220..e1eb66a1b 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -49,9 +49,10 @@ enum LogFilters LOG_FILTER_DAMAGE = 0x0400, // Direct/Area damage trace LOG_FILTER_COMBAT = 0x0800, // attack states/roll attack results/etc LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events + LOG_FILTER_DB_STRICTED_CHECK = 0x2000, // stricted DB data checks output (with possible false reports) for DB devs }; -#define LOG_FILTER_COUNT 13 +#define LOG_FILTER_COUNT 14 struct LogFilterData { @@ -212,6 +213,13 @@ class Log : public MaNGOS::Singleton