[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
// and if more high version not exist must be used lesser version
// for raid order different:
// 10 man normal version must be used instead not existed 10 man heroic version
// 25 man normal version must be used instead not existed 25 man heroic version
// 10 man normal version must be used instead nonexistent 10 man heroic version
// 25 man normal version must be used instead nonexistent 25 man heroic version
CreatureInfo const *cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetDifficulty()); diff > 0;)
{

View file

@ -299,6 +299,12 @@ void ObjectMgr::LoadCreatureLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -368,6 +374,27 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
uint16 menuId = fields[0].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)];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -431,6 +458,12 @@ void ObjectMgr::LoadPointOfInterestLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -1769,6 +1802,12 @@ void ObjectMgr::LoadItemLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -4377,6 +4416,12 @@ void ObjectMgr::LoadQuestLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -5147,6 +5192,12 @@ void ObjectMgr::LoadPageTextLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)
@ -5335,6 +5386,12 @@ void ObjectMgr::LoadNpcTextLocales()
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];
for(int i=1; i<MAX_LOCALE; ++i)
@ -6408,6 +6465,12 @@ void ObjectMgr::LoadGameObjectLocales()
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];
for(int i = 1; i < MAX_LOCALE; ++i)

View file

@ -16062,7 +16062,7 @@ void Player::_LoadItemLoot(QueryResult *result)
if (!item)
{
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;
}

View file

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

View file

@ -922,6 +922,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Initialize data stores...");
LoadDBCStores(m_dataPath);
DetectDBCLang();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
sLog.outString( "Loading Script Names...");
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.
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( "Loading Page Texts..." );
@ -1161,6 +1149,45 @@ void World::SetInitialWorldSettings()
sLog.outString( ">>> Achievements loaded" );
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
sLog.outString( "Loading Auctions..." );
sLog.outString();
@ -1193,32 +1220,6 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading GameTeleports..." );
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...");
sTicketMgr.LoadGMTickets();

View file

@ -706,7 +706,7 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
{
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)
{
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();
// 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)
{
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_PLAYER_MOVES = 0x0080, // player moves by grid/cell
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_COMBAT = 0x0800, // attack states/roll attack results/etc
LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events

View file

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