aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorleak <none@none>2010-12-19 17:06:33 +0100
committerleak <none@none>2010-12-19 17:06:33 +0100
commitfd694cd2324a7e2d61d833a78024b68fd3605053 (patch)
tree2fb48411eb25ff627b56786b66c96dd646a30651 /src/server
parent9c35e10444b24848e0a909c46727ac2a312ab5de (diff)
Streamlining loading functions for server startup
- Added a couple of timer outputs - Improved code consistency between loading functions - Progess bars should look and behave similar on all OS now (sLog.outString() is not needed anymore to replace the progress bar in log files) --HG-- branch : trunk
Diffstat (limited to 'src/server')
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp1204
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp28
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp61
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.cpp19
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp21
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp29
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp14
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp13
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp4
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp15
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp34
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp6
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp30
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp368
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp1783
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h2
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp5
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp256
-rwxr-xr-xsrc/server/game/Loot/LootMgr.h4
-rwxr-xr-xsrc/server/game/Movement/Waypoints/WaypointManager.cpp23
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp70
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.h3
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp36
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp8
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp286
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp13
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp105
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp137
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp14
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp21
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp5
-rwxr-xr-xsrc/server/game/Weather/WeatherMgr.cpp8
-rwxr-xr-xsrc/server/game/World/World.cpp62
-rwxr-xr-xsrc/server/shared/Utilities/ProgressBar.cpp32
-rwxr-xr-xsrc/server/shared/Utilities/ProgressBar.h1
-rwxr-xr-xsrc/server/shared/Utilities/Timer.h5
36 files changed, 2542 insertions, 2183 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index c9b75ddb669..d27c6f4b9ac 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -30,6 +30,8 @@
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
{
+ uint32 oldMSTime = getMSTime();
+
// Drop Existing Text Map, only done once and we are ready to add data from multiple sources.
m_CreatureEventAI_TextMap.clear();
@@ -39,128 +41,129 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// Gather Additional data from EventAI Texts
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
- sLog.outString("Loading EventAI Texts additional data...");
- if (result)
+ if (!result)
{
- barGoLink bar(result->GetRowCount());
- uint32 count = 0;
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+ sLog.outString();
+ return;
+ }
- do
- {
- bar.step();
- Field* fields = result->Fetch();
- StringTextData temp;
-
- int32 i = fields[0].GetInt32();
- temp.SoundId = fields[1].GetInt32();
- temp.Type = fields[2].GetInt32();
- temp.Language = fields[3].GetInt32();
- temp.Emote = fields[4].GetInt32();
-
- // range negative
- if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
- {
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
- continue;
- }
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- // range negative (don't must be happen, loaded from same table)
- if (!sObjectMgr.GetTrinityStringLocale(i))
- {
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i);
- continue;
- }
+ do
+ {
+ bar.step();
+ Field* fields = result->Fetch();
+ StringTextData temp;
- if (temp.SoundId)
- {
- if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId);
- }
+ int32 i = fields[0].GetInt32();
+ temp.SoundId = fields[1].GetInt32();
+ temp.Type = fields[2].GetInt32();
+ temp.Language = fields[3].GetInt32();
+ temp.Emote = fields[4].GetInt32();
+
+ // range negative
+ if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
+ {
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
+ continue;
+ }
- if (!GetLanguageDescByID(temp.Language))
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
+ // range negative (don't must be happen, loaded from same table)
+ if (!sObjectMgr.GetTrinityStringLocale(i))
+ {
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i);
+ continue;
+ }
- if (temp.Type > CHAT_TYPE_ZONE_YELL)
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
+ if (temp.SoundId)
+ {
+ if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId);
+ }
- if (temp.Emote)
- {
- if (!sEmotesStore.LookupEntry(temp.Emote))
- sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote);
- }
+ if (!GetLanguageDescByID(temp.Language))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
- m_CreatureEventAI_TextMap[i] = temp;
- ++count;
- } while (result->NextRow());
+ if (temp.Type > CHAT_TYPE_ZONE_YELL)
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
- sLog.outString();
- sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
- }
- else
- {
- barGoLink bar(1);
- bar.step();
- sLog.outString();
- sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+ if (temp.Emote)
+ {
+ if (!sEmotesStore.LookupEntry(temp.Emote))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote);
+ }
+
+ m_CreatureEventAI_TextMap[i] = temp;
+ ++count;
}
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
{
+ uint32 oldMSTime = getMSTime();
//Drop Existing EventSummon Map
m_CreatureEventAI_Summon_Map.clear();
// Gather additional data for EventAI
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
- if (result)
+
+ if (!result)
{
- barGoLink bar(result->GetRowCount());
- uint32 Count = 0;
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+ sLog.outString();
+ return;
+ }
- do
- {
- bar.step();
- Field *fields = result->Fetch();
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- CreatureEventAI_Summon temp;
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
- uint32 i = fields[0].GetUInt32();
- temp.position_x = fields[1].GetFloat();
- temp.position_y = fields[2].GetFloat();
- temp.position_z = fields[3].GetFloat();
- temp.orientation = fields[4].GetFloat();
- temp.SpawnTimeSecs = fields[5].GetUInt32();
+ CreatureEventAI_Summon temp;
- if (!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
- {
- sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation);
- continue;
- }
+ uint32 i = fields[0].GetUInt32();
+ temp.position_x = fields[1].GetFloat();
+ temp.position_y = fields[2].GetFloat();
+ temp.position_z = fields[3].GetFloat();
+ temp.orientation = fields[4].GetFloat();
+ temp.SpawnTimeSecs = fields[5].GetUInt32();
- //Add to map
- m_CreatureEventAI_Summon_Map[i] = temp;
- ++Count;
- } while (result->NextRow());
+ if (!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
+ {
+ sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation);
+ continue;
+ }
- sLog.outString();
- sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
- }
- else
- {
- barGoLink bar(1);
- bar.step();
- sLog.outString();
- sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+ //Add to map
+ m_CreatureEventAI_Summon_Map[i] = temp;
+ ++count;
}
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
+ uint32 oldMSTime = getMSTime();
+
//Drop Existing EventAI List
m_CreatureEventAI_Event_Map.clear();
@@ -171,139 +174,93 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
"action2_type, action2_param1, action2_param2, action2_param3, "
"action3_type, action3_param1, action3_param2, action3_param3 "
"FROM creature_ai_scripts");
- if (result)
- {
- barGoLink bar(result->GetRowCount());
- uint32 Count = 0;
- do
- {
- bar.step();
- Field *fields = result->Fetch();
-
- CreatureEventAI_Event temp;
- temp.event_id = EventAI_Type(fields[0].GetUInt32());
- uint32 i = temp.event_id;
+ if (!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+ sLog.outString();
+ return;
+ }
- temp.creature_id = fields[1].GetUInt32();
- uint32 creature_id = temp.creature_id;
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- uint32 e_type = fields[2].GetUInt32();
- //Report any errors in event
- if (e_type >= EVENT_T_END)
- {
- sLog.outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i,e_type);
- continue;
- }
- temp.event_type = EventAI_Type(e_type);
-
- temp.event_inverse_phase_mask = fields[3].GetUInt32();
- temp.event_chance = fields[4].GetUInt8();
- temp.event_flags = fields[5].GetUInt8();
- temp.raw.param1 = fields[6].GetUInt32();
- temp.raw.param2 = fields[7].GetUInt32();
- temp.raw.param3 = fields[8].GetUInt32();
- temp.raw.param4 = fields[9].GetUInt32();
-
- //Creature does not exist in database
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
- {
- sLog.outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id);
- continue;
- }
-
- //No chance of this event occuring
- if (temp.event_chance == 0)
- sLog.outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
- //Chance above 100, force it to be 100
- else if (temp.event_chance > 100)
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
- temp.event_chance = 100;
- }
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
- //Individual event checks
- switch (temp.event_type)
- {
- case EVENT_T_TIMER:
- case EVENT_T_TIMER_OOC:
- if (temp.timer.initialMax < temp.timer.initialMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
- if (temp.timer.repeatMax < temp.timer.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_HP:
- case EVENT_T_MANA:
- case EVENT_T_TARGET_HP:
- case EVENT_T_TARGET_MANA:
- if (temp.percent_range.percentMax > 100)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
-
- if (temp.percent_range.percentMax <= temp.percent_range.percentMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
-
- if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax)
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
- temp.event_flags &= ~EFLAG_REPEATABLE;
- }
- break;
- case EVENT_T_SPELLHIT:
- if (temp.spell_hit.spellId)
- {
- SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
- if (!pSpell)
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
- continue;
- }
+ CreatureEventAI_Event temp;
+ temp.event_id = EventAI_Type(fields[0].GetUInt32());
+ uint32 i = temp.event_id;
- if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask)
- sLog.outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
- }
+ temp.creature_id = fields[1].GetUInt32();
+ uint32 creature_id = temp.creature_id;
- if (!temp.spell_hit.schoolMask)
- sLog.outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ uint32 e_type = fields[2].GetUInt32();
+ //Report any errors in event
+ if (e_type >= EVENT_T_END)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i,e_type);
+ continue;
+ }
+ temp.event_type = EventAI_Type(e_type);
+
+ temp.event_inverse_phase_mask = fields[3].GetUInt32();
+ temp.event_chance = fields[4].GetUInt8();
+ temp.event_flags = fields[5].GetUInt8();
+ temp.raw.param1 = fields[6].GetUInt32();
+ temp.raw.param2 = fields[7].GetUInt32();
+ temp.raw.param3 = fields[8].GetUInt32();
+ temp.raw.param4 = fields[9].GetUInt32();
+
+ //Creature does not exist in database
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id);
+ continue;
+ }
+
+ //No chance of this event occuring
+ if (temp.event_chance == 0)
+ sLog.outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
+ //Chance above 100, force it to be 100
+ else if (temp.event_chance > 100)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
+ temp.event_chance = 100;
+ }
- if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_RANGE:
- if (temp.range.maxDist < temp.range.minDist)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
- if (temp.range.repeatMax < temp.range.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_OOC_LOS:
- if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_SPAWNED:
- switch(temp.spawned.condition)
- {
- case SPAWNED_EVENT_ALWAY:
- break;
- case SPAWNED_EVENT_MAP:
- if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
- sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
- break;
- case SPAWNED_EVENT_ZONE:
- if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
- sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
- default:
- sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
- break;
- }
- break;
- case EVENT_T_FRIENDLY_HP:
- if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_FRIENDLY_IS_CC:
- if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_FRIENDLY_MISSING_BUFF:
+ //Individual event checks
+ switch (temp.event_type)
+ {
+ case EVENT_T_TIMER:
+ case EVENT_T_TIMER_OOC:
+ if (temp.timer.initialMax < temp.timer.initialMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
+ if (temp.timer.repeatMax < temp.timer.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_HP:
+ case EVENT_T_MANA:
+ case EVENT_T_TARGET_HP:
+ case EVENT_T_TARGET_MANA:
+ if (temp.percent_range.percentMax > 100)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
+
+ if (temp.percent_range.percentMax <= temp.percent_range.percentMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
+
+ if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
+ temp.event_flags &= ~EFLAG_REPEATABLE;
+ }
+ break;
+ case EVENT_T_SPELLHIT:
+ if (temp.spell_hit.spellId)
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
if (!pSpell)
@@ -311,456 +268,503 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
- if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
+
+ if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask)
+ sLog.outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
}
- case EVENT_T_KILL:
- if (temp.kill.repeatMax < temp.kill.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_TARGET_CASTING:
- if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_SUMMONED_UNIT:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.summon_unit.creatureId))
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
- if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
- case EVENT_T_QUEST_ACCEPT:
- case EVENT_T_QUEST_COMPLETE:
- if (!sObjectMgr.GetQuestTemplate(temp.quest.questId))
- sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
- sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
- continue;
- case EVENT_T_AGGRO:
- case EVENT_T_DEATH:
- case EVENT_T_EVADE:
- case EVENT_T_REACHED_HOME:
+ if (!temp.spell_hit.schoolMask)
+ sLog.outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
+
+ if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_RANGE:
+ if (temp.range.maxDist < temp.range.minDist)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
+ if (temp.range.repeatMax < temp.range.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_OOC_LOS:
+ if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_SPAWNED:
+ switch(temp.spawned.condition)
{
- if (temp.event_flags & EFLAG_REPEATABLE)
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
- temp.event_flags &= ~EFLAG_REPEATABLE;
- }
-
- break;
+ case SPAWNED_EVENT_ALWAY:
+ break;
+ case SPAWNED_EVENT_MAP:
+ if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ break;
+ case SPAWNED_EVENT_ZONE:
+ if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ default:
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
+ break;
}
+ break;
+ case EVENT_T_FRIENDLY_HP:
+ if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_FRIENDLY_IS_CC:
+ if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_FRIENDLY_MISSING_BUFF:
+ {
+ SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
+ if (!pSpell)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ continue;
+ }
+ if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ }
+ case EVENT_T_KILL:
+ if (temp.kill.repeatMax < temp.kill.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_TARGET_CASTING:
+ if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_SUMMONED_UNIT:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.summon_unit.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
+ if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ case EVENT_T_QUEST_ACCEPT:
+ case EVENT_T_QUEST_COMPLETE:
+ if (!sObjectMgr.GetQuestTemplate(temp.quest.questId))
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
+ sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
+ continue;
- case EVENT_T_RECEIVE_EMOTE:
+ case EVENT_T_AGGRO:
+ case EVENT_T_DEATH:
+ case EVENT_T_EVADE:
+ case EVENT_T_REACHED_HOME:
+ {
+ if (temp.event_flags & EFLAG_REPEATABLE)
{
- if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId))
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.",temp.creature_id, i, temp.receive_emote.emoteId);
- continue;
- }
- if (temp.receive_emote.condition)
- {
- Condition cond;
- cond.mConditionType = ConditionType(temp.receive_emote.condition);
- cond.mConditionValue1 = temp.receive_emote.conditionValue1;
- cond.mConditionValue2 = temp.receive_emote.conditionValue2;
- if (!sConditionMgr.isConditionTypeValid(&cond))
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
- continue;
- }
- }
+ sLog.outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
+ temp.event_flags &= ~EFLAG_REPEATABLE;
+ }
- if (!(temp.event_flags & EFLAG_REPEATABLE))
- {
- sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
- temp.event_flags |= EFLAG_REPEATABLE;
- }
+ break;
+ }
- break;
+ case EVENT_T_RECEIVE_EMOTE:
+ {
+ if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId))
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.",temp.creature_id, i, temp.receive_emote.emoteId);
+ continue;
}
-
- case EVENT_T_BUFFED:
- case EVENT_T_TARGET_BUFFED:
+ if (temp.receive_emote.condition)
{
- SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
- if (!pSpell)
+ Condition cond;
+ cond.mConditionType = ConditionType(temp.receive_emote.condition);
+ cond.mConditionValue1 = temp.receive_emote.conditionValue1;
+ cond.mConditionValue2 = temp.receive_emote.conditionValue2;
+ if (!sConditionMgr.isConditionTypeValid(&cond))
{
- sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
continue;
}
- if (temp.buffed.repeatMax < temp.buffed.repeatMin)
- sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- break;
}
- default:
- sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
- break;
+ if (!(temp.event_flags & EFLAG_REPEATABLE))
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
+ temp.event_flags |= EFLAG_REPEATABLE;
+ }
+
+ break;
}
- for (uint32 j = 0; j < MAX_ACTIONS; j++)
+ case EVENT_T_BUFFED:
+ case EVENT_T_TARGET_BUFFED:
{
- uint16 action_type = fields[10+(j*4)].GetUInt16();
- if (action_type >= ACTION_T_END)
+ SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
+ if (!pSpell)
{
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
- temp.action[j].type = ACTION_T_NONE;
+ sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
+ if (temp.buffed.repeatMax < temp.buffed.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ }
- CreatureEventAI_Action& action = temp.action[j];
+ default:
+ sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
+ break;
+ }
- action.type = EventAI_ActionType(action_type);
- action.raw.param1 = fields[11+(j*4)].GetUInt32();
- action.raw.param2 = fields[12+(j*4)].GetUInt32();
- action.raw.param3 = fields[13+(j*4)].GetUInt32();
+ for (uint32 j = 0; j < MAX_ACTIONS; j++)
+ {
+ uint16 action_type = fields[10+(j*4)].GetUInt16();
+ if (action_type >= ACTION_T_END)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
+ temp.action[j].type = ACTION_T_NONE;
+ continue;
+ }
- //Report any errors in actions
- switch (action.type)
+ CreatureEventAI_Action& action = temp.action[j];
+
+ action.type = EventAI_ActionType(action_type);
+ action.raw.param1 = fields[11+(j*4)].GetUInt32();
+ action.raw.param2 = fields[12+(j*4)].GetUInt32();
+ action.raw.param3 = fields[13+(j*4)].GetUInt32();
+
+ //Report any errors in actions
+ switch (action.type)
+ {
+ case ACTION_T_NONE:
+ break;
+ case ACTION_T_TEXT:
{
- case ACTION_T_NONE:
- break;
- case ACTION_T_TEXT:
+ if (action.text.TextId1 < 0)
{
- if (action.text.TextId1 < 0)
- {
- if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end())
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
- }
- if (action.text.TextId2 < 0)
- {
- if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end())
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
+ if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
+ }
+ if (action.text.TextId2 < 0)
+ {
+ if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
- if (!action.text.TextId1)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
- }
- if (action.text.TextId3 < 0)
- {
- if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end())
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
+ if (!action.text.TextId1)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
+ }
+ if (action.text.TextId3 < 0)
+ {
+ if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
- if (!action.text.TextId1 || !action.text.TextId2)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
- }
- break;
+ if (!action.text.TextId1 || !action.text.TextId2)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
+ }
+ break;
+ }
+ case ACTION_T_SET_FACTION:
+ if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId))
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
+ action.set_faction.factionId = 0;
}
- case ACTION_T_SET_FACTION:
- if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId))
+ break;
+ case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
+ if (action.morph.creatureId !=0 || action.morph.modelId !=0)
+ {
+ if (action.morph.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.morph.creatureId))
{
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
- action.set_faction.factionId = 0;
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
+ action.morph.creatureId = 0;
}
- break;
- case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
- if (action.morph.creatureId !=0 || action.morph.modelId !=0)
+
+ if (action.morph.modelId)
{
- if (action.morph.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.morph.creatureId))
+ if (action.morph.creatureId)
{
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
- action.morph.creatureId = 0;
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatureId);
+ action.morph.modelId = 0;
}
-
- if (action.morph.modelId)
+ else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId))
{
- if (action.morph.creatureId)
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatureId);
- action.morph.modelId = 0;
- }
- else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId))
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
- action.morph.modelId = 0;
- }
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
+ action.morph.modelId = 0;
}
}
- break;
- case ACTION_T_SOUND:
- if (!sSoundEntriesStore.LookupEntry(action.sound.soundId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
- break;
- case ACTION_T_EMOTE:
- if (!sEmotesStore.LookupEntry(action.emote.emoteId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
- break;
- case ACTION_T_RANDOM_SOUND:
- if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
- if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
- if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
- break;
- case ACTION_T_RANDOM_EMOTE:
- if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
- if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
- if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
- break;
- case ACTION_T_CAST:
+ }
+ break;
+ case ACTION_T_SOUND:
+ if (!sSoundEntriesStore.LookupEntry(action.sound.soundId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
+ break;
+ case ACTION_T_EMOTE:
+ if (!sEmotesStore.LookupEntry(action.emote.emoteId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
+ break;
+ case ACTION_T_RANDOM_SOUND:
+ if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
+ if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
+ if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
+ break;
+ case ACTION_T_RANDOM_EMOTE:
+ if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
+ if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
+ if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
+ break;
+ case ACTION_T_CAST:
+ {
+ const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId);
+ if (!spell)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
+ /* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
+ else
{
- const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId);
- if (!spell)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
- /* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
- else
+ if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE)
{
- if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE)
- {
- //output as debug for now, also because there's no general rule all spells have RecoveryTime
- if (temp.event_param3 < spell->RecoveryTime)
- sLog.outDebug("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,action.cast.spellId, spell->RecoveryTime, temp.event_param3);
- }
+ //output as debug for now, also because there's no general rule all spells have RecoveryTime
+ if (temp.event_param3 < spell->RecoveryTime)
+ sLog.outDebug("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,action.cast.spellId, spell->RecoveryTime, temp.event_param3);
}
- */
+ }
+ */
- //Cast is always triggered if target is forced to cast on self
- if (action.cast.castFlags & CAST_FORCE_TARGET_SELF)
- action.cast.castFlags |= CAST_TRIGGERED;
+ //Cast is always triggered if target is forced to cast on self
+ if (action.cast.castFlags & CAST_FORCE_TARGET_SELF)
+ action.cast.castFlags |= CAST_TRIGGERED;
- if (action.cast.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- }
- case ACTION_T_SUMMON:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
+ if (action.cast.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ }
+ case ACTION_T_SUMMON:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
- if (action.summon.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_THREAT_SINGLE_PCT:
- if (std::abs(action.threat_single_pct.percent) > 100)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
- if (action.threat_single_pct.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_THREAT_ALL_PCT:
- if (std::abs(action.threat_all_pct.percent) > 100)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
- break;
- case ACTION_T_QUEST_EVENT:
- if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId))
- {
- if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
- }
- else
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
+ if (action.summon.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_THREAT_SINGLE_PCT:
+ if (std::abs(action.threat_single_pct.percent) > 100)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
+ if (action.threat_single_pct.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_THREAT_ALL_PCT:
+ if (std::abs(action.threat_all_pct.percent) > 100)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
+ break;
+ case ACTION_T_QUEST_EVENT:
+ if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId))
+ {
+ if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
- if (action.quest_event.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ if (action.quest_event.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_CAST_EVENT:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
- if (!sSpellStore.LookupEntry(action.cast_event.spellId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
- if (action.cast_event.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_SET_UNIT_FIELD:
- if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
- if (action.set_unit_field.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_SET_UNIT_FLAG:
- case ACTION_T_REMOVE_UNIT_FLAG:
- if (action.unit_flag.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_SET_PHASE:
- if (action.set_phase.phase >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- break;
- case ACTION_T_INC_PHASE:
- if (action.set_inc_phase.step == 0)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
- else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
- break;
- case ACTION_T_QUEST_EVENT_ALL:
- if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
- {
- if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
- }
- else
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
- break;
- case ACTION_T_CAST_EVENT_ALL:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
- if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
- break;
- case ACTION_T_REMOVEAURASFROMSPELL:
- if (!sSpellStore.LookupEntry(action.remove_aura.spellId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
- if (action.remove_aura.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3
- if (action.random_phase.phase1 >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- if (action.random_phase.phase2 >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- if (action.random_phase.phase3 >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- break;
- case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
- if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
- if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax)
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
- std::swap(action.random_phase_range.phaseMin,action.random_phase_range.phaseMax);
- // equal case processed at call
- }
- break;
- case ACTION_T_SUMMON_ID:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon_id.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
- if (action.summon_id.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
- break;
- case ACTION_T_KILLED_MONSTER:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.killed_monster.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
- if (action.killed_monster.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_SET_INST_DATA:
- if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
- if (action.set_inst_data.value > 4/*SPECIAL*/)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
- break;
- case ACTION_T_SET_INST_DATA64:
- if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
- if (action.set_inst_data64.target >= TARGET_T_END)
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
- case ACTION_T_UPDATE_TEMPLATE:
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.update_template.creatureId))
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
- break;
- case ACTION_T_SET_SHEATH:
- if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
+ break;
+ case ACTION_T_CAST_EVENT:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
+ if (!sSpellStore.LookupEntry(action.cast_event.spellId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
+ if (action.cast_event.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_SET_UNIT_FIELD:
+ if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
+ if (action.set_unit_field.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_SET_UNIT_FLAG:
+ case ACTION_T_REMOVE_UNIT_FLAG:
+ if (action.unit_flag.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_SET_PHASE:
+ if (action.set_phase.phase >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ break;
+ case ACTION_T_INC_PHASE:
+ if (action.set_inc_phase.step == 0)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
+ else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
+ break;
+ case ACTION_T_QUEST_EVENT_ALL:
+ if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
+ {
+ if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
+ break;
+ case ACTION_T_CAST_EVENT_ALL:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
+ if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
+ break;
+ case ACTION_T_REMOVEAURASFROMSPELL:
+ if (!sSpellStore.LookupEntry(action.remove_aura.spellId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
+ if (action.remove_aura.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3
+ if (action.random_phase.phase1 >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ if (action.random_phase.phase2 >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ if (action.random_phase.phase3 >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ break;
+ case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
+ if (action.random_phase_range.phaseMin >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ if (action.random_phase_range.phaseMin >= MAX_PHASE)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
+ std::swap(action.random_phase_range.phaseMin,action.random_phase_range.phaseMax);
+ // equal case processed at call
+ }
+ break;
+ case ACTION_T_SUMMON_ID:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon_id.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
+ if (action.summon_id.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
+ break;
+ case ACTION_T_KILLED_MONSTER:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.killed_monster.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
+ if (action.killed_monster.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_SET_INST_DATA:
+ if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ if (action.set_inst_data.value > 4/*SPECIAL*/)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
+ break;
+ case ACTION_T_SET_INST_DATA64:
+ if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ if (action.set_inst_data64.target >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+ case ACTION_T_UPDATE_TEMPLATE:
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.update_template.creatureId))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
+ break;
+ case ACTION_T_SET_SHEATH:
+ if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
+ action.set_sheath.sheath = SHEATH_STATE_UNARMED;
+ }
+ break;
+ case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
+ if (action.invincibility_hp_level.is_percent)
+ {
+ if (action.invincibility_hp_level.hp_level > 100)
{
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
- action.set_sheath.sheath = SHEATH_STATE_UNARMED;
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
+ action.invincibility_hp_level.hp_level = 100;
}
- break;
- case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
- if (action.invincibility_hp_level.is_percent)
+ }
+ break;
+ case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
+ if (action.mount.creatureId != 0 || action.mount.modelId != 0)
+ {
+ if (action.mount.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.mount.creatureId))
{
- if (action.invincibility_hp_level.hp_level > 100)
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
- action.invincibility_hp_level.hp_level = 100;
- }
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
+ action.morph.creatureId = 0;
}
- break;
- case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
- if (action.mount.creatureId != 0 || action.mount.modelId != 0)
+
+ if (action.mount.modelId)
{
- if (action.mount.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.mount.creatureId))
+ if (action.mount.creatureId)
{
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
- action.morph.creatureId = 0;
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
+ action.mount.modelId = 0;
}
-
- if (action.mount.modelId)
+ else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId))
{
- if (action.mount.creatureId)
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
- action.mount.modelId = 0;
- }
- else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId))
- {
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
- action.mount.modelId = 0;
- }
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
+ action.mount.modelId = 0;
}
}
- break;
- case ACTION_T_EVADE: //No Params
- case ACTION_T_FLEE_FOR_ASSIST: //No Params
- case ACTION_T_DIE: //No Params
- case ACTION_T_ZONE_COMBAT_PULSE: //No Params
- case ACTION_T_FORCE_DESPAWN: //No Params
- case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking)
- case ACTION_T_COMBAT_MOVEMENT: //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
- case ACTION_T_RANGED_MOVEMENT: //Distance, Angle
- case ACTION_T_CALL_FOR_HELP: //Distance
- break;
+ }
+ break;
+ case ACTION_T_EVADE: //No Params
+ case ACTION_T_FLEE_FOR_ASSIST: //No Params
+ case ACTION_T_DIE: //No Params
+ case ACTION_T_ZONE_COMBAT_PULSE: //No Params
+ case ACTION_T_FORCE_DESPAWN: //No Params
+ case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking)
+ case ACTION_T_COMBAT_MOVEMENT: //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
+ case ACTION_T_RANGED_MOVEMENT: //Distance, Angle
+ case ACTION_T_CALL_FOR_HELP: //Distance
+ break;
- case ACTION_T_RANDOM_SAY:
- case ACTION_T_RANDOM_YELL:
- case ACTION_T_RANDOM_TEXTEMOTE:
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
- break;
+ case ACTION_T_RANDOM_SAY:
+ case ACTION_T_RANDOM_YELL:
+ case ACTION_T_RANDOM_TEXTEMOTE:
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
+ break;
- case ACTION_T_MOVE_RANDOM_POINT:
- case ACTION_T_SET_STAND_STATE:
- case ACTION_T_SET_PHASE_MASK:
- case ACTION_T_SET_VISIBILITY:
- case ACTION_T_SET_ACTIVE:
- case ACTION_T_SET_AGGRESSIVE:
- case ACTION_T_ATTACK_START_PULSE:
- case ACTION_T_SUMMON_GO:
- break;
+ case ACTION_T_MOVE_RANDOM_POINT:
+ case ACTION_T_SET_STAND_STATE:
+ case ACTION_T_SET_PHASE_MASK:
+ case ACTION_T_SET_VISIBILITY:
+ case ACTION_T_SET_ACTIVE:
+ case ACTION_T_SET_AGGRESSIVE:
+ case ACTION_T_ATTACK_START_PULSE:
+ case ACTION_T_SUMMON_GO:
+ break;
- default:
- sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type);
- break;
- }
+ default:
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type);
+ break;
}
+ }
- //Add to list
- m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
- ++Count;
+ //Add to list
+ m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
+ ++count;
- if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
+ {
+ if (!cInfo->AIName || !cInfo->AIName[0])
{
- if (!cInfo->AIName || !cInfo->AIName[0])
- {
- //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry);
- size_t len = strlen("EventAI")+1;
- const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
- strncpy(const_cast<char*>(cInfo->AIName), "EventAI", len);
- }
- if (strcmp(cInfo->AIName, "EventAI"))
- {
- //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName);
- }
- if (cInfo->ScriptID)
- {
- //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry);
- }
+ //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry);
+ size_t len = strlen("EventAI")+1;
+ const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
+ strncpy(const_cast<char*>(cInfo->AIName), "EventAI", len);
}
- } while (result->NextRow());
-
- sLog.outString();
- sLog.outString(">> Loaded %u CreatureEventAI scripts", Count);
- }
- else
- {
- barGoLink bar(1);
- bar.step();
- sLog.outString();
- sLog.outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+ if (strcmp(cInfo->AIName, "EventAI"))
+ {
+ //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName);
+ }
+ if (cInfo->ScriptID)
+ {
+ //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry);
+ }
+ }
}
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index f37ca014269..ea993aa8480 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -34,6 +34,8 @@
void SmartWaypointMgr::LoadFromDB()
{
+ uint32 oldMSTime = getMSTime();
+
waypoint_map.clear();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_SMARTAI_WP);
@@ -43,17 +45,17 @@ void SmartWaypointMgr::LoadFromDB()
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
+ sLog.outString();
return;
}
- WPPath* path = NULL;
- uint32 last_entry = 0;
- uint32 last_id = 1;
barGoLink bar(result->GetRowCount());
uint32 count = 0;
uint32 total = 0;
+ WPPath* path = NULL;
+ uint32 last_entry = 0;
+ uint32 last_id = 1;
do
{
@@ -88,14 +90,17 @@ void SmartWaypointMgr::LoadFromDB()
}
last_entry = entry;
total++;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u SmartAI Waypoint Paths, total %u waypoints.", count, total);
}
void SmartAIMgr::LoadSmartAIFromDB()
{
+ uint32 oldMSTime = getMSTime();
+
for (uint8 i = 0; i < SMART_SCRIPT_TYPE_MAX; i++)
mEventMap[i].clear(); //Drop Existing SmartAI List
@@ -106,13 +111,13 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
- uint32 ScriptCount = 0;
+ uint32 count = 0;
do
{
@@ -215,16 +220,17 @@ void SmartAIMgr::LoadSmartAIFromDB()
// creature entry / guid not found in storage, create empty event list for it and increase counters
if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())
{
- ++ScriptCount;
+ ++count;
SmartAIEventList eventList;
mEventMap[source_type][temp.entryOrGuid] = eventList;
}
// store the new event
mEventMap[source_type][temp.entryOrGuid].push_back(temp);
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u SmartAI scripts.", ScriptCount);
}
bool SmartAIMgr::IsTargetValid(SmartScriptHolder e)
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 4aabb08886c..fe50a40f3a4 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -2095,13 +2095,14 @@ AchievementCriteriaEntryList const& AchievementGlobalMgr::GetTimedAchievementCri
void AchievementGlobalMgr::LoadAchievementCriteriaList()
{
+ uint32 oldMSTime = getMSTime();
+
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
barGoLink bar(1);
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 achievement criteria.");
+ sLog.outString();
return;
}
@@ -2121,24 +2122,26 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
}
+ sLog.outString(">> Loaded %lu achievement criteria in %u ms",(unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu achievement criteria.",(unsigned long)m_AchievementCriteriasByType->size());
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
{
+ uint32 oldMSTime = getMSTime();
+
if (sAchievementStore.GetNumRows() == 0)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 achievement references.");
sLog.outString();
- sLog.outErrorDb(">> Loaded 0 achievement references.");
return;
}
- uint32 count = 0;
barGoLink bar(sAchievementStore.GetNumRows());
+ uint32 count = 0;
+
for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId)
{
bar.step();
@@ -2151,12 +2154,14 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
++count;
}
+ sLog.outString(">> Loaded %u achievement references in %u ms",count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u achievement references.",count);
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
{
+ uint32 oldMSTime = getMSTime();
+
m_criteriaDataMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2, ScriptName FROM achievement_criteria_data");
@@ -2165,14 +2170,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
{
barGoLink bar(1);
bar.step();
-
- sLog.outString();
sLog.outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
+ sLog.outString();
return;
}
- uint32 count = 0;
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+
do
{
bar.step();
@@ -2213,7 +2218,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
// counting data by and data types
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
// post loading checks
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
@@ -2294,21 +2300,22 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
sLog.outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
+ sLog.outString(">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u additional achievement criteria data.",count);
}
void AchievementGlobalMgr::LoadCompletedAchievements()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty.");
return;
}
@@ -2330,12 +2337,14 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
m_allCompletedAchievements.insert(achievement_id);
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu completed achievements in %u ms",(unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu realm completed achievements.",(unsigned long)m_allCompletedAchievements.size());
}
void AchievementGlobalMgr::LoadRewards()
{
+ uint32 oldMSTime = getMSTime();
+
m_achievementRewards.clear(); // need for reload case
// 0 1 2 3 4 5 6
@@ -2344,11 +2353,9 @@ void AchievementGlobalMgr::LoadRewards()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
+ sLog.outString();
return;
}
@@ -2439,27 +2446,29 @@ void AchievementGlobalMgr::LoadRewards()
m_achievementRewards[entry] = reward;
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u achievement rewards", count);
}
void AchievementGlobalMgr::LoadRewardLocales()
{
+ uint32 oldMSTime = getMSTime();
+
m_achievementRewardLocales.clear(); // need for reload case
- QueryResult result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward");
+ QueryResult result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,"
+ "subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8"
+ " FROM locales_achievement_reward");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
sLog.outString();
- sLog.outString(">> Loaded 0 achievement reward locale strings.");
- sLog.outString(">> DB table `locales_achievement_reward` is empty.");
return;
}
@@ -2491,6 +2500,6 @@ void AchievementGlobalMgr::LoadRewardLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size());
}
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 2bce694299e..3350829efdf 100755
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -34,32 +34,39 @@ AddonMgr::~AddonMgr()
void AddonMgr::LoadFromDB()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
+
if (!result)
{
- sLog.outErrorDb("The table `addons` is empty");
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 known addons. DB table `addons` is empty!");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
uint32 count = 0;
- Field *fields;
do
{
- fields = result->Fetch();
+ Field *fields = result->Fetch();
bar.step();
- count++;
std::string name = fields[0].GetString();
uint32 crc = fields[1].GetUInt32();
SavedAddon addon(name, crc);
m_knownAddons.push_back(addon);
- } while (result->NextRow());
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u known addons", count);
}
void AddonMgr::SaveAddon(AddonInfo const& addon)
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index ddfe50bb41a..a157a776dcb 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -308,6 +308,8 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
void AuctionHouseMgr::LoadAuctionItems()
{
+ uint32 oldMSTime = getMSTime();
+
// data needs to be at first place for Item::LoadFromDB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_AUCTION_ITEMS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -316,14 +318,14 @@ void AuctionHouseMgr::LoadAuctionItems()
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
sLog.outString();
- sLog.outString(">> Loaded 0 auction items");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
+
do
{
bar.step();
@@ -352,36 +354,37 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u auction items", count);
}
void AuctionHouseMgr::LoadAuctions()
{
+ uint32 oldMSTime = getMSTime();
+
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_AUCTIONS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- uint32 count = 0;
- AuctionEntry *aItem;
do
{
Field* fields = result->Fetch();
bar.step();
- aItem = new AuctionEntry();
+ AuctionEntry *aItem = new AuctionEntry();
if (!aItem->LoadFromDB(fields))
{
aItem->DeleteFromDB(trans);
@@ -395,8 +398,8 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
+ sLog.outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u auctions", count);
}
void AuctionHouseMgr::AddAItem(Item* it)
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 6103aabf694..f29e03ec77f 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -661,6 +661,8 @@ uint32 BattlegroundMgr::CreateBattleground(BattlegroundTypeId bgTypeId, bool IsA
void BattlegroundMgr::CreateInitialBattlegrounds()
{
+ uint32 oldMSTime = getMSTime();
+
float AStartLoc[4];
float HStartLoc[4];
uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2;
@@ -670,23 +672,20 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
bool IsArena;
uint32 scriptId = 0;
- uint32 count = 0;
-
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO,Weight,ScriptName FROM battleground_template");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -785,10 +784,11 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
else if (bgTypeID != BATTLEGROUND_RB)
m_BGSelectionWeights[bgTypeID] = selectionWeight;
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u battlegrounds", count);
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@@ -1112,23 +1112,23 @@ uint32 BattlegroundMgr::GetPrematureFinishTime() const
void BattlegroundMgr::LoadBattleMastersEntry()
{
- mBattleMastersMap.clear(); // need for reload case
+ uint32 oldMSTime = getMSTime();
- QueryResult result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
+ mBattleMastersMap.clear(); // need for reload case
- uint32 count = 0;
+ QueryResult result = WorldDatabase.Query("SELECT entry, bg_template FROM battlemaster_entry");
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
sLog.outString();
- sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -1147,10 +1147,11 @@ void BattlegroundMgr::LoadBattleMastersEntry()
mBattleMastersMap[entry] = BattlegroundTypeId(bgTypeId);
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u battlemaster entries", count);
}
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 17fa9a6caa9..99e77e65408 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -348,6 +348,8 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureID, uint
void ConditionMgr::LoadConditions(bool isReload)
{
+ uint32 oldMSTime = getMSTime();
+
Clean();
//must clear all custom handled cases (groupped types) before reload
@@ -374,21 +376,21 @@ void ConditionMgr::LoadConditions(bool isReload)
sObjectMgr.LoadGossipMenuItems();
}
- uint32 count = 0;
- QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, ElseGroup, ConditionTypeOrReference, ConditionValue1, ConditionValue2, ConditionValue3, ErrorTextId, ScriptName FROM conditions");
+
+ QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, ElseGroup, ConditionTypeOrReference,"
+ " ConditionValue1, ConditionValue2, ConditionValue3, ErrorTextId, ScriptName FROM conditions");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 conditions. DB table `groups` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded `conditions`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -576,8 +578,8 @@ void ConditionMgr::LoadConditions(bool isReload)
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u conditions", count);
}
bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot)
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 51e7df69552..17004b3f6a3 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -36,6 +36,8 @@ DisableMgr::~DisableMgr()
void DisableMgr::LoadDisables()
{
+ uint32 oldMSTime = getMSTime();
+
// reload case
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
itr->second.clear();
@@ -50,9 +52,8 @@ void DisableMgr::LoadDisables()
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 disables. DB table `disables` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u disables", total_count);
return;
}
@@ -182,19 +183,21 @@ void DisableMgr::LoadDisables()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u disables.", total_count);
}
void DisableMgr::CheckQuestDisables()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Checked 0 quest disables.");
sLog.outString();
- sLog.outString(">> Done.");
return;
}
@@ -215,8 +218,8 @@ void DisableMgr::CheckQuestDisables()
++itr;
}
+ sLog.outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Done.");
}
bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit)
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 9966ac6afd0..a9416b066ed 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -244,6 +244,8 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
void LoadDBCStores(const std::string& dataPath)
{
+ uint32 oldMSTime = getMSTime();
+
std::string dbcPath = dataPath+"dbc/";
const uint32 DBCFilesCount = 90;
@@ -620,8 +622,8 @@ void LoadDBCStores(const std::string& dataPath)
sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client.");
exit(1);
}
+ sLog.outString(">> Initialized %d data stores in %u ms", DBCFilesCount, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Initialized %d data stores", DBCFilesCount);
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index d892c023ff7..b62966c2904 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -75,9 +75,10 @@ LFGMgr::~LFGMgr()
/// Load achievement <-> encounter associations
void LFGMgr::LoadDungeonEncounters()
{
+ uint32 oldMSTime = getMSTime();
+
m_EncountersByAchievement.clear();
- uint32 count = 0;
QueryResult result = WorldDatabase.Query("SELECT achievementId, dungeonId FROM lfg_dungeon_encounters");
if (!result)
@@ -91,6 +92,7 @@ void LFGMgr::LoadDungeonEncounters()
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
Field* fields = NULL;
do
@@ -124,19 +126,20 @@ void LFGMgr::LoadDungeonEncounters()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u dungeon encounter lfg associations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u dungeon encounter lfg associations.", count);
}
/// Load rewards for completing dungeons
void LFGMgr::LoadRewards()
{
+ uint32 oldMSTime = getMSTime();
+
for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr)
delete itr->second;
m_RewardMap.clear();
- uint32 count = 0;
// ORDER BY is very important for GetRandomDungeonReward!
QueryResult result = WorldDatabase.Query("SELECT dungeonId, maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar FROM lfg_dungeon_rewards ORDER BY dungeonId, maxLevel ASC");
@@ -144,13 +147,13 @@ void LFGMgr::LoadRewards()
{
barGoLink bar(1);
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
Field* fields = NULL;
do
@@ -194,8 +197,8 @@ void LFGMgr::LoadRewards()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u lfg dungeon rewards.", count);
}
void LFGMgr::Update(uint32 diff)
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 6feb47bff8d..6158336b0b4 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -70,26 +70,21 @@ void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *group, Creatur
void CreatureGroupManager::LoadCreatureFormations()
{
- //Clear existing map
- for (CreatureGroupInfoType::iterator itr = CreatureGroupMap.begin(); itr != CreatureGroupMap.end(); ++itr)
- delete itr->second;
- CreatureGroupMap.clear();
-
- //Check Integrity of the table
- QueryResult result = WorldDatabase.Query("SELECT MAX(leaderGUID) FROM creature_formations");
+ uint32 oldMSTime = getMSTime();
- if (!result)
- {
- sLog.outErrorDb(" ...an error occured while loading the table creature_formations (maybe it doesn't exist ?)\n");
- return;
- }
+ for (CreatureGroupInfoType::iterator itr = CreatureGroupMap.begin(); itr != CreatureGroupMap.end(); ++itr) // for reload case
+ delete itr->second;
+ CreatureGroupMap.clear();
//Get group data
- result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID");
+ QueryResult result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID");
if (!result)
{
- sLog.outErrorDb("The table creature_formations is empty or corrupted");
+ barGoLink bar(1);
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
+ sLog.outString();
return;
}
@@ -108,12 +103,11 @@ void CreatureGroupManager::LoadCreatureFormations()
} while (guidResult->NextRow());
}
- uint64 total_records = result->GetRowCount();
- barGoLink bar(total_records);
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
Field *fields;
-
FormationInfo *group_member;
- //Loading data...
+
do
{
fields = result->Fetch();
@@ -154,11 +148,11 @@ void CreatureGroupManager::LoadCreatureFormations()
}
CreatureGroupMap[memberGUID] = group_member;
+ ++count;
}
while (result->NextRow()) ;
- sLog.outString();
- sLog.outString(">> Loaded " UI64FMTD " creatures in formations", total_records);
+ sLog.outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
}
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index e177e4db485..b1e0f173d2e 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -46,6 +46,8 @@ static EnchantmentStore RandomItemEnch;
void LoadRandomEnchantmentsTable()
{
+ uint32 oldMSTime = getMSTime();
+
RandomItemEnch.clear(); // for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
@@ -70,13 +72,13 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u Item Enchantment definitions", count);
}
else
{
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
+ sLog.outString();
}
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 7d1dce86b5a..a718256aa49 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -30,21 +30,21 @@
void MapManager::LoadTransports()
{
- QueryResult result = WorldDatabase.Query("SELECT guid, entry, name, period, ScriptName FROM transports");
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ QueryResult result = WorldDatabase.Query("SELECT guid, entry, name, period, ScriptName FROM transports");
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 transports. DB table `transports` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u transports", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -113,9 +113,6 @@ void MapManager::LoadTransports()
}
while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u transports", count);
-
// check transport data DB integrity
result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry");
if (result) // wrong data found
@@ -131,26 +128,29 @@ void MapManager::LoadTransports()
}
while (result->NextRow());
}
+
+ sLog.outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void MapManager::LoadTransportNPCs()
{
- // Spawn NPCs linked to the transport
+ uint32 oldMSTime = getMSTime();
+
// 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.PQuery("SELECT guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO, emote FROM creature_transport");
- uint32 count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u transport NPCs.", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -174,10 +174,12 @@ void MapManager::LoadTransportNPCs()
}
}
- count++;
- } while (result->NextRow());
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u transport npcs", count);
}
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_period(period), ScriptId(script)
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index fd51c3c1c46..18b1d13a6d3 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -194,109 +194,107 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
void GameEventMgr::LoadFromDB()
{
+ uint32 oldMSTime = getMSTime();
+
+ QueryResult result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
+ if (!result)
{
- QueryResult result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
- if (!result)
- {
- sLog.outString(">> Table game_event is empty.");
- sLog.outString();
- return;
- }
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 weather definitions. DB table `game_event` is empty.");
+ sLog.outString();
+ return;
+ }
- Field *fields = result->Fetch();
+ Field *fields = result->Fetch();
- uint32 max_event_id = fields[0].GetUInt16();
+ uint32 max_event_id = fields[0].GetUInt16();
- mGameEvent.resize(max_event_id+1);
- }
+ mGameEvent.resize(max_event_id+1);
- QueryResult result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description,world_event FROM game_event");
+ result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description,world_event FROM game_event");
if (!result)
{
mGameEvent.clear();
- sLog.outString(">> Table game_event is empty!");
+ sLog.outErrorDb(">> Loaded 0 game events. DB table `game_event` is empty.");
sLog.outString();
return;
}
uint32 count = 0;
-
+ barGoLink bar(result->GetRowCount());
+ do
{
- barGoLink bar(result->GetRowCount());
- do
- {
- ++count;
- Field *fields = result->Fetch();
+ ++count;
+ Field *fields = result->Fetch();
- bar.step();
+ 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);
- continue;
- }
+ 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);
+ continue;
+ }
- 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();
- pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
+ 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();
+ pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
- pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
- pGameEvent.nextstart = 0;
+ pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
+ pGameEvent.nextstart = 0;
- if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
- {
- sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
- continue;
- }
+ if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
+ {
+ sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
+ continue;
+ }
- if (pGameEvent.holiday_id != HOLIDAY_NONE)
+ if (pGameEvent.holiday_id != HOLIDAY_NONE)
+ {
+ if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
- if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
- {
- sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id);
- pGameEvent.holiday_id = HOLIDAY_NONE;
- }
+ sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id);
+ pGameEvent.holiday_id = HOLIDAY_NONE;
}
+ }
- pGameEvent.description = fields[6].GetString();
+ pGameEvent.description = fields[6].GetString();
- } while (result->NextRow());
+ } while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u game events", count);
- }
+ sLog.outString(">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
// load game event saves
sLog.outString("Loading Game Event Saves Data...");
+ oldMSTime = getMSTime();
// 0 1 2
result = CharacterDatabase.Query("SELECT event_id, state, next_start FROM game_event_save");
- count = 0;
if (!result)
{
- barGoLink bar2(1);
- bar2.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u game event saves in game events", count);
}
else
{
-
- barGoLink bar2(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar2.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
@@ -320,32 +318,33 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u game event saves in game events", count);
}
// load game event links (prerequisites)
sLog.outString("Loading Game Event Prerequisite Data...");
+ oldMSTime = getMSTime();
result = WorldDatabase.Query("SELECT event_id, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
- barGoLink bar2(1);
- bar2.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u game event prerequisites in game events", count);
}
else
{
-
- barGoLink bar2(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar2.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
@@ -374,31 +373,31 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u game event prerequisites in game events", count);
}
// Creatures
sLog.outString("Loading Game Event Creature Data...");
+ oldMSTime = getMSTime();
mGameEventCreatureGuids.resize(mGameEvent.size()*2-1);
// 1 2
result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.event "
"FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid");
- count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
sLog.outString();
- sLog.outString(">> Loaded %u creatures in game events", count);
}
else
{
-
+ count = 0;
barGoLink bar(result->GetRowCount());
do
{
@@ -423,31 +422,30 @@ void GameEventMgr::LoadFromDB()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u creatures in game events", count);
}
// Gameobjects
sLog.outString("Loading Game Event GO Data...");
+ oldMSTime = getMSTime();
mGameEventGameobjectGuids.resize(mGameEvent.size()*2-1);
// 1 2
result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.event "
"FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
- count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u gameobjects in game events", count);
}
else
{
-
+ count = 0;
barGoLink bar(result->GetRowCount());
do
{
@@ -472,13 +470,14 @@ void GameEventMgr::LoadFromDB()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u gameobjects in game events", count);
}
// Model/Equipment Changes
sLog.outString("Loading Game Event Model/Equipment Change Data...");
+ oldMSTime = getMSTime();
mGameEventModelEquip.resize(mGameEvent.size());
// 0 1 2
@@ -487,18 +486,16 @@ void GameEventMgr::LoadFromDB()
"game_event_model_equip.equipment_id "
"FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
- count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u model/equipment changes in game events", count);
}
else
{
-
+ count = 0;
barGoLink bar(result->GetRowCount());
do
{
@@ -535,30 +532,29 @@ void GameEventMgr::LoadFromDB()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u model/equipment changes in game events", count);
}
// Quests
sLog.outString("Loading Game Event Quest Data...");
+ oldMSTime = getMSTime();
mGameEventCreatureQuests.resize(mGameEvent.size());
// 0 1 2
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_creature_quest");
- count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u quests additions in game events", count);
}
else
{
-
+ count = 0;
barGoLink bar(result->GetRowCount());
do
{
@@ -580,36 +576,36 @@ void GameEventMgr::LoadFromDB()
questlist.push_back(QuestRelation(id, quest));
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quests additions in game events", count);
}
// GO Quests
sLog.outString("Loading Game Event GO Quest Data...");
+ oldMSTime = getMSTime();
mGameEventGameObjectQuests.resize(mGameEvent.size());
// 0 1 2
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_gameobject_quest");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u go quests additions in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
@@ -626,34 +622,34 @@ void GameEventMgr::LoadFromDB()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quests additions in game events", count);
}
// Load quest to (event,condition) mapping
// 0 1 2 3
sLog.outString("Loading Game Event Quest Condition Data...");
+ oldMSTime = getMSTime();
+
result = WorldDatabase.Query("SELECT quest, event_id, condition_id, num FROM game_event_quest_condition");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u quest event conditions in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 quest = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
uint32 condition = fields[2].GetUInt32();
@@ -671,35 +667,35 @@ void GameEventMgr::LoadFromDB()
mQuestToEventConditions[quest].num = num;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quest event conditions in game events", count);
}
- // load conditions of the events
- // 0 1 2 3 4
+ // Load conditions for events
sLog.outString("Loading Game Event Condition Data...");
+ oldMSTime = getMSTime();
+ // 0 1 2 3 4
result = WorldDatabase.Query("SELECT event_id, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u conditions in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
@@ -717,35 +713,35 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u conditions in game events", count);
}
- // load condition saves
+ // Load condition saves
sLog.outString("Loading Game Event Condition Save Data...");
+ oldMSTime = getMSTime();
// 0 1 2
result = CharacterDatabase.Query("SELECT event_id, condition_id, done FROM game_event_condition_save");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u condition saves in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
@@ -769,36 +765,37 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u condition saves in game events", count);
}
- mGameEventNPCFlags.resize(mGameEvent.size());
- // load game event npcflag
+ // Load game event npcflag
sLog.outString("Loading Game Event NPCflag Data...");
+ oldMSTime = getMSTime();
+
+ mGameEventNPCFlags.resize(mGameEvent.size());
// 0 1 2
result = WorldDatabase.Query("SELECT guid, event_id, npcflag FROM game_event_npcflag");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u npcflags in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
uint32 npcflag = fields[2].GetUInt32();
@@ -814,36 +811,37 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u npcflags in game events", count);
}
- // Vendor
- mGameEventVendors.resize(mGameEvent.size());
+ // Load game event vendors
sLog.outString("Loading Game Event Vendor Additions Data...");
+ oldMSTime = getMSTime();
+
+ mGameEventVendors.resize(mGameEvent.size());
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u vendor additions in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
if (event_id >= mGameEventVendors.size())
@@ -883,35 +881,35 @@ void GameEventMgr::LoadFromDB()
vendors.push_back(newEntry);
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u vendor additions in game events", count);
}
- // load game event npc gossip ids
+ // Load game event npc gossip ids
sLog.outString("Loading Game Event NPC Gossip Data...");
+ oldMSTime = getMSTime();
// 0 1 2
result = WorldDatabase.Query("SELECT guid, event_id, textid FROM game_event_npc_gossip");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 npc gossip textids in game events. DB table `game_event_npc_gossip` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u npc gossip textids in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
uint32 textid = fields[2].GetUInt32();
@@ -927,37 +925,38 @@ void GameEventMgr::LoadFromDB()
++count;
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u npc gossip textids in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u npc gossip textids in game events", count);
}
- // set all flags to 0
- mGameEventBattlegroundHolidays.resize(mGameEvent.size(),0);
- // load game event battleground flags
+ // Load game event battleground flags
sLog.outString("Loading Game Event Battleground Data...");
+ oldMSTime = getMSTime();
+
+ // set all flags to 0
+ mGameEventBattlegroundHolidays.resize(mGameEvent.size(),0);
// 0 1
result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday");
- count = 0;
if (!result)
{
- barGoLink bar3(1);
- bar3.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u battleground holidays in game events", count);
}
else
{
-
- barGoLink bar3(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar3.step();
+ bar.step();
uint16 event_id = fields[0].GetUInt16();
@@ -972,40 +971,40 @@ void GameEventMgr::LoadFromDB()
mGameEventBattlegroundHolidays[event_id] = fields[1].GetUInt32();
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u battleground holidays in game events", count);
}
////////////////////////
// GameEventPool
////////////////////////
- mGameEventPoolIds.resize(mGameEvent.size()*2-1);
-
sLog.outString("Loading Game Event Pool Data...");
+ oldMSTime = getMSTime();
+
+ mGameEventPoolIds.resize(mGameEvent.size()*2-1);
// 1 2
result = WorldDatabase.Query("SELECT pool_template.entry, game_event_pool.event "
"FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
- count = 0;
if (!result)
{
- barGoLink bar2(1);
- bar2.step();
-
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u pools in game events", count);
}
else
{
-
- barGoLink bar2(result->GetRowCount());
+ count = 0;
+ barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
- bar2.step();
+ bar.step();
uint32 entry = fields[0].GetUInt32();
int16 event_id = fields[1].GetInt16();
@@ -1029,8 +1028,9 @@ void GameEventMgr::LoadFromDB()
poollist.push_back(entry);
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u pools in game events", count);
}
}
@@ -1064,7 +1064,6 @@ uint32 GameEventMgr::Initialize() // return the next e
{
m_ActiveEvents.clear();
uint32 delay = Update();
- sLog.outBasic("Game Event system initialized.");
isSystemInit = true;
return delay;
}
@@ -1085,6 +1084,7 @@ void GameEventMgr::StartArenaSeason()
StartEvent(eventId,true);
sLog.outString("Arena Season %i started...",sWorld.getIntConfig(CONFIG_ARENA_SEASON_ID));
+ sLog.outString();
}
uint32 GameEventMgr::Update() // return the next event delay in ms
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 154efc0ce70..2333a8ab5f6 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -434,6 +434,8 @@ void ObjectMgr::AddLocaleString(std::string& s, LocaleConstant locale, StringVec
void ObjectMgr::LoadCreatureLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mCreatureLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature");
@@ -463,12 +465,14 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)mCreatureLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu creature locale strings", (unsigned long)mCreatureLocaleMap.size());
}
void ObjectMgr::LoadGossipMenuItemsLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mGossipMenuItemsLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT menu_id,id,"
@@ -504,12 +508,14 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)mGossipMenuItemsLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mGossipMenuItemsLocaleMap.size());
}
void ObjectMgr::LoadPointOfInterestLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mPointOfInterestLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,icon_name_loc1,icon_name_loc2,icon_name_loc3,icon_name_loc4,icon_name_loc5,icon_name_loc6,icon_name_loc7,icon_name_loc8 FROM locales_points_of_interest");
@@ -535,8 +541,8 @@ void ObjectMgr::LoadPointOfInterestLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)mPointOfInterestLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu points_of_interest locale strings", (unsigned long)mPointOfInterestLocaleMap.size());
}
struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader>
@@ -550,18 +556,20 @@ struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader>
void ObjectMgr::LoadCreatureTemplates()
{
+ uint32 oldMSTime = getMSTime();
+
SQLCreatureLoader loader;
loader.Load(sCreatureStorage);
- sLog.outString(">> Loaded %u creature definitions", sCreatureStorage.RecordCount);
- sLog.outString();
-
// check data correctness
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i);
CheckCreatureTemplate(cInfo);
}
+
+ sLog.outString(">> Loaded %u creature definitions in %u ms", sCreatureStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
@@ -961,13 +969,10 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
endAura.effectMask = 0;
}
-void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
+uint32 ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName)
{
creatureaddons.Load();
- sLog.outString(">> Loaded %u %s", creatureaddons.RecordCount, comment);
- sLog.outString();
-
// check data correctness and convert 'auras'
for (uint32 i = 1; i < creatureaddons.MaxEntry; ++i)
{
@@ -995,11 +1000,15 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry
ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), creatureaddons.GetTableName(), entryName);
}
+
+ return creatureaddons.RecordCount;
}
void ObjectMgr::LoadCreatureAddons()
{
- LoadCreatureAddons(sCreatureInfoAddonStorage,"Entry","creature template addons");
+ uint32 oldMSTime = getMSTime();
+
+ uint32 count = LoadCreatureAddons(sCreatureInfoAddonStorage,"Entry");
// check entry ids
for (uint32 i = 1; i < sCreatureInfoAddonStorage.MaxEntry; ++i)
@@ -1007,14 +1016,20 @@ void ObjectMgr::LoadCreatureAddons()
if (!sCreatureStorage.LookupEntry<CreatureInfo>(addon->guidOrEntry))
sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`",addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName());
+ sLog.outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
+
sLog.outString("Loading Creature Addon Data...");
- LoadCreatureAddons(sCreatureDataAddonStorage,"GUID","creature addons");
+ count = LoadCreatureAddons(sCreatureDataAddonStorage,"GUID");
// check entry ids
for (uint32 i = 1; i < sCreatureDataAddonStorage.MaxEntry; ++i)
if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(i))
if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end())
sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`",addon->guidOrEntry);
+
+ sLog.outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry)
@@ -1024,6 +1039,8 @@ EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry)
void ObjectMgr::LoadEquipmentTemplates()
{
+ uint32 oldMSTime = getMSTime();
+
sEquipmentStorage.Load();
for (uint32 i = 0; i < sEquipmentStorage.MaxEntry; ++i)
@@ -1062,7 +1079,8 @@ void ObjectMgr::LoadEquipmentTemplates()
}
}
}
- sLog.outString(">> Loaded %u equipment template", sEquipmentStorage.RecordCount);
+
+ sLog.outString(">> Loaded %u equipment templates in %u ms", sEquipmentStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
}
@@ -1129,6 +1147,8 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_
void ObjectMgr::LoadCreatureModelInfo()
{
+ uint32 oldMSTime = getMSTime();
+
sCreatureModelStorage.Load();
// post processing
@@ -1154,9 +1174,6 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
- sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount);
- sLog.outString();
-
// check if combat_reach is valid
for (uint32 i = 1; i < sCreatureModelStorage.MaxEntry; ++i)
{
@@ -1170,6 +1187,9 @@ void ObjectMgr::LoadCreatureModelInfo()
const_cast<CreatureModelInfo*>(mInfo)->combat_reach = DEFAULT_COMBAT_REACH;
}
}
+
+ sLog.outString(">> Loaded %u creature model based info in %u ms", sCreatureModelStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
bool ObjectMgr::CheckCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid) const
@@ -1204,17 +1224,17 @@ bool ObjectMgr::CheckCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid) const
void ObjectMgr::LoadCreatureLinkedRespawn()
{
+ uint32 oldMSTime = getMSTime();
+
mCreatureLinkedRespawnMap.clear();
QueryResult result = WorldDatabase.Query("SELECT guid, linkedGuid FROM creature_linked_respawn ORDER BY guid ASC");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 linked respawns. DB table `creature_linked_respawn` is empty.");
+ sLog.outString();
return;
}
@@ -1233,8 +1253,8 @@ void ObjectMgr::LoadCreatureLinkedRespawn()
} while (result->NextRow());
+ sLog.outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(mCreatureLinkedRespawnMap.size()), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded " UI64FMTD " linked respawns", uint64(mCreatureLinkedRespawnMap.size()));
}
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid)
@@ -1266,6 +1286,8 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid)
void ObjectMgr::LoadCreatures()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 count = 0;
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid,"
@@ -1281,11 +1303,9 @@ void ObjectMgr::LoadCreatures()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 creatures. DB table `creature` is empty.");
sLog.outString();
- sLog.outErrorDb(">> Loaded 0 creature. DB table `creature` is empty.");
return;
}
@@ -1455,8 +1475,8 @@ void ObjectMgr::LoadCreatures()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u creatures in %u ms", (uint32)mCreatureDataMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u creatures", (uint32)mCreatureDataMap.size());
}
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
@@ -1634,6 +1654,8 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
void ObjectMgr::LoadGameobjects()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 count = 0;
// 0 1 2 3 4 5 6
@@ -1646,11 +1668,9 @@ void ObjectMgr::LoadGameobjects()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
+ sLog.outString();
return;
}
@@ -1774,8 +1794,8 @@ void ObjectMgr::LoadGameobjects()
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)mGameObjectDataMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu gameobjects", (unsigned long)mGameObjectDataMap.size());
}
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
@@ -1812,6 +1832,8 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
void ObjectMgr::LoadCreatureRespawnTimes()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 count = 0;
QueryResult result = CharacterDatabase.Query("SELECT guid,respawntime,instance FROM creature_respawn");
@@ -1819,11 +1841,9 @@ void ObjectMgr::LoadCreatureRespawnTimes()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outString(">> Loaded 0 creature respawn time.");
+ sLog.outString();
return;
}
@@ -1843,12 +1863,14 @@ void ObjectMgr::LoadCreatureRespawnTimes()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu creature respawn times in %u ms", (unsigned long)mCreatureRespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu creature respawn times", (unsigned long)mCreatureRespawnTimes.size());
}
void ObjectMgr::LoadGameobjectRespawnTimes()
{
+ uint32 oldMSTime = getMSTime();
+
// remove outdated data
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GAMEOBJECT_RESPAWN_TIMES);
CharacterDatabase.Execute(stmt);
@@ -1860,11 +1882,9 @@ void ObjectMgr::LoadGameobjectRespawnTimes()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 gameobject respawn times. DB table `gameobject_respawn` is empty!");
sLog.outString();
- sLog.outString(">> Loaded 0 gameobject respawn time.");
return;
}
@@ -1884,8 +1904,8 @@ void ObjectMgr::LoadGameobjectRespawnTimes()
++count;
} while (result->NextRow());
- sLog.outString(">> Loaded %lu gameobject respawn times", (unsigned long)mGORespawnTimes.size());
sLog.outString();
+ sLog.outString(">> Loaded %lu gameobject respawn times in %u ms", (unsigned long)mGORespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime));
}
Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
@@ -1980,6 +2000,8 @@ uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
void ObjectMgr::LoadItemLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mItemLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item");
@@ -2009,8 +2031,8 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu Item locale strings in %u ms", (unsigned long)mItemLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu Item locale strings", (unsigned long)mItemLocaleMap.size());
}
struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader>
@@ -2024,10 +2046,10 @@ struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader>
void ObjectMgr::LoadItemPrototypes()
{
+ uint32 oldMSTime = getMSTime();
+
SQLItemLoader loader;
loader.Load(sItemStorage);
- sLog.outString(">> Loaded %u item prototypes", sItemStorage.RecordCount);
- sLog.outString();
// check data correctness
bool enforceDBCAttributes = sWorld.getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES);
@@ -2477,10 +2499,15 @@ void ObjectMgr::LoadItemPrototypes()
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
sLog.outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
+
+ sLog.outString(">> Loaded %u item prototypes in %u ms", sItemStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void ObjectMgr::LoadItemSetNameLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mItemSetNameLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT `entry`,`name_loc1`,`name_loc2`,`name_loc3`,`name_loc4`,`name_loc5`,`name_loc6`,`name_loc7`,`name_loc8` FROM `locales_item_set_names`");
@@ -2506,17 +2533,16 @@ void ObjectMgr::LoadItemSetNameLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(mItemSetNameLocaleMap.size()), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded " UI64FMTD " Item set name locale strings", uint64(mItemSetNameLocaleMap.size()));
}
void ObjectMgr::LoadItemSetNames()
{
- mItemSetNameMap.clear(); // needed for reload case
+ uint32 oldMSTime = getMSTime();
- QueryResult result = WorldDatabase.Query("SELECT `entry`,`name`,`InventoryType` FROM `item_set_names`");
+ mItemSetNameMap.clear(); // needed for reload case
- uint32 count = 0;
std::set<uint32> itemSetItems;
// fill item set member ids
@@ -2531,45 +2557,48 @@ void ObjectMgr::LoadItemSetNames()
itemSetItems.insert(setEntry->itemId[i]);
}
- if (result)
- {
- barGoLink bar(result->GetRowCount());
- do
- {
- Field *fields = result->Fetch();
- bar.step();
-
- uint32 entry = fields[0].GetUInt32();
- if (itemSetItems.find(entry) == itemSetItems.end())
- {
- sLog.outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
- continue;
- }
-
- ItemSetNameEntry &data = mItemSetNameMap[entry];
- data.name = fields[1].GetString();
-
- uint32 invType = fields[2].GetUInt32();
- if (invType >= MAX_INVTYPE)
- {
- sLog.outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
- invType = INVTYPE_NON_EQUIP;
- }
+ QueryResult result = WorldDatabase.Query("SELECT `entry`,`name`,`InventoryType` FROM `item_set_names`");
- data.InventoryType = invType;
- itemSetItems.erase(entry);
- ++count;
- } while (result->NextRow());
- }
- else
+ if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
sLog.outString();
- sLog.outErrorDb(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
+ return;
}
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+
+ do
+ {
+ Field *fields = result->Fetch();
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ if (itemSetItems.find(entry) == itemSetItems.end())
+ {
+ sLog.outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
+ continue;
+ }
+
+ ItemSetNameEntry &data = mItemSetNameMap[entry];
+ data.name = fields[1].GetString();
+
+ uint32 invType = fields[2].GetUInt32();
+ if (invType >= MAX_INVTYPE)
+ {
+ sLog.outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
+ invType = INVTYPE_NON_EQUIP;
+ }
+
+ data.InventoryType = invType;
+ itemSetItems.erase(entry);
+ ++count;
+ } while (result->NextRow());
+
+
if (!itemSetItems.empty())
{
ItemPrototype const* pProto;
@@ -2591,12 +2620,14 @@ void ObjectMgr::LoadItemSetNames()
}
}
+ sLog.outString(">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u item set names", count);
}
void ObjectMgr::LoadVehicleAccessories()
{
+ uint32 oldMSTime = getMSTime();
+
m_VehicleAccessoryMap.clear(); // needed for reload case
uint32 count = 0;
@@ -2606,11 +2637,9 @@ void ObjectMgr::LoadVehicleAccessories()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 LoadVehicleAccessor. DB table `vehicle_accessory` is empty.");
+ sLog.outString();
return;
}
@@ -2643,12 +2672,14 @@ void ObjectMgr::LoadVehicleAccessories()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u Vehicle Accessories", count);
}
void ObjectMgr::LoadVehicleScaling()
{
+ uint32 oldMSTime = getMSTime();
+
m_VehicleScalingMap.clear(); // needed for reload case
uint32 count = 0;
@@ -2659,8 +2690,8 @@ void ObjectMgr::LoadVehicleScaling()
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 vehicle scaling entries. DB table `vehicle_scaling_info` is empty.");
sLog.outString();
- sLog.outErrorDb(">> Loaded 0 vehicle scaling entries. DB table `vehicle_scaling_info` is empty.");
return;
}
@@ -2688,85 +2719,79 @@ void ObjectMgr::LoadVehicleScaling()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u vehicle scaling entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u vehicle scaling entries.", count);
}
void ObjectMgr::LoadPetLevelInfo()
{
- // Loading levels data
- {
- // 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
- if (!result)
- {
- barGoLink bar(1);
+ if (!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
+ sLog.outString();
+ return;
+ }
- sLog.outString();
- sLog.outString(">> Loaded %u level pet stats definitions", count);
- sLog.outErrorDb("Error loading `pet_levelstats` table or empty table.");
- return;
- }
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- barGoLink bar(result->GetRowCount());
+ do
+ {
+ Field* fields = result->Fetch();
- do
+ uint32 creature_id = fields[0].GetUInt32();
+ if (!sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
{
- Field* fields = result->Fetch();
-
- uint32 creature_id = fields[0].GetUInt32();
- if (!sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
- {
- sLog.outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.",creature_id);
- continue;
- }
+ sLog.outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.",creature_id);
+ continue;
+ }
- uint32 current_level = fields[1].GetUInt32();
- if (current_level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- {
- if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
- else
- {
- sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
- ++count; // make result loading percent "expected" correct in case disabled detail mode for example.
- }
- continue;
- }
- else if (current_level < 1)
+ uint32 current_level = fields[1].GetUInt32();
+ if (current_level > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
+ {
+ if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
+ sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
+ else
{
- sLog.outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.",current_level);
- continue;
+ sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
+ ++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
+ continue;
+ }
+ else if (current_level < 1)
+ {
+ sLog.outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.",current_level);
+ continue;
+ }
- PetLevelInfo*& pInfoMapEntry = petInfo[creature_id];
-
- if (pInfoMapEntry == NULL)
- pInfoMapEntry = new PetLevelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
+ PetLevelInfo*& pInfoMapEntry = petInfo[creature_id];
- // data for level 1 stored in [0] array element, ...
- PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
+ if (pInfoMapEntry == NULL)
+ pInfoMapEntry = new PetLevelInfo[sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
- pLevelInfo->health = fields[2].GetUInt16();
- pLevelInfo->mana = fields[3].GetUInt16();
- pLevelInfo->armor = fields[9].GetUInt16();
+ // data for level 1 stored in [0] array element, ...
+ PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
- for (int i = 0; i < MAX_STATS; i++)
- {
- pLevelInfo->stats[i] = fields[i+4].GetUInt16();
- }
+ pLevelInfo->health = fields[2].GetUInt16();
+ pLevelInfo->mana = fields[3].GetUInt16();
+ pLevelInfo->armor = fields[9].GetUInt16();
- bar.step();
- ++count;
+ for (int i = 0; i < MAX_STATS; i++)
+ {
+ pLevelInfo->stats[i] = fields[i+4].GetUInt16();
}
- while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u level pet stats definitions", count);
+ bar.step();
+ ++count;
}
+ while (result->NextRow());
// Fill gaps and check integrity
for (PetLevelInfoMap::iterator itr = petInfo.begin(); itr != petInfo.end(); ++itr)
@@ -2790,6 +2815,9 @@ void ObjectMgr::LoadPetLevelInfo()
}
}
}
+
+ sLog.outString(">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
@@ -2849,115 +2877,113 @@ void ObjectMgr::LoadPlayerInfo()
{
// Load playercreate
{
+ uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
sLog.outString();
- sLog.outString(">> Loaded %u player create definitions", count);
- sLog.outErrorDb("Error loading `playercreateinfo` table or empty table.");
+ sLog.outErrorDb(">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
exit(1);
}
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- barGoLink bar(result->GetRowCount());
+ do
+ {
+ Field* fields = result->Fetch();
- do
- {
- Field* fields = result->Fetch();
+ uint32 current_race = fields[0].GetUInt32();
+ uint32 current_class = fields[1].GetUInt32();
+ uint32 mapId = fields[2].GetUInt32();
+ uint32 areaId = fields[3].GetUInt32();
+ float positionX = fields[4].GetFloat();
+ float positionY = fields[5].GetFloat();
+ float positionZ = fields[6].GetFloat();
+ float orientation = fields[7].GetFloat();
- uint32 current_race = fields[0].GetUInt32();
- uint32 current_class = fields[1].GetUInt32();
- uint32 mapId = fields[2].GetUInt32();
- uint32 areaId = fields[3].GetUInt32();
- float positionX = fields[4].GetFloat();
- float positionY = fields[5].GetFloat();
- float positionZ = fields[6].GetFloat();
- float orientation = fields[7].GetFloat();
+ if (current_race >= MAX_RACES)
+ {
+ sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
+ continue;
+ }
- if (current_race >= MAX_RACES)
- {
- sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
- continue;
- }
+ ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
+ if (!rEntry)
+ {
+ sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
+ continue;
+ }
- ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
- if (!rEntry)
- {
- sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.",current_race);
- continue;
- }
+ if (current_class >= MAX_CLASSES)
+ {
+ sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
+ continue;
+ }
- if (current_class >= MAX_CLASSES)
- {
- sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
- continue;
- }
+ if (!sChrClassesStore.LookupEntry(current_class))
+ {
+ sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
+ continue;
+ }
- if (!sChrClassesStore.LookupEntry(current_class))
- {
- sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.",current_class);
- continue;
- }
+ // accept DB data only for valid position (and non instanceable)
+ if (!MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ,orientation))
+ {
+ sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
+ continue;
+ }
- // accept DB data only for valid position (and non instanceable)
- if (!MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ,orientation))
- {
- sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
- continue;
- }
+ if (sMapStore.LookupEntry(mapId)->Instanceable())
+ {
+ sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
+ continue;
+ }
- if (sMapStore.LookupEntry(mapId)->Instanceable())
- {
- sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
- continue;
- }
+ PlayerInfo* pInfo = &playerInfo[current_race][current_class];
- PlayerInfo* pInfo = &playerInfo[current_race][current_class];
+ pInfo->mapId = mapId;
+ pInfo->areaId = areaId;
+ pInfo->positionX = positionX;
+ pInfo->positionY = positionY;
+ pInfo->positionZ = positionZ;
+ pInfo->orientation = orientation;
- pInfo->mapId = mapId;
- pInfo->areaId = areaId;
- pInfo->positionX = positionX;
- pInfo->positionY = positionY;
- pInfo->positionZ = positionZ;
- pInfo->orientation = orientation;
+ pInfo->displayId_m = rEntry->model_m;
+ pInfo->displayId_f = rEntry->model_f;
- pInfo->displayId_m = rEntry->model_m;
- pInfo->displayId_f = rEntry->model_f;
+ bar.step();
+ ++count;
+ }
+ while (result->NextRow());
- bar.step();
- ++count;
+ sLog.outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
-
- sLog.outString();
- sLog.outString(">> Loaded %u player create definitions", count);
}
// Load playercreate items
sLog.outString("Loading Player Create Items Data...");
{
+ uint32 oldMSTime = getMSTime();
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT race, class, itemid, amount FROM playercreateinfo_item");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u custom player create items", count);
}
else
{
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3011,14 +3037,15 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u custom player create items", count);
}
}
// Load playercreate spells
sLog.outString("Loading Player Create Spell Data...");
{
+ uint32 oldMSTime = getMSTime();
QueryResult result = QueryResult(NULL);
if (sWorld.getBoolConfig(CONFIG_START_ALL_SPELLS))
@@ -3026,19 +3053,17 @@ void ObjectMgr::LoadPlayerInfo()
else
result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld.getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
sLog.outString();
- sLog.outString(">> Loaded %u player create spells", count);
- sLog.outErrorDb("Error loading player starting spells or empty table.");
}
else
{
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3076,30 +3101,30 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u player create spells", count);
}
}
// Load playercreate actions
sLog.outString("Loading Player Create Action Data...");
{
+ uint32 oldMSTime = getMSTime();
+
// 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT race, class, button, action, type FROM playercreateinfo_action");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u player create actions", count);
- sLog.outErrorDb("Error loading `playercreateinfo_action` table or empty table.");
}
else
{
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3127,30 +3152,30 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u player create actions", count);
}
}
// Loading levels data (class only dependent)
sLog.outString("Loading Player Create Level HP/Mana Data...");
{
+ uint32 oldMSTime = getMSTime();
+
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT class, level, basehp, basemana FROM player_classlevelstats");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u level health/mana definitions", count);
- sLog.outErrorDb("Error loading `player_classlevelstats` table or empty table.");
exit(1);
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3186,56 +3211,56 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u level health/mana definitions", count);
- }
-
- // Fill gaps and check integrity
- for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
- {
- // skip non existed classes
- if (!sChrClassesStore.LookupEntry(class_))
- continue;
+ // Fill gaps and check integrity
+ for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
+ {
+ // skip non existed classes
+ if (!sChrClassesStore.LookupEntry(class_))
+ continue;
- PlayerClassInfo* pClassInfo = &playerClassInfo[class_];
+ PlayerClassInfo* pClassInfo = &playerClassInfo[class_];
- // fatal error if no level 1 data
- if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0)
- {
- sLog.outErrorDb("Class %i Level 1 does not have health/mana data!",class_);
- exit(1);
- }
+ // fatal error if no level 1 data
+ if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0)
+ {
+ sLog.outErrorDb("Class %i Level 1 does not have health/mana data!",class_);
+ exit(1);
+ }
- // fill level gaps
- for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
- {
- if (pClassInfo->levelInfo[level].basehealth == 0)
+ // fill level gaps
+ for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- sLog.outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.",class_,level+1, level);
- pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1];
+ if (pClassInfo->levelInfo[level].basehealth == 0)
+ {
+ sLog.outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.",class_,level+1, level);
+ pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1];
+ }
}
}
+
+ sLog.outString(">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
// Loading levels data (class/race dependent)
sLog.outString("Loading Player Create Level Stats Data...");
{
+ uint32 oldMSTime = getMSTime();
+
// 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT race, class, level, str, agi, sta, inte, spi FROM player_levelstats");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u level stats definitions", count);
- sLog.outErrorDb("Error loading `player_levelstats` table or empty table.");
exit(1);
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3285,59 +3310,61 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u level stats definitions", count);
- }
-
- // Fill gaps and check integrity
- for (int race = 0; race < MAX_RACES; ++race)
- {
- // skip non existed races
- if (!sChrRacesStore.LookupEntry(race))
- continue;
-
- for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
+ // Fill gaps and check integrity
+ for (int race = 0; race < MAX_RACES; ++race)
{
- // skip non existed classes
- if (!sChrClassesStore.LookupEntry(class_))
+ // skip non existed races
+ if (!sChrRacesStore.LookupEntry(race))
continue;
- PlayerInfo* pInfo = &playerInfo[race][class_];
+ for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
+ {
+ // skip non existed classes
+ if (!sChrClassesStore.LookupEntry(class_))
+ continue;
- // skip non loaded combinations
- if (!pInfo->displayId_m || !pInfo->displayId_f)
- continue;
+ PlayerInfo* pInfo = &playerInfo[race][class_];
- // skip expansion races if not playing with expansion
- if (sWorld.getIntConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI))
- continue;
+ // skip non loaded combinations
+ if (!pInfo->displayId_m || !pInfo->displayId_f)
+ continue;
- // skip expansion classes if not playing with expansion
- if (sWorld.getIntConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
- continue;
+ // skip expansion races if not playing with expansion
+ if (sWorld.getIntConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI))
+ continue;
- // fatal error if no level 1 data
- if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
- {
- sLog.outErrorDb("Race %i Class %i Level 1 does not have stats data!",race,class_);
- exit(1);
- }
+ // skip expansion classes if not playing with expansion
+ if (sWorld.getIntConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
+ continue;
- // fill level gaps
- for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
- {
- if (pInfo->levelInfo[level].stats[0] == 0)
+ // fatal error if no level 1 data
+ if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
+ {
+ sLog.outErrorDb("Race %i Class %i Level 1 does not have stats data!",race,class_);
+ exit(1);
+ }
+
+ // fill level gaps
+ for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- sLog.outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.",race,class_,level+1, level);
- pInfo->levelInfo[level] = pInfo->levelInfo[level-1];
+ if (pInfo->levelInfo[level].stats[0] == 0)
+ {
+ sLog.outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.",race,class_,level+1, level);
+ pInfo->levelInfo[level] = pInfo->levelInfo[level-1];
+ }
}
}
}
+
+ sLog.outString(">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
// Loading xp per level data
sLog.outString("Loading Player Create XP Data...");
{
+ uint32 oldMSTime = getMSTime();
+
mPlayerXPperLevel.resize(sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
for (uint8 level = 0; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
mPlayerXPperLevel[level] = 0;
@@ -3345,19 +3372,17 @@ void ObjectMgr::LoadPlayerInfo()
// 0 1
QueryResult result = WorldDatabase.Query("SELECT lvl, xp_for_next_level FROM player_xp_for_level");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
-
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u xp for level definitions", count);
- sLog.outErrorDb("Error loading `player_xp_for_level` table or empty table.");
exit(1);
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3384,18 +3409,18 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u xp for level definitions", count);
- }
-
- // fill level gaps
- for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
- {
- if (mPlayerXPperLevel[level] == 0)
+ // fill level gaps
+ for (uint8 level = 1; level < sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- sLog.outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.",level+1, level);
- mPlayerXPperLevel[level] = mPlayerXPperLevel[level-1]+100;
+ if (mPlayerXPperLevel[level] == 0)
+ {
+ sLog.outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.",level+1, level);
+ mPlayerXPperLevel[level] = mPlayerXPperLevel[level-1]+100;
+ }
}
+
+ sLog.outString(">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
}
@@ -3505,292 +3530,366 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
void ObjectMgr::LoadGuilds()
{
- PreparedStatement* stmt = NULL;
- PreparedQueryResult result;
-
- sLog.outString("Loading Guilds...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILDS);
- result = CharacterDatabase.Query(stmt);
- if (!result)
- {
- barGoLink bar(1);
- bar.step();
-
- sLog.outString(">> Loaded 0 guild definitions");
- sLog.outString();
- return;
- }
- mGuildMap.resize(m_guildId, NULL); // Reserve space and initialize storage for loading guilds
// 1. Load all guilds
- uint64 rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ sLog.outString("Loading guilds definitions...");
{
- bar.step();
+ uint32 oldMSTime = getMSTime();
- Field* fields = result->Fetch();
- Guild* pNewGuild = new Guild();
- if (!pNewGuild->LoadFromDB(fields))
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILDS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
- delete pNewGuild;
- continue;
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 guild definitions. DB table `guild` is empty.");
+ sLog.outString();
+ return;
+ }
+ else
+ {
+ mGuildMap.resize(m_guildId, NULL); // Reserve space and initialize storage for loading guilds //TODOLEAK: fix this shit
+
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ Guild* pNewGuild = new Guild();
+ if (!pNewGuild->LoadFromDB(fields))
+ {
+ delete pNewGuild;
+ continue;
+ }
+ AddGuild(pNewGuild);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- AddGuild(pNewGuild);
}
- while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded " UI64FMTD " guilds definitions", rowCount);
- sLog.outString();
// 2. Load all guild ranks
sLog.outString("Loading guild ranks...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_RANKS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Delete orphaned guild rank entries before loading the valid ones
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_RANKS);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_RANKS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadRankFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadRankFromDB(fields); //TODOLEAK: untangle that shit
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
}
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
- }
- sLog.outString(">> Loaded " UI64FMTD " ranks for all the guilds", rowCount);
- sLog.outString();
// 3. Load all guild members
sLog.outString("Loading guild members...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_MEMBERS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Delete orphaned guild member entries before loading the valid ones
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_MEMBERS);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_MEMBERS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild members. DB table `guild_member` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadMemberFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadMemberFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
- }
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
}
- sLog.outString(">> Loaded " UI64FMTD " members from all the guilds", rowCount);
- sLog.outString();
// 4. Load all guild bank tab rights
sLog.outString("Loading bank tab rights...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_RIGHTS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Delete orphaned guild bank right entries before loading the valid ones
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_RIGHTS);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_RIGHTS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadBankRightFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadBankRightFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
- }
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
}
- sLog.outString(">> Loaded " UI64FMTD " bank tab rights for all the guilds", rowCount);
- sLog.outString();
// 5. Load all event logs
sLog.outString("Loading guild event logs...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_EVENTLOGS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_GUILD_EVENT_LOGS);
+ stmt->setUInt32(0, sWorld.getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_EVENTLOGS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadEventLogFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadEventLogFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
}
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
- }
- sLog.outString(">> Loaded " UI64FMTD " event logs for all the guilds", rowCount);
- sLog.outString();
// 6. Load all bank event logs
sLog.outString("Loading guild bank event logs...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_EVENTLOGS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Remove log entries that exceed the number of allowed entries per guild
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_GUILD_BANK_EVENT_LOGS);
+ stmt->setUInt32(0, sWorld.getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_EVENTLOGS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadBankEventLogFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadBankEventLogFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
}
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
- }
- sLog.outString(">> Loaded " UI64FMTD " bank event logs for all the guilds", rowCount);
- sLog.outString();
// 7. Load all guild bank tabs
sLog.outString("Loading guild bank tabs...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_TABS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Delete orphaned guild bank tab entries before loading the valid ones
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_TABS);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_TABS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadBankTabFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[0].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadBankTabFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
- }
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
}
- sLog.outString(">> Loaded " UI64FMTD " bank tabs for all the guilds", rowCount);
- sLog.outString();
// 8. Fill all guild bank tabs
sLog.outString("Filling bank tabs with items...");
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_ITEMS);
- result = CharacterDatabase.Query(stmt);
- if (result)
{
- rowCount = result->GetRowCount();
- barGoLink bar(rowCount);
- do
+ uint32 oldMSTime = getMSTime();
+
+ // Delete orphan guild bank items
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_ITEMS);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_BANK_ITEMS);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
{
+ barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
+ sLog.outString();
+ }
+ else
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- Field* fields = result->Fetch();
- uint32 guildId = fields[11].GetUInt32();
- if (Guild* pGuild = GetGuildById(guildId))
- pGuild->LoadBankItemFromDB(fields);
+ do
+ {
+ bar.step();
+
+ Field* fields = result->Fetch();
+ uint32 guildId = fields[11].GetUInt32();
+ if (Guild* pGuild = GetGuildById(guildId))
+ pGuild->LoadBankItemFromDB(fields);
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
- while (result->NextRow());
}
- else
- {
- rowCount = 0;
- barGoLink bar(1);
- bar.step();
- }
- sLog.outString(">> Filled bank tabs with " UI64FMTD " items for all the guilds", rowCount);
- sLog.outString();
// 9. Validate loaded guild data
- uint32 totalGuilds = 0;
sLog.outString("Validating data of loaded guilds...");
- barGoLink barGuilds(mGuildMap.size());
- for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
{
- barGuilds.step();
- Guild* pGuild = *itr;
- if (pGuild)
+ uint32 oldMSTime = getMSTime();
+
+ barGoLink barGuilds(mGuildMap.size());
+ for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
{
- if (!pGuild->Validate())
+ barGuilds.step();
+ Guild* pGuild = *itr;
+ if (pGuild)
{
- RemoveGuild(pGuild->GetId());
- delete pGuild;
+ if (!pGuild->Validate())
+ {
+ RemoveGuild(pGuild->GetId());
+ delete pGuild;
+ }
}
- else
- ++totalGuilds;
}
- }
- // Cleanup
- // Delete orphan guild ranks
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_RANKS);
- CharacterDatabase.Execute(stmt);
- // Delete orphan guild members
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_MEMBERS);
- CharacterDatabase.Execute(stmt);
- // Delete orphan guild bank rights
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_RIGHTS);
- CharacterDatabase.Execute(stmt);
- // Delete orphan guild bank tabs
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_TABS);
- CharacterDatabase.Execute(stmt);
- // Delete orphan guild bank items
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_GUILD_BANK_ITEMS);
- CharacterDatabase.Execute(stmt);
-
- // Delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table.
- // You can comment these lines if you don't plan to change CONFIG_GUILD_EVENT_LOG_COUNT and CONFIG_GUILD_BANK_EVENT_LOG_COUNT
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_GUILD_EVENT_LOGS);
- stmt->setUInt32(0, sWorld.getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
- CharacterDatabase.Execute(stmt);
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_GUILD_BANK_EVENT_LOGS);
- stmt->setUInt32(0, sWorld.getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
- CharacterDatabase.Execute(stmt);
- sLog.outString();
- sLog.outString(">> Successfully loaded %u guilds", totalGuilds);
+ sLog.outString("Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
+ }
}
void ObjectMgr::LoadArenaTeams()
{
- uint32 count = 0;
+ uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5
QueryResult result = CharacterDatabase.Query("SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,"
@@ -3800,13 +3899,10 @@ void ObjectMgr::LoadArenaTeams()
if (!result)
{
-
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 arena team definitions. DB table `arena_team` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u arenateam definitions", count);
return;
}
@@ -3817,6 +3913,7 @@ void ObjectMgr::LoadArenaTeams()
"FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC");
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -3837,139 +3934,155 @@ void ObjectMgr::LoadArenaTeams()
}while (result->NextRow());
sLog.outString();
- sLog.outString(">> Loaded %u arenateam definitions", count);
+ sLog.outString(">> Loaded %u arena team definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGroups()
{
- Group *group = NULL;
- Field *fields = NULL;
- uint32 count = 0;
-
- // Consistency cleaning before load to avoid having to do some checks later
- // Delete all members that does not exist
- CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_CHARACTER_GROUP_MEMBERS));
- // Delete all groups whose leader does not exist
- CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_LEADERLESS_GROUPS));
- // Delete all groups with less than 2 members
- CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_TINY_GROUPS));
- // Delete all rows from group_member or group_instance with no group
- CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GROUP_MEMBERS));
- CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GROUP_INSTANCES));
-
- // ----------------------- Load Group definitions
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- QueryResult result = CharacterDatabase.PQuery("SELECT leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, guid FROM groups");
- if (!result)
{
- barGoLink bar(1);
- bar.step();
+ uint32 oldMSTime = getMSTime();
- sLog.outString();
- sLog.outString(">> Loaded 0 group definitions");
- return;
- }
+ // Delete all groups whose leader does not exist
+ CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_LEADERLESS_GROUPS));
+ // Delete all groups with less than 2 members
+ CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_TINY_GROUPS));
- barGoLink bar(result->GetRowCount());
- do
- {
- bar.step();
- fields = result->Fetch();
- ++count;
- group = new Group;
- group->LoadGroupFromDB(fields[15].GetUInt32(), result, false);
- // group load will never be false (we have run consistency sql's before loading)
- AddGroup(group);
- }while (result->NextRow());
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = CharacterDatabase.PQuery("SELECT leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6"
+ // 10 11 12 13 14 15
+ ",icon7, icon8, groupType, difficulty, raiddifficulty, guid FROM groups");
+ if (!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 group definitions. DB table `groups` is empty!");
+ sLog.outString();
+ return;
+ }
- sLog.outString();
- sLog.outString(">> Loaded %u group definitions", count);
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- // ----------------------- Load member
- // 0 1 2 3 4
- result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
- if (!result)
- {
- barGoLink bar2(1);
- bar2.step();
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
+ ++count;
+ Group *group = new Group;
+ group->LoadGroupFromDB(fields[15].GetUInt32(), result, false);
+ // group load will never be false (we have run consistency sql's before loading)
+ AddGroup(group);
+ }
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded 0 group members");
- return;
}
- barGoLink bar2(result->GetRowCount());
- uint32 groupLowGuid = 0;
- count = 0;
- do
+ sLog.outString("Loading Group members...");
{
- bar2.step();
- fields = result->Fetch();
+ uint32 oldMSTime = getMSTime();
+
+ // Delete all rows from group_member or group_instance with no group
+ CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GROUP_MEMBERS));
+ CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GROUP_INSTANCES));
+ // Delete all members that does not exist
+ CharacterDatabase.Execute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_CHARACTER_GROUP_MEMBERS));
- if (groupLowGuid != fields[0].GetUInt32())
+ // 0 1 2 3 4
+ QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
+ if (!result)
{
- groupLowGuid = fields[0].GetUInt32();
- group = GetGroupByGUID(groupLowGuid);
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 group members. DB table `group_member` is empty!");
+ sLog.outString();
+ return;
}
- if (group) // Should never be null
- group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8());
- else
- sLog.outError("ObjectMgr::LoadGroups: Consistency failed, can't find group (lowguid %u)", groupLowGuid);
- ++count;
- }while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u group members", count);
-
-
- // ----------------------- Load instance save
- // 0 1 2 3 4 5
- result = CharacterDatabase.Query("SELECT guid, map, instance, permanent, difficulty, resettime, "
- // 6
- "(SELECT COUNT(1) FROM groups JOIN character_instance ON leaderGuid = groups.guid WHERE instance = group_instance.instance AND permanent = 1 LIMIT 1) "
- "FROM group_instance LEFT JOIN instance ON instance = id ORDER BY guid");
+ barGoLink bar(result->GetRowCount());
+ uint32 groupLowGuid = 0;
+ uint32 count = 0;
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
+ Group *group = NULL;
+ if (groupLowGuid != fields[0].GetUInt32())
+ {
+ groupLowGuid = fields[0].GetUInt32();
+ group = GetGroupByGUID(groupLowGuid);
+ }
+ if (group) // Should never be null
+ group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8());
+ else
+ sLog.outError("ObjectMgr::LoadGroups: Consistency failed, can't find group (lowguid %u)", groupLowGuid);
+ ++count;
+ }
+ while (result->NextRow());
- if (!result)
- {
- barGoLink bar2(1);
- bar2.step();
+ sLog.outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded 0 group-instance saves");
- return;
}
- barGoLink bar3(result->GetRowCount());
- count = 0;
- do
+
+ sLog.outString("Loading Group instance saves...");
{
- bar3.step();
- fields = result->Fetch();
- group = GetGroupByGUID(fields[0].GetUInt32());
- // group will never be NULL (we have run consistency sql's before loading)
+ uint32 oldMSTime = getMSTime();
- MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32());
- if (!mapEntry || !mapEntry->IsDungeon())
+ // 0 1 2 3 4 5
+ QueryResult result = CharacterDatabase.Query("SELECT guid, map, instance, permanent, difficulty, resettime, "
+ // 6
+ "(SELECT COUNT(1) FROM groups JOIN character_instance ON leaderGuid = groups.guid WHERE instance = group_instance.instance AND permanent = 1 LIMIT 1) "
+ "FROM group_instance LEFT JOIN instance ON instance = id ORDER BY guid");
+
+ if (!result)
{
- sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32());
- continue;
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString();
+ sLog.outString(">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
+ return;
}
- uint32 diff = fields[4].GetUInt8();
- if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
+ barGoLink bar3(result->GetRowCount());
+ uint32 count = 0;
+ do
{
- sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
- diff = 0; // default for both difficaly types
+ bar3.step();
+ Field *fields = result->Fetch();
+ Group *group = GetGroupByGUID(fields[0].GetUInt32());
+ // group will never be NULL (we have run consistency sql's before loading)
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32());
+ if (!mapEntry || !mapEntry->IsDungeon())
+ {
+ sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32());
+ continue;
+ }
+
+ uint32 diff = fields[4].GetUInt8();
+ if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
+ {
+ sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
+ diff = 0; // default for both difficaly types
+ }
+
+ InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt64()), fields[6].GetBool(), true);
+ group->BindToInstance(save, fields[3].GetBool(), true);
+ ++count;
}
+ while (result->NextRow());
- InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt64()), fields[6].GetBool(), true);
- group->BindToInstance(save, fields[3].GetBool(), true);
- ++count;
- }while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u group-instance saves", count);
+ sLog.outString(">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
+ }
}
void ObjectMgr::LoadQuests()
{
+ uint32 oldMSTime = getMSTime();
+
// For reload case
for (QuestMap::const_iterator itr=mQuestTemplates.begin(); itr != mQuestTemplates.end(); ++itr)
delete itr->second;
@@ -4018,10 +4131,8 @@ void ObjectMgr::LoadQuests()
{
barGoLink bar(1);
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 quests definitions");
- sLog.outErrorDb("`quest_template` table is empty!");
return;
}
@@ -4662,12 +4773,14 @@ void ObjectMgr::LoadQuests()
}
}
+ sLog.outString(">> Loaded %lu quests definitions in %u ms", (unsigned long)mQuestTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu quests definitions", (unsigned long)mQuestTemplates.size());
}
void ObjectMgr::LoadQuestLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mQuestLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,"
@@ -4679,8 +4792,7 @@ void ObjectMgr::LoadQuestLocales()
"Title_loc6,Details_loc6,Objectives_loc6,OfferRewardText_loc6,RequestItemsText_loc6,EndText_loc6,CompletedText_loc6,ObjectiveText1_loc6,ObjectiveText2_loc6,ObjectiveText3_loc6,ObjectiveText4_loc6,"
"Title_loc7,Details_loc7,Objectives_loc7,OfferRewardText_loc7,RequestItemsText_loc7,EndText_loc7,CompletedText_loc7,ObjectiveText1_loc7,ObjectiveText2_loc7,ObjectiveText3_loc7,ObjectiveText4_loc7,"
"Title_loc8,Details_loc8,Objectives_loc8,OfferRewardText_loc8,RequestItemsText_loc8,EndText_loc8,CompletedText_loc8,ObjectiveText1_loc8,ObjectiveText2_loc8,ObjectiveText3_loc8,ObjectiveText4_loc8"
- " FROM locales_quest"
-);
+ " FROM locales_quest");
if (!result)
return;
@@ -4728,12 +4840,14 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu Quest locale strings in %u ms", (unsigned long)mQuestLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu Quest locale strings", (unsigned long)mQuestLocaleMap.size());
}
void ObjectMgr::LoadScripts(ScriptsType type)
{
+ uint32 oldMSTime = getMSTime();
+
ScriptMapMap *scripts = GetScriptsMapByType(type);
if (!scripts)
return;
@@ -4745,7 +4859,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.
return;
- sLog.outString("%s :", tableName.c_str());
+ sLog.outString("Loading %s...", tableName.c_str());
scripts->clear(); // need for reload support
@@ -4754,19 +4868,18 @@ void ObjectMgr::LoadScripts(ScriptsType type)
sprintf(buff, "SELECT id,delay,command,datalong,datalong2,dataint,x,y,z,o%s FROM %s", isSpellScriptTable ? ",effIndex" : "", tableName.c_str());
QueryResult result = WorldDatabase.Query(buff);
- uint32 count = 0;
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
sLog.outString();
- sLog.outString(">> Loaded %u script definitions", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -5052,10 +5165,11 @@ void ObjectMgr::LoadScripts(ScriptsType type)
(*scripts)[tmp.id].insert(std::pair<uint32, ScriptInfo>(tmp.delay, tmp));
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u script definitions", count);
}
void ObjectMgr::LoadGameObjectScripts()
@@ -5199,26 +5313,26 @@ void ObjectMgr::LoadWaypointScripts()
void ObjectMgr::LoadSpellScriptNames()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellScripts.clear(); // need for reload case
- QueryResult result = WorldDatabase.Query("SELECT spell_id, ScriptName FROM spell_script_names");
- uint32 count = 0;
+ QueryResult result = WorldDatabase.Query("SELECT spell_id, ScriptName FROM spell_script_names");
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u spell script names", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
- ++count;
bar.step();
Field *fields = result->Fetch();
@@ -5255,26 +5369,30 @@ void ObjectMgr::LoadSpellScriptNames()
}
else
mSpellScripts.insert(SpellScriptsMap::value_type(spellId, GetScriptId(scriptName)));
+ ++count;
+ }
+ while (result->NextRow());
- } while (result->NextRow());
-
+ sLog.outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell script names", count);
}
void ObjectMgr::ValidateSpellScripts()
{
+ uint32 oldMSTime = getMSTime();
+
if (mSpellScripts.empty())
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Validated 0 scripts.");
sLog.outString();
- sLog.outString(">> Validation done");
return;
}
barGoLink bar(mSpellScripts.size());
+ uint32 count = 0;
+
for (SpellScriptsMap::iterator itr = mSpellScripts.begin(); itr != mSpellScripts.end();)
{
SpellEntry const * spellEntry = sSpellStore.LookupEntry(itr->first);
@@ -5282,9 +5400,10 @@ void ObjectMgr::ValidateSpellScripts()
sScriptMgr.CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
itr = mSpellScripts.upper_bound(itr->first);
+ bar.step();
+
for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr)
{
- bar.step();
SpellScript * spellScript = sitr->first->GetSpellScript();
AuraScript * auraScript = sitr->first->GetAuraScript();
bool valid = true;
@@ -5310,12 +5429,16 @@ void ObjectMgr::ValidateSpellScripts()
delete auraScript;
}
if (!valid)
+ {
mSpellScripts.erase(sitr->second);
+ bar.step();
+ }
}
+ ++count;
}
+ sLog.outString(">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Validation done");
}
void ObjectMgr::LoadGossipScripts()
@@ -5327,11 +5450,11 @@ void ObjectMgr::LoadGossipScripts()
void ObjectMgr::LoadPageTexts()
{
+ uint32 oldMSTime = getMSTime();
+
sPageTextStore.Free(); // for reload case
sPageTextStore.Load();
- sLog.outString(">> Loaded %u page texts", sPageTextStore.RecordCount);
- sLog.outString();
for (uint32 i = 1; i < sPageTextStore.MaxEntry; ++i)
{
@@ -5367,10 +5490,15 @@ void ObjectMgr::LoadPageTexts()
}
}
}
+
+ sLog.outString(">> Loaded %u page texts in %u ms", sPageTextStore.RecordCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void ObjectMgr::LoadPageTextLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mPageTextLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text");
@@ -5397,8 +5525,8 @@ void ObjectMgr::LoadPageTextLocales()
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)mPageTextLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu PageText locale strings", (unsigned long)mPageTextLocaleMap.size());
}
struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
@@ -5412,6 +5540,8 @@ struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
void ObjectMgr::LoadInstanceTemplate()
{
+ uint32 oldMSTime = getMSTime();
+
SQLInstanceLoader loader;
loader.Load(sInstanceTemplate);
@@ -5431,7 +5561,7 @@ void ObjectMgr::LoadInstanceTemplate()
}
}
- sLog.outString(">> Loaded %u Instance Template definitions", sInstanceTemplate.RecordCount);
+ sLog.outString(">> Loaded %u Instance Template definitions in %u ms", sInstanceTemplate.RecordCount, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
}
@@ -5445,6 +5575,8 @@ GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const
void ObjectMgr::LoadGossipText()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT * FROM npc_text");
int count = 0;
@@ -5453,8 +5585,8 @@ void ObjectMgr::LoadGossipText()
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded %u npc texts", count);
+ sLog.outString();
return;
}
@@ -5496,12 +5628,14 @@ void ObjectMgr::LoadGossipText()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u npc texts", count);
}
void ObjectMgr::LoadNpcTextLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mNpcTextLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,"
@@ -5543,13 +5677,15 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)mNpcTextLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu NpcText locale strings", (unsigned long)mNpcTextLocaleMap.size());
}
//not very fast function but it is called only once a day, or on starting-up
void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
+ uint32 oldMSTime = getMSTime();
+
time_t curTime = time(NULL);
tm* lt = localtime(&curTime);
uint64 basetime(curTime);
@@ -5569,19 +5705,18 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> No expired mails found or DB table `mail` is empty.");
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
}
barGoLink bar(result->GetRowCount());
uint32 count = 0;
- Field *fields;
do
{
bar.step();
- fields = result->Fetch();
+ Field *fields = result->Fetch();
Mail *m = new Mail;
m->messageID = fields[0].GetUInt32();
m->messageType = fields[1].GetUInt8();
@@ -5668,31 +5803,32 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
CharacterDatabase.Execute(stmt);
delete m;
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u mails in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u mails", count);
}
void ObjectMgr::LoadQuestAreaTriggers()
{
+ uint32 oldMSTime = getMSTime();
+
mQuestAreaTriggerMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT id,quest FROM areatrigger_involvedrelation");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u quest trigger points", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -5733,29 +5869,29 @@ void ObjectMgr::LoadQuestAreaTriggers()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quest trigger points", count);
}
void ObjectMgr::LoadTavernAreaTriggers()
{
+ uint32 oldMSTime = getMSTime();
+
mTavernAreaTriggerSet.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT id FROM areatrigger_tavern");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u tavern triggers", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -5776,28 +5912,28 @@ void ObjectMgr::LoadTavernAreaTriggers()
mTavernAreaTriggerSet.insert(Trigger_ID);
} while (result->NextRow());
+ sLog.outString(">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u tavern triggers", count);
}
void ObjectMgr::LoadAreaTriggerScripts()
{
+ uint32 oldMSTime = getMSTime();
+
mAreaTriggerScripts.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u areatrigger scripts", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -5818,8 +5954,8 @@ void ObjectMgr::LoadAreaTriggerScripts()
mAreaTriggerScripts[Trigger_ID] = GetScriptId(scriptName);
} while (result->NextRow());
+ sLog.outString(">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u areatrigger scripts", count);
}
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
@@ -5929,23 +6065,23 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
void ObjectMgr::LoadGraveyardZones()
{
+ uint32 oldMSTime = getMSTime();
+
mGraveYardMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT id,ghost_zone,faction FROM game_graveyard_zone");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u graveyard-zone links", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -5988,8 +6124,8 @@ void ObjectMgr::LoadGraveyardZones()
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId);
} while (result->NextRow());
+ sLog.outString(">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u graveyard-zone links", count);
}
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
@@ -6201,25 +6337,23 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
void ObjectMgr::LoadAreaTriggerTeleports()
{
- mAreaTriggers.clear(); // need for reload case
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ mAreaTriggers.clear(); // need for reload case
// 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if (!result)
{
-
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u area trigger teleport definitions", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -6263,31 +6397,29 @@ void ObjectMgr::LoadAreaTriggerTeleports()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u area trigger teleport definitions", count);
}
void ObjectMgr::LoadAccessRequirements()
{
- mAccessRequirements.clear(); // need for reload case
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ mAccessRequirements.clear(); // need for reload case
// 0 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
-
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u access requirement definitions", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -6362,8 +6494,8 @@ void ObjectMgr::LoadAccessRequirements()
mAccessRequirements[requirement_ID] = ar;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u access requirement definitions", count);
}
/*
@@ -6607,6 +6739,8 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
void ObjectMgr::LoadGameObjectLocales()
{
+ uint32 oldMSTime = getMSTime();
+
mGameObjectLocaleMap.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry,"
@@ -6642,8 +6776,8 @@ void ObjectMgr::LoadGameObjectLocales()
} while (result->NextRow());
+ sLog.outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)mGameObjectLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %lu gameobject locale strings", (unsigned long)mGameObjectLocaleMap.size());
}
struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
@@ -6717,6 +6851,8 @@ inline void CheckGOConsumable(GameObjectInfo const* goInfo,uint32 dataN,uint32 N
void ObjectMgr::LoadGameobjectInfo()
{
+ uint32 oldMSTime = getMSTime();
+
SQLGameObjectLoader loader;
loader.Load(sGOStorage);
@@ -6859,27 +6995,27 @@ void ObjectMgr::LoadGameobjectInfo()
}
}
- sLog.outString(">> Loaded %u game object templates", sGOStorage.RecordCount);
+ sLog.outString(">> Loaded %u game object templates in %u ms", sGOStorage.RecordCount, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
}
void ObjectMgr::LoadExplorationBaseXP()
{
- uint32 count = 0;
- QueryResult result = WorldDatabase.Query("SELECT level,basexp FROM exploration_basexp");
+ uint32 oldMSTime = getMSTime();
+
+ QueryResult result = WorldDatabase.Query("SELECT word,entry,half FROM pet_name_generation");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u BaseXP definitions", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -6893,8 +7029,8 @@ void ObjectMgr::LoadExplorationBaseXP()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u BaseXP definitions", count);
}
uint32 ObjectMgr::GetBaseXP(uint8 level)
@@ -6911,21 +7047,21 @@ uint32 ObjectMgr::GetXPForLevel(uint8 level)
void ObjectMgr::LoadPetNames()
{
- uint32 count = 0;
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT word,entry,half FROM pet_name_generation");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u pet name parts", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -6943,12 +7079,14 @@ void ObjectMgr::LoadPetNames()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u pet name parts", count);
}
void ObjectMgr::LoadPetNumber()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = CharacterDatabase.Query("SELECT MAX(id) FROM character_pet");
if (result)
{
@@ -6956,11 +7094,8 @@ void ObjectMgr::LoadPetNumber()
m_hiPetNumber = fields[0].GetUInt32()+1;
}
- barGoLink bar(1);
- bar.step();
-
+ sLog.outString(">> Loaded the max pet number: %d in %u ms", m_hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded the max pet number: %d", m_hiPetNumber-1);
}
std::string ObjectMgr::GeneratePetName(uint32 entry)
@@ -6987,22 +7122,24 @@ uint32 ObjectMgr::GeneratePetNumber()
void ObjectMgr::LoadCorpses()
{
- uint32 count = 0;
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
- QueryResult result = CharacterDatabase.Query("SELECT position_x, position_y, position_z, orientation, map, displayId, itemCache, bytes1, bytes2, guild, flags, dynFlags, time, corpse_type, instance, phaseMask, guid, player FROM corpse WHERE corpse_type <> 0");
+ uint32 oldMSTime = getMSTime();
+
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ QueryResult result = CharacterDatabase.Query("SELECT position_x, position_y, position_z, orientation, map, displayId, itemCache, bytes1, bytes2, guild, flags, dynFlags"
+ // 12 13 14 15 16 17
+ ", time, corpse_type, instance, phaseMask, guid, player FROM corpse WHERE corpse_type <> 0");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 corpses. DB table `pet_name_generation` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u corpses", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -7025,12 +7162,14 @@ void ObjectMgr::LoadCorpses()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u corpses", count);
}
void ObjectMgr::LoadReputationRewardRate()
{
+ uint32 oldMSTime = getMSTime();
+
m_RepRewardRateMap.clear(); // for reload case
uint32 count = 0;
@@ -7039,11 +7178,9 @@ void ObjectMgr::LoadReputationRewardRate()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded `reputation_reward_rate`, table is empty!");
+ sLog.outString();
return;
}
@@ -7094,12 +7231,14 @@ void ObjectMgr::LoadReputationRewardRate()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u reputation_reward_rate", count);
}
void ObjectMgr::LoadReputationOnKill()
{
+ uint32 oldMSTime = getMSTime();
+
// For reload case
mRepOnKill.clear();
@@ -7114,11 +7253,9 @@ void ObjectMgr::LoadReputationOnKill()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
+ sLog.outString();
return;
}
@@ -7173,12 +7310,14 @@ void ObjectMgr::LoadReputationOnKill()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u creature award reputation definitions", count);
}
void ObjectMgr::LoadReputationSpilloverTemplate()
{
+ uint32 oldMSTime = getMSTime();
+
m_RepSpilloverTemplateMap.clear(); // for reload case
uint32 count = 0;
@@ -7187,11 +7326,9 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outString(">> Loaded `reputation_spillover_template`, table is empty.");
+ sLog.outString();
return;
}
@@ -7291,12 +7428,14 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u reputation_spillover_template", count);
}
void ObjectMgr::LoadPointsOfInterest()
{
+ uint32 oldMSTime = getMSTime();
+
mPointsOfInterest.clear(); // need for reload case
uint32 count = 0;
@@ -7307,11 +7446,9 @@ void ObjectMgr::LoadPointsOfInterest()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
+ sLog.outString();
return;
}
@@ -7343,12 +7480,14 @@ void ObjectMgr::LoadPointsOfInterest()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u Points of Interest definitions", count);
}
void ObjectMgr::LoadQuestPOI()
{
+ uint32 oldMSTime = getMSTime();
+
mQuestPOIMap.clear(); // need for reload case
uint32 count = 0;
@@ -7359,11 +7498,9 @@ void ObjectMgr::LoadQuestPOI()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
+ sLog.outString();
return;
}
@@ -7422,13 +7559,13 @@ void ObjectMgr::LoadQuestPOI()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quest POI definitions", count);
}
void ObjectMgr::LoadNPCSpellClickSpells()
{
- uint32 count = 0;
+ uint32 oldMSTime = getMSTime();
mSpellClickInfoMap.clear();
// 0 1 2 3 4 5 6 7 8
@@ -7437,15 +7574,14 @@ void ObjectMgr::LoadNPCSpellClickSpells()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -7538,10 +7674,11 @@ void ObjectMgr::LoadNPCSpellClickSpells()
const_cast<CreatureInfo*>(cInfo)->npcflag |= UNIT_NPC_FLAG_SPELLCLICK;
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spellclick definitions", count);
}
void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t)
@@ -7651,6 +7788,8 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_
void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go)
{
+ uint32 oldMSTime = getMSTime();
+
map.clear(); // need for reload case
uint32 count = 0;
@@ -7660,11 +7799,9 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
sLog.outString();
- sLog.outErrorDb(">> Loaded 0 quest relations from %s, table is empty.", table.c_str());
return;
}
@@ -7696,8 +7833,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quest relations from %s", count, table.c_str());
}
void ObjectMgr::LoadGameobjectQuestRelations()
@@ -7758,23 +7895,23 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
void ObjectMgr::LoadReservedPlayersNames()
{
+ uint32 oldMSTime = getMSTime();
+
m_ReservedNames.clear(); // need for reload case
QueryResult result = CharacterDatabase.Query("SELECT name FROM reserved_name");
- uint32 count = 0;
-
if (!result)
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
sLog.outString();
- sLog.outString(">> Loaded %u reserved player names", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
Field* fields;
do
@@ -7794,10 +7931,11 @@ void ObjectMgr::LoadReservedPlayersNames()
m_ReservedNames.insert(wstr);
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u reserved player names", count);
}
bool ObjectMgr::IsReservedName(const std::string& name) const
@@ -7944,14 +8082,16 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name)
void ObjectMgr::LoadGameObjectForQuests()
{
+ uint32 oldMSTime = getMSTime();
+
mGameObjectForQuestSet.clear(); // need for reload case
if (!sGOStorage.MaxEntry)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 GameObjects for quests");
+ sLog.outString();
return;
}
@@ -8004,12 +8144,14 @@ void ObjectMgr::LoadGameObjectForQuests()
}
}
+ sLog.outString(">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u GameObjects for quests", count);
}
bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max_value)
{
+ uint32 oldMSTime = getMSTime();
+
int32 start_value = min_value;
int32 end_value = max_value;
// some string can have negative indexes range
@@ -8052,11 +8194,11 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
bar.step();
- sLog.outString();
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
sLog.outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.",table);
else
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.",table);
+ sLog.outString();
return false;
}
@@ -8100,12 +8242,13 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
}
} while (result->NextRow());
- sLog.outString();
+
if (min_value == MIN_TRINITY_STRING_ID)
- sLog.outString(">> Loaded %u Trinity strings from table %s", count,table);
+ sLog.outString(">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
- sLog.outString(">> Loaded %u string templates from %s", count,table);
+ sLog.outString(">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
return true;
}
@@ -8128,23 +8271,23 @@ const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx)
void ObjectMgr::LoadFishingBaseSkillLevel()
{
+ uint32 oldMSTime = getMSTime();
+
mFishingBaseForArea.clear(); // for reload case
- uint32 count = 0;
QueryResult result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
sLog.outString();
- sLog.outErrorDb(">> Loaded `skill_fishing_base_level`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -8166,8 +8309,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u areas for fishing base skill level", count);
}
bool ObjectMgr::CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names)
@@ -8231,23 +8374,23 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial)
void ObjectMgr::LoadGameTele()
{
+ uint32 oldMSTime = getMSTime();
+
m_GameTeleMap.clear(); // for reload case
- uint32 count = 0;
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded `game_tele`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -8286,8 +8429,8 @@ void ObjectMgr::LoadGameTele()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u GameTeleports", count);
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -8361,23 +8504,23 @@ bool ObjectMgr::DeleteGameTele(const std::string& name)
void ObjectMgr::LoadMailLevelRewards()
{
+ uint32 oldMSTime = getMSTime();
+
m_mailLevelRewardMap.clear(); // for reload case
- uint32 count = 0;
QueryResult result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
sLog.outString();
- sLog.outErrorDb(">> Loaded `mail_level_reward`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -8420,8 +8563,8 @@ void ObjectMgr::LoadMailLevelRewards()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u level dependent mail rewards,", count);
}
bool ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, Field *fields, std::set<uint32> *skip_trainers, std::set<uint32> *talentIds)
@@ -8536,6 +8679,8 @@ int ObjectMgr::LoadReferenceTrainer(uint32 trainer, int32 spell, std::set<uint32
void ObjectMgr::LoadTrainerSpell()
{
+ uint32 oldMSTime = getMSTime();
+
// For reload case
for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr)
itr->second.Clear();
@@ -8548,19 +8693,16 @@ void ObjectMgr::LoadTrainerSpell()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded `npc_trainer`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
-
- std::set<uint32> talentIds;
-
uint32 count = 0;
+ std::set<uint32> talentIds;
+
do
{
bar.step();
@@ -8574,10 +8716,11 @@ void ObjectMgr::LoadTrainerSpell()
else if (this->AddSpellToTrainer(entry, uint32(spell), fields, &skip_trainers, &talentIds))
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %d Trainers", count);
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
@@ -8619,6 +8762,8 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
void ObjectMgr::LoadVendors()
{
+ uint32 oldMSTime = getMSTime();
+
// For reload case
for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr)
itr->second.Clear();
@@ -8630,17 +8775,15 @@ void ObjectMgr::LoadVendors()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
sLog.outString();
- sLog.outErrorDb(">> Loaded `npc_vendor`, table is empty!");
+ sLog.outErrorDb(">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
+
do
{
bar.step();
@@ -8667,33 +8810,34 @@ void ObjectMgr::LoadVendors()
++count;
}
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %d Vendors ", count);
}
void ObjectMgr::LoadNpcTextId()
{
+ uint32 oldMSTime = getMSTime();
m_mCacheNpcTextIdMap.clear();
QueryResult result = WorldDatabase.Query("SELECT npc_guid, textid FROM npc_gossip");
+
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 NpcTextId. DB table `npc_gossip` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded `npc_gossip`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
- uint32 guid,textid;
+ uint32 guid, textid;
+
do
{
bar.step();
@@ -8717,14 +8861,17 @@ void ObjectMgr::LoadNpcTextId()
m_mCacheNpcTextIdMap[guid] = textid ;
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %d NpcTextId in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %d NpcTextId ", count);
}
void ObjectMgr::LoadGossipMenu()
{
+ uint32 oldMSTime = getMSTime();
+
m_mGossipMenusMap.clear();
QueryResult result = WorldDatabase.Query("SELECT entry, text_id FROM gossip_menu");
@@ -8732,16 +8879,13 @@ void ObjectMgr::LoadGossipMenu()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded `gossip_menu`, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
do
@@ -8767,12 +8911,14 @@ void ObjectMgr::LoadGossipMenu()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u gossip_menu entries", count);
}
void ObjectMgr::LoadGossipMenuItems()
{
+ uint32 oldMSTime = getMSTime();
+
m_mGossipMenuItemsMap.clear();
QueryResult result = WorldDatabase.Query(
@@ -8783,16 +8929,13 @@ void ObjectMgr::LoadGossipMenuItems()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outErrorDb(">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
sLog.outString();
- sLog.outErrorDb(">> Loaded gossip_menu_option, table is empty!");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
std::set<uint32> gossipScriptSet;
@@ -8866,8 +9009,8 @@ void ObjectMgr::LoadGossipMenuItems()
sLog.outErrorDb("Table `gossip_scripts` contain unused script, id %u.", *itr);
}
+ sLog.outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u gossip_menu_option entries", count);
}
void ObjectMgr::AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb)
@@ -8981,6 +9124,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
void ObjectMgr::LoadScriptNames()
{
+ uint32 oldMSTime = getMSTime();
+
m_scriptNames.push_back("");
QueryResult result = WorldDatabase.Query(
"SELECT DISTINCT(ScriptName) FROM achievement_criteria_data WHERE ScriptName <> '' AND type = 11 "
@@ -9029,8 +9174,8 @@ void ObjectMgr::LoadScriptNames()
while (result->NextRow());
std::sort(m_scriptNames.begin(), m_scriptNames.end());
+ sLog.outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %d Script Names", count);
}
uint32 ObjectMgr::GetScriptId(const char *name)
@@ -9159,14 +9304,16 @@ CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unit
void ObjectMgr::LoadCreatureClassLevelStats()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT level, class, basehp0, basehp1, basehp2, basemana, basearmor FROM creature_classlevelstats");
if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
+ sLog.outString();
return;
}
@@ -9220,25 +9367,27 @@ void ObjectMgr::LoadCreatureClassLevelStats()
}
}
+ sLog.outString(">> Loaded %u creature base stats in %u ms", counter, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u creature base stats.", counter);
}
void ObjectMgr::LoadFactionChangeAchievements()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_achievement");
if (!result)
{
barGoLink bar(1);
bar.step();
+ sLog.outErrorDb(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
- uint32 counter = 0;
+ uint32 count = 0;
do
{
@@ -9255,29 +9404,31 @@ void ObjectMgr::LoadFactionChangeAchievements()
factionchange_achievements[alliance] = horde;
bar.step();
- ++counter;
+ ++count;
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u faction change achievement pairs.", counter);
}
void ObjectMgr::LoadFactionChangeItems()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_items");
if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
- uint32 counter = 0;
+ uint32 count = 0;
do
{
@@ -9294,29 +9445,31 @@ void ObjectMgr::LoadFactionChangeItems()
factionchange_items[alliance] = horde;
bar.step();
- ++counter;
+ ++count;
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u faction change item pairs.", counter);
}
void ObjectMgr::LoadFactionChangeSpells()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_spells");
if (!result)
{
barGoLink bar(1);
bar.step();
+ sLog.outErrorDb(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
- uint32 counter = 0;
+ uint32 count = 0;
do
{
@@ -9333,29 +9486,31 @@ void ObjectMgr::LoadFactionChangeSpells()
factionchange_spells[alliance] = horde;
bar.step();
- ++counter;
+ ++count;
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u faction change spell pairs.", counter);
}
void ObjectMgr::LoadFactionChangeReputations()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_reputations");
if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
- uint32 counter = 0;
+ uint32 count = 0;
do
{
@@ -9372,10 +9527,10 @@ void ObjectMgr::LoadFactionChangeReputations()
factionchange_reputations[alliance] = horde;
bar.step();
- ++counter;
+ ++count;
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u faction change reputation pairs.", counter);
}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ba719add25f..15b4c501551 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -1282,7 +1282,7 @@ class ObjectMgr
private:
void LoadScripts(ScriptsType type);
void CheckScripts(ScriptsType type, std::set<int32>& ids);
- void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
+ uint32 LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName);
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
void LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go);
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 1c391c2338b..dabc7ee5e65 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -253,6 +253,8 @@ void InstanceSaveManager::_DelHelper(const char *fields, const char *table, cons
void InstanceSaveManager::CleanupAndPackInstances()
{
+ uint32 oldMSTime = getMSTime();
+
// load reset times and clean expired instances
sInstanceSaveMgr.LoadResetTimes();
@@ -291,7 +293,8 @@ void InstanceSaveManager::CleanupAndPackInstances()
CharacterDatabase.DirectExecute("ALTER TABLE instance DROP COLUMN newid");
// Bake some cookies for click
- sLog.outString(">> Cleaned up and packed instances");
+ sLog.outString(">> Cleaned up and packed instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void InstanceSaveManager::LoadResetTimes()
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index be3058be2d4..b00bfd44b36 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -91,79 +91,75 @@ void LootStore::Verify() const
// Loads a *_loot_template DB table into loot store
// All checks of the loaded template are called from here, no error reports at loot generation required
-void LootStore::LoadLootTable()
+uint32 LootStore::LoadLootTable()
{
LootTemplateMap::const_iterator tab;
// Clearing store (for reloading case)
Clear();
- sLog.outString("%s :", GetName());
+ // 0 1 2 3 4 5 6
+ QueryResult result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount FROM %s", GetName());
- // 0 1 2 3 4 5 6
- QueryResult result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount FROM %s",GetName());
-
- if (result)
+ if (!result)
{
- uint32 count = 0;
+ barGoLink bar(1);
+ bar.step();
+ return 0;
+}
- barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+ barGoLink bar(result->GetRowCount());
- do
+ do
+ {
+ Field *fields = result->Fetch();
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ uint32 item = fields[1].GetUInt32();
+ float chanceOrQuestChance = fields[2].GetFloat();
+ uint16 lootmode = fields[3].GetUInt16();
+ uint8 group = fields[4].GetUInt8();
+ int32 mincountOrRef = fields[5].GetInt32();
+ int32 maxcount = fields[6].GetInt32();
+
+ if (maxcount > std::numeric_limits<uint8>::max())
{
- Field *fields = result->Fetch();
- bar.step();
-
- uint32 entry = fields[0].GetUInt32();
- uint32 item = fields[1].GetUInt32();
- float chanceOrQuestChance = fields[2].GetFloat();
- uint16 lootmode = fields[3].GetUInt16();
- uint8 group = fields[4].GetUInt8();
- int32 mincountOrRef = fields[5].GetInt32();
- int32 maxcount = fields[6].GetInt32();
-
- if (maxcount > std::numeric_limits<uint8>::max())
- {
- sLog.outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount,std::numeric_limits<uint8>::max());
- continue; // error already printed to log/console.
- }
+ sLog.outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount,std::numeric_limits<uint8>::max());
+ continue; // error already printed to log/console.
+ }
- LootStoreItem storeitem = LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
+ LootStoreItem storeitem = LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
- if (!storeitem.IsValid(*this,entry)) // Validity checks
- continue;
+ if (!storeitem.IsValid(*this,entry)) // Validity checks
+ continue;
- // Looking for the template of the entry
- // often entries are put together
- if (m_LootTemplates.empty() || tab->first != entry)
+ // Looking for the template of the entry
+ // often entries are put together
+ if (m_LootTemplates.empty() || tab->first != entry)
+ {
+ // Searching the template (in case template Id changed)
+ tab = m_LootTemplates.find(entry);
+ if (tab == m_LootTemplates.end())
{
- // Searching the template (in case template Id changed)
- tab = m_LootTemplates.find(entry);
- if (tab == m_LootTemplates.end())
- {
- std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate));
- tab = pr.first;
- }
+ std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate));
+ tab = pr.first;
}
- // else is empty - template Id and iter are the same
- // finally iter refers to already existed or just created <entry, LootTemplate>
+ }
+ // else is empty - template Id and iter are the same
+ // finally iter refers to already existed or just created <entry, LootTemplate>
- // Adds current row to the template
- tab->second->AddEntry(storeitem);
- ++count;
+ // Adds current row to the template
+ tab->second->AddEntry(storeitem);
+ ++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
- Verify(); // Checks validity of the loot store
+ Verify(); // Checks validity of the loot store
- sLog.outString();
- sLog.outString(">> Loaded %u loot definitions (%lu templates)", count, (unsigned long)m_LootTemplates.size());
- }
- else
- {
- sLog.outString();
- sLog.outErrorDb(">> Loaded 0 loot definitions. DB table `%s` is empty.",GetName());
- }
+ return count;
}
bool LootStore::HaveQuestLootFor(uint32 loot_id) const
@@ -215,12 +211,14 @@ LootTemplate* LootStore::GetLootForConditionFill(uint32 loot_id)
return tab->second;
}
-void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
+uint32 LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
{
- LoadLootTable();
+ uint32 count = LoadLootTable();
for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab)
ids_set.insert(tab->first);
+
+ return count;
}
void LootStore::CheckLootRefs(LootIdSet* ref_set) const
@@ -1407,8 +1405,12 @@ bool LootTemplate::isReference(uint32 id)
void LoadLootTemplates_Creature()
{
+ sLog.outString("Loading creature loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set, ids_setUsed;
- LootTemplates_Creature.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
@@ -1429,12 +1431,23 @@ void LoadLootTemplates_Creature()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Creature.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Disenchant()
{
+ sLog.outString("Loading disenchanting loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set, ids_setUsed;
- LootTemplates_Disenchant.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Disenchant.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
@@ -1454,12 +1467,22 @@ void LoadLootTemplates_Disenchant()
ids_set.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Disenchant.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
+ sLog.outString();
}
void LoadLootTemplates_Fishing()
{
+ sLog.outString("Loading fishing loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Fishing.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
@@ -1469,12 +1492,23 @@ void LoadLootTemplates_Fishing()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Fishing.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Gameobject()
{
+ sLog.outString("Loading gameobject loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set, ids_setUsed;
- LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
@@ -1495,12 +1529,23 @@ void LoadLootTemplates_Gameobject()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Gameobject.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Item()
{
+ sLog.outString("Loading item loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Item.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Item.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
@@ -1510,12 +1555,23 @@ void LoadLootTemplates_Item()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Item.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 prospecting loot templates. DB table `item_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Milling()
{
+ sLog.outString("Loading milling loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Milling.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Milling.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
@@ -1533,12 +1589,23 @@ void LoadLootTemplates_Milling()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Milling.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Pickpocketing()
{
+ sLog.outString("Loading pickpocketing loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set, ids_setUsed;
- LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
@@ -1559,12 +1626,23 @@ void LoadLootTemplates_Pickpocketing()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Pickpocketing.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Prospecting()
{
+ sLog.outString("Loading prospecting loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
@@ -1582,12 +1660,23 @@ void LoadLootTemplates_Prospecting()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Prospecting.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Mail()
{
+ sLog.outString("Loading mail loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Mail.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
@@ -1597,12 +1686,23 @@ void LoadLootTemplates_Mail()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Mail.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Skinning()
{
+ sLog.outString("Loading skinning loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set, ids_setUsed;
- LootTemplates_Skinning.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
@@ -1623,12 +1723,23 @@ void LoadLootTemplates_Skinning()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Skinning.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
+
+ sLog.outString();
}
void LoadLootTemplates_Spell()
{
+ sLog.outString("Loading spell loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
- LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
+ uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
@@ -1656,10 +1767,20 @@ void LoadLootTemplates_Spell()
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Spell.ReportUnusedIds(ids_set);
+
+ if(count)
+ sLog.outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog.outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
+ sLog.outString();
}
void LoadLootTemplates_Reference()
{
+ sLog.outString("Loading reference loot templates...");
+
+ uint32 oldMSTime = getMSTime();
+
LootIdSet ids_set;
LootTemplates_Reference.LoadAndCollectLootIds(ids_set);
@@ -1678,4 +1799,7 @@ void LoadLootTemplates_Reference()
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(ids_set);
+
+ sLog.outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 5b6a5f2f185..efb41ec2131 100755
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -183,7 +183,7 @@ class LootStore
void Verify() const;
- void LoadAndCollectLootIds(LootIdSet& ids_set);
+ uint32 LoadAndCollectLootIds(LootIdSet& ids_set);
void CheckLootRefs(LootIdSet* ref_set = NULL) const; // check existence reference and remove it from ref_set
void ReportUnusedIds(LootIdSet const& ids_set) const;
void ReportNotExistedId(uint32 id) const;
@@ -200,7 +200,7 @@ class LootStore
char const* GetEntryName() const { return m_entryName; }
bool IsRatesAllowed() const { return m_ratesAllowed; }
protected:
- void LoadLootTable();
+ uint32 LoadLootTable();
void Clear();
private:
LootTemplateMap m_LootTemplates;
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index c6dc25d69e6..60751fce1f8 100755
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -36,28 +36,24 @@ void WaypointStore::Free()
void WaypointStore::Load()
{
- QueryResult result = WorldDatabase.Query("SELECT COUNT(id) FROM waypoint_data");
- if (!result)
- {
- sLog.outError("an error occured while loading the table `waypoint_data` (maybe it doesn't exist ?)");
- exit(1); // Stop server at loading non exited table or not accessable table
- }
+ uint32 oldMSTime = getMSTime();
- records = (*result)[0].GetUInt32();
+ QueryResult result = WorldDatabase.Query("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point");
- result = WorldDatabase.Query("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point");
if (!result)
{
- sLog.outErrorDb("The table `waypoint_data` is empty or corrupted");
+ barGoLink bar(1);
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
+ sLog.outString();
return;
}
- WaypointPath* path_data = NULL;
-
barGoLink bar(result->GetRowCount());
uint32 count = 0;
Field *fields;
uint32 last_id = 0;
+ WaypointPath* path_data = NULL;
do
{
@@ -94,10 +90,11 @@ void WaypointStore::Load()
last_id = id;
- } while (result->NextRow()) ;
+ }
+ while (result->NextRow()) ;
+ sLog.outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u waypoints", count);
}
void WaypointStore::UpdatePath(uint32 id)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index a073c018d9b..bd245ba85ab 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -40,40 +40,7 @@ OutdoorPvPMgr::~OutdoorPvPMgr()
void OutdoorPvPMgr::InitOutdoorPvP()
{
- LoadTemplates();
-
- OutdoorPvP* pvp;
- for (uint8 i = 1; i < MAX_OUTDOORPVP_TYPES; ++i)
- {
- OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
- if (iter == m_OutdoorPvPDatas.end())
- {
- sLog.outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
- continue;
- }
-
- pvp = sScriptMgr.CreateOutdoorPvP(iter->second);
- if (!pvp)
- {
- sLog.outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
- continue;
- }
-
- if (!pvp->SetupOutdoorPvP())
- {
- sLog.outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
- delete pvp;
- continue;
- }
-
- m_OutdoorPvPSet.push_back(pvp);
- }
-}
-
-void OutdoorPvPMgr::LoadTemplates()
-{
- uint32 typeId = 0;
- uint32 count = 0;
+ uint32 oldMSTime = getMSTime();
// 0 1
QueryResult result = WorldDatabase.Query("SELECT TypeId, ScriptName FROM outdoorpvp_template");
@@ -81,15 +48,15 @@ void OutdoorPvPMgr::LoadTemplates()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
+ sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+ uint32 typeId = 0;
do
{
@@ -117,8 +84,35 @@ void OutdoorPvPMgr::LoadTemplates()
}
while (result->NextRow());
+ OutdoorPvP* pvp;
+ for (uint8 i = 1; i < MAX_OUTDOORPVP_TYPES; ++i)
+ {
+ OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
+ if (iter == m_OutdoorPvPDatas.end())
+ {
+ sLog.outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
+ continue;
+ }
+
+ pvp = sScriptMgr.CreateOutdoorPvP(iter->second);
+ if (!pvp)
+ {
+ sLog.outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
+ continue;
+ }
+
+ if (!pvp->SetupOutdoorPvP())
+ {
+ sLog.outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
+ delete pvp;
+ continue;
+ }
+
+ m_OutdoorPvPSet.push_back(pvp);
+ }
+
+ sLog.outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u outdoor PvP definitions.", count);
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP *handle)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 1158fd6a701..a7ee2ac602e 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
@@ -49,9 +49,6 @@ class OutdoorPvPMgr
// create outdoor pvp events
void InitOutdoorPvP();
- // loads outdoorpvp_template
- void LoadTemplates();
-
// called when a player enters an outdoor pvp area
void HandlePlayerEnterZone(Player * plr, uint32 areaflag);
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 882014a1316..1a9a9c38eeb 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -543,10 +543,12 @@ PoolMgr::PoolMgr()
void PoolMgr::LoadFromDB()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template");
if (!result)
{
- sLog.outString(">> Table pool_template is empty.");
+ sLog.outString(">> Loaded 0 object pools. DB table `pool_template` is empty.");
sLog.outString();
return;
}
@@ -562,7 +564,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
mPoolTemplate.clear();
- sLog.outString(">> Table pool_template is empty:");
+ sLog.outString(">> Loaded 0 object pools. DB table `pool_template` is empty.");
sLog.outString();
return;
}
@@ -584,13 +586,13 @@ void PoolMgr::LoadFromDB()
} while (result->NextRow());
+ sLog.outString(">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u objects pools", count);
// Creatures
- sLog.outString();
sLog.outString("Loading Creatures Pooling Data...");
+ oldMSTime = getMSTime();
mPoolCreatureGroups.resize(max_pool_id + 1);
mCreatureSearchMap.clear();
@@ -602,9 +604,8 @@ void PoolMgr::LoadFromDB()
{
barGoLink bar2(1);
bar2.step();
-
+ sLog.outString(">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u creatures in pools", count);
}
else
{
@@ -647,8 +648,10 @@ void PoolMgr::LoadFromDB()
mCreatureSearchMap.insert(p);
} while (result->NextRow());
+
+
+ sLog.outString(">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u creatures in pools", count);
}
// Gameobjects
@@ -665,9 +668,8 @@ void PoolMgr::LoadFromDB()
{
barGoLink bar2(1);
bar2.step();
-
+ sLog.outString(">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u gameobject in pools", count);
}
else
{
@@ -719,13 +721,15 @@ void PoolMgr::LoadFromDB()
mGameobjectSearchMap.insert(p);
} while (result->NextRow());
+
+ sLog.outString(">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u gameobject in pools", count);
}
// Pool of pools
sLog.outString("Loading Mother Pooling Data...");
+ oldMSTime = getMSTime();
mPoolPoolGroups.resize(max_pool_id + 1);
// 1 2 3
@@ -736,9 +740,8 @@ void PoolMgr::LoadFromDB()
{
barGoLink bar2(1);
bar2.step();
-
+ sLog.outString(">> Loaded 0 pools in pools");
sLog.outString();
- sLog.outString(">> Loaded %u pools in pools", count);
}
else
{
@@ -811,13 +814,15 @@ void PoolMgr::LoadFromDB()
}
}
+ sLog.outString(">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u pools in mother pools", count);
}
}
void PoolMgr::LoadQuestPools()
{
+ uint32 oldMSTime = getMSTime();
+
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_QUEST_POOLS);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -829,9 +834,8 @@ void PoolMgr::LoadQuestPools()
{
barGoLink bar(1);
bar.step();
-
- sLog.outString();
sLog.outString(">> Loaded 0 quests in pools");
+ sLog.outString();
return;
}
@@ -910,8 +914,8 @@ void PoolMgr::LoadQuestPools()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u quests in pools", count);
}
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index ec27831c3f9..055c7ae1f8b 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -178,17 +178,19 @@ ScriptMgr::~ScriptMgr()
void ScriptMgr::Initialize()
{
+ uint32 oldMSTime = getMSTime();
+
LoadDatabase();
sLog.outString("Loading C++ scripts");
barGoLink bar(1);
bar.step();
- sLog.outString();
-
+
FillSpellSummary();
AddScripts();
- sLog.outString(">> Loaded %u C++ scripts", GetScriptCount());
+ sLog.outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void ScriptMgr::LoadDatabase()
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 649ff82fcde..6a2748a38a3 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -55,66 +55,66 @@ void SystemMgr::LoadScriptTexts()
{
sLog.outString("TSCR: Loading Script Texts...");
LoadTrinityStrings("script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2));
-
- QueryResult Result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
-
+
sLog.outString("TSCR: Loading Script Texts additional data...");
+ uint32 oldMSTime = getMSTime();
- if (Result)
- {
- barGoLink bar(Result->GetRowCount());
- uint32 uiCount = 0;
-
- do
- {
- bar.step();
- Field* pFields = Result->Fetch();
- StringTextData pTemp;
-
- int32 iId = pFields[0].GetInt32();
- pTemp.uiSoundId = pFields[1].GetUInt32();
- pTemp.uiType = pFields[2].GetUInt32();
- pTemp.uiLanguage = pFields[3].GetUInt32();
- pTemp.uiEmote = pFields[4].GetUInt32();
-
- if (iId >= 0)
- {
- sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
- {
- sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (pTemp.uiSoundId)
- {
- if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
- sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(pTemp.uiLanguage))
- sLog.outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
-
- if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
-
- m_mTextDataMap[iId] = pTemp;
- ++uiCount;
- } while (Result->NextRow());
+ QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
- sLog.outString();
- sLog.outString(">> Loaded %u additional Script Texts data.", uiCount);
- }
- else
+ if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
+ sLog.outString();
+ return;
}
+
+ barGoLink bar(result->GetRowCount());
+ uint32 uiCount = 0;
+
+ do
+ {
+ bar.step();
+ Field* pFields = result->Fetch();
+ StringTextData pTemp;
+
+ int32 iId = pFields[0].GetInt32();
+ pTemp.uiSoundId = pFields[1].GetUInt32();
+ pTemp.uiType = pFields[2].GetUInt32();
+ pTemp.uiLanguage = pFields[3].GetUInt32();
+ pTemp.uiEmote = pFields[4].GetUInt32();
+
+ if (iId >= 0)
+ {
+ sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
+ continue;
+ }
+
+ if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
+ {
+ sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
+ continue;
+ }
+
+ if (pTemp.uiSoundId)
+ {
+ if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
+ sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
+ }
+
+ if (!GetLanguageDescByID(pTemp.uiLanguage))
+ sLog.outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
+
+ if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
+ sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
+
+ m_mTextDataMap[iId] = pTemp;
+ ++uiCount;
+ } while (result->NextRow());
+
+ sLog.outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void SystemMgr::LoadScriptTextsCustom()
@@ -122,125 +122,125 @@ void SystemMgr::LoadScriptTextsCustom()
sLog.outString("TSCR: Loading Custom Texts...");
LoadTrinityStrings("custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3));
- QueryResult Result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
-
sLog.outString("TSCR: Loading Custom Texts additional data...");
- if (Result)
- {
- barGoLink bar(Result->GetRowCount());
- uint32 uiCount = 0;
-
- do
- {
- bar.step();
- Field* pFields = Result->Fetch();
- StringTextData pTemp;
-
- int32 iId = pFields[0].GetInt32();
- pTemp.uiSoundId = pFields[1].GetUInt32();
- pTemp.uiType = pFields[2].GetUInt32();
- pTemp.uiLanguage = pFields[3].GetUInt32();
- pTemp.uiEmote = pFields[4].GetUInt32();
-
- if (iId >= 0)
- {
- sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
- {
- sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (pTemp.uiSoundId)
- {
- if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
- sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(pTemp.uiLanguage))
- sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
-
- if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
-
- m_mTextDataMap[iId] = pTemp;
- ++uiCount;
- } while (Result->NextRow());
+ QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
- sLog.outString();
- sLog.outString(">> Loaded %u additional Custom Texts data.", uiCount);
- }
- else
+ if (!result)
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
+ sLog.outString();
+ return;
}
+
+ barGoLink bar(result->GetRowCount());
+ uint32 uiCount = 0;
+
+ do
+ {
+ bar.step();
+ Field* pFields = result->Fetch();
+ StringTextData pTemp;
+
+ int32 iId = pFields[0].GetInt32();
+ pTemp.uiSoundId = pFields[1].GetUInt32();
+ pTemp.uiType = pFields[2].GetUInt32();
+ pTemp.uiLanguage = pFields[3].GetUInt32();
+ pTemp.uiEmote = pFields[4].GetUInt32();
+
+ if (iId >= 0)
+ {
+ sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
+ continue;
+ }
+
+ if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
+ {
+ sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
+ continue;
+ }
+
+ if (pTemp.uiSoundId)
+ {
+ if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
+ sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
+ }
+
+ if (!GetLanguageDescByID(pTemp.uiLanguage))
+ sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
+
+ if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
+ sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
+
+ m_mTextDataMap[iId] = pTemp;
+ ++uiCount;
+ } while (result->NextRow());
+
+ sLog.outString(">> Loaded %u additional Custom Texts data.", uiCount);
+ sLog.outString();
}
void SystemMgr::LoadScriptWaypoints()
{
+ uint32 oldMSTime = getMSTime();
+
// Drop Existing Waypoint list
m_mPointMoveMap.clear();
uint64 uiCreatureCount = 0;
// Load Waypoints
- QueryResult Result = WorldDatabase.Query("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
- if (Result)
- uiCreatureCount = Result->GetRowCount();
+ QueryResult result = WorldDatabase.Query("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
+ if (result)
+ uiCreatureCount = result->GetRowCount();
sLog.outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
- Result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
+ result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
- if (Result)
+ if (!result)
{
- barGoLink bar(Result->GetRowCount());
- uint32 uiNodeCount = 0;
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
+ sLog.outString();
+ return;
+ }
- do
- {
- bar.step();
- Field* pFields = Result->Fetch();
- ScriptPointMove pTemp;
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
- pTemp.uiCreatureEntry = pFields[0].GetUInt32();
- uint32 uiEntry = pTemp.uiCreatureEntry;
- pTemp.uiPointId = pFields[1].GetUInt32();
- pTemp.fX = pFields[2].GetFloat();
- pTemp.fY = pFields[3].GetFloat();
- pTemp.fZ = pFields[4].GetFloat();
- pTemp.uiWaitTime = pFields[5].GetUInt32();
+ do
+ {
+ bar.step();
+ Field* pFields = result->Fetch();
+ ScriptPointMove pTemp;
- CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.uiCreatureEntry);
+ pTemp.uiCreatureEntry = pFields[0].GetUInt32();
+ uint32 uiEntry = pTemp.uiCreatureEntry;
+ pTemp.uiPointId = pFields[1].GetUInt32();
+ pTemp.fX = pFields[2].GetFloat();
+ pTemp.fY = pFields[3].GetFloat();
+ pTemp.fZ = pFields[4].GetFloat();
+ pTemp.uiWaitTime = pFields[5].GetUInt32();
- if (!pCInfo)
- {
- sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry);
- continue;
- }
+ CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.uiCreatureEntry);
- if (!pCInfo->ScriptID)
- sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry);
+ if (!pCInfo)
+ {
+ sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry);
+ continue;
+ }
- m_mPointMoveMap[uiEntry].push_back(pTemp);
- ++uiNodeCount;
- } while (Result->NextRow());
+ if (!pCInfo->ScriptID)
+ sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry);
- sLog.outString();
- sLog.outString(">> Loaded %u Script Waypoint nodes.", uiNodeCount);
- }
- else
- {
- barGoLink bar(1);
- bar.step();
- sLog.outString();
- sLog.outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
- }
+ m_mPointMoveMap[uiEntry].push_back(pTemp);
+ ++count;
+ } while (result->NextRow());
+
+ sLog.outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index a520fa84f9c..510ead760b4 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -46,22 +46,24 @@ static SkillDiscoveryMap SkillDiscoveryStore;
void LoadSkillDiscoveryTable()
{
+ uint32 oldMSTime = getMSTime();
SkillDiscoveryStore.clear(); // need for reload
- uint32 count = 0;
-
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, reqSpell, reqSkillValue, chance FROM skill_discovery_template");
if (!result)
{
+ barGoLink bar(1);
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
std::ostringstream ssNonDiscoverableEntries;
std::set<uint32> reportedReqSpells;
@@ -135,8 +137,6 @@ void LoadSkillDiscoveryTable()
++count;
} while (result->NextRow());
- sLog.outString();
- sLog.outString(">> Loaded %u skill discovery definitions", count);
if (!ssNonDiscoverableEntries.str().empty())
sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str());
@@ -154,6 +154,9 @@ void LoadSkillDiscoveryTable()
if (SkillDiscoveryStore.find(spell_id) == SkillDiscoveryStore.end())
sLog.outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table",spell_id);
}
+
+ sLog.outString(">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 5cc86ffbe3c..c487d9a881a 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -52,68 +52,71 @@ SkillExtraItemMap SkillExtraItemStore;
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
+ uint32 oldMSTime = getMSTime();
+
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
- if (result)
+ if (!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
+ sLog.outString();
+ return;
+ }
+
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+
+ do
{
- uint32 count = 0;
+ Field *fields = result->Fetch();
+ bar.step();
- barGoLink bar(result->GetRowCount());
+ uint32 spellId = fields[0].GetUInt32();
- do
+ if (!sSpellStore.LookupEntry(spellId))
{
- Field *fields = result->Fetch();
- bar.step();
-
- uint32 spellId = fields[0].GetUInt32();
-
- if (!sSpellStore.LookupEntry(spellId))
- {
- sLog.outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
- continue;
- }
-
- uint32 requiredSpecialization = fields[1].GetUInt32();
- if (!sSpellStore.LookupEntry(requiredSpecialization))
- {
- sLog.outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId,requiredSpecialization);
- continue;
- }
-
- float additionalCreateChance = fields[2].GetFloat();
- if (additionalCreateChance <= 0.0f)
- {
- sLog.outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
- continue;
- }
-
- uint8 additionalMaxNum = fields[3].GetUInt8();
- if (!additionalMaxNum)
- {
- sLog.outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
- continue;
- }
-
- SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
-
- skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
- skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
- skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
-
- ++count;
- } while (result->NextRow());
+ sLog.outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
+ continue;
+ }
- sLog.outString();
- sLog.outString(">> Loaded %u spell specialization definitions", count);
- }
- else
- {
- sLog.outString();
- sLog.outString(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
+ uint32 requiredSpecialization = fields[1].GetUInt32();
+ if (!sSpellStore.LookupEntry(requiredSpecialization))
+ {
+ sLog.outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId,requiredSpecialization);
+ continue;
+ }
+
+ float additionalCreateChance = fields[2].GetFloat();
+ if (additionalCreateChance <= 0.0f)
+ {
+ sLog.outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
+ continue;
+ }
+
+ uint8 additionalMaxNum = fields[3].GetUInt8();
+ if (!additionalMaxNum)
+ {
+ sLog.outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
+ continue;
+ }
+
+ SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
+
+ skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
+ skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
+ skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
+
+ ++count;
}
+ while (result->NextRow());
+
+ sLog.outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
bool canCreateExtraItems(Player * player, uint32 spellId, float &additionalChance, uint8 &additionalMax)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 233e97d06f1..76175ada22a 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -1114,25 +1114,23 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
void SpellMgr::LoadSpellTargetPositions()
{
- mSpellTargetPositions.clear(); // need for reload case
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ mSpellTargetPositions.clear(); // need for reload case
// 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
-
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u spell target coordinates", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -1235,8 +1233,8 @@ void SpellMgr::LoadSpellTargetPositions()
}
}
+ sLog.outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell teleport coordinates", count);
}
bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
@@ -1259,6 +1257,8 @@ bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod)
void SpellMgr::LoadSpellProcEvents()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellProcEventMap.clear(); // need for reload case
uint32 count = 0;
@@ -1269,8 +1269,8 @@ void SpellMgr::LoadSpellProcEvents()
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded %u spell proc event conditions", count);
+ sLog.outString();
return;
}
@@ -1318,15 +1318,17 @@ void SpellMgr::LoadSpellProcEvents()
++count;
} while (result->NextRow());
- sLog.outString();
if (customProc)
- sLog.outString(">> Loaded %u extra spell proc event conditions + %u custom", count, customProc);
+ sLog.outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
else
- sLog.outString(">> Loaded %u extra spell proc event conditions", count);
+ sLog.outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void SpellMgr::LoadSpellBonusess()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellBonusMap.clear(); // need for reload case
uint32 count = 0;
// 0 1 2 3 4
@@ -1335,8 +1337,8 @@ void SpellMgr::LoadSpellBonusess()
{
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded %u spell bonus data", count);
+ sLog.outString();
return;
}
@@ -1365,8 +1367,8 @@ void SpellMgr::LoadSpellBonusess()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u extra spell bonus data", count);
}
bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active)
@@ -1500,6 +1502,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
void SpellMgr::LoadSpellGroups()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellSpellGroup.clear(); // need for reload case
mSpellGroupSpell.clear();
@@ -1585,12 +1589,14 @@ void SpellMgr::LoadSpellGroups()
}
}
+ sLog.outString(">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell group definitions", count);
}
void SpellMgr::LoadSpellGroupStackRules()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellGroupStack.clear(); // need for reload case
uint32 count = 0;
@@ -1599,13 +1605,12 @@ void SpellMgr::LoadSpellGroupStackRules()
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
-
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 spell group stack rules");
sLog.outString();
- sLog.outString(">> Loaded %u spell group stack rules", count);
return;
}
@@ -1638,12 +1643,14 @@ void SpellMgr::LoadSpellGroupStackRules()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell group stack rules", count);
}
void SpellMgr::LoadSpellThreats()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellThreatMap.clear(); // need for reload case
uint32 count = 0;
@@ -1657,8 +1664,8 @@ void SpellMgr::LoadSpellThreats()
bar.step();
- sLog.outString();
sLog.outString(">> Loaded %u aggro generating spells", count);
+ sLog.outString();
return;
}
@@ -1684,8 +1691,8 @@ void SpellMgr::LoadSpellThreats()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u aggro generating spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u aggro generating spells", count);
}
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const
@@ -1962,6 +1969,8 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
void SpellMgr::LoadSpellLearnSkills()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellLearnSkills.clear(); // need for reload case
// search auto-learned skills and add its to map also for use in unlearn spells/talents
@@ -1994,12 +2003,14 @@ void SpellMgr::LoadSpellLearnSkills()
}
}
+ sLog.outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u Spell Learn Skills from DBC", dbc_count);
}
void SpellMgr::LoadSpellLearnSpells()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellLearnSpells.clear(); // need for reload case
// 0 1 2
@@ -2009,8 +2020,8 @@ void SpellMgr::LoadSpellLearnSpells()
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 spell learn spells");
+ sLog.outString();
sLog.outErrorDb("`spell_learn_spell` table is empty!");
return;
}
@@ -2102,30 +2113,29 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
+ sLog.outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count);
}
void SpellMgr::LoadSpellPetAuras()
{
- mSpellPetAuraMap.clear(); // need for reload case
+ uint32 oldMSTime = getMSTime();
- uint32 count = 0;
+ mSpellPetAuraMap.clear(); // need for reload case
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u spell pet auras", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -2171,12 +2181,14 @@ void SpellMgr::LoadSpellPetAuras()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell pet auras", count);
}
void SpellMgr::LoadPetLevelupSpellMap()
{
+ uint32 oldMSTime = getMSTime();
+
mPetLevelupSpellMap.clear(); // need for reload case
uint32 count = 0;
@@ -2230,8 +2242,8 @@ void SpellMgr::LoadPetLevelupSpellMap()
}
}
+ sLog.outString(">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u pet levelup and default spells for %u families", count, family_count);
}
bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntry& petDefSpells)
@@ -2284,12 +2296,14 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr
void SpellMgr::LoadPetDefaultSpells()
{
+ uint32 oldMSTime = getMSTime();
+
mPetDefaultSpellsMap.clear();
uint32 countCreature = 0;
uint32 countData = 0;
- barGoLink bar(sCreatureStorage.MaxEntry + sSpellStore.GetNumRows());
+ barGoLink bar(sCreatureStorage.MaxEntry);
for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
{
@@ -2319,10 +2333,18 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
+ sLog.outString(">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
+
+ sLog.outString("Loading summonable creature templates...");
+ oldMSTime = getMSTime();
+
+ barGoLink bar2(sSpellStore.GetNumRows());
+
// different summon spells
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
- bar.step();
+ bar2.step();
SpellEntry const* spellEntry = sSpellStore.LookupEntry(i);
if (!spellEntry)
@@ -2359,9 +2381,9 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
+
+ sLog.outString(">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded addition spells for %u pet spell data entries.", countData);
- sLog.outString(">> Loaded %u summonable creature templates.", countCreature);
}
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
@@ -2459,29 +2481,28 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg)
void SpellMgr::LoadSpellAreas()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellAreaMap.clear(); // need for reload case
mSpellAreaForQuestMap.clear();
mSpellAreaForActiveQuestMap.clear();
mSpellAreaForQuestEndMap.clear();
mSpellAreaForAuraMap.clear();
- uint32 count = 0;
-
// 0 1 2 3 4 5 6 7 8
QueryResult result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
+ sLog.outString(">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u spell area requirements", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -2660,8 +2681,8 @@ void SpellMgr::LoadSpellAreas()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell area requirements", count);
}
SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player)
@@ -2799,6 +2820,8 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
void SpellMgr::LoadSkillLineAbilityMap()
{
+ uint32 oldMSTime = getMSTime();
+
mSkillLineAbilityMap.clear();
barGoLink bar(sSkillLineAbilityStore.GetNumRows());
@@ -2815,8 +2838,8 @@ void SpellMgr::LoadSkillLineAbilityMap()
++count;
}
+ sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data", count);
}
DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered)
@@ -3227,6 +3250,8 @@ bool CanSpellPierceImmuneAura(SpellEntry const * pierceSpell, SpellEntry const *
void SpellMgr::LoadSpellEnchantProcData()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellEnchantProcEventMap.clear(); // need for reload case
uint32 count = 0;
@@ -3239,8 +3264,8 @@ void SpellMgr::LoadSpellEnchantProcData()
bar.step();
- sLog.outString();
sLog.outString(">> Loaded %u spell enchant proc event conditions", count);
+ sLog.outString();
return;
}
@@ -3271,12 +3296,14 @@ void SpellMgr::LoadSpellEnchantProcData()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u enchant proc data definitions", count);
}
void SpellMgr::LoadSpellRequired()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellsReqSpell.clear(); // need for reload case
mSpellReq.clear(); // need for reload case
@@ -3287,8 +3314,8 @@ void SpellMgr::LoadSpellRequired()
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 spell required records");
+ sLog.outString();
sLog.outErrorDb("`spell_required` table is empty!");
return;
}
@@ -3331,12 +3358,14 @@ void SpellMgr::LoadSpellRequired()
++rows;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell required records", rows);
}
void SpellMgr::LoadSpellRanks()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellChains.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id , rank");
@@ -3346,8 +3375,8 @@ void SpellMgr::LoadSpellRanks()
barGoLink bar(1);
bar.step();
- sLog.outString();
sLog.outString(">> Loaded 0 spell rank records");
+ sLog.outString();
sLog.outErrorDb("`spell_ranks` table is empty!");
return;
}
@@ -3445,13 +3474,15 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
+ sLog.outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u spell rank records", rows);
}
// set data in core for now
void SpellMgr::LoadSpellCustomAttr()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellCustomAttr.resize(GetSpellStore()->GetNumRows());
barGoLink bar(GetSpellStore()->GetNumRows());
@@ -4018,13 +4049,15 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
+ sLog.outString(">> Loaded %u custom spell attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u custom spell attributes", count);
}
// Fill custom data about enchancments
void SpellMgr::LoadEnchantCustomAttr()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 size = sSpellItemEnchantmentStore.GetNumRows();
mEnchantCustomAttr.resize(size);
@@ -4062,14 +4095,15 @@ void SpellMgr::LoadEnchantCustomAttr()
}
}
+ sLog.outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u custom enchant attributes", count);
}
void SpellMgr::LoadSpellLinked()
{
+ uint32 oldMSTime = getMSTime();
+
mSpellLinkedMap.clear(); // need for reload case
- uint32 count = 0;
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
@@ -4077,12 +4111,13 @@ void SpellMgr::LoadSpellLinked()
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
sLog.outString();
- sLog.outString(">> Loaded %u linked spells", count);
return;
}
barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
do
{
@@ -4133,6 +4168,6 @@ void SpellMgr::LoadSpellLinked()
++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u linked spells", count);
}
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 1445e5bed32..17bf02939b4 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -24,6 +24,8 @@
void CreatureTextMgr::LoadCreatureTexts()
{
+ uint32 oldMSTime = getMSTime();
+
mTextMap.clear(); // for reload case
mTextRepeatMap.clear(); //reset all currently used temp texts
@@ -34,14 +36,14 @@ void CreatureTextMgr::LoadCreatureTexts()
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
sLog.outString();
- sLog.outString(">> Loaded 0 Creature Texts. DB table `creature_texts` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
- uint32 TextCount = 0;
- uint32 CreatureCount = 0;
+ uint32 textCount = 0;
+ uint32 creatureCount = 0;
do
{
@@ -88,7 +90,7 @@ void CreatureTextMgr::LoadCreatureTexts()
//entry not yet added, add empty TextHolder (list of groups)
if (mTextMap.find(temp.entry) == mTextMap.end())
{
- ++CreatureCount;
+ ++creatureCount;
CreatureTextHolder TextHolder;
mTextMap[temp.entry] = TextHolder;
}
@@ -101,11 +103,11 @@ void CreatureTextMgr::LoadCreatureTexts()
//add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
- ++TextCount;
+ ++textCount;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u Creature Texts for %u Creatures.", TextCount, CreatureCount);
}
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid, ChatType msgtype, Language language, TextRange range, uint32 sound, Team team, bool gmOnly, Player* srcPlr)
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index ab04b060e71..d9d54559cf1 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -41,6 +41,8 @@ uint64 TicketMgr::GenerateGMTicketId()
void TicketMgr::LoadGMTickets()
{
+ uint32 oldMSTime = getMSTime();
+
if (!m_GMTicketList.empty())
for (GmTicketList::const_iterator itr = m_GMTicketList.begin(); itr != m_GMTicketList.end(); ++itr)
delete *itr;
@@ -49,24 +51,25 @@ void TicketMgr::LoadGMTickets()
m_GMticketid = 0;
m_openTickets = 0;
- QueryResult result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment, completed, escalated, viewed FROM gm_tickets");
+ QueryResult result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed,"
+ "assignedto, comment, completed, escalated, viewed FROM gm_tickets");
if (!result)
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
sLog.outString();
- sLog.outString(">> GM Tickets table is empty, no tickets were loaded.");
return;
}
- uint16 count = 0;
barGoLink bar(result->GetRowCount());
- GM_Ticket *ticket;
+ uint32 count = 0;
+
do
{
Field *fields = result->Fetch();
- ticket = new GM_Ticket;
+ GM_Ticket *ticket = new GM_Ticket;
ticket->guid = fields[0].GetUInt64();
ticket->playerGuid = fields[1].GetUInt64();
ticket->name = fields[2].GetString();
@@ -100,11 +103,14 @@ void TicketMgr::LoadGMTickets()
m_GMticketid = fields[0].GetUInt64();
}
- sLog.outString(">> Loaded %u GM Tickets from the database.", count);
+ sLog.outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void TicketMgr::LoadGMSurveys()
{
+ uint32 oldMSTime = getMSTime();
+
// we don't actually load anything into memory here as there's no reason to
QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyid) FROM gm_surveys");
if (result)
@@ -115,7 +121,8 @@ void TicketMgr::LoadGMSurveys()
else
m_GMSurveyID = 0;
- sLog.outString(">> Loaded GM Survey count from database.");
+ sLog.outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void TicketMgr::AddOrUpdateGMTicket(GM_Ticket &ticket, bool create)
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index 143f8afbb59..8a6953059a6 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -31,6 +31,8 @@ void CharacterDatabaseCleaner::CleanDatabase()
sLog.outString("Cleaning character database...");
+ uint32 oldMSTime = getMSTime();
+
// check flags which clean ups are necessary
QueryResult result = CharacterDatabase.Query("SELECT value FROM worldstates WHERE entry=20004");
if(!result)
@@ -47,6 +49,9 @@ void CharacterDatabaseCleaner::CleanDatabase()
if(flags & CLEANING_FLAG_TALENTS)
CleanCharacterTalent();
CharacterDatabase.Query("UPDATE worldstates SET value = 0 WHERE entry=20004");
+
+ sLog.outString(">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog.outString();
}
void CharacterDatabaseCleaner::CheckUnique(const char* column, const
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index f548a13b87b..18fe7176947 100755
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -76,6 +76,8 @@ Weather* WeatherMgr::AddWeather(uint32 zone_id)
void WeatherMgr::LoadWeatherData()
{
+ uint32 oldMSTime = getMSTime();
+
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
@@ -84,11 +86,9 @@ void WeatherMgr::LoadWeatherData()
if (!result)
{
barGoLink bar(1);
-
bar.step();
-
- sLog.outString();
sLog.outErrorDb(">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
+ sLog.outString();
return;
}
@@ -134,8 +134,8 @@ void WeatherMgr::LoadWeatherData()
}
while (result->NextRow());
+ sLog.outString(">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u weather definitions", count);
}
void WeatherMgr::Update(uint32 diff)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index f9bd822865f..edf93516207 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1193,6 +1193,9 @@ void World::LoadConfigSettings(bool reload)
/// Initialize the World
void World::SetInitialWorldSettings()
{
+ ///- Server startup begin
+ uint32 startupBegin = getMSTime();
+
///- Initialize the random number generator
srand((unsigned int)time(NULL));
@@ -1260,6 +1263,7 @@ void World::SetInitialWorldSettings()
sInstanceSaveMgr.CleanupAndPackInstances(); // must be called before `creature_respawn`/`gameobject_respawn` tables
sLog.outString("Loading Localization strings...");
+ uint32 oldMSTime = getMSTime();
sObjectMgr.LoadCreatureLocales();
sObjectMgr.LoadGameObjectLocales();
sObjectMgr.LoadItemLocales();
@@ -1269,14 +1273,15 @@ void World::SetInitialWorldSettings()
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(">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
sLog.outString("Loading Page Texts...");
sObjectMgr.LoadPageTexts();
- sLog.outString("Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog.outString("Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr.LoadGameobjectInfo();
sLog.outString("Loading Spell Rank Data...");
@@ -1289,7 +1294,7 @@ void World::SetInitialWorldSettings()
sSpellMgr.LoadSpellGroups();
sLog.outString("Loading Spell Learn Skills...");
- sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellRanks
+ sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellRanks
sLog.outString("Loading Spell Learn Spells...");
sSpellMgr.LoadSpellLearnSpells();
@@ -1316,12 +1321,12 @@ void World::SetInitialWorldSettings()
LoadRandomEnchantmentsTable();
sLog.outString("Loading Disables");
- sDisableMgr.LoadDisables(); // must be before loading quests and items
+ sDisableMgr.LoadDisables(); // must be before loading quests and items
- sLog.outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog.outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr.LoadItemPrototypes();
- sLog.outString("Loading Item set names..."); // must be after LoadItemPrototypes
+ sLog.outString("Loading Item set names..."); // must be after LoadItemPrototypes
sObjectMgr.LoadItemSetNames();
sLog.outString("Loading Creature Model Based Info Data...");
@@ -1360,7 +1365,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading pet levelup spells...");
sSpellMgr.LoadPetLevelupSpellMap();
- sLog.outString("Loading pet default spell additional to levelup spells...");
+ sLog.outString("Loading pet default spells additional to levelup spells...");
sSpellMgr.LoadPetDefaultSpells();
sLog.outString("Loading Creature Template Addon Data...");
@@ -1378,7 +1383,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
sObjectMgr.LoadGameobjectRespawnTimes();
- sLog.outString("Loading Objects Pooling Data...");
+ sLog.outString("Loading Objects Pooling Data..."); // TODOLEAK: scope
sPoolMgr.LoadFromDB();
sLog.outString("Loading Weather Data...");
@@ -1400,7 +1405,7 @@ void World::SetInitialWorldSettings()
sPoolMgr.LoadQuestPools();
sLog.outString("Loading Game Event Data..."); // must be after loading pools fully
- sGameEventMgr.LoadFromDB();
+ sGameEventMgr.LoadFromDB(); // TODOLEAK: add scopes
sLog.outString("Loading Dungeon boss data...");
sLFGMgr.LoadDungeonEncounters();
@@ -1411,7 +1416,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data...");
sObjectMgr.LoadNPCSpellClickSpells();
- sLog.outString("Loading SpellArea Data..."); // must be after quest load
+ sLog.outString("Loading SpellArea Data..."); // must be after quest load
sSpellMgr.LoadSpellAreas();
sLog.outString("Loading AreaTrigger definitions...");
@@ -1471,7 +1476,7 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadMailLevelRewards();
// Loot tables
- LoadLootTables();
+ LoadLootTables(); //TODOLEAK: untangle that shit
sLog.outString("Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
@@ -1501,7 +1506,6 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Auctions...");
sAuctionMgr.LoadAuctions();
- sLog.outString("***** GUILDS *****");
sObjectMgr.LoadGuilds();
sLog.outString("Loading ArenaTeams...");
@@ -1580,16 +1584,12 @@ void World::SetInitialWorldSettings()
LoadAutobroadcasts();
///- Load and initialize scripts
- sLog.outString("Loading Scripts...");
- sLog.outString();
sObjectMgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr.LoadWaypointScripts();
- sLog.outString(">>> Scripts loaded");
- sLog.outString();
sLog.outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr.LoadDbScriptStrings();
@@ -1610,7 +1610,7 @@ void World::SetInitialWorldSettings()
sCreatureTextMgr.LoadCreatureTexts();
sLog.outString("Initializing Scripts...");
- sScriptMgr.Initialize();
+ sScriptMgr.Initialize(); //LEAKTODO
sLog.outString("Validating spell scripts...");
sObjectMgr.ValidateSpellScripts();
@@ -1724,7 +1724,10 @@ void World::SetInitialWorldSettings()
else
sLog.SetLogDB(false);
- sLog.outString("WORLD: World initialized");
+ uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
+ sLog.outString();
+ sLog.outString("WORLD: World initialized in %u minuntes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000) );
+ sLog.outString();
}
void World::DetectDBCLang()
@@ -1799,6 +1802,8 @@ void World::RecordTimeDiff(const char *text, ...)
void World::LoadAutobroadcasts()
{
+ uint32 oldMSTime = getMSTime();
+
m_Autobroadcasts.clear();
QueryResult result = WorldDatabase.Query("SELECT text FROM autobroadcast");
@@ -1807,14 +1812,12 @@ void World::LoadAutobroadcasts()
{
barGoLink bar(1);
bar.step();
-
+ sLog.outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
sLog.outString();
- sLog.outString(">> Loaded 0 autobroadcasts definitions");
return;
}
barGoLink bar(result->GetRowCount());
-
uint32 count = 0;
do
@@ -1826,11 +1829,11 @@ void World::LoadAutobroadcasts()
m_Autobroadcasts.push_back(message);
- count++;
+ ++count;
} while (result->NextRow());
+ sLog.outString(">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u autobroadcasts definitions", count);
}
/// Update the World !
@@ -2765,30 +2768,33 @@ void World::UpdateAreaDependentAuras()
void World::LoadWorldStates()
{
+ uint32 oldMSTime = getMSTime();
+
QueryResult result = CharacterDatabase.Query("SELECT entry, value FROM worldstates");
if (!result)
{
barGoLink bar(1);
bar.step();
+ sLog.outString(">> Loaded 0 world states. DB table `worldstates` is empty!");
sLog.outString();
- sLog.outString(">> Loaded 0 world states.");
return;
}
barGoLink bar(result->GetRowCount());
- uint32 counter = 0;
+ uint32 count = 0;
do
{
Field *fields = result->Fetch();
m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt64();
bar.step();
- ++counter;
- } while (result->NextRow());
+ ++count;
+ }
+ while (result->NextRow());
+ sLog.outString(">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
- sLog.outString(">> Loaded %u world states.", counter);
}
// Setting a worldstate will save it to DB
diff --git a/src/server/shared/Utilities/ProgressBar.cpp b/src/server/shared/Utilities/ProgressBar.cpp
index 6d6cdf893d1..01f467b798f 100755
--- a/src/server/shared/Utilities/ProgressBar.cpp
+++ b/src/server/shared/Utilities/ProgressBar.cpp
@@ -21,17 +21,7 @@
#include "ProgressBar.h"
char const* const barGoLink::empty = " ";
-#ifdef _WIN32
-char const* const barGoLink::full = "\x3D";
-#else
char const* const barGoLink::full = "*";
-#endif
-
-barGoLink::~barGoLink()
-{
- printf( "\n" );
- fflush(stdout);
-}
barGoLink::barGoLink( uint64 row_count )
{
@@ -39,17 +29,9 @@ barGoLink::barGoLink( uint64 row_count )
rec_pos = 0;
indic_len = 50;
num_rec = row_count;
- #ifdef _WIN32
- printf( "\x3D" );
- #else
printf( "[" );
- #endif
for (uint64 i = 0; i < indic_len; ++i) printf( empty );
- #ifdef _WIN32
- printf( "\x3D 0%%\r\x3D" );
- #else
printf( "] 0%%\r[" );
- #endif
fflush(stdout);
}
@@ -62,22 +44,20 @@ void barGoLink::step( void )
n = rec_no * indic_len / num_rec;
if ( n != rec_pos )
{
- #ifdef _WIN32
- printf( "\r\x3D" );
- #else
printf( "\r[" );
- #endif
for (i = 0; i < n; i++ ) printf( full );
for (; i < indic_len; i++ ) printf( empty );
float percent = (((float)n/(float)indic_len)*100);
- #ifdef _WIN32
- printf( "\x3D %i%% \r\x3D", (int)percent);
- #else
printf( "] %i%% \r[", (int)percent);
- #endif
fflush(stdout);
rec_pos = n;
}
+
+ if( num_rec == rec_no)
+ {
+ printf( "\n" );
+ fflush(stdout);
+ }
}
diff --git a/src/server/shared/Utilities/ProgressBar.h b/src/server/shared/Utilities/ProgressBar.h
index 93363dc70b9..6c5382ab735 100755
--- a/src/server/shared/Utilities/ProgressBar.h
+++ b/src/server/shared/Utilities/ProgressBar.h
@@ -34,6 +34,5 @@ class barGoLink
void step( void );
barGoLink( uint64 );
- ~barGoLink();
};
#endif
diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h
index 28c7fcd999b..bae864bef02 100755
--- a/src/server/shared/Utilities/Timer.h
+++ b/src/server/shared/Utilities/Timer.h
@@ -37,6 +37,11 @@ inline uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
return newMSTime - oldMSTime;
}
+inline uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
+{
+ return getMSTimeDiff(oldMSTime, getMSTime());
+}
+
struct IntervalTimer
{
public: