[10711] Check localization data for existance main table entres.

Data will skipped for nonexistent entries, and reported with
disabled LogFilter_DbStrictedCheck filter.
This commit is contained in:
VladimirMangos 2010-11-09 19:53:31 +03:00
parent 24eb9ec87a
commit 534ff29f15
8 changed files with 118 additions and 54 deletions

View file

@ -208,8 +208,8 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
// difficulties for dungeons/battleground ordered in normal way // difficulties for dungeons/battleground ordered in normal way
// and if more high version not exist must be used lesser version // and if more high version not exist must be used lesser version
// for raid order different: // for raid order different:
// 10 man normal version must be used instead not existed 10 man heroic version // 10 man normal version must be used instead nonexistent 10 man heroic version
// 25 man normal version must be used instead not existed 25 man heroic version // 25 man normal version must be used instead nonexistent 25 man heroic version
CreatureInfo const *cinfo = normalInfo; CreatureInfo const *cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetDifficulty()); diff > 0;) for (uint8 diff = uint8(GetMap()->GetDifficulty()); diff > 0;)
{ {

View file

@ -299,6 +299,12 @@ void ObjectMgr::LoadCreatureLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetCreatureTemplate(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_creature` has data for not existed creature entry %u, skipped.", entry);
continue;
}
CreatureLocale& data = mCreatureLocaleMap[entry]; CreatureLocale& data = mCreatureLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -368,6 +374,27 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
uint16 menuId = fields[0].GetUInt16(); uint16 menuId = fields[0].GetUInt16();
uint16 id = fields[1].GetUInt16(); uint16 id = fields[1].GetUInt16();
GossipMenuItemsMapBounds bounds = GetGossipMenuItemsMapBounds(menuId);
bool found = false;
if (bounds.first != bounds.second)
{
for (GossipMenuItemsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
if (itr->second.id == id)
{
found = true;
break;
}
}
}
if (!found)
{
ERROR_DB_STRICT_LOG("Table `locales_gossip_menu_option` has data for nonexistent gossip menu %u item %u, skipped.", menuId, id);
continue;
}
GossipMenuItemsLocale& data = mGossipMenuItemsLocaleMap[MAKE_PAIR32(menuId,id)]; GossipMenuItemsLocale& data = mGossipMenuItemsLocaleMap[MAKE_PAIR32(menuId,id)];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -431,6 +458,12 @@ void ObjectMgr::LoadPointOfInterestLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetPointOfInterest(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_points_of_interest` has data for nonexistent POI entry %u, skipped.", entry);
continue;
}
PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry]; PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -1769,6 +1802,12 @@ void ObjectMgr::LoadItemLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetItemPrototype(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_item` has data for nonexistent item entry %u, skipped.", entry);
continue;
}
ItemLocale& data = mItemLocaleMap[entry]; ItemLocale& data = mItemLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -4377,6 +4416,12 @@ void ObjectMgr::LoadQuestLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetQuestTemplate(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_quest` has data for nonexistent quest entry %u, skipped.", entry);
continue;
}
QuestLocale& data = mQuestLocaleMap[entry]; QuestLocale& data = mQuestLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -5147,6 +5192,12 @@ void ObjectMgr::LoadPageTextLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!sPageTextStore.LookupEntry<PageText>(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_page_text` has data for nonexistent page text entry %u, skipped.", entry);
continue;
}
PageTextLocale& data = mPageTextLocaleMap[entry]; PageTextLocale& data = mPageTextLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)
@ -5335,6 +5386,12 @@ void ObjectMgr::LoadNpcTextLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetGossipText(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_npc_text` has data for nonexistent gossip text entry %u, skipped.", entry);
continue;
}
NpcTextLocale& data = mNpcTextLocaleMap[entry]; NpcTextLocale& data = mNpcTextLocaleMap[entry];
for(int i=1; i<MAX_LOCALE; ++i) for(int i=1; i<MAX_LOCALE; ++i)
@ -6408,6 +6465,12 @@ void ObjectMgr::LoadGameObjectLocales()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!GetGameObjectInfo(entry))
{
ERROR_DB_STRICT_LOG("Table `locales_gameobject` has data for nonexistent gameobject entry %u, skipped.", entry);
continue;
}
GameObjectLocale& data = mGameObjectLocaleMap[entry]; GameObjectLocale& data = mGameObjectLocaleMap[entry];
for(int i = 1; i < MAX_LOCALE; ++i) for(int i = 1; i < MAX_LOCALE; ++i)

