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
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user