From 054723241eaf1abe7d45a96460e84b9ff113ffb2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 6 Aug 2023 21:40:10 +0200 Subject: Core/Misc: Reduce number of player spec hardcoded checks --- .../AzjolNerub/Ahnkahet/boss_herald_volazj.cpp | 44 +++------------------- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 4 +- 2 files changed, 8 insertions(+), 40 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 4a7b9cd7a80..41bce531c60 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -419,50 +419,18 @@ struct npc_twisted_visage : public ScriptedAI void AttackStart(Unit* who) override { - switch (_playerClass) - { - case CLASS_SHAMAN: - switch (_playerSpec) - { - case TALENT_SPEC_SHAMAN_ELEMENTAL: - case TALENT_SPEC_SHAMAN_RESTORATION: - ScriptedAI::AttackStartCaster(who, 25.0f); - break; - default: - break; - } - break; - case CLASS_DRUID: - switch (_playerSpec) - { - case TALENT_SPEC_DRUID_BALANCE: - case TALENT_SPEC_DRUID_RESTORATION: - ScriptedAI::AttackStartCaster(who, 25.0f); - break; - default: - break; - } - break; - case CLASS_PRIEST: - case CLASS_HUNTER: - case CLASS_MAGE: - case CLASS_WARLOCK: - ScriptedAI::AttackStartCaster(who, 25.0f); - break; - case CLASS_ROGUE: - ScriptedAI::AttackStart(who); - break; - default: - ScriptedAI::AttackStart(who); - break; - } + ChrSpecializationEntry const* chrSpecialization = sChrSpecializationStore.LookupEntry(_playerSpec); + if (chrSpecialization && chrSpecialization->GetFlags().HasFlag(ChrSpecializationFlag::Ranged)) + ScriptedAI::AttackStartCaster(who, 25.0f); + else + ScriptedAI::AttackStart(who); } void SetData(uint32 type, uint32 data) override { if (type == DATA_TWISTED_VISAGE_PLAYER_CLASS) { - if (data > CLASS_NONE && data <= CLASS_DRUID) + if (data > CLASS_NONE && data < MAX_CLASSES) _playerClass = data; } else if (type == DATA_TWISTED_VISAGE_PLAYER_SPEC && _playerClass != CLASS_NONE) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index ce9f385e625..e4d74a47faa 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1099,13 +1099,13 @@ class spell_sindragosa_unchained_magic : public SpellScript continue; ChrSpecializationEntry const* specialization = sChrSpecializationStore.LookupEntry(player->GetPrimarySpecialization()); - if (specialization->Role == 1) + if (specialization->GetRole() == ChrSpecializationRole::Healer) { healers.push_back(target); continue; } - if (specialization->Flags & CHR_SPECIALIZATION_FLAG_CASTER) + if (specialization->GetFlags().HasFlag(ChrSpecializationFlag::Caster)) casters.push_back(target); } -- cgit v1.2.3