diff options
author | treeston <treeston.mmoc@gmail.com> | 2017-02-19 19:26:44 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-07-21 21:06:54 +0200 |
commit | 6455f1c256e566da43d55583bca9c94c0d3139ce (patch) | |
tree | 40cf3dfba0e020153afd89af1dfafbe6d5885b78 | |
parent | 83e277724945a8849c93cf041ecb071a76c4c7b4 (diff) |
DB/Creature: The instance_encounters extra flag (CREATURE_FLAG_EXTRA_DUNGEON_BOSS) now properly propagates to all difficulty entries (not just difficulty 0).
This lets us simplify IsDungeonBoss() on Creature (and move it to header).
Closes #18824.
(cherrypicked from 1beb2e5fd6e85332173b1f3e414d5b385c3022fb)
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 3 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 8 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e4240e04554..660cce5f62c 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2825,12 +2825,6 @@ void Creature::SetPosition(float x, float y, float z, float o) GetVehicleKit()->RelocatePassengers(); } -bool Creature::IsDungeonBoss() const -{ - CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry()); - return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS); -} - float Creature::GetAggroRange(Unit const* target) const { // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection. diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 21a53dbc973..c92d664984f 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -100,6 +100,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma bool CanWalk() const { return (GetCreatureTemplate()->InhabitType & INHABIT_GROUND) != 0; } bool CanSwim() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) != 0 || IsPet(); } bool CanFly() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; } + bool IsDungeonBoss() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS) != 0; } void SetReactState(ReactStates st) { m_reactState = st; } ReactStates GetReactState() const { return m_reactState; } @@ -116,8 +117,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma bool isElite() const; bool isWorldBoss() const; - bool IsDungeonBoss() const; - bool HasScalableLevels() const; uint8 GetLevelForTarget(WorldObject const* target) const override; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 18c922bbb84..ad5eb8f7969 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -5671,6 +5671,14 @@ void ObjectMgr::LoadInstanceEncounters() continue; } const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; + for (uint8 diff = 0; diff < MAX_CREATURE_DIFFICULTIES; ++diff) + { + if (uint32 diffEntry = creatureInfo->DifficultyEntry[diff]) + { + if (CreatureTemplate const* diffInfo = GetCreatureTemplate(diffEntry)) + const_cast<CreatureTemplate*>(diffInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; + } + } break; } case ENCOUNTER_CREDIT_CAST_SPELL: |