View file

@ -16062,7 +16062,7 @@ void Player::_LoadItemLoot(QueryResult *result)
if (!item) if (!item)
{ {
CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u'", item_guid); CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u'", item_guid);
sLog.outError("Player::_LoadItemLoot: Player %s has loot for not existed item (GUID: %u) in `item_loot`, deleted.", GetName(), item_guid ); sLog.outError("Player::_LoadItemLoot: Player %s has loot for nonexistent item (GUID: %u) in `item_loot`, deleted.", GetName(), item_guid );
continue; continue;
} }

View file

@ -2809,7 +2809,7 @@ bool Unit::IsSpellBlocked(Unit *pCaster, SpellEntry const *spellEntry, WeaponAtt
{ {
if (!(*i)->isAffectedOnSpell(spellProto)) if (!(*i)->isAffectedOnSpell(spellProto))
continue; continue;
if ((*i)->GetModifier()->m_miscvalue == ) if ((*i)->GetModifier()->m_miscvalue == ???)
return false; return false;
} }
*/ */

View file

@ -922,6 +922,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Initialize data stores..."); sLog.outString("Initialize data stores...");
LoadDBCStores(m_dataPath); LoadDBCStores(m_dataPath);
DetectDBCLang(); DetectDBCLang();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
sLog.outString( "Loading Script Names..."); sLog.outString( "Loading Script Names...");
sObjectMgr.LoadScriptNames(); sObjectMgr.LoadScriptNames();
@ -944,19 +945,6 @@ void World::SetInitialWorldSettings()
///- Init highest guids before any guid using table loading to prevent using not initialized guids in some code. ///- Init highest guids before any guid using table loading to prevent using not initialized guids in some code.
sObjectMgr.SetHighestGuids(); // must be after packing instances sObjectMgr.SetHighestGuids(); // must be after packing instances
sLog.outString();
sLog.outString( "Loading Localization strings..." );
sObjectMgr.LoadCreatureLocales();
sObjectMgr.LoadGameObjectLocales();
sObjectMgr.LoadItemLocales();
sObjectMgr.LoadQuestLocales();
sObjectMgr.LoadNpcTextLocales();
sObjectMgr.LoadPageTextLocales();
sObjectMgr.LoadGossipMenuItemsLocales();
sObjectMgr.LoadPointOfInterestLocales();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
sLog.outString( ">>> Localization strings loaded" );
sLog.outString(); sLog.outString();
sLog.outString( "Loading Page Texts..." ); sLog.outString( "Loading Page Texts..." );
@ -972,7 +960,7 @@ void World::SetInitialWorldSettings()
sSpellMgr.LoadSpellElixirs(); sSpellMgr.LoadSpellElixirs();
sLog.outString( "Loading Spell Learn Skills..." ); sLog.outString( "Loading Spell Learn Skills..." );
sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellChains sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellChains
sLog.outString( "Loading Spell Learn Spells..." ); sLog.outString( "Loading Spell Learn Spells..." );
sSpellMgr.LoadSpellLearnSpells(); sSpellMgr.LoadSpellLearnSpells();
@ -1014,7 +1002,7 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadCreatureModelRace(); sObjectMgr.LoadCreatureModelRace();
sLog.outString( "Loading SpellsScriptTarget..."); sLog.outString( "Loading SpellsScriptTarget...");
sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo
sLog.outString( "Loading ItemRequiredTarget..."); sLog.outString( "Loading ItemRequiredTarget...");
sObjectMgr.LoadItemRequiredTarget(); sObjectMgr.LoadItemRequiredTarget();
@ -1042,7 +1030,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Creature Addon Data..." ); sLog.outString( "Loading Creature Addon Data..." );
sLog.outString(); sLog.outString();
sObjectMgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() sObjectMgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
sLog.outString( ">>> Creature Addon Data loaded" ); sLog.outString( ">>> Creature Addon Data loaded" );
sLog.outString(); sLog.outString();
@ -1062,14 +1050,14 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadWeatherZoneChances(); sObjectMgr.LoadWeatherZoneChances();
sLog.outString( "Loading Quests..." ); sLog.outString( "Loading Quests..." );
sObjectMgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables sObjectMgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
sLog.outString( "Loading Quest POI" ); sLog.outString( "Loading Quest POI" );
sObjectMgr.LoadQuestPOI(); sObjectMgr.LoadQuestPOI();
sLog.outString( "Loading Quests Relations..." ); sLog.outString( "Loading Quests Relations..." );
sLog.outString(); sLog.outString();
sObjectMgr.LoadQuestRelations(); // must be after quest load sObjectMgr.LoadQuestRelations(); // must be after quest load
sLog.outString( ">>> Quests Relations loaded" ); sLog.outString( ">>> Quests Relations loaded" );
sLog.outString(); sLog.outString();
@ -1086,10 +1074,10 @@ void World::SetInitialWorldSettings()
sSpellMgr.LoadSpellAreas(); sSpellMgr.LoadSpellAreas();
sLog.outString( "Loading AreaTrigger definitions..." ); sLog.outString( "Loading AreaTrigger definitions..." );
sObjectMgr.LoadAreaTriggerTeleports(); // must be after item template load sObjectMgr.LoadAreaTriggerTeleports(); // must be after item template load
sLog.outString( "Loading Quest Area Triggers..." ); sLog.outString( "Loading Quest Area Triggers..." );
sObjectMgr.LoadQuestAreaTriggers(); // must be after LoadQuests sObjectMgr.LoadQuestAreaTriggers(); // must be after LoadQuests
sLog.outString( "Loading Tavern Area Triggers..." ); sLog.outString( "Loading Tavern Area Triggers..." );
sObjectMgr.LoadTavernAreaTriggers(); sObjectMgr.LoadTavernAreaTriggers();
@ -1161,6 +1149,45 @@ void World::SetInitialWorldSettings()
sLog.outString( ">>> Achievements loaded" ); sLog.outString( ">>> Achievements loaded" );
sLog.outString(); sLog.outString();
sLog.outString( "Loading Npc Text Id..." );
sObjectMgr.LoadNpcTextId(); // must be after load Creature and LoadGossipText
sLog.outString( "Loading Gossip scripts..." );
sObjectMgr.LoadGossipScripts(); // must be before gossip menu options
sLog.outString( "Loading Gossip menus..." );
sObjectMgr.LoadGossipMenu();
sLog.outString( "Loading Gossip menu options..." );
sObjectMgr.LoadGossipMenuItems();
sLog.outString( "Loading Vendors..." );
sObjectMgr.LoadVendorTemplates(); // must be after load ItemTemplate
sObjectMgr.LoadVendors(); // must be after load CreatureTemplate, VendorTemplate, and ItemTemplate
sLog.outString( "Loading Trainers..." );
sObjectMgr.LoadTrainerSpell(); // must be after load CreatureTemplate
sLog.outString( "Loading Waypoint scripts..." ); // before loading from creature_movement
sObjectMgr.LoadCreatureMovementScripts();
sLog.outString( "Loading Waypoints..." );
sLog.outString();
sWaypointMgr.Load();
///- Loading localization data
sLog.outString( "Loading Localization strings..." );
sObjectMgr.LoadCreatureLocales(); // must be after CreatureInfo loading
sObjectMgr.LoadGameObjectLocales(); // must be after GameobjectInfo loading
sObjectMgr.LoadItemLocales(); // must be after ItemPrototypes loading
sObjectMgr.LoadQuestLocales(); // must be after QuestTemplates loading
sObjectMgr.LoadNpcTextLocales(); // must be after LoadGossipText
sObjectMgr.LoadPageTextLocales(); // must be after PageText loading
sObjectMgr.LoadGossipMenuItemsLocales(); // must be after gossip menu items loading
sObjectMgr.LoadPointOfInterestLocales(); // must be after POI loading
sLog.outString( ">>> Localization strings loaded" );
sLog.outString();
///- Load dynamic data tables from the database ///- Load dynamic data tables from the database
sLog.outString( "Loading Auctions..." ); sLog.outString( "Loading Auctions..." );
sLog.outString(); sLog.outString();
@ -1193,32 +1220,6 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading GameTeleports..." ); sLog.outString( "Loading GameTeleports..." );
sObjectMgr.LoadGameTele(); sObjectMgr.LoadGameTele();
sLog.outString( "Loading Npc Text Id..." );
sObjectMgr.LoadNpcTextId(); // must be after load Creature and NpcText
sLog.outString( "Loading Gossip scripts..." );
sObjectMgr.LoadGossipScripts(); // must be before gossip menu options
sLog.outString( "Loading Gossip menus..." );
sObjectMgr.LoadGossipMenu();
sLog.outString( "Loading Gossip menu options..." );
sObjectMgr.LoadGossipMenuItems();
sLog.outString( "Loading Vendors..." );
sObjectMgr.LoadVendorTemplates(); // must be after load ItemTemplate
sObjectMgr.LoadVendors(); // must be after load CreatureTemplate, VendorTemplate, and ItemTemplate
sLog.outString( "Loading Trainers..." );
sObjectMgr.LoadTrainerSpell(); // must be after load CreatureTemplate
sLog.outString( "Loading Waypoint scripts..." ); // before loading from creature_movement
sObjectMgr.LoadCreatureMovementScripts();
sLog.outString( "Loading Waypoints..." );
sLog.outString();
sWaypointMgr.Load();
sLog.outString( "Loading GM tickets..."); sLog.outString( "Loading GM tickets...");
sTicketMgr.LoadGMTickets(); sTicketMgr.LoadGMTickets();

View file

@ -706,7 +706,7 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
{ {
ObjectGuid guid = target->GetObjectGuid(); ObjectGuid guid = target->GetObjectGuid();
// not allow access to not existed or critical for work field // not allow access to nonexistent or critical for work field
if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY) if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY)
{ {
PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount()); PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount());
@ -909,7 +909,7 @@ bool ChatHandler::HandlerDebugModValueHelper( Object* target, uint32 field, char
{ {
ObjectGuid guid = target->GetObjectGuid(); ObjectGuid guid = target->GetObjectGuid();
// not allow access to not existed or critical for work field // not allow access to nonexistent or critical for work field
if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY) if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY)
{ {
PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount()); PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount());

View file

@ -45,7 +45,7 @@ enum LogFilters
LOG_FILTER_SQL_TEXT = 0x0040, // raw SQL text send to DB engine LOG_FILTER_SQL_TEXT = 0x0040, // raw SQL text send to DB engine
LOG_FILTER_PLAYER_MOVES = 0x0080, // player moves by grid/cell LOG_FILTER_PLAYER_MOVES = 0x0080, // player moves by grid/cell
LOG_FILTER_PERIODIC_AFFECTS = 0x0100, // DoT/HoT apply trace LOG_FILTER_PERIODIC_AFFECTS = 0x0100, // DoT/HoT apply trace
LOG_FILTER_AI_AND_MOVEGENSS = 0x0200, // DoT/HoT apply trace LOG_FILTER_AI_AND_MOVEGENSS = 0x0200, // AI/movement generators debug output
LOG_FILTER_DAMAGE = 0x0400, // Direct/Area damage trace LOG_FILTER_DAMAGE = 0x0400, // Direct/Area damage trace
LOG_FILTER_COMBAT = 0x0800, // attack states/roll attack results/etc LOG_FILTER_COMBAT = 0x0800, // attack states/roll attack results/etc
LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10710" #define REVISION_NR "10711"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__