mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
fix(Core/Spells): add several missing null checks for the DamageInfo struct to fix a crash - Part II. (#8376)
This commit is contained in:
@@ -1059,15 +1059,16 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion
|
||||
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
|
||||
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
|
||||
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit* victim = eventInfo.GetActionTarget();
|
||||
SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
|
||||
|
||||
//uint32 markCount = 0;
|
||||
//if (Creature* saurfang = eventInfo.GetActor()->ToCreature())
|
||||
@@ -1091,7 +1092,6 @@ public:
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_deathbringer_blood_link_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_deathbringer_blood_link_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathbringer_blood_link_AuraScript::HandlePeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
@@ -1113,8 +1113,9 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion
|
||||
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
|
||||
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
|
||||
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
|
||||
@@ -947,7 +947,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
|
||||
{
|
||||
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(nullptr))
|
||||
return false;
|
||||
|
||||
@@ -585,8 +585,8 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
if (!spellInfo || !eventInfo.GetActionTarget())
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo || !eventInfo.GetActionTarget() || !eventInfo.GetDamageInfo())
|
||||
return false;
|
||||
|
||||
if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChance(BASE_ATTACK, eventInfo.GetActionTarget())))
|
||||
@@ -660,7 +660,7 @@ public:
|
||||
void HandleProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea())
|
||||
if (!eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->IsTargetingArea())
|
||||
DropCharge();
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ public:
|
||||
void HandleProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetDamageInfo()->GetSpellInfo() || eventInfo.GetDamageInfo()->GetSpellInfo()->Dispel != DISPEL_DISEASE))
|
||||
if (eventInfo.GetDamageInfo() && eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetSpellInfo() || eventInfo.GetSpellInfo()->Dispel != DISPEL_DISEASE))
|
||||
SetDuration(0);
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ public:
|
||||
if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return true;
|
||||
|
||||
@@ -815,7 +815,7 @@ public:
|
||||
return;
|
||||
|
||||
dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
|
||||
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (const SpellInfo* procSpell = eventInfo.GetSpellInfo())
|
||||
{
|
||||
// xinef: ugly hack
|
||||
if (!procSpell->IsAffectingArea())
|
||||
@@ -823,7 +823,7 @@ public:
|
||||
dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
|
||||
GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f);
|
||||
}
|
||||
else
|
||||
else if (eventInfo.GetDamageInfo())
|
||||
{
|
||||
target = player->GetMeleeHitRedirectTarget(target);
|
||||
CalcDamageInfo damageInfo;
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -773,7 +773,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
@@ -927,7 +927,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return !eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea();
|
||||
return !eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->IsTargetingArea();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1694,7 +1694,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (eventInfo.GetDamageInfo()->GetSpellInfo()) // eventInfo.GetSpellInfo()
|
||||
if (eventInfo.GetSpellInfo())
|
||||
return false;
|
||||
|
||||
// find Mage Armor
|
||||
@@ -2145,7 +2145,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (eventInfo.GetDamageInfo()->GetSpellInfo()) // eventInfo.GetSpellInfo()
|
||||
if (eventInfo.GetSpellInfo())
|
||||
return false;
|
||||
|
||||
if (GetFirstSchoolInMask(eventInfo.GetSchoolMask()) == SPELL_SCHOOL_NORMAL)
|
||||
|
||||
@@ -444,7 +444,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& procInfo)
|
||||
{
|
||||
SpellInfo const* spellInfo = procInfo.GetDamageInfo()->GetSpellInfo();
|
||||
SpellInfo const* spellInfo = procInfo.GetSpellInfo();
|
||||
// Xinef: cannot proc from volley damage
|
||||
if (spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x2000) && spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
|
||||
return false;
|
||||
|
||||
@@ -668,7 +668,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_HEAL))
|
||||
return false;
|
||||
|
||||
@@ -2868,7 +2868,7 @@ public:
|
||||
/*if (!GetTarget()->FindMap() || GetTarget()->FindMap()->IsBattlegroundOrArena())
|
||||
return false;*/
|
||||
|
||||
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (const SpellInfo* procSpell = eventInfo.GetSpellInfo())
|
||||
if (!eventInfo.GetDamageInfo()->GetDamage())
|
||||
{
|
||||
if (procSpell->SpellFamilyName == SPELLFAMILY_WARRIOR)
|
||||
|
||||
@@ -138,11 +138,11 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetActionTarget())
|
||||
if (!eventInfo.GetSpellInfo() || !eventInfo.GetActionTarget())
|
||||
return false;
|
||||
|
||||
// Need Interrupt or Silenced mechanic
|
||||
if (!(eventInfo.GetDamageInfo()->GetSpellInfo()->GetAllEffectsMechanicMask() & ((1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE))))
|
||||
if (!(eventInfo.GetSpellInfo()->GetAllEffectsMechanicMask() & ((1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE))))
|
||||
return false;
|
||||
|
||||
// Xinef: immuned effect should just eat charge
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK))
|
||||
return true;
|
||||
|
||||
@@ -262,14 +262,14 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo()->GetSpellInfo(); // eventInfo.GetSpellInfo()
|
||||
return eventInfo.GetSpellInfo();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
int32 mana = int32(eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()));
|
||||
int32 mana = int32(eventInfo.GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask()));
|
||||
mana = CalculatePct(mana, aurEff->GetAmount());
|
||||
|
||||
GetTarget()->CastCustomSpell(SPELL_MAGE_BURNOUT_TRIGGER, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff);
|
||||
@@ -453,7 +453,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
@@ -865,7 +865,7 @@ public:
|
||||
return false;
|
||||
|
||||
// Molten Armor
|
||||
if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
|
||||
if (spellInfo->SpellFamilyFlags[1] & 0x8)
|
||||
return false;
|
||||
|
||||
@@ -993,7 +993,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
_spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
_spellInfo = eventInfo.GetSpellInfo();
|
||||
if (!_spellInfo)
|
||||
{
|
||||
return false;
|
||||
@@ -1029,7 +1029,7 @@ public:
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
int32 mana = int32(_spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()) / ticksModifier);
|
||||
int32 mana = int32(_spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask()) / ticksModifier);
|
||||
mana = CalculatePct(mana, aurEff->GetAmount());
|
||||
|
||||
if (mana > 0)
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (const SpellInfo* procSpell = eventInfo.GetSpellInfo())
|
||||
if (procSpell->SpellIconID == 3025) // Righteous Vengeance, should not proc SoC
|
||||
return false;
|
||||
return true;
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int32 targets = 3;
|
||||
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
|
||||
if (const SpellInfo* procSpell = eventInfo.GetSpellInfo())
|
||||
if (procSpell->IsAffectingArea())
|
||||
targets = 1;
|
||||
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
// xinef: skip divine storm self hit (dummy) and righteous vengeance (0x20000000=
|
||||
return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000));
|
||||
return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo()->GetDamage() > 0;
|
||||
return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo() && eventInfo.GetDamageInfo()->GetDamage() > 0;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
if (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
|
||||
{
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
const SpellInfo* procSpell = eventInfo.GetSpellInfo();
|
||||
if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
|
||||
procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
|
||||
{
|
||||
|
||||
@@ -288,8 +288,14 @@ public:
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
HealInfo* healInfo = eventInfo.GetHealInfo();
|
||||
if (!healInfo || healInfo->GetHeal())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL);
|
||||
int32 heal = int32(CalculatePct(int32(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks());
|
||||
int32 heal = int32(CalculatePct(int32(healInfo->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks());
|
||||
GetTarget()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, SPELLVALUE_BASE_POINT0, heal, eventInfo.GetProcTarget(), true, nullptr, aurEff);
|
||||
}
|
||||
|
||||
|
||||
@@ -1120,13 +1120,13 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
return eventInfo.GetSpellInfo();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int32 mana = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask());
|
||||
int32 mana = eventInfo.GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask());
|
||||
int32 damage = CalculatePct(mana, 35);
|
||||
|
||||
GetTarget()->CastCustomSpell(SPELL_SHAMAN_ITEM_MANA_SURGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, nullptr, aurEff);
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION;
|
||||
return eventInfo.GetSpellInfo() && eventInfo.GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION;
|
||||
}
|
||||
|
||||
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
|
||||
Reference in New Issue
Block a user