mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/SmartAI: add param2 to SMART_ACTION_UPDATE_TEMPLATE, allowing to specify if creature's level should remain the same between entry updates.
A value of 0 (default) forces the creature to keep its current level between entry updates. Fixes #16371
This commit is contained in:
@@ -1013,7 +1013,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||||||
|
|
||||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||||
if (IsCreature(*itr))
|
if (IsCreature(*itr))
|
||||||
(*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature);
|
(*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, nullptr, e.action.updateTemplate.updateLevel);
|
||||||
|
|
||||||
delete targets;
|
delete targets;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -740,6 +740,7 @@ struct SmartAction
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 creature;
|
uint32 creature;
|
||||||
|
uint32 updateLevel;
|
||||||
} updateTemplate;
|
} updateTemplate;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
|
bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, bool updateLevel /* = true */)
|
||||||
{
|
{
|
||||||
if (!InitEntry(entry, data))
|
if (!InitEntry(entry, data))
|
||||||
return false;
|
return false;
|
||||||
@@ -434,7 +434,8 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
|
|||||||
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
|
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
|
||||||
SetAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime);
|
SetAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime);
|
||||||
|
|
||||||
SelectLevel();
|
if (updateLevel)
|
||||||
|
SelectLevel();
|
||||||
|
|
||||||
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));
|
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));
|
||||||
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
|
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
|||||||
|
|
||||||
bool HasSpell(uint32 spellID) const override;
|
bool HasSpell(uint32 spellID) const override;
|
||||||
|
|
||||||
bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr);
|
bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr, bool updateLevel = true);
|
||||||
|
|
||||||
void UpdateMovementFlags();
|
void UpdateMovementFlags();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user