diff options
Diffstat (limited to 'src/server/scripts')
5 files changed, 75 insertions, 151 deletions
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index b8b43344dff..557e48fe04e 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -195,9 +195,6 @@ public: if (playerClass != talentInfo->ClassID) continue; - if (talentInfo->SpecID && player->GetPrimarySpecialization() != ChrSpecialization(talentInfo->SpecID)) - continue; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(talentInfo->SpellID, DIFFICULTY_NONE); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false)) continue; 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 0812891367b..102714a3b71 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -242,7 +242,7 @@ struct boss_volazj : public BossAI // clone player->CastSpell(summon, SPELL_CLONE_PLAYER, true); summon->GetAI()->SetData(DATA_TWISTED_VISAGE_PLAYER_CLASS, player->GetClass()); - summon->GetAI()->SetData(DATA_TWISTED_VISAGE_PLAYER_SPEC, AsUnderlyingType(player->GetPrimarySpecialization())); + summon->GetAI()->SetData(DATA_TWISTED_VISAGE_PLAYER_SPEC, player->GetPrimaryTalentTree()); summon->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(summon); // set phase @@ -417,11 +417,40 @@ struct npc_twisted_visage : public ScriptedAI void AttackStart(Unit* who) override { - ChrSpecializationEntry const* chrSpecialization = sChrSpecializationStore.LookupEntry(_playerSpec); - if (chrSpecialization && chrSpecialization->GetFlags().HasFlag(ChrSpecializationFlag::Ranged)) - ScriptedAI::AttackStartCaster(who, 25.0f); - else - ScriptedAI::AttackStart(who); + switch (_playerClass) + { + case CLASS_SHAMAN: + switch (_playerSpec) + { + case SPEC_SHAMAN_ELEMENTAL: + case SPEC_SHAMAN_RESTORATION: + ScriptedAI::AttackStartCaster(who, 25.0f); + break; + default: + break; + } + break; + case CLASS_DRUID: + switch (_playerSpec) + { + case SPEC_DRUID_BALANCE: + case 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; + } } void SetData(uint32 type, uint32 data) override @@ -439,9 +468,9 @@ struct npc_twisted_visage : public ScriptedAI switch (_playerClass) { case CLASS_WARRIOR: - switch (ChrSpecialization(data)) + switch (data) { - case ChrSpecialization::WarriorArms: + case SPEC_WARRIOR_ARMS: _scheduler.Schedule(3s, [this](TaskContext mortalStrike) { DoCastVictim(SPELL_TWISTED_VISAGE_MORTAL_STRIKE); @@ -453,7 +482,7 @@ struct npc_twisted_visage : public ScriptedAI }); break; default: - case ChrSpecialization::WarriorFury: + case SPEC_WARRIOR_FURY: _scheduler.Schedule(2s, [this](TaskContext intercept) { if (!me->IsWithinCombatRange(me->GetVictim(), 8.0f)) @@ -469,7 +498,7 @@ struct npc_twisted_visage : public ScriptedAI bloodthirst.Repeat(3s, 5s); }); break; - case ChrSpecialization::WarriorProtection: + case SPEC_WARRIOR_PROTECTION: _scheduler.Schedule(5s, [this](TaskContext thunderClap) { DoCastSelf(SPELL_TWISTED_VISAGE_THUNDER_CLAP); @@ -483,9 +512,9 @@ struct npc_twisted_visage : public ScriptedAI } break; case CLASS_PALADIN: - switch (ChrSpecialization(data)) + switch (data) { - case ChrSpecialization::PaladinProtection: + case SPEC_PALADIN_PROTECTION: _scheduler.Schedule(5s, [this](TaskContext consecration) { DoCastSelf(SPELL_TWISTED_VISAGE_CONSECRATION); @@ -497,7 +526,7 @@ struct npc_twisted_visage : public ScriptedAI }); break; default: - case ChrSpecialization::PaladinRetribution: + case SPEC_PALADIN_RETRIBUTION: _scheduler.Schedule(5s, [this](TaskContext consecration) { DoCastSelf(SPELL_TWISTED_VISAGE_CONSECRATION); @@ -542,9 +571,9 @@ struct npc_twisted_visage : public ScriptedAI }); break; case CLASS_PRIEST: - switch (ChrSpecialization(data)) + switch (data) { - case ChrSpecialization::PriestShadow: + case SPEC_PRIEST_SHADOW: _scheduler.Schedule(5s, [this](TaskContext shadowWordPain) { DoCastVictim(SPELL_TWISTED_VISAGE_SHADOW_WORD_PAIN); @@ -595,10 +624,10 @@ struct npc_twisted_visage : public ScriptedAI }); break; case CLASS_SHAMAN: - switch (ChrSpecialization(data)) + switch (data) { default: - case ChrSpecialization::ShamanElemental: + case SPEC_SHAMAN_ELEMENTAL: _scheduler.Schedule(5s, [this](TaskContext thunderstorm) { DoCastSelf(SPELL_TWISTED_VISAGE_THUNDERSTORM); @@ -609,14 +638,14 @@ struct npc_twisted_visage : public ScriptedAI lightningBolt.Repeat(3s, 5s); }); break; - case ChrSpecialization::ShamanEnhancement: + case SPEC_SHAMAN_ENHANCEMENT: _scheduler.Schedule(2s, [this](TaskContext earthShock) { DoCastVictim(SPELL_TWISTED_VISAGE_EARTH_SHOCK); earthShock.Repeat(3s, 5s); }); break; - case ChrSpecialization::ShamanRestoration: + case SPEC_SHAMAN_RESTORATION: _scheduler.Schedule(2s, [this](TaskContext earthShield) { if (Unit* target = DoSelectLowestHpFriendly(40.f)) @@ -662,9 +691,9 @@ struct npc_twisted_visage : public ScriptedAI }); break; case CLASS_DRUID: - switch (ChrSpecialization(data)) + switch (data) { - case ChrSpecialization::DruidBalance: + case SPEC_DRUID_BALANCE: _scheduler.Schedule(2s, [this](TaskContext moonfire) { DoCastVictim(SPELL_TWISTED_VISAGE_MOONFIRE); @@ -675,8 +704,7 @@ struct npc_twisted_visage : public ScriptedAI wrath.Repeat(3s, 5s); }); break; - case ChrSpecialization::DruidGuardian: - case ChrSpecialization::DruidFeral: + case SPEC_DRUID_FERAL: _scheduler.Schedule(1ms, [this](TaskContext /*catForm*/) { DoCastSelf(SPELL_TWISTED_VISAGE_CAT_FORM); @@ -691,7 +719,7 @@ struct npc_twisted_visage : public ScriptedAI }); break; default: - case ChrSpecialization::DruidRestoration: + case SPEC_DRUID_RESTORATION: _scheduler.Schedule(2s, [this](TaskContext lifebloom) { if (Unit* target = DoSelectLowestHpFriendly(40.f)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 807109e1493..46bc594645c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -16,6 +16,7 @@ */ #include "icecrown_citadel.h" +#include "CommonHelpers.h" #include "Containers.h" #include "DB2Stores.h" #include "GridNotifiers.h" @@ -1089,18 +1090,30 @@ class spell_sindragosa_unchained_magic : public SpellScript if (!player) continue; - ChrSpecializationEntry const* specialization = player->GetPrimarySpecializationEntry(); - if (!specialization) - continue; - - if (specialization->GetRole() == ChrSpecializationRole::Healer) + if (Trinity::Helpers::Entity::IsPlayerHealer(player)) { healers.push_back(target); continue; } - if (specialization->GetFlags().HasFlag(ChrSpecializationFlag::Caster)) - casters.push_back(target); + switch (player->GetClass()) + { + case CLASS_PRIEST: + case CLASS_MAGE: + case CLASS_WARLOCK: + casters.push_back(target); + break; + case CLASS_SHAMAN: + if (Trinity::Helpers::Entity::GetPlayerSpecialization(player) != SPEC_SHAMAN_ENHANCEMENT) + casters.push_back(target); + break; + case CLASS_DRUID: + if (Trinity::Helpers::Entity::GetPlayerSpecialization(player) != SPEC_DRUID_FERAL) + casters.push_back(target); + break; + default: + break; + } } targets.clear(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index a36f99be4a2..a1864798ff1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -15,11 +15,12 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "naxxramas.h" #include "ScriptMgr.h" +#include "CommonHelpers.h" #include "GameObject.h" #include "InstanceScript.h" #include "MotionMaster.h" -#include "naxxramas.h" #include "ObjectAccessor.h" #include "Player.h" #include "PlayerAI.h" @@ -183,7 +184,7 @@ class KelThuzadCharmedPlayerAI : public SimpleCharmedPlayerAI if (pTarget->HasBreakableByDamageCrowdControlAura()) return false; // We _really_ dislike healers. So we hit them in the face. Repeatedly. Exclusively. - return PlayerAI::IsPlayerHealer(pTarget); + return Trinity::Helpers::Entity::IsPlayerHealer(pTarget); } }; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index a9c0464863c..6ec90ad3535 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -4252,119 +4252,6 @@ class spell_item_sephuzs_secret : public AuraScript } }; -enum AmalgamsSeventhSpine -{ - SPELL_FRAGILE_ECHOES_MONK = 225281, - SPELL_FRAGILE_ECHOES_SHAMAN = 225292, - SPELL_FRAGILE_ECHOES_PRIEST_DISCIPLINE = 225294, - SPELL_FRAGILE_ECHOES_PALADIN = 225297, - SPELL_FRAGILE_ECHOES_DRUID = 225298, - SPELL_FRAGILE_ECHOES_PRIEST_HOLY = 225366, - SPELL_FRAGILE_ECHOES_EVOKER = 429020, - SPELL_FRAGILE_ECHO_ENERGIZE = 215270, -}; - -// 215266 - Fragile Echoes -class spell_item_amalgams_seventh_spine : public AuraScript -{ - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo - ({ - SPELL_FRAGILE_ECHOES_MONK, - SPELL_FRAGILE_ECHOES_SHAMAN, - SPELL_FRAGILE_ECHOES_PRIEST_DISCIPLINE, - SPELL_FRAGILE_ECHOES_PALADIN, - SPELL_FRAGILE_ECHOES_DRUID, - SPELL_FRAGILE_ECHOES_PRIEST_HOLY, - SPELL_FRAGILE_ECHOES_EVOKER - }); - } - - void UpdateSpecAura(bool apply) const - { - Player* target = GetUnitOwner()->ToPlayer(); - if (!target) - return; - - auto updateAuraIfInCorrectSpec = [&](ChrSpecialization spec, AmalgamsSeventhSpine aura) - { - if (!apply || target->GetPrimarySpecialization() != spec) - target->RemoveAurasDueToSpell(aura); - else if (!target->HasAura(aura)) - target->CastSpell(target, aura, GetEffect(EFFECT_0)); - }; - - switch (target->GetClass()) - { - case CLASS_MONK: - updateAuraIfInCorrectSpec(ChrSpecialization::MonkMistweaver, SPELL_FRAGILE_ECHOES_MONK); - break; - case CLASS_SHAMAN: - updateAuraIfInCorrectSpec(ChrSpecialization::ShamanRestoration, SPELL_FRAGILE_ECHOES_SHAMAN); - break; - case CLASS_PRIEST: - updateAuraIfInCorrectSpec(ChrSpecialization::PriestDiscipline, SPELL_FRAGILE_ECHOES_PRIEST_DISCIPLINE); - updateAuraIfInCorrectSpec(ChrSpecialization::PriestHoly, SPELL_FRAGILE_ECHOES_PRIEST_HOLY); - break; - case CLASS_PALADIN: - updateAuraIfInCorrectSpec(ChrSpecialization::PaladinHoly, SPELL_FRAGILE_ECHOES_PALADIN); - break; - case CLASS_DRUID: - updateAuraIfInCorrectSpec(ChrSpecialization::DruidRestoration, SPELL_FRAGILE_ECHOES_DRUID); - break; - case CLASS_EVOKER: - updateAuraIfInCorrectSpec(ChrSpecialization::EvokerPreservation, SPELL_FRAGILE_ECHOES_EVOKER); - break; - default: - break; - } - } - - void HandleHeartbeat() const - { - UpdateSpecAura(true); - } - - void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const - { - UpdateSpecAura(false); - } - - void Register() override - { - OnHeartbeat += AuraHeartbeatFn(spell_item_amalgams_seventh_spine::HandleHeartbeat); - AfterEffectRemove += AuraEffectRemoveFn(spell_item_amalgams_seventh_spine::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } -}; - -// 215267 - Fragile Echo -class spell_item_amalgams_seventh_spine_mana_restore : public AuraScript -{ - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_FRAGILE_ECHO_ENERGIZE }); - } - - void TriggerManaRestoration(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const - { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - - Unit* caster = GetCaster(); - if (!caster) - return; - - if (AuraEffect const* trinketEffect = caster->GetAuraEffect(aurEff->GetSpellEffectInfo().TriggerSpell, EFFECT_0)) - caster->CastSpell(caster, SPELL_FRAGILE_ECHO_ENERGIZE, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_BASE_POINT0, trinketEffect->GetAmount())); - } - - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_item_amalgams_seventh_spine_mana_restore::TriggerManaRestoration, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } -}; - // 228445 - March of the Legion class spell_item_set_march_of_the_legion : public AuraScript { @@ -4787,8 +4674,6 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_eggnog); RegisterSpellScript(spell_item_sephuzs_secret); - RegisterSpellScript(spell_item_amalgams_seventh_spine); - RegisterSpellScript(spell_item_amalgams_seventh_spine_mana_restore); RegisterSpellScript(spell_item_set_march_of_the_legion); RegisterSpellScript(spell_item_seal_of_darkshire_nobility); RegisterSpellScript(spell_item_lightblood_elixir); |
