[7151] Startup log cleanup and beautification.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
begemot 2009-01-23 04:21:34 +03:00 committed by VladimirMangos
parent 34fc995ef9
commit 9bede601a2
10 changed files with 289 additions and 160 deletions

View file

@ -907,14 +907,30 @@ AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteria
void AchievementGlobalMgr::LoadAchievementCriteriaList() void AchievementGlobalMgr::LoadAchievementCriteriaList()
{ {
if(sAchievementCriteriaStore.GetNumRows()==0)
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outErrorDb(">> Loaded 0 achievement criteria.");
return;
}
barGoLink bar( sAchievementCriteriaStore.GetNumRows() );
for (uint32 entryId = 0; entryId<sAchievementCriteriaStore.GetNumRows(); entryId++) for (uint32 entryId = 0; entryId<sAchievementCriteriaStore.GetNumRows(); entryId++)
{ {
bar.step();
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
if(!criteria) if(!criteria)
continue; continue;
m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria); m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria);
} }
sLog.outString();
sLog.outErrorDb(">> Loaded 0 achievement criteria.",m_AchievementCriteriasByType->size());
} }
@ -923,15 +939,27 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement"); QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
if(!result) if(!result)
return; {
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
do do
{ {
bar.step();
Field *fields = result->Fetch(); Field *fields = result->Fetch();
m_allCompletedAchievements.insert(fields[0].GetUInt32()); m_allCompletedAchievements.insert(fields[0].GetUInt32());
} while(result->NextRow()); } while(result->NextRow());
delete result; delete result;
sLog.outString("");
sLog.outString(">> Loaded %u realm completed achievements.",m_allCompletedAchievements.size());
} }
void AchievementGlobalMgr::LoadRewards() void AchievementGlobalMgr::LoadRewards()
@ -948,7 +976,7 @@ void AchievementGlobalMgr::LoadRewards()
bar.step(); bar.step();
sLog.outString(""); sLog.outString("");
sLog.outString(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return; return;
} }
@ -956,9 +984,9 @@ void AchievementGlobalMgr::LoadRewards()
do do
{ {
Field *fields = result->Fetch();
bar.step(); bar.step();
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
if (!sAchievementStore.LookupEntry(entry)) if (!sAchievementStore.LookupEntry(entry))
{ {

View file

@ -111,49 +111,51 @@ void GameEvent::LoadFromDB()
if( !result ) if( !result )
{ {
mGameEvent.clear(); mGameEvent.clear();
sLog.outString(">> Table game_event is empty:"); sLog.outString(">> Table game_event is empty!");
sLog.outString(); sLog.outString();
return; return;
} }
uint32 count = 0; uint32 count = 0;
barGoLink bar( result->GetRowCount() );
do
{ {
++count; barGoLink bar( result->GetRowCount() );
Field *fields = result->Fetch(); do
bar.step();
uint16 event_id = fields[0].GetUInt16();
if(event_id==0)
{ {
sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id); ++count;
continue; Field *fields = result->Fetch();
}
GameEventData& pGameEvent = mGameEvent[event_id]; bar.step();
uint64 starttime = fields[1].GetUInt64();
pGameEvent.start = time_t(starttime);
uint64 endtime = fields[2].GetUInt64();
pGameEvent.end = time_t(endtime);
pGameEvent.occurence = fields[3].GetUInt32();
pGameEvent.length = fields[4].GetUInt32();
if(pGameEvent.length==0) // length>0 is validity check uint16 event_id = fields[0].GetUInt16();
{ if(event_id==0)
sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.",event_id); {
continue; sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id);
} continue;
}
pGameEvent.description = fields[5].GetCppString(); GameEventData& pGameEvent = mGameEvent[event_id];
uint64 starttime = fields[1].GetUInt64();
pGameEvent.start = time_t(starttime);
uint64 endtime = fields[2].GetUInt64();
pGameEvent.end = time_t(endtime);
pGameEvent.occurence = fields[3].GetUInt32();
pGameEvent.length = fields[4].GetUInt32();
} while( result->NextRow() ); if(pGameEvent.length==0) // length>0 is validity check
{
sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.",event_id);
continue;
}
sLog.outString(); pGameEvent.description = fields[5].GetCppString();
sLog.outString( ">> Loaded %u game events", count );
delete result; } while( result->NextRow() );
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u game events", count );
}
mGameEventCreatureGuids.resize(mGameEvent.size()*2-1); mGameEventCreatureGuids.resize(mGameEvent.size()*2-1);
// 1 2 // 1 2
@ -163,8 +165,8 @@ void GameEvent::LoadFromDB()
count = 0; count = 0;
if( !result ) if( !result )
{ {
barGoLink bar2(1); barGoLink bar(1);
bar2.step(); bar.step();
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u creatures in game events", count ); sLog.outString(">> Loaded %u creatures in game events", count );
@ -172,12 +174,12 @@ void GameEvent::LoadFromDB()
else else
{ {
barGoLink bar2( result->GetRowCount() ); barGoLink bar( result->GetRowCount() );
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
bar2.step(); bar.step();
uint32 guid = fields[0].GetUInt32(); uint32 guid = fields[0].GetUInt32();
int16 event_id = fields[1].GetInt16(); int16 event_id = fields[1].GetInt16();
@ -195,9 +197,10 @@ void GameEvent::LoadFromDB()
crelist.push_back(guid); crelist.push_back(guid);
} while( result->NextRow() ); } while( result->NextRow() );
delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u creatures in game events", count ); sLog.outString( ">> Loaded %u creatures in game events", count );
delete result;
} }
mGameEventGameobjectGuids.resize(mGameEvent.size()*2-1); mGameEventGameobjectGuids.resize(mGameEvent.size()*2-1);
@ -208,8 +211,8 @@ void GameEvent::LoadFromDB()
count = 0; count = 0;
if( !result ) if( !result )
{ {
barGoLink bar3(1); barGoLink bar(1);
bar3.step(); bar.step();
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u gameobjects in game events", count ); sLog.outString(">> Loaded %u gameobjects in game events", count );
@ -217,12 +220,12 @@ void GameEvent::LoadFromDB()
else else
{ {
barGoLink bar3( result->GetRowCount() ); barGoLink bar( result->GetRowCount() );
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
bar3.step(); bar.step();
uint32 guid = fields[0].GetUInt32(); uint32 guid = fields[0].GetUInt32();
int16 event_id = fields[1].GetInt16(); int16 event_id = fields[1].GetInt16();
@ -240,10 +243,10 @@ void GameEvent::LoadFromDB()
golist.push_back(guid); golist.push_back(guid);
} while( result->NextRow() ); } while( result->NextRow() );
delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u gameobjects in game events", count ); sLog.outString( ">> Loaded %u gameobjects in game events", count );
delete result;
} }
mGameEventModelEquip.resize(mGameEvent.size()); mGameEventModelEquip.resize(mGameEvent.size());
@ -256,8 +259,8 @@ void GameEvent::LoadFromDB()
count = 0; count = 0;
if( !result ) if( !result )
{ {
barGoLink bar3(1); barGoLink bar(1);
bar3.step(); bar.step();
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u model/equipment changes in game events", count ); sLog.outString(">> Loaded %u model/equipment changes in game events", count );
@ -265,12 +268,12 @@ void GameEvent::LoadFromDB()
else else
{ {
barGoLink bar3( result->GetRowCount() ); barGoLink bar( result->GetRowCount() );
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
bar3.step(); bar.step();
uint32 guid = fields[0].GetUInt32(); uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16(); uint16 event_id = fields[1].GetUInt16();
@ -300,10 +303,10 @@ void GameEvent::LoadFromDB()
equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet)); equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet));
} while( result->NextRow() ); } while( result->NextRow() );
delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u model/equipment changes in game events", count ); sLog.outString( ">> Loaded %u model/equipment changes in game events", count );
delete result;
} }
mGameEventQuests.resize(mGameEvent.size()); mGameEventQuests.resize(mGameEvent.size());
@ -313,8 +316,8 @@ void GameEvent::LoadFromDB()
count = 0; count = 0;
if( !result ) if( !result )
{ {
barGoLink bar3(1); barGoLink bar(1);
bar3.step(); bar.step();
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u quests additions in game events", count ); sLog.outString(">> Loaded %u quests additions in game events", count );
@ -322,12 +325,12 @@ void GameEvent::LoadFromDB()
else else
{ {
barGoLink bar3( result->GetRowCount() ); barGoLink bar( result->GetRowCount() );
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
bar3.step(); bar.step();
uint32 id = fields[0].GetUInt32(); uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32(); uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16(); uint16 event_id = fields[2].GetUInt16();
@ -343,10 +346,10 @@ void GameEvent::LoadFromDB()
questlist.push_back(QuestRelation(id, quest)); questlist.push_back(QuestRelation(id, quest));
} while( result->NextRow() ); } while( result->NextRow() );
delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u quests additions in game events", count ); sLog.outString( ">> Loaded %u quests additions in game events", count );
delete result;
} }
} }

