Skip to content

Commit

Permalink
[10711] Check localization data for existance main table entres.
Browse files Browse the repository at this point in the history
Data will skipped for nonexistent entries, and reported with
disabled LogFilter_DbStrictedCheck filter.
  • Loading branch information
VladimirMangos authored and tomrus88 committed Nov 15, 2010
1 parent d3ec590 commit 595be39
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 54 deletions.
4 changes: 2 additions & 2 deletions src/game/Creature.cpp
Expand Up @@ -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;)
{
Expand Down
63 changes: 63 additions & 0 deletions src/game/ObjectMgr.cpp
Expand Up @@ -301,6 +301,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)
Expand Down Expand Up @@ -370,6 +376,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)
Expand Down Expand Up @@ -433,6 +460,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)
Expand Down Expand Up @@ -1772,6 +1805,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)
Expand Down Expand Up @@ -4389,6 +4428,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)
Expand Down Expand Up @@ -5160,6 +5205,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)
Expand Down Expand Up @@ -5348,6 +5399,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)
Expand Down Expand Up @@ -6424,6 +6481,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)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.cpp
Expand Up @@ -16093,7 +16093,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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/Unit.cpp
Expand Up @@ -2815,7 +2815,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;
}
*/
Expand Down
93 changes: 47 additions & 46 deletions src/game/World.cpp
Expand Up @@ -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();
Expand All @@ -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..." );
Expand All @@ -972,7 +960,7 @@ void World::SetInitialWorldSettings()
sSpellMgr.LoadSpellElixirs();

sLog.outString( "Loading Spell Learn Skills..." );
sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellChains
sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellChains

sLog.outString( "Loading Spell Learn Spells..." );
sSpellMgr.LoadSpellLearnSpells();
Expand Down Expand Up @@ -1014,7 +1002,7 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadCreatureModelRace();

sLog.outString( "Loading SpellsScriptTarget...");
sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo
sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo

sLog.outString( "Loading ItemRequiredTarget...");
sObjectMgr.LoadItemRequiredTarget();
Expand Down Expand Up @@ -1042,7 +1030,7 @@ void World::SetInitialWorldSettings()

sLog.outString( "Loading Creature Addon Data..." );
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();

Expand All @@ -1062,14 +1050,14 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadWeatherZoneChances();

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" );
sObjectMgr.LoadQuestPOI();

sLog.outString( "Loading Quests Relations..." );
sLog.outString();
sObjectMgr.LoadQuestRelations(); // must be after quest load
sObjectMgr.LoadQuestRelations(); // must be after quest load
sLog.outString( ">>> Quests Relations loaded" );
sLog.outString();

Expand All @@ -1086,10 +1074,10 @@ void World::SetInitialWorldSettings()
sSpellMgr.LoadSpellAreas();

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..." );
sObjectMgr.LoadQuestAreaTriggers(); // must be after LoadQuests
sObjectMgr.LoadQuestAreaTriggers(); // must be after LoadQuests

sLog.outString( "Loading Tavern Area Triggers..." );
sObjectMgr.LoadTavernAreaTriggers();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/game/debugcmds.cpp
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/shared/Log.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10710"
#define REVISION_NR "10711"
#endif // __REVISION_NR_H__

0 comments on commit 595be39

Please sign in to comment.