diff options
author | Carbenium <carbenium@outlook.com> | 2015-11-10 19:58:13 +0100 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2015-11-11 00:13:43 +0100 |
commit | c5f635b6896abaa3b9a2242c63c61a37fc60bf80 (patch) | |
tree | 3333311433e3baf408dcfc732c42d7bb405bd317 /src | |
parent | ade33880ba323d9de991794d2477d25b2016c881 (diff) |
Core/Creature: Remove duplicate call to LoadCreatureAddons in Creature::Create
* Add error log for duplicated aura entries in creature_(template_)addon
Diffstat (limited to 'src')
5 files changed, 19 insertions, 14 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6c48cfd650a..9173d44ae86 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -440,7 +440,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/) ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); } - LoadCreaturesAddon(true); + LoadCreaturesAddon(); UpdateMovementFlags(); return true; } @@ -821,8 +821,6 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u break; } - LoadCreaturesAddon(); - //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) { @@ -1558,7 +1556,7 @@ void Creature::setDeathState(DeathState s) if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask) SetPhaseMask(GetCreatureData()->phaseMask, false); Unit::setDeathState(ALIVE); - LoadCreaturesAddon(true); + LoadCreaturesAddon(); } } @@ -2064,7 +2062,7 @@ CreatureAddon const* Creature::GetCreatureAddon() const } //creature_addon table -bool Creature::LoadCreaturesAddon(bool reload) +bool Creature::LoadCreaturesAddon() { CreatureAddon const* cainfo = GetCreatureAddon(); if (!cainfo) @@ -2130,12 +2128,7 @@ bool Creature::LoadCreaturesAddon(bool reload) // skip already applied aura if (HasAura(*itr)) - { - if (!reload) - TC_LOG_ERROR("sql.sql", "Creature (GUID: %u 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 (GUID: %u Entry: %u)", *itr, GetGUID().GetCounter(), GetEntry()); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index df83a2f9c0f..9a41c8570ed 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -432,7 +432,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 858cb79c6dc..046ce422cd2 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -555,6 +555,12 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (AdditionalSpellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %lu defined in `auras` field in `creature_template_addon`.", entry, atoul(*itr)); + if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), atoul(*itr)) != creatureAddon.auras.end()) + { + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has duplicate aura (spell %lu) in `auras` field in `creature_template_addon`.", entry, atoul(*itr)); + continue; + } + creatureAddon.auras[i++] = atoul(*itr); } @@ -1003,6 +1009,12 @@ void ObjectMgr::LoadCreatureAddons() if (AdditionalSpellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has SPELL_AURA_CONTROL_VEHICLE aura %lu defined in `auras` field in `creature_addon`.", guid, atoul(*itr)); + if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), atoul(*itr)) != creatureAddon.auras.end()) + { + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has duplicate aura (spell %lu) in `auras` field in `creature_addon`.", guid, atoul(*itr)); + continue; + } + creatureAddon.auras[i++] = atoul(*itr); } 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 f9d5a310526..4a76dc667e8 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 |