View file

@ -356,8 +356,8 @@ void InstanceSaveManager::PackInstances()
bar.step(); bar.step();
} }
sLog.outString();
sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber ); sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber );
sLog.outString();
} }
void InstanceSaveManager::LoadResetTimes() void InstanceSaveManager::LoadResetTimes()

View file

@ -1460,18 +1460,36 @@ void ObjectMgr::LoadAuctions()
{ {
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse"); QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");
if( !result ) if( !result )
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
}
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 AuctionCount=fields[0].GetUInt32(); uint32 AuctionCount=fields[0].GetUInt32();
delete result; delete result;
if(!AuctionCount) if(!AuctionCount)
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
}
result = CharacterDatabase.Query( "SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit,location FROM auctionhouse" ); result = CharacterDatabase.Query( "SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit,location FROM auctionhouse" );
if( !result ) if( !result )
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
}
barGoLink bar( AuctionCount ); barGoLink bar( AuctionCount );
@ -1512,7 +1530,6 @@ void ObjectMgr::LoadAuctions()
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u auctions", AuctionCount ); sLog.outString( ">> Loaded %u auctions", AuctionCount );
sLog.outString();
} }
void ObjectMgr::LoadItemLocales() void ObjectMgr::LoadItemLocales()
@ -1946,7 +1963,13 @@ void ObjectMgr::LoadAuctionItems()
QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" ); QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" );
if( !result ) if( !result )
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Loaded 0 auction items");
return; return;
}
barGoLink bar( result->GetRowCount() ); barGoLink bar( result->GetRowCount() );
@ -1981,7 +2004,6 @@ void ObjectMgr::LoadAuctionItems()
++count; ++count;
} }
while( result->NextRow() ); while( result->NextRow() );
delete result; delete result;
sLog.outString(); sLog.outString();
@ -4540,14 +4562,27 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
// 0 1 2 3 4 5 6 7 8 9 // 0 1 2 3 4 5 6 7 8 9
QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" I64FMTD "'", (uint64)basetime); QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" I64FMTD "'", (uint64)basetime);
if ( !result ) if ( !result )
{
barGoLink bar(1);
bar.step();
sLog.outString("");
sLog.outString(">> Only expired mails (need to be return or delete) or DB table `mail` is empty.");
return; // any mails need to be returned or deleted return; // any mails need to be returned or deleted
Field *fields; }
//std::ostringstream delitems, delmails; //will be here for optimization //std::ostringstream delitems, delmails; //will be here for optimization
//bool deletemail = false, deleteitem = false; //bool deletemail = false, deleteitem = false;
//delitems << "DELETE FROM item_instance WHERE guid IN ( "; //delitems << "DELETE FROM item_instance WHERE guid IN ( ";
//delmails << "DELETE FROM mail WHERE id IN ( " //delmails << "DELETE FROM mail WHERE id IN ( "
barGoLink bar( result->GetRowCount() );
uint32 count = 0;
Field *fields;
do do
{ {
bar.step();
fields = result->Fetch(); fields = result->Fetch();
Mail *m = new Mail; Mail *m = new Mail;
m->messageID = fields[0].GetUInt32(); m->messageID = fields[0].GetUInt32();
@ -4613,8 +4648,12 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
//delmails << m->messageID << ", "; //delmails << m->messageID << ", ";
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", m->messageID); CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", m->messageID);
delete m; delete m;
++count;
} while (result->NextRow()); } while (result->NextRow());
delete result; delete result;
sLog.outString();
sLog.outString( ">> Loaded %u mails", count );
} }
void ObjectMgr::LoadQuestAreaTriggers() void ObjectMgr::LoadQuestAreaTriggers()
@ -6481,11 +6520,22 @@ void ObjectMgr::LoadGameObjectForQuests()
{ {
mGameObjectForQuestSet.clear(); // need for reload case mGameObjectForQuestSet.clear(); // need for reload case
if( !sGOStorage.MaxEntry )
{
barGoLink bar( 1 );
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 GameObjects for quests" );
return;
}
barGoLink bar( sGOStorage.MaxEntry - 1 );
uint32 count = 0; uint32 count = 0;
// collect GO entries for GO that must activated // collect GO entries for GO that must activated
for(uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry) for(uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry)
{ {
bar.step();
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry); GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry);
if(!goInfo) if(!goInfo)
continue; continue;
@ -6520,7 +6570,7 @@ void ObjectMgr::LoadGameObjectForQuests()
} }
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u GameObject for quests", count ); sLog.outString( ">> Loaded %u GameObjects for quests", count );
} }
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value)
@ -7012,11 +7062,10 @@ void ObjectMgr::LoadGameTele()
++count; ++count;
} }
while (result->NextRow()); while (result->NextRow());
delete result; delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %u game tele's", count ); sLog.outString( ">> Loaded %u GameTeleports", count );
} }
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@ -7186,7 +7235,7 @@ void ObjectMgr::LoadTrainerSpell()
delete result; delete result;
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded Trainers %d", count ); sLog.outString( ">> Loaded %d Trainers", count );
} }
void ObjectMgr::LoadVendors() void ObjectMgr::LoadVendors()
@ -7464,16 +7513,30 @@ void ObjectMgr::LoadScriptNames()
"SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' " "SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' "
"UNION " "UNION "
"SELECT DISTINCT(script) FROM instance_template WHERE script <> ''"); "SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
if(result)
if( !result )
{ {
do barGoLink bar( 1 );
{ bar.step();
m_scriptNames.push_back((*result)[0].GetString()); sLog.outString();
} while (result->NextRow()); sLog.outErrorDb(">> Loaded empty set of Script Names!");
delete result; return;
} }
barGoLink bar( result->GetRowCount() );
uint32 count = 0;
do
{
bar.step();
m_scriptNames.push_back((*result)[0].GetString());
++count;
} while (result->NextRow());
delete result;
std::sort(m_scriptNames.begin(), m_scriptNames.end()); std::sort(m_scriptNames.begin(), m_scriptNames.end());
sLog.outString();
sLog.outString( ">> Loaded %d Script Names", count );
} }
uint32 ObjectMgr::GetScriptId(const char *name) uint32 ObjectMgr::GetScriptId(const char *name)

View file

@ -84,7 +84,8 @@ bool LoadScriptingModule(char const* libName)
return false; return false;
} }
printf("Scripts Library %s was successfully loaded.\n",name.c_str()); sLog.outString();
sLog.outString( ">>> Scripts Library %s was successfully loaded.\n", name.c_str() );
//heh we are still there :P we have a valid library //heh we are still there :P we have a valid library
//we reload script //we reload script

View file

@ -1667,8 +1667,10 @@ void SpellMgr::LoadSpellLearnSkills()
// search auto-learned skills and add its to map also for use in unlearn spells/talents // search auto-learned skills and add its to map also for use in unlearn spells/talents
uint32 dbc_count = 0; uint32 dbc_count = 0;
barGoLink bar( sSpellStore.GetNumRows() );
for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell) for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
{ {
bar.step();
SpellEntry const* entry = sSpellStore.LookupEntry(spell); SpellEntry const* entry = sSpellStore.LookupEntry(spell);
if(!entry) if(!entry)
@ -2358,10 +2360,12 @@ void SpellMgr::LoadSkillLineAbilityMap()
{ {
mSkillLineAbilityMap.clear(); mSkillLineAbilityMap.clear();
barGoLink bar( sSkillLineAbilityStore.GetNumRows() );
uint32 count = 0; uint32 count = 0;
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); i++) for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); i++)
{ {
bar.step();
SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i); SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
if(!SkillInfo) if(!SkillInfo)
continue; continue;
@ -2371,7 +2375,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
} }
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u SkillLineAbility MultiMap", count); sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data", count);
} }
DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered) DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered)

View file

@ -57,97 +57,105 @@ void WaypointManager::Load()
uint32 total_behaviors = 0; uint32 total_behaviors = 0;
QueryResult *result = WorldDatabase.Query("SELECT id, COUNT(point) FROM creature_movement GROUP BY id"); QueryResult *result = WorldDatabase.Query("SELECT id, COUNT(point) FROM creature_movement GROUP BY id");
if(result)
if(!result)
{ {
barGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 paths. DB table `creature_movement` is empty." );
return;
} else {
total_paths = result->GetRowCount(); total_paths = result->GetRowCount();
barGoLink bar( total_paths ); barGoLink bar( total_paths );
do do
{ {
bar.step();
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 id = fields[0].GetUInt32(); uint32 id = fields[0].GetUInt32();
uint32 count = fields[1].GetUInt32(); uint32 count = fields[1].GetUInt32();
m_pathMap[id].resize(count); m_pathMap[id].resize(count);
total_nodes += count; total_nodes += count;
bar.step();
} while( result->NextRow() ); } while( result->NextRow() );
delete result; delete result;
sLog.outString();
sLog.outString( ">> Paths loaded" );
} }
result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement"); result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement");
if(result)
barGoLink bar( result->GetRowCount() );
do
{ {
barGoLink bar( result->GetRowCount() ); bar.step();
do Field *fields = result->Fetch();
uint32 point = fields[15].GetUInt32();
uint32 id = fields[14].GetUInt32();
WaypointPath &path = m_pathMap[id];
// the cleanup queries make sure the following is true
assert(point >= 1 && point <= path.size());
WaypointNode &node = path[point-1];
node.x = fields[0].GetFloat();
node.y = fields[1].GetFloat();
node.z = fields[2].GetFloat();
node.orientation = fields[3].GetFloat();
node.delay = fields[6].GetUInt16();
// prevent using invalid coordinates
if(!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation))
{ {
Field *fields = result->Fetch(); QueryResult *result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id);
uint32 point = fields[15].GetUInt32(); if(result1)
uint32 id = fields[14].GetUInt32(); sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y);
WaypointPath &path = m_pathMap[id];
// the cleanup queries make sure the following is true
assert(point >= 1 && point <= path.size());
WaypointNode &node = path[point-1];
node.x = fields[0].GetFloat();
node.y = fields[1].GetFloat();
node.z = fields[2].GetFloat();
node.orientation = fields[3].GetFloat();
node.delay = fields[6].GetUInt16();
// prevent using invalid coordinates
if(!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation))
{
QueryResult *result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id);
if(result1)
sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y);
else
sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
id, point, node.x, node.y);
MaNGOS::NormalizeMapCoord(node.x);
MaNGOS::NormalizeMapCoord(node.y);
if(result1)
{
node.z = MapManager::Instance ().GetBaseMap(result1->Fetch()[1].GetUInt32())->GetHeight(node.x, node.y, node.z);
delete result1;
}
WorldDatabase.PExecute("UPDATE creature_movement SET position_x = '%f', position_y = '%f', position_z = '%f' WHERE id = '%u' AND point = '%u'", node.x, node.y, node.z, id, point);
}
WaypointBehavior be;
be.model1 = fields[4].GetUInt32();
be.model2 = fields[5].GetUInt32();
be.emote = fields[7].GetUInt32();
be.spell = fields[8].GetUInt32();
for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
be.textid[i] = fields[9+i].GetUInt32();
if(be.textid[i])
{
if (be.textid[i] < MIN_DB_SCRIPT_STRING_ID || be.textid[i] >= MAX_DB_SCRIPT_STRING_ID)
{
sLog.outErrorDb( "Table `db_script_string` not have string id %u", be.textid[i]);
continue;
}
}
}
// save memory by not storing empty behaviors
if(!be.isEmpty())
{
node.behavior = new WaypointBehavior(be);
++total_behaviors;
}
else else
node.behavior = NULL; sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
bar.step(); id, point, node.x, node.y);
} while( result->NextRow() );
delete result; MaNGOS::NormalizeMapCoord(node.x);
} MaNGOS::NormalizeMapCoord(node.y);
sLog.outString( ">> Loaded %u paths, %u nodes and %u behaviors", total_paths, total_nodes, total_behaviors); if(result1)
{
node.z = MapManager::Instance ().GetBaseMap(result1->Fetch()[1].GetUInt32())->GetHeight(node.x, node.y, node.z);
delete result1;
}
WorldDatabase.PExecute("UPDATE creature_movement SET position_x = '%f', position_y = '%f', position_z = '%f' WHERE id = '%u' AND point = '%u'", node.x, node.y, node.z, id, point);
}
WaypointBehavior be;
be.model1 = fields[4].GetUInt32();
be.model2 = fields[5].GetUInt32();
be.emote = fields[7].GetUInt32();
be.spell = fields[8].GetUInt32();
for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
be.textid[i] = fields[9+i].GetUInt32();
if(be.textid[i])
{
if (be.textid[i] < MIN_DB_SCRIPT_STRING_ID || be.textid[i] >= MAX_DB_SCRIPT_STRING_ID)
{
sLog.outErrorDb( "Table `db_script_string` not have string id %u", be.textid[i]);
continue;
}
}
}
// save memory by not storing empty behaviors
if(!be.isEmpty())
{
node.behavior = new WaypointBehavior(be);
++total_behaviors;
}
else
node.behavior = NULL;
} while( result->NextRow() );
delete result;
sLog.outString();
sLog.outString( ">> Waypoints and behaviors loaded" );
sLog.outString();
sLog.outString( ">>> Loaded %u paths, %u nodes and %u behaviors", total_paths, total_nodes, total_behaviors);
} }
void WaypointManager::Cleanup() void WaypointManager::Cleanup()

