diff options
| author | SnapperRy <snapperryen@gmail.com> | 2016-08-23 23:46:24 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-02-18 14:47:01 +0100 |
| commit | 6ea973adecbc77711a090357c7fdd2809cf3fb61 (patch) | |
| tree | 0653214a69f9a2061c9e2df7097afe3e0e2663f3 | |
| parent | 6a8ca9b0bf6f7cd355e1994723d6be6a5003d4d4 (diff) | |
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
(cherry picked from commit a6ef9d45395be0f4551a55439c7790a288c40df8)
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 5 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index d814143a9ae..2a316e7e14b 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1035,7 +1035,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++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; break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 2fde9031a36..a5c4f96b333 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -741,6 +741,7 @@ struct SmartAction struct { uint32 creature; + uint32 updateLevel; } updateTemplate; struct diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 1288e84e31d..8e16c9e0c17 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -406,7 +406,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) 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)) return false; @@ -441,7 +441,8 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/) SetBaseAttackTime(OFF_ATTACK, cInfo->BaseAttackTime); SetBaseAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime); - SelectLevel(); + if (updateLevel) + SelectLevel(); SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 2fdf36049ae..51a5b3b93e6 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -761,7 +761,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma 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(); |
