Merge branch 'master' into Playerbot
This commit is contained in:
@@ -22,20 +22,19 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "CreatureAIFactory.h"
|
||||
#include "Config.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "CreatureAIFactory.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameObjectAIFactory.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObjectAIFactory.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Pet.h"
|
||||
@@ -45,13 +44,14 @@
|
||||
#include "Spell.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellScriptLoader.h"
|
||||
#include "StringConvert.h"
|
||||
#include "Tokenize.h"
|
||||
#include "Transport.h"
|
||||
#include "Unit.h"
|
||||
#include "Util.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "StringConvert.h"
|
||||
#include "Tokenize.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
ScriptMapMap sSpellScripts;
|
||||
@@ -591,7 +591,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
"ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, ExperienceModifier, "
|
||||
// 64 65 66 67 68 69 70
|
||||
"RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName "
|
||||
"FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId;");
|
||||
"FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId ORDER BY entry DESC;");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -600,6 +600,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
}
|
||||
|
||||
_creatureTemplateStore.rehash(result->GetRowCount());
|
||||
_creatureTemplateStoreFast.clear();
|
||||
|
||||
uint32 count = 0;
|
||||
do
|
||||
@@ -609,20 +610,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
// pussywizard:
|
||||
{
|
||||
uint32 max = 0;
|
||||
for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
|
||||
if (itr->first > max)
|
||||
max = itr->first;
|
||||
if (max)
|
||||
{
|
||||
_creatureTemplateStoreFast.clear();
|
||||
_creatureTemplateStoreFast.resize(max + 1, nullptr);
|
||||
for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
|
||||
_creatureTemplateStoreFast[itr->first] = &(itr->second);
|
||||
}
|
||||
}
|
||||
sScriptMgr->OnAfterDatabaseLoadCreatureTemplates(_creatureTemplateStoreFast);
|
||||
|
||||
LoadCreatureTemplateResistances();
|
||||
LoadCreatureTemplateSpells();
|
||||
@@ -638,12 +626,28 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplate(Field* fields)
|
||||
/**
|
||||
* @brief Loads a creature template from a database result
|
||||
*
|
||||
* @param fields Database result
|
||||
* @param triggerHook If true, will trigger the OnAfterDatabaseLoadCreatureTemplates hook. Useful if you are not calling the hook yourself.
|
||||
*/
|
||||
void ObjectMgr::LoadCreatureTemplate(Field* fields, bool triggerHook)
|
||||
{
|
||||
uint32 entry = fields[0].Get<uint32>();
|
||||
|
||||
CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
|
||||
|
||||
// enlarge the fast cache as necessary
|
||||
if (_creatureTemplateStoreFast.size() < entry + 1)
|
||||
{
|
||||
_creatureTemplateStoreFast.resize(entry + 1, nullptr);
|
||||
}
|
||||
|
||||
// load a pointer to this creatureTemplate into the fast cache
|
||||
_creatureTemplateStoreFast[entry] = &creatureTemplate;
|
||||
|
||||
// build the creatureTemplate
|
||||
creatureTemplate.Entry = entry;
|
||||
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
|
||||
@@ -750,6 +754,13 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
|
||||
creatureTemplate.SpellSchoolImmuneMask = fields[68].Get<uint8>();
|
||||
creatureTemplate.flags_extra = fields[69].Get<uint32>();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[70].Get<std::string>());
|
||||
|
||||
// useful if the creature template load is being triggered from outside this class
|
||||
if (triggerHook)
|
||||
{
|
||||
sScriptMgr->OnAfterDatabaseLoadCreatureTemplates(_creatureTemplateStoreFast);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplateResistances()
|
||||
@@ -4931,6 +4942,25 @@ void ObjectMgr::LoadQuests()
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j)
|
||||
{
|
||||
if (!qinfo->RewardItemId[0] && qinfo->RewardItemId[j])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Quest {} has no `RewardItemId1` but has `RewardItem{}`. Reward item will not be loaded.",
|
||||
qinfo->GetQuestId(), j + 1);
|
||||
}
|
||||
if (!qinfo->RewardItemId[1] && j > 1 && qinfo->RewardItemId[j])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Quest {} has no `RewardItemId2` but has `RewardItem{}`. Reward item will not be loaded.",
|
||||
qinfo->GetQuestId(), j + 1);
|
||||
}
|
||||
if (!qinfo->RewardItemId[2] && j > 2 && qinfo->RewardItemId[j])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Quest {} has no `RewardItemId3` but has `RewardItem{}`. Reward item will not be loaded.",
|
||||
qinfo->GetQuestId(), j + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j)
|
||||
{
|
||||
uint32 id = qinfo->RewardItemId[j];
|
||||
@@ -5660,7 +5690,7 @@ void ObjectMgr::ValidateSpellScripts()
|
||||
|
||||
for (SpellScriptsContainer::iterator itr = _spellScriptsStore.begin(); itr != _spellScriptsStore.end();)
|
||||
{
|
||||
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first);
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
std::vector<std::pair<SpellScriptLoader*, SpellScriptsContainer::iterator> > SpellScriptLoaders;
|
||||
sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
|
||||
itr = _spellScriptsStore.upper_bound(itr->first);
|
||||
@@ -5677,17 +5707,17 @@ void ObjectMgr::ValidateSpellScripts()
|
||||
}
|
||||
if (spellScript)
|
||||
{
|
||||
spellScript->_Init(&sitr->first->GetName(), spellEntry->Id);
|
||||
spellScript->_Init(&sitr->first->GetName(), spellInfo->Id);
|
||||
spellScript->_Register();
|
||||
if (!spellScript->_Validate(spellEntry))
|
||||
if (!spellScript->_Validate(spellInfo))
|
||||
valid = false;
|
||||
delete spellScript;
|
||||
}
|
||||
if (auraScript)
|
||||
{
|
||||
auraScript->_Init(&sitr->first->GetName(), spellEntry->Id);
|
||||
auraScript->_Init(&sitr->first->GetName(), spellInfo->Id);
|
||||
auraScript->_Register();
|
||||
if (!auraScript->_Validate(spellEntry))
|
||||
if (!auraScript->_Validate(spellInfo))
|
||||
valid = false;
|
||||
delete auraScript;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "GameObject.h"
|
||||
#include "GossipDef.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "Mail.h"
|
||||
@@ -36,7 +37,6 @@
|
||||
#include "QuestDef.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "VehicleDefines.h"
|
||||
#include "GossipDef.h"
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
@@ -1021,7 +1021,7 @@ public:
|
||||
void LoadCreatureClassLevelStats();
|
||||
void LoadCreatureLocales();
|
||||
void LoadCreatureTemplates();
|
||||
void LoadCreatureTemplate(Field* fields);
|
||||
void LoadCreatureTemplate(Field* fields, bool triggerHook = false);
|
||||
void LoadCreatureTemplateAddons();
|
||||
void LoadCreatureTemplateResistances();
|
||||
void LoadCreatureTemplateSpells();
|
||||
|
||||
Reference in New Issue
Block a user