View file

@ -1069,7 +1069,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Script Names..."); sLog.outString( "Loading Script Names...");
objmgr.LoadScriptNames(); objmgr.LoadScriptNames();
sLog.outString( "Loading InstanceTemplate" ); sLog.outString( "Loading InstanceTemplate..." );
objmgr.LoadInstanceTemplate(); objmgr.LoadInstanceTemplate();
sLog.outString( "Loading SkillLineAbilityMultiMap Data..." ); sLog.outString( "Loading SkillLineAbilityMultiMap Data..." );
@ -1082,6 +1082,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Packing instances..." ); sLog.outString( "Packing instances..." );
sInstanceSaveManager.PackInstances(); sInstanceSaveManager.PackInstances();
sLog.outString();
sLog.outString( "Loading Localization strings..." ); sLog.outString( "Loading Localization strings..." );
objmgr.LoadCreatureLocales(); objmgr.LoadCreatureLocales();
objmgr.LoadGameObjectLocales(); objmgr.LoadGameObjectLocales();
@ -1091,6 +1092,8 @@ void World::SetInitialWorldSettings()
objmgr.LoadPageTextLocales(); objmgr.LoadPageTextLocales();
objmgr.LoadNpcOptionLocales(); objmgr.LoadNpcOptionLocales();
objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) objmgr.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..." ); sLog.outString( "Loading Page Texts..." );
objmgr.LoadPageTexts(); objmgr.LoadPageTexts();
@ -1150,7 +1153,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadCreatures(); objmgr.LoadCreatures();
sLog.outString( "Loading Creature Addon Data..." ); sLog.outString( "Loading Creature Addon Data..." );
sLog.outString();
objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
sLog.outString( ">>> Creature Addon Data loaded" );
sLog.outString();
sLog.outString( "Loading Creature Respawn Data..." ); // must be after PackInstances() sLog.outString( "Loading Creature Respawn Data..." ); // must be after PackInstances()
objmgr.LoadCreatureRespawnTimes(); objmgr.LoadCreatureRespawnTimes();
@ -1162,7 +1168,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadGameobjectRespawnTimes(); objmgr.LoadGameobjectRespawnTimes();
sLog.outString( "Loading Game Event Data..."); sLog.outString( "Loading Game Event Data...");
sLog.outString();
gameeventmgr.LoadFromDB(); gameeventmgr.LoadFromDB();
sLog.outString( ">>> Game Event Data loaded" );
sLog.outString();
sLog.outString( "Loading Weather Data..." ); sLog.outString( "Loading Weather Data..." );
objmgr.LoadWeatherZoneChances(); objmgr.LoadWeatherZoneChances();
@ -1171,7 +1180,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables objmgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
sLog.outString( "Loading Quests Relations..." ); sLog.outString( "Loading Quests Relations..." );
sLog.outString();
objmgr.LoadQuestRelations(); // must be after quest load objmgr.LoadQuestRelations(); // must be after quest load
sLog.outString( ">>> Quests Relations loaded" );
sLog.outString();
sLog.outString( "Loading AreaTrigger definitions..." ); sLog.outString( "Loading AreaTrigger definitions..." );
objmgr.LoadAreaTriggerTeleports(); // must be after item template load objmgr.LoadAreaTriggerTeleports(); // must be after item template load
@ -1200,8 +1212,11 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading pet levelup spells..." ); sLog.outString( "Loading pet levelup spells..." );
spellmgr.LoadPetLevelupSpellMap(); spellmgr.LoadPetLevelupSpellMap();
sLog.outString( "Loading player Create Info & Level Stats..." ); sLog.outString( "Loading Player Create Info & Level Stats..." );
sLog.outString();
objmgr.LoadPlayerInfo(); objmgr.LoadPlayerInfo();
sLog.outString( ">>> Player Create Info & Level Stats loaded" );
sLog.outString();
sLog.outString( "Loading Exploration BaseXP Data..." ); sLog.outString( "Loading Exploration BaseXP Data..." );
objmgr.LoadExplorationBaseXP(); objmgr.LoadExplorationBaseXP();
@ -1219,7 +1234,10 @@ void World::SetInitialWorldSettings()
objmgr.LoadCorpses(); objmgr.LoadCorpses();
sLog.outString( "Loading Loot Tables..." ); sLog.outString( "Loading Loot Tables..." );
sLog.outString();
LoadLootTables(); LoadLootTables();
sLog.outString( ">>> Loot Tables loaded" );
sLog.outString();
sLog.outString( "Loading Skill Discovery Table..." ); sLog.outString( "Loading Skill Discovery Table..." );
LoadSkillDiscoveryTable(); LoadSkillDiscoveryTable();
@ -1230,22 +1248,22 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Skill Fishing base level requirements..." ); sLog.outString( "Loading Skill Fishing base level requirements..." );
objmgr.LoadFishingBaseSkillLevel(); objmgr.LoadFishingBaseSkillLevel();
sLog.outString( "Loading AchievementCriteriaList..." ); sLog.outString( "Loading Achievements..." );
sLog.outString();
achievementmgr.LoadAchievementCriteriaList(); achievementmgr.LoadAchievementCriteriaList();
sLog.outString( "Loading achievement rewards..." );
achievementmgr.LoadRewards(); achievementmgr.LoadRewards();
sLog.outString( "Loading achievement reward locale strings..." );
achievementmgr.LoadRewardLocales(); achievementmgr.LoadRewardLocales();
sLog.outString( "Loading completed achievements..." );
achievementmgr.LoadCompletedAchievements(); achievementmgr.LoadCompletedAchievements();
sLog.outString( ">>> Achievements 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();
objmgr.LoadAuctionItems(); objmgr.LoadAuctionItems();
objmgr.LoadAuctions(); objmgr.LoadAuctions();
sLog.outString( ">>> Auctions loaded" );
sLog.outString();
sLog.outString( "Loading Guilds..." ); sLog.outString( "Loading Guilds..." );
objmgr.LoadGuilds(); objmgr.LoadGuilds();
@ -1259,7 +1277,7 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading ReservedNames..." ); sLog.outString( "Loading ReservedNames..." );
objmgr.LoadReservedPlayersNames(); objmgr.LoadReservedPlayersNames();
sLog.outString( "Loading GameObject for quests..." ); sLog.outString( "Loading GameObjects for quests..." );
objmgr.LoadGameObjectForQuests(); objmgr.LoadGameObjectForQuests();
sLog.outString( "Loading BattleMasters..." ); sLog.outString( "Loading BattleMasters..." );
@ -1274,13 +1292,14 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Npc Options..." ); sLog.outString( "Loading Npc Options..." );
objmgr.LoadNpcOptions(); objmgr.LoadNpcOptions();
sLog.outString( "Loading vendors..." ); sLog.outString( "Loading Vendors..." );
objmgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate objmgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
sLog.outString( "Loading trainers..." ); sLog.outString( "Loading Trainers..." );
objmgr.LoadTrainerSpell(); // must be after load CreatureTemplate objmgr.LoadTrainerSpell(); // must be after load CreatureTemplate
sLog.outString( "Loading Waypoints..." ); sLog.outString( "Loading Waypoints..." );
sLog.outString();
WaypointMgr.Load(); WaypointMgr.Load();
sLog.outString( "Loading GM tickets..."); sLog.outString( "Loading GM tickets...");
@ -1292,11 +1311,14 @@ void World::SetInitialWorldSettings()
///- Load and initialize scripts ///- Load and initialize scripts
sLog.outString( "Loading Scripts..." ); sLog.outString( "Loading Scripts..." );
sLog.outString();
objmgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate objmgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
objmgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate objmgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sLog.outString( ">>> Scripts loaded" );
sLog.outString();
sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls
objmgr.LoadDbScriptStrings(); objmgr.LoadDbScriptStrings();
@ -1409,6 +1431,7 @@ void World::DetectDBCLang()
m_defaultDbcLocale = LocaleConstant(default_locale); m_defaultDbcLocale = LocaleConstant(default_locale);
sLog.outString("Using %s DBC Locale as default. All available DBC locales: %s",localeNames[m_defaultDbcLocale],availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str()); sLog.outString("Using %s DBC Locale as default. All available DBC locales: %s",localeNames[m_defaultDbcLocale],availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
sLog.outString();
} }
/// Update the World ! /// Update the World !

View file

@ -518,8 +518,7 @@ void LoadDBCStores(const std::string& dataPath)
} }
sLog.outString(); sLog.outString();
sLog.outString( ">> Loaded %d data stores", DBCFilesCount ); sLog.outString( ">> Initialized %d data stores", DBCFilesCount );
sLog.outString();
} }
SimpleFactionsList const* GetFactionTeamList(uint32 faction) SimpleFactionsList const* GetFactionTeamList(uint32 faction)

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 "7150" #define REVISION_NR "7151"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__