Some misc cleansup.
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Game.AI
|
|||||||
if (me.GetVictim() && me.GetVictim().IsAlive())
|
if (me.GetVictim() && me.GetVictim().IsAlive())
|
||||||
{
|
{
|
||||||
// is only necessary to stop casting, the pet must not exit combat
|
// is only necessary to stop casting, the pet must not exit combat
|
||||||
if (!me.GetCurrentSpell(CurrentSpellTypes.Channeled) && // ignore channeled spells (Pin, Seduction)
|
if (me.GetCurrentSpell(CurrentSpellTypes.Channeled) == null && // ignore channeled spells (Pin, Seduction)
|
||||||
(me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)))
|
(me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)))
|
||||||
{
|
{
|
||||||
me.InterruptNonMeleeSpells(false);
|
me.InterruptNonMeleeSpells(false);
|
||||||
|
|||||||
@@ -3178,7 +3178,7 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focusSpell)
|
if (focusSpell != null)
|
||||||
return focusSpell == _spellFocusInfo.Spell;
|
return focusSpell == _spellFocusInfo.Spell;
|
||||||
else
|
else
|
||||||
return _spellFocusInfo.Spell != null || _spellFocusInfo.Delay != 0;
|
return _spellFocusInfo.Spell != null || _spellFocusInfo.Delay != 0;
|
||||||
@@ -3186,11 +3186,11 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void ReleaseSpellFocus(Spell focusSpell = null, bool withDelay = true)
|
public void ReleaseSpellFocus(Spell focusSpell = null, bool withDelay = true)
|
||||||
{
|
{
|
||||||
if (!_spellFocusInfo.Spell)
|
if (_spellFocusInfo.Spell == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// focused to something else
|
// focused to something else
|
||||||
if (focusSpell && focusSpell != _spellFocusInfo.Spell)
|
if (focusSpell != null && focusSpell != _spellFocusInfo.Spell)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_spellFocusInfo.Spell.GetSpellInfo().HasAttribute(SpellAttr5.AiDoesntFaceTarget))
|
if (_spellFocusInfo.Spell.GetSpellInfo().HasAttribute(SpellAttr5.AiDoesntFaceTarget))
|
||||||
|
|||||||
@@ -2453,7 +2453,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (spell.m_CastItem == null && info.HasAttribute(SpellAttr2.RetainItemCast))
|
if (spell.m_CastItem == null && info.HasAttribute(SpellAttr2.RetainItemCast))
|
||||||
{
|
{
|
||||||
if (args.TriggeringSpell)
|
if (args.TriggeringSpell != null)
|
||||||
spell.m_CastItem = args.TriggeringSpell.m_CastItem;
|
spell.m_CastItem = args.TriggeringSpell.m_CastItem;
|
||||||
else if (args.TriggeringAura != null && !args.TriggeringAura.GetBase().GetCastItemGUID().IsEmpty())
|
else if (args.TriggeringAura != null && !args.TriggeringAura.GetBase().GetCastItemGUID().IsEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1000,7 +1000,7 @@ namespace Game.Entities
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Call not from spell cast, send cooldown event for item spells if no in combat
|
// Call not from spell cast, send cooldown event for item spells if no in combat
|
||||||
if (!spell)
|
if (spell == null)
|
||||||
{
|
{
|
||||||
// spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions)
|
// spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions)
|
||||||
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(m_lastPotionId);
|
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(m_lastPotionId);
|
||||||
@@ -2946,7 +2946,7 @@ namespace Game.Entities
|
|||||||
pct = 1.0f;
|
pct = 1.0f;
|
||||||
|
|
||||||
// Drop charges for triggering spells instead of triggered ones
|
// Drop charges for triggering spells instead of triggered ones
|
||||||
if (m_spellModTakingSpell)
|
if (m_spellModTakingSpell != null)
|
||||||
spell = m_spellModTakingSpell;
|
spell = m_spellModTakingSpell;
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
@@ -3114,7 +3114,7 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// First time this aura applies a mod to us and is out of charges
|
// First time this aura applies a mod to us and is out of charges
|
||||||
if (spell && mod.ownerAura.IsUsingCharges() && mod.ownerAura.GetCharges() == 0 && !spell.m_appliedMods.Contains(mod.ownerAura))
|
if (spell != null && mod.ownerAura.IsUsingCharges() && mod.ownerAura.GetCharges() == 0 && !spell.m_appliedMods.Contains(mod.ownerAura))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (mod.op)
|
switch (mod.op)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public SpellInfo GetSpellInfo()
|
public SpellInfo GetSpellInfo()
|
||||||
{
|
{
|
||||||
if (_spell)
|
if (_spell != null)
|
||||||
return _spell.GetSpellInfo();
|
return _spell.GetSpellInfo();
|
||||||
if (_damageInfo != null)
|
if (_damageInfo != null)
|
||||||
return _damageInfo.GetSpellInfo();
|
return _damageInfo.GetSpellInfo();
|
||||||
@@ -209,7 +209,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
public SpellSchoolMask GetSchoolMask()
|
public SpellSchoolMask GetSchoolMask()
|
||||||
{
|
{
|
||||||
if (_spell)
|
if (_spell != null)
|
||||||
return _spell.GetSpellInfo().GetSchoolMask();
|
return _spell.GetSpellInfo().GetSchoolMask();
|
||||||
if (_damageInfo != null)
|
if (_damageInfo != null)
|
||||||
return _damageInfo.GetSchoolMask();
|
return _damageInfo.GetSchoolMask();
|
||||||
|
|||||||
@@ -733,7 +733,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call script handlers
|
// call script handlers
|
||||||
if (spell)
|
if (spell != null)
|
||||||
spell.CallScriptCalcCritChanceHandlers(this, ref crit_chance);
|
spell.CallScriptCalcCritChanceHandlers(this, ref crit_chance);
|
||||||
else
|
else
|
||||||
aurEff.GetBase().CallScriptEffectCalcCritChanceHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(GetGUID()), this, ref crit_chance);
|
aurEff.GetBase().CallScriptEffectCalcCritChanceHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(GetGUID()), this, ref crit_chance);
|
||||||
@@ -1620,7 +1620,7 @@ namespace Game.Entities
|
|||||||
Player modOwner = GetSpellModOwner();
|
Player modOwner = GetSpellModOwner();
|
||||||
if (modOwner)
|
if (modOwner)
|
||||||
{
|
{
|
||||||
if (modOwner != this && spell)
|
if (modOwner != this && spell != null)
|
||||||
{
|
{
|
||||||
List<AuraApplication> modAuras = new();
|
List<AuraApplication> modAuras = new();
|
||||||
foreach (var itr in modOwner.GetAppliedAuras())
|
foreach (var itr in modOwner.GetAppliedAuras())
|
||||||
@@ -1648,7 +1648,7 @@ namespace Game.Entities
|
|||||||
void TriggerAurasProcOnEvent(ProcEventInfo eventInfo, List<Tuple<uint, AuraApplication>> aurasTriggeringProc)
|
void TriggerAurasProcOnEvent(ProcEventInfo eventInfo, List<Tuple<uint, AuraApplication>> aurasTriggeringProc)
|
||||||
{
|
{
|
||||||
Spell triggeringSpell = eventInfo.GetProcSpell();
|
Spell triggeringSpell = eventInfo.GetProcSpell();
|
||||||
bool disableProcs = triggeringSpell && triggeringSpell.IsProcDisabled();
|
bool disableProcs = triggeringSpell != null && triggeringSpell.IsProcDisabled();
|
||||||
|
|
||||||
|
|
||||||
int oldProcChainLength = m_procChainLength;
|
int oldProcChainLength = m_procChainLength;
|
||||||
@@ -1746,7 +1746,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
case CurrentSpellTypes.AutoRepeat:
|
case CurrentSpellTypes.AutoRepeat:
|
||||||
{
|
{
|
||||||
if (GetCurrentSpell(CSpellType) && GetCurrentSpell(CSpellType).GetState() == SpellState.Idle)
|
if (GetCurrentSpell(CSpellType) != null && GetCurrentSpell(CSpellType).GetState() == SpellState.Idle)
|
||||||
GetCurrentSpell(CSpellType).SetState(SpellState.Finished);
|
GetCurrentSpell(CSpellType).SetState(SpellState.Finished);
|
||||||
|
|
||||||
// only Auto Shoot does not break anything
|
// only Auto Shoot does not break anything
|
||||||
@@ -1780,9 +1780,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
// generic spells are cast when they are not finished and not delayed
|
// generic spells are cast when they are not finished and not delayed
|
||||||
var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic);
|
var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic);
|
||||||
if (currentSpell &&
|
if (currentSpell != null && (currentSpell.GetState() != SpellState.Finished) && (withDelayed || currentSpell.GetState() != SpellState.Delayed))
|
||||||
(currentSpell.GetState() != SpellState.Finished) &&
|
|
||||||
(withDelayed || currentSpell.GetState() != SpellState.Delayed))
|
|
||||||
{
|
{
|
||||||
if (!skipInstant || currentSpell.GetCastTime() != 0)
|
if (!skipInstant || currentSpell.GetCastTime() != 0)
|
||||||
{
|
{
|
||||||
@@ -1790,17 +1788,18 @@ namespace Game.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||||
// channeled spells may be delayed, but they are still considered cast
|
// channeled spells may be delayed, but they are still considered cast
|
||||||
if (!skipChanneled && currentSpell &&
|
if (!skipChanneled && currentSpell != null && (currentSpell.GetState() != SpellState.Finished))
|
||||||
(currentSpell.GetState() != SpellState.Finished))
|
|
||||||
{
|
{
|
||||||
if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.DoNotResetCombatTimers))
|
if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.DoNotResetCombatTimers))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSpell = GetCurrentSpell(CurrentSpellTypes.AutoRepeat);
|
currentSpell = GetCurrentSpell(CurrentSpellTypes.AutoRepeat);
|
||||||
// autorepeat spells may be finished or delayed, but they are still considered cast
|
// autorepeat spells may be finished or delayed, but they are still considered cast
|
||||||
if (!skipAutorepeat && currentSpell)
|
if (!skipAutorepeat && currentSpell != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Guid);
|
Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Guid);
|
||||||
Spell spell = caster ? caster.GetCurrentSpell(CurrentSpellTypes.Generic) : null;
|
Spell spell = caster ? caster.GetCurrentSpell(CurrentSpellTypes.Generic) : null;
|
||||||
if (!spell || spell.m_spellInfo.Id != packet.SpellID || spell.m_castId != packet.CastID || !spell.m_targets.HasDst() || !spell.m_targets.HasSrc())
|
if (spell == null || spell.m_spellInfo.Id != packet.SpellID || spell.m_castId != packet.CastID || !spell.m_targets.HasDst() || !spell.m_targets.HasSrc())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Position pos = spell.m_targets.GetSrcPos();
|
Position pos = spell.m_targets.GetSrcPos();
|
||||||
|
|||||||
@@ -476,10 +476,10 @@ namespace Game
|
|||||||
trader.ModifyMoney(-(long)his_trade.GetMoney());
|
trader.ModifyMoney(-(long)his_trade.GetMoney());
|
||||||
trader.ModifyMoney((long)my_trade.GetMoney());
|
trader.ModifyMoney((long)my_trade.GetMoney());
|
||||||
|
|
||||||
if (my_spell)
|
if (my_spell != null)
|
||||||
my_spell.Prepare(my_targets);
|
my_spell.Prepare(my_targets);
|
||||||
|
|
||||||
if (his_spell)
|
if (his_spell != null)
|
||||||
his_spell.Prepare(his_targets);
|
his_spell.Prepare(his_targets);
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|||||||
@@ -283,12 +283,6 @@ namespace Game.Scripting
|
|||||||
public void IncrementScriptCount() { ++_ScriptCount; }
|
public void IncrementScriptCount() { ++_ScriptCount; }
|
||||||
public uint GetScriptCount() { return _ScriptCount; }
|
public uint GetScriptCount() { return _ScriptCount; }
|
||||||
|
|
||||||
//Reloading
|
|
||||||
public void Reload()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Unloading
|
//Unloading
|
||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1696,7 +1696,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
// check spell triggering us
|
// check spell triggering us
|
||||||
Spell spell = eventInfo.GetProcSpell();
|
Spell spell = eventInfo.GetProcSpell();
|
||||||
if (spell)
|
if (spell != null)
|
||||||
{
|
{
|
||||||
// Do not allow auras to proc from effect triggered from itself
|
// Do not allow auras to proc from effect triggered from itself
|
||||||
if (spell.IsTriggeredByAura(m_spellInfo))
|
if (spell.IsTriggeredByAura(m_spellInfo))
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ namespace Game.Spells
|
|||||||
break;
|
break;
|
||||||
case AuraType.ModCastingSpeedNotStack:
|
case AuraType.ModCastingSpeedNotStack:
|
||||||
// skip melee hits and instant cast spells
|
// skip melee hits and instant cast spells
|
||||||
if (!eventInfo.GetProcSpell() || eventInfo.GetProcSpell().GetCastTime() == 0)
|
if (eventInfo.GetProcSpell() == null || eventInfo.GetProcSpell().GetCastTime() == 0)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case AuraType.ModSchoolMaskDamageFromCaster:
|
case AuraType.ModSchoolMaskDamageFromCaster:
|
||||||
@@ -651,7 +651,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
// Skip melee hits and spells with wrong school or zero cost
|
// Skip melee hits and spells with wrong school or zero cost
|
||||||
if (spellInfo == null || !Convert.ToBoolean((int)spellInfo.GetSchoolMask() & GetMiscValue()) // School Check
|
if (spellInfo == null || !Convert.ToBoolean((int)spellInfo.GetSchoolMask() & GetMiscValue()) // School Check
|
||||||
|| !eventInfo.GetProcSpell())
|
|| eventInfo.GetProcSpell() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Costs Check
|
// Costs Check
|
||||||
@@ -1963,7 +1963,7 @@ namespace Game.Spells
|
|||||||
for (var i = CurrentSpellTypes.Melee; i < CurrentSpellTypes.Max; ++i)
|
for (var i = CurrentSpellTypes.Melee; i < CurrentSpellTypes.Max; ++i)
|
||||||
{
|
{
|
||||||
Spell spell = target.GetCurrentSpell(i);
|
Spell spell = target.GetCurrentSpell(i);
|
||||||
if (spell)
|
if (spell != null)
|
||||||
if (spell.m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.NoActions))
|
if (spell.m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.NoActions))
|
||||||
// Stop spells on prepare or casting state
|
// Stop spells on prepare or casting state
|
||||||
target.InterruptSpell(i, false);
|
target.InterruptSpell(i, false);
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Game.Spells
|
|||||||
for (var i = 0; i < m_loadedScripts.Count; ++i)
|
for (var i = 0; i < m_loadedScripts.Count; ++i)
|
||||||
m_loadedScripts[i]._Unload();
|
m_loadedScripts[i]._Unload();
|
||||||
|
|
||||||
if (m_referencedFromCurrentSpell && m_selfContainer && m_selfContainer == this)
|
if (m_referencedFromCurrentSpell && m_selfContainer != null && m_selfContainer == this)
|
||||||
{
|
{
|
||||||
// Clean the reference to avoid later crash.
|
// Clean the reference to avoid later crash.
|
||||||
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
|
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
|
||||||
@@ -2722,13 +2722,13 @@ namespace Game.Spells
|
|||||||
if (modOwner)
|
if (modOwner)
|
||||||
{
|
{
|
||||||
lastSpellMod = modOwner.m_spellModTakingSpell;
|
lastSpellMod = modOwner.m_spellModTakingSpell;
|
||||||
if (lastSpellMod)
|
if (lastSpellMod != null)
|
||||||
modOwner.SetSpellModTakingSpell(lastSpellMod, false);
|
modOwner.SetSpellModTakingSpell(lastSpellMod, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_cast(skipCheck);
|
_cast(skipCheck);
|
||||||
|
|
||||||
if (lastSpellMod)
|
if (lastSpellMod != null)
|
||||||
modOwner.SetSpellModTakingSpell(lastSpellMod, true);
|
modOwner.SetSpellModTakingSpell(lastSpellMod, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8086,11 +8086,6 @@ namespace Game.Spells
|
|||||||
|
|
||||||
public int GetTimer() { return m_timer; }
|
public int GetTimer() { return m_timer; }
|
||||||
|
|
||||||
public static implicit operator bool(Spell spell)
|
|
||||||
{
|
|
||||||
return spell != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
Dictionary<SpellEffectName, SpellLogEffect> _executeLogEffects = new();
|
Dictionary<SpellEffectName, SpellLogEffect> _executeLogEffects = new();
|
||||||
PathGenerator m_preGeneratedPath;
|
PathGenerator m_preGeneratedPath;
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ namespace Game.Entities
|
|||||||
// check power requirement
|
// check power requirement
|
||||||
if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReqPowerCost))
|
if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReqPowerCost))
|
||||||
{
|
{
|
||||||
if (!eventInfo.GetProcSpell())
|
if (eventInfo.GetProcSpell() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var costs = eventInfo.GetProcSpell().GetPowerCost();
|
var costs = eventInfo.GetProcSpell().GetPowerCost();
|
||||||
|
|||||||
Reference in New Issue
Block a user