diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e45fe4f1b..3d6a2e675 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1993,7 +1993,10 @@ public: void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_FALL_DOWN, true, nullptr, aurEff); + if (eventInfo.GetActionTarget()) + { + eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_FALL_DOWN, true, nullptr, aurEff); + } } void Register() override @@ -2674,7 +2677,10 @@ public: void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + if (GetHitUnit()) + { + GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } } void Register() override @@ -2719,7 +2725,10 @@ public: void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + if (GetHitUnit()) + { + GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } } void Register() override @@ -4601,6 +4610,11 @@ public: Unit* caster = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_GEN_BLADE_WARDING_TRIGGERED); + if (!caster) + { + return; + } + uint8 stacks = GetStackAmount(); int32 bp = 0; @@ -4656,8 +4670,10 @@ public: void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { // Final heal only on duration end - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + if (GetTargetApplication() && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + { return; + } // final heal GetTarget()->CastSpell(GetTarget(), _spellId, true, nullptr, aurEff, GetCasterGUID()); @@ -5228,8 +5244,12 @@ public: void HandleDummy(SpellEffIndex /* effIndex */) { if (Creature* vendor = GetCaster()->ToCreature()) - if (vendor->GetEntry() == NPC_AMPHITHEATER_VENDOR) + { + if (vendor->GetEntry() == NPC_AMPHITHEATER_VENDOR && vendor->AI()) + { vendor->AI()->Talk(SAY_AMPHITHEATER_VENDOR); + } + } } void Register() override @@ -5294,6 +5314,11 @@ public: void RemoveVehicleAuras() { + if (!GetHitUnit()) + { + return; + } + Unit* u = nullptr; if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit()) { @@ -5345,6 +5370,11 @@ public: void EjectPassenger(SpellEffIndex /*effIndex*/) { + if (!GetHitUnit()) + { + return; + } + if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit()) { if (Unit* passenger = vehicle->GetPassenger(GetEffectValue() - 1)) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index f7789985f..a8e03ef0b 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1281,9 +1281,16 @@ public: void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64442 /*SPELL_BLADE_WARDING*/); - int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); - eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); + if (!eventInfo.GetActionTarget()) + { + return; + } + + if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64442 /*SPELL_BLADE_WARDING*/)) + { + int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); + eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); + } } void Register() override @@ -1315,10 +1322,12 @@ public: return; } - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64569 /*SPELL_BLOOD_RESERVE*/); - int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); - eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); - eventInfo.GetActionTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Id); // Remove rest auras + if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64569 /*SPELL_BLOOD_RESERVE*/)) + { + int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); + eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); + eventInfo.GetActionTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Id); // Remove rest auras + } } void Register() override @@ -2887,7 +2896,8 @@ public: return false;*/ if (const SpellInfo* procSpell = eventInfo.GetSpellInfo()) - if (!eventInfo.GetDamageInfo()->GetDamage()) + { + if (eventInfo.GetDamageInfo() && !eventInfo.GetDamageInfo()->GetDamage()) { if (procSpell->SpellFamilyName == SPELLFAMILY_WARRIOR) { @@ -2902,6 +2912,7 @@ public: else return false; } + } return eventInfo.GetProcTarget() && eventInfo.GetActor() != eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); } @@ -3916,6 +3927,12 @@ public: void HandleDummy(SpellEffIndex /* effIndex */) { Player* caster = GetCaster()->ToPlayer(); + + if (!caster) + { + return; + } + if (caster->HasAuraType(SPELL_AURA_MOUNTED)) { caster->RemoveAurasByType(SPELL_AURA_MOUNTED); @@ -4205,6 +4222,7 @@ public: void HandleDummy(SpellEffIndex /* effIndex */) { Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) { if (!target->HasAura(SPELL_CHICKEN_NET) && (caster->GetQuestStatus(QUEST_CHICKEN_PARTY) == QUEST_STATUS_INCOMPLETE || caster->GetQuestStatus(QUEST_FLOWN_THE_COOP) == QUEST_STATUS_INCOMPLETE))