diff options
author | Kitzunu <24550914+Kitzunu@users.noreply.github.com> | 2021-10-12 13:35:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 13:35:22 +0200 |
commit | d464ee7083f6321aa4d33c3f68c2432b247c38e0 (patch) | |
tree | 90fab7884dbbe51dd02ce4e3684a67edb89a9a01 /src | |
parent | 57658d821dca6c59dba94b3e04b36e31606dc49a (diff) |
refactor(Core/CreatureAI): Turn hardcoded entries into flagsExtra (#8189)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 33 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/CreatureData.h | 6 |
2 files changed, 6 insertions, 33 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 34a7647206..50e09e0368 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -196,38 +196,9 @@ void CreatureAI::EnterEvadeMode() } } - // @todo: Turn into a flags_extra in creature_template // despawn bosses at reset - only verified tbc/woltk bosses with this reset type - add bosses in last line respectively (dungeon/raid) and increase array limit - static constexpr std::array<uint32, 24> bosses = { - /* dungeons */ - 28684, /* Krik'thir the Gatewatcher */ - 36502, /* Devourer of Souls */ - 36658, /* Scourgelord Tyrannus */ - /* raids */ - 32871, /* Algalon */ - 39863, /* Halion */ - 33186, /* Razorscale */ - 36626, /* Festergut */ - 32867, /* Steelbreaker - Assembly of Iron */ - 32927, /* Runemaster Molgeim - Assembly of Iron */ - 32857, /* Stormcaller Brundir - Assembly of Iron */ - 33350, /* Mimiron */ - 16060, /* Gothik the Harvester */ - 36678, /* Professor Putricide */ - 15990, /* Kel'Thuzad */ - 33993, /* Emalon the Storm Watcher */ - 17257, /* Magtheridon */ - 25315, /* Kil'jaeden */ - 15928, /* Thaddius */ - 32930, /* Kologarn */ - 32906, /* Freya */ - 36597, /* The Lich King */ - 36853, /* Sindragosa */ - 36855, /* Lady Deathwhisper */ - 37955 /* Blood-Queen Lana'thel */ - }; - - if (std::find(std::begin(bosses), std::end(bosses), me->GetEntry()) != std::end(bosses)) + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(me->GetEntry()); + if (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET)) { me->DespawnOnEvade(); me->m_Events.AddEvent(new PhasedRespawn(*me), me->m_Events.CalculateTime(20000)); diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h index 1fd3d49665..b54979049e 100644 --- a/src/server/game/Entities/Creature/CreatureData.h +++ b/src/server/game/Entities/Creature/CreatureData.h @@ -73,11 +73,11 @@ enum CreatureFlagsExtra : uint32 CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000, // creature is immune to knockback effects - CREATURE_FLAG_EXTRA_UNUSED_32 = 0x80000000, + CREATURE_FLAG_EXTRA_HARD_RESET = 0x80000000, // Masks CREATURE_FLAG_EXTRA_UNUSED = (CREATURE_FLAG_EXTRA_UNUSED_12 | CREATURE_FLAG_EXTRA_UNUSED_25 | CREATURE_FLAG_EXTRA_UNUSED_26 | - CREATURE_FLAG_EXTRA_UNUSED_27 | CREATURE_FLAG_EXTRA_UNUSED_28 | CREATURE_FLAG_EXTRA_UNUSED_32), + CREATURE_FLAG_EXTRA_UNUSED_27 | CREATURE_FLAG_EXTRA_UNUSED_28), CREATURE_FLAG_EXTRA_DB_ALLOWED = (0xFFFFFFFF & ~(CREATURE_FLAG_EXTRA_UNUSED | CREATURE_FLAG_EXTRA_DUNGEON_BOSS)) }; @@ -177,6 +177,8 @@ struct CreatureTemplate return exotic || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_EXOTIC) == 0; } + [[nodiscard]] bool HasFlagsExtra (uint32 flag) const { return (flags_extra & flag) != 0; } + void InitializeQueryData(); }; |