From 6455f1c256e566da43d55583bca9c94c0d3139ce Mon Sep 17 00:00:00 2001 From: treeston Date: Sun, 19 Feb 2017 19:26:44 +0100 Subject: 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) --- src/server/game/Entities/Creature/Creature.cpp | 6 ------ src/server/game/Entities/Creature/Creature.h | 3 +-- src/server/game/Globals/ObjectMgr.cpp | 8 ++++++++ 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') 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, 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, 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(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(diffInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; + } + } break; } case ENCOUNTER_CREDIT_CAST_SPELL: -- cgit v1.2.3