refactor(Core/CreatureAI): Turn hardcoded entries into flagsExtra (#8189)

This commit is contained in:
Kitzunu
2021-10-12 13:35:22 +02:00
committed by GitHub
parent 57658d821d
commit d464ee7083
3 changed files with 33 additions and 33 deletions

View File

@@ -0,0 +1,27 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1631986343234423300');
UPDATE `creature_template` SET `flags_extra`=`flags_extra`|0x80000000 WHERE `entry` IN (
28684, /* Krik'thir the Gatewatcher */
36502, /* Devourer of Souls */
36658, /* Scourgelord Tyrannus */
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 */);

View File

@@ -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));

View File

@@ -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();
};