aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarbenium <carbenium@outlook.com>2015-11-10 19:58:13 +0100
committerCarbenium <carbenium@outlook.com>2015-11-14 04:22:42 +0100
commit230e820898c4e7d17f17f5ad03bff6e981ade9b4 (patch)
treedbd32c46e6c3418e09069a1f113f5ea687b9bfc3 /src
parent4e76974ce5ba3f6ebd73d6dd96860b60d50a19f4 (diff)
Core/Creature: Remove duplicate call to LoadCreatureAddons in Creature::Create
* Add error log for duplicated aura entries in creature_(template_)addon (cherry picked from commit c5f635b6896abaa3b9a2242c63c61a37fc60bf80) Conflicts: src/server/game/Entities/Creature/Creature.cpp src/server/game/Globals/ObjectMgr.cpp
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp9
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp12
-rw-r--r--src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp4
5 files changed, 18 insertions, 11 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 26ee5329808..ea21bf8af96 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1580,7 +1580,7 @@ void Creature::setDeathState(DeathState s)
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
Motion_Initialize();
Unit::setDeathState(ALIVE);
- LoadCreaturesAddon(true);
+ LoadCreaturesAddon();
}
}
@@ -2096,7 +2096,7 @@ CreatureAddon const* Creature::GetCreatureAddon() const
}
//creature_addon table
-bool Creature::LoadCreaturesAddon(bool reload)
+bool Creature::LoadCreaturesAddon()
{
CreatureAddon const* cainfo = GetCreatureAddon();
if (!cainfo)
@@ -2162,12 +2162,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
// skip already applied aura
if (HasAura(*itr))
- {
- if (!reload)
- TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD " Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetSpawnId(), GetEntry(), *itr);
-
continue;
- }
AddAura(*itr, this);
TC_LOG_DEBUG("entities.unit", "Spell: %u added to creature (%s)", *itr, GetGUID().ToString().c_str());
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index eb2e7df65b8..1f5984691be 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -475,7 +475,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void DisappearAndDie();
bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0);
- bool LoadCreaturesAddon(bool reload = false);
+ bool LoadCreaturesAddon();
void SelectLevel();
void LoadEquipment(int8 id = 1, bool force = false);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index ca41d9890e5..cc990cc3b1c 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -577,6 +577,12 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, spellId);
+ if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellId) != creatureAddon.auras.end())
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has duplicate aura (spell %lu) in `auras` field in `creature_template_addon`.", entry, spellId);
+ continue;
+ }
+
creatureAddon.auras[i++] = spellId;
}
@@ -1028,6 +1034,12 @@ void ObjectMgr::LoadCreatureAddons()
if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, spellId);
+ if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellId) != creatureAddon.auras.end())
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has duplicate aura (spell %lu) in `auras` field in `creature_addon`.", guid, spellId);
+ continue;
+ }
+
creatureAddon.auras[i++] = spellId;
}
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
index 4245bffb864..7ab7534199a 100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
@@ -33,7 +33,7 @@ void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner)
{
owner->ClearUnitState(UNIT_STATE_EVADE);
owner->SetWalk(true);
- owner->LoadCreaturesAddon(true);
+ owner->LoadCreaturesAddon();
owner->AI()->JustReachedHome();
}
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 4a8f56d0d55..97ad45542d0 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -309,7 +309,7 @@ class boss_valithria_dreamwalker : public CreatureScript
{
me->SetHealth(_spawnHealth);
me->SetReactState(REACT_PASSIVE);
- me->LoadCreaturesAddon(true);
+ me->LoadCreaturesAddon();
// immune to percent heals
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_OBS_MOD_HEALTH, true);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL_PCT, true);
@@ -1072,7 +1072,7 @@ class npc_dream_cloud : public CreatureScript
_events.Reset();
_events.ScheduleEvent(EVENT_CHECK_PLAYER, 1000);
me->SetCorpseDelay(0); // remove corpse immediately
- me->LoadCreaturesAddon(true);
+ me->LoadCreaturesAddon();
}
void UpdateAI(uint32 diff) override