diff options
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 14 | ||||
| -rw-r--r-- | src/server/scripts/Kalimdor/zone_winterspring.cpp | 24 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp | 24 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/zone_dragonblight.cpp | 46 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 5 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 30 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 54 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 8 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 10 |
11 files changed, 103 insertions, 116 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 7249480108f..ce359603176 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -934,20 +934,16 @@ public: void FindMinions(Unit* owner) { - std::list<Creature*> MinionList; + std::list<TempSummon*> MinionList; owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); if (!MinionList.empty()) { - for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) + for (TempSummon* summon : MinionList) { - if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) - { - if ((*itr)->IsInCombat() && (*itr)->getAttackerForHelper()) - { - AttackStart((*itr)->getAttackerForHelper()); - } - } + if (summon->GetOwnerGUID() == me->GetOwnerGUID()) + if (summon->IsInCombat() && summon->getAttackerForHelper()) + AttackStart(summon->getAttackerForHelper()); } } } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index ee73d9b27a9..b8200c59258 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -377,15 +377,15 @@ public: void DoSummonPriestess() { // Summon 2 Elune priestess and make each of them move to a different spot - if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ, wingThicketLocations[0].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[0], TEMPSUMMON_CORPSE_DESPAWN, 0)) { - priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[3].m_positionX, wingThicketLocations[3].m_positionY, wingThicketLocations[3].m_positionZ); + priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[3]); _firstPriestessGUID = priestess->GetGUID(); } - if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ, wingThicketLocations[1].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[1], TEMPSUMMON_CORPSE_DESPAWN, 0)) { // Left priestess should have a distinct move point because she is the one who starts the dialogue at point reach - priestess->GetMotionMaster()->MovePoint(1, wingThicketLocations[4].m_positionX, wingThicketLocations[4].m_positionY, wingThicketLocations[4].m_positionZ); + priestess->GetMotionMaster()->MovePoint(1, wingThicketLocations[4]); _secondPriestessGUID = priestess->GetGUID(); } } @@ -476,19 +476,19 @@ public: case SAY_PRIESTESS_ALTAR_9: // move near the escort npc if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) - priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6].m_positionX, wingThicketLocations[6].m_positionY, wingThicketLocations[6].m_positionZ); + priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6]); break; case SAY_PRIESTESS_ALTAR_13: // summon the Guardian of Elune - if (Creature* guard = me->SummonCreature(NPC_GUARDIAN_ELUNE, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ, wingThicketLocations[2].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Creature* guard = me->SummonCreature(NPC_GUARDIAN_ELUNE, wingThicketLocations[2], TEMPSUMMON_CORPSE_DESPAWN, 0)) { - guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[5].m_positionX, wingThicketLocations[5].m_positionY, wingThicketLocations[5].m_positionZ); + guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[5]); _guardEluneGUID = guard->GetGUID(); } // summon the Voice of Elune if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) { - if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, altar->GetPositionX(), altar->GetPositionY(), altar->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000)) + if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, *altar, TEMPSUMMON_TIMED_DESPAWN, 30000)) _voiceEluneGUID = voice->GetGUID(); } break; @@ -497,14 +497,14 @@ public: if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) { priestess->AI()->Talk(SAY_PRIESTESS_ALTAR_14); - priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7].m_positionX, wingThicketLocations[7].m_positionY, wingThicketLocations[7].m_positionZ); + priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7]); } break; case SAY_PRIESTESS_ALTAR_19: // make the voice of elune leave if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID)) { - guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ); + guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2]); guard->DespawnOrUnsummon(4000); } break; @@ -512,7 +512,7 @@ public: // make the first priestess leave if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) { - priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ); + priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0]); priestess->DespawnOrUnsummon(4000); } break; @@ -520,7 +520,7 @@ public: // make the second priestess leave if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) { - priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ); + priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1]); priestess->DespawnOrUnsummon(4000); } break; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index a5feb4fac16..d2c38c47d55 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -111,23 +111,15 @@ class boss_keristrasza : public CreatureScript Talk(SAY_SLAY); } - bool CheckContainmentSpheres(bool remove_prison = false) + bool CheckContainmentSpheres(bool removePrison = false) { - ContainmentSphereGUIDs[0] = instance->GetGuidData(ANOMALUS_CONTAINMET_SPHERE); - ContainmentSphereGUIDs[1] = instance->GetGuidData(ORMOROKS_CONTAINMET_SPHERE); - ContainmentSphereGUIDs[2] = instance->GetGuidData(TELESTRAS_CONTAINMET_SPHERE); - - GameObject* ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; - - for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i) + for (uint32 i = ANOMALUS_CONTAINMET_SPHERE; i < (ANOMALUS_CONTAINMET_SPHERE + DATA_CONTAINMENT_SPHERES); ++i) { - ContainmentSpheres[i] = ObjectAccessor::GetGameObject(*me, ContainmentSphereGUIDs[i]); - if (!ContainmentSpheres[i]) - return false; - if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE) + GameObject* containmentSpheres = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(i)); + if (!containmentSpheres || containmentSpheres->GetGoState() != GO_STATE_ACTIVE) return false; } - if (remove_prison) + if (removePrison) RemovePrison(true); return true; } @@ -207,7 +199,7 @@ class boss_keristrasza : public CreatureScript private: bool _intenseCold; bool _enrage; - ObjectGuid ContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; + public: GuidList _intenseColdList; }; @@ -285,9 +277,9 @@ class achievement_intense_cold : public AchievementCriteriaScript if (!target) return false; - GuidList _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->_intenseColdList; + GuidList const& _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->_intenseColdList; if (!_intenseColdList.empty()) - for (GuidList::iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr) + for (GuidList::const_iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr) if (player->GetGUID() == *itr) return false; diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index eff84365f63..7058f8689f0 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -174,34 +174,29 @@ class npc_commander_eligor_dawnbringer : public CreatureScript { if (id == 1) { - me->SetFacingTo(PosTalkLocations[talkWing].m_orientation); + me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation()); TurnAudience(); switch (talkWing) { - case 0: // Pinnacle of Naxxramas - { - switch (urand (0, 1)) + case 0: // Pinnacle of Naxxramas + switch (urand(0, 1)) { case 0: ChangeImage(NPC_IMAGE_OF_KELTHUZAD, MODEL_IMAGE_OF_KELTHUZAD, SAY_KELTHUZAD_1); - _events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break; + _events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break; case 1: ChangeImage(NPC_IMAGE_OF_SAPPHIRON, MODEL_IMAGE_OF_SAPPHIRON, SAY_SAPPHIRON); break; } - } - break; - case 1: // Death knight wing of Naxxramas - { - switch (urand (0, 2)) + break; + case 1: // Death knight wing of Naxxramas + switch (urand(0, 2)) { case 0: ChangeImage(NPC_IMAGE_OF_RAZUVIOUS, MODEL_IMAGE_OF_RAZUVIOUS, SAY_RAZUVIOUS); break; case 1: ChangeImage(NPC_IMAGE_OF_GOTHIK, MODEL_IMAGE_OF_GOTHIK, SAY_GOTHIK); break; case 2: ChangeImage(NPC_IMAGE_OF_THANE, MODEL_IMAGE_OF_THANE, SAY_DEATH_KNIGHTS_1); - _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break; + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break; } - } - break; - case 2: // Blighted abomination wing of Naxxramas - { + break; + case 2: // Blighted abomination wing of Naxxramas switch (urand (0, 3)) { case 0: ChangeImage(NPC_IMAGE_OF_PATCHWERK, MODEL_IMAGE_OF_PATCHWERK, SAY_PATCHWERK); break; @@ -209,20 +204,16 @@ class npc_commander_eligor_dawnbringer : public CreatureScript case 2: ChangeImage(NPC_IMAGE_OF_THADDIUS, MODEL_IMAGE_OF_THADDIUS, SAY_THADDIUS); break; case 3: ChangeImage(NPC_IMAGE_OF_GLUTH, MODEL_IMAGE_OF_GLUTH, SAY_GLUTH); break; } - } - break; - case 3: // Accursed spider wing of Naxxramas - { + break; + case 3: // Accursed spider wing of Naxxramas switch (urand (0, 2)) { case 0: ChangeImage(NPC_IMAGE_OF_ANUBREKHAN, MODEL_IMAGE_OF_ANUBREKHAN, SAY_ANUBREKHAN); break; case 1: ChangeImage(NPC_IMAGE_OF_FAERLINA, MODEL_IMAGE_OF_FAERLINA, SAY_FAERLINA); break; case 2: ChangeImage(NPC_IMAGE_OF_MAEXXNA, MODEL_IMAGE_OF_MAEXXNA, SAY_MAEXXNA); break; } - } - break; - case 4: // Dread plague wing of Naxxramas - { + break; + case 4: // Dread plague wing of Naxxramas switch (urand (0, 2)) { case 0: ChangeImage(NPC_IMAGE_OF_NOTH, MODEL_IMAGE_OF_NOTH, SAY_NOTH); break; @@ -230,11 +221,10 @@ class npc_commander_eligor_dawnbringer : public CreatureScript _events.ScheduleEvent(EVENT_HEIGAN_2, 8000); break; case 2: ChangeImage(NPC_IMAGE_OF_LOATHEB, MODEL_IMAGE_OF_LOATHEB, SAY_LOATHEB); break; } - } - break; - case 5: // Home - _events.ScheduleEvent(EVENT_START_RANDOM, 30000); - break; + break; + case 5: // Home + _events.ScheduleEvent(EVENT_START_RANDOM, 30000); + break; } } } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index cc96b27cb0a..5a2e19f08c2 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1231,12 +1231,11 @@ class spell_dk_raise_dead : public SpellScriptLoader private: bool Validate(SpellInfo const* spellInfo) override { - // 6.x effects changed - /*if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_1)->CalcValue()) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_1)->CalcValue()) || !sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_2)->CalcValue()) || !sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT) || !sSpellMgr->GetSpellInfo(SPELL_DK_MASTER_OF_GHOULS)) - return false;*/ + return false; return false; } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index c38d6b07124..01501c04c2e 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -159,7 +159,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader return true; } - void HandleEnergize(SpellEffIndex effIndex) + void HandleEnergize(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 87619460ee7..8800903b095 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1180,13 +1180,12 @@ class spell_gen_defend : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - // 6.x effects changed - //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) - // return false; - //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) - // return false; - //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) - // return false; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) + return false; return false; } @@ -1221,26 +1220,29 @@ class spell_gen_defend : public SpellScriptLoader void Register() override { + /* SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId); // 6.x effects removed // Defend spells cast by NPCs (add visuals) - /*if (spell->GetEffect(EFFECT_0)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + if (spell->GetEffect(EFFECT_0)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - }*/ + } + // Remove Defend spell from player when he dismounts - //if (spell->GetEffect(EFFECT_2)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) - // OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); + if (spell->GetEffect(EFFECT_2)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); // Defend spells cast by players (add/remove visuals) - /*if (spell->GetEffect(EFFECT_1)->ApplyAuraName == SPELL_AURA_DUMMY) + if (spell->GetEffect(EFFECT_1)->ApplyAuraName == SPELL_AURA_DUMMY) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - }*/ + } + */ } }; @@ -1913,6 +1915,8 @@ class spell_gen_mounted_charge: public SpellScriptLoader } break; } + default: + break; } } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index a8f8dc1f31c..ed888b2d33d 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1485,7 +1485,7 @@ class spell_item_gift_of_the_harvester : public SpellScriptLoader SpellCastResult CheckRequirement() { - std::list<Creature*> ghouls; + std::list<TempSummon*> ghouls; GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); if (ghouls.size() >= MAX_GHOULS) { diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index fc8ba0ffad0..782a4ca6190 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -1294,51 +1294,53 @@ class spell_mage_ring_of_frost : public SpellScriptLoader return true; } - bool Load() override - { - ringOfFrost = NULL; - return true; - } - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - if (ringOfFrost) - if (GetMaxDuration() - (int32)ringOfFrost->GetTimer() >= sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_DUMMY)->GetDuration()) + if (TempSummon* ringOfFrost = GetRingOfFrostMinion()) + if (GetMaxDuration() - int32(ringOfFrost->GetTimer()) >= sSpellMgr->EnsureSpellInfo(SPELL_MAGE_RING_OF_FROST_DUMMY)->GetDuration()) GetTarget()->CastSpell(ringOfFrost->GetPositionX(), ringOfFrost->GetPositionY(), ringOfFrost->GetPositionZ(), SPELL_MAGE_RING_OF_FROST_FREEZE, true); } void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - std::list<Creature*> MinionList; + std::list<TempSummon*> MinionList; GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->GetEffect(EFFECT_0)->MiscValue); // Get the last summoned RoF, save it and despawn older ones - for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) + for (std::list<TempSummon*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) { - TempSummon* summon = (*itr)->ToTempSummon(); + TempSummon* summon = (*itr); - if (ringOfFrost && summon) + if (TempSummon* ringOfFrost = GetRingOfFrostMinion()) { if (summon->GetTimer() > ringOfFrost->GetTimer()) { ringOfFrost->DespawnOrUnsummon(); - ringOfFrost = summon; + _ringOfFrostGUID = summon->GetGUID(); } else summon->DespawnOrUnsummon(); } - else if (summon) - ringOfFrost = summon; + else + _ringOfFrostGUID = summon->GetGUID(); } } - TempSummon* ringOfFrost; - void Register() override { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_ring_of_frost_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - OnEffectApply += AuraEffectApplyFn(spell_mage_ring_of_frost_AuraScript::Apply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_ring_of_frost_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectApply += AuraEffectApplyFn(spell_mage_ring_of_frost_AuraScript::Apply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); } + + private: + TempSummon* GetRingOfFrostMinion() const + { + if (Creature* creature = ObjectAccessor::GetCreature(*GetOwner(), _ringOfFrostGUID)) + return creature->ToTempSummon(); + return nullptr; + } + + ObjectGuid _ringOfFrostGUID; }; AuraScript* GetAuraScript() const override @@ -1369,13 +1371,17 @@ class spell_mage_ring_of_frost_freeze : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets) { - float outRadius = sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->GetEffect(EFFECT_0)->CalcRadius(); + WorldLocation const* dest = GetExplTargetDest(); + float outRadius = sSpellMgr->EnsureSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->GetEffect(EFFECT_0)->CalcRadius(); float inRadius = 4.7f; - for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (Unit* unit = (*itr)->ToUnit()) - if (unit->HasAura(SPELL_MAGE_RING_OF_FROST_DUMMY) || unit->HasAura(SPELL_MAGE_RING_OF_FROST_FREEZE) || unit->GetExactDist(GetExplTargetDest()) > outRadius || unit->GetExactDist(GetExplTargetDest()) < inRadius) - targets.erase(itr--); + targets.remove_if([dest, outRadius, inRadius](WorldObject* target) + { + Unit* unit = target->ToUnit(); + if (!unit) + return true; + return unit->HasAura(SPELL_MAGE_RING_OF_FROST_DUMMY) || unit->HasAura(SPELL_MAGE_RING_OF_FROST_FREEZE) || unit->GetExactDist(dest) > outRadius || unit->GetExactDist(dest) < inRadius; + }); } void Register() override diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index fba40986c31..727748c2f3f 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -1251,17 +1251,13 @@ class spell_warl_soul_swap_dot_marker : public SpellScriptLoader { PrepareSpellScript(spell_warl_soul_swap_dot_marker_SpellScript); - void HandleHit(SpellEffIndex effIndex) + void HandleHit(SpellEffIndex /*effIndex*/) { Unit* swapVictim = GetCaster(); Unit* warlock = GetHitUnit(); if (!warlock || !swapVictim) return; - // effect existance checked in dbc, should not be removed by core at any time, so no need to check for null - SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_0); - flag128 classMask = effect->SpellClassMask; - Unit::AuraApplicationMap const& appliedAuras = swapVictim->GetAppliedAuras(); SoulSwapOverrideAuraScript* swapSpellScript = nullptr; if (Aura* swapOverrideAura = warlock->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE)) @@ -1270,6 +1266,8 @@ class spell_warl_soul_swap_dot_marker : public SpellScriptLoader if (!swapSpellScript) return; + flag128 classMask = GetEffectInfo()->SpellClassMask; + for (Unit::AuraApplicationMap::const_iterator itr = appliedAuras.begin(); itr != appliedAuras.end(); ++itr) { SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo(); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index d6ff9375544..3279a5181a7 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -866,6 +866,7 @@ class spell_warr_vigilance : public SpellScriptLoader return true; } + /* bool CheckProc(ProcEventInfo& eventInfo) { _procTarget = GetCaster(); @@ -874,12 +875,13 @@ class spell_warr_vigilance : public SpellScriptLoader void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { - /*PreventDefaultAction(); + PreventDefaultAction(); int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue())); GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, NULL, aurEff); - _procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff);*/ + _procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff); } + */ void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { @@ -892,8 +894,8 @@ class spell_warr_vigilance : public SpellScriptLoader void Register() override { - DoCheckProc += AuraCheckProcFn(spell_warr_vigilance_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + //DoCheckProc += AuraCheckProcFn(spell_warr_vigilance_AuraScript::CheckProc); + //OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); OnEffectRemove += AuraEffectRemoveFn(spell_warr_vigilance_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } |
