More refactoring of code.

This commit is contained in:
hondacrx
2019-09-23 21:41:13 -04:00
parent 2418715800
commit 570aebce26
176 changed files with 2261 additions and 2265 deletions
+1 -1
View File
@@ -2715,7 +2715,7 @@ namespace Game.Spells
if (ReferenceEquals(first, other))
return true;
if ((object)first == null || (object)other == null)
if (ReferenceEquals(first, null) || ReferenceEquals(other, null))
return false;
return first.Equals(other);
+7 -7
View File
@@ -1727,7 +1727,7 @@ namespace Game.Spells
if (GetCasterGUID() == target.GetGUID() && target.GetCurrentSpell(CurrentSpellTypes.Generic) != null)
target.FinishSpell(CurrentSpellTypes.Generic, false);
target.InterruptNonMeleeSpells(true);
target.GetHostileRefManager().deleteReferences();
target.GetHostileRefManager().DeleteReferences();
// stop handling the effect if it was removed by linked event
if (aurApp.HasRemoveMode())
@@ -2375,7 +2375,7 @@ namespace Game.Spells
Unit caster = GetCaster();
if (caster != null && caster.IsAlive())
target.GetHostileRefManager().addTempThreat(GetAmount(), apply);
target.GetHostileRefManager().AddTempThreat(GetAmount(), apply);
}
[AuraEffectHandler(AuraType.ModTaunt)]
@@ -5237,7 +5237,7 @@ namespace Game.Spells
{
Creature c = target.ToCreature();
if (c == null || caster == null || !Global.ScriptMgr.OnDummyEffect(caster, GetId(), GetEffIndex(), target.ToCreature()) ||
!c.GetAI().sOnDummyEffect(caster, GetId(), GetEffIndex()))
!c.GetAI().OnDummyEffect(caster, GetId(), GetEffIndex()))
Log.outDebug(LogFilter.Spells, "AuraEffect.HandlePeriodicTriggerSpellAuraTick: Spell {0} has non-existent spell {1} in EffectTriggered[{2}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
}
}
@@ -5511,7 +5511,7 @@ namespace Game.Spells
HealInfo healInfo = new HealInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.HealBySpell(healInfo);
caster.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
caster.GetHostileRefManager().ThreatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
caster.ProcSkillsAndAuras(caster, ProcFlags.DonePeriodic, ProcFlags.TakenPeriodic, ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.None, hitMask, null, null, healInfo);
}
@@ -5634,7 +5634,7 @@ namespace Game.Spells
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, heal, (uint)damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
target.SendPeriodicAuraLog(pInfo);
target.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
target.GetHostileRefManager().ThreatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
// %-based heal - does not proc auras
if (GetAuraType() == AuraType.ObsModHealth)
@@ -5728,7 +5728,7 @@ namespace Game.Spells
int gain = target.ModifyPower(powerType, amount);
if (caster != null)
target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
target.GetHostileRefManager().ThreatAssist(caster, gain * 0.5f, GetSpellInfo());
target.SendPeriodicAuraLog(pInfo);
}
@@ -5756,7 +5756,7 @@ namespace Game.Spells
int gain = target.ModifyPower(powerType, amount);
if (caster != null)
target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
target.GetHostileRefManager().ThreatAssist(caster, gain * 0.5f, GetSpellInfo());
target.SendPeriodicAuraLog(pInfo);
}
+69 -69
View File
@@ -550,7 +550,7 @@ namespace Game.Spells
else
{
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
}
return;
}
@@ -567,7 +567,7 @@ namespace Game.Spells
else
{
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
}
return;
}
@@ -582,7 +582,7 @@ namespace Game.Spells
{
Log.outDebug(LogFilter.Spells, "Spell.SelectImplicitNearbyTargets: cannot find nearby target for spell ID {0}, effect {1}", m_spellInfo.Id, effIndex);
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
return;
}
@@ -591,7 +591,7 @@ namespace Game.Spells
{
Log.outDebug(LogFilter.Spells, $"Spell.SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id {m_spellInfo.Id} set NULL target, effect {effIndex}");
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
return;
}
@@ -605,7 +605,7 @@ namespace Game.Spells
{
Log.outDebug(LogFilter.Spells, $"Spell.SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id {m_spellInfo.Id} set object of wrong type, expected unit, got {target.GetGUID().GetHigh()}, effect {effMask}");
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
return;
}
break;
@@ -617,7 +617,7 @@ namespace Game.Spells
{
Log.outDebug(LogFilter.Spells, $"Spell.SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id {m_spellInfo.Id} set object of wrong type, expected gameobject, got {target.GetGUID().GetHigh()}, effect {effMask}");
SendCastResult(SpellCastResult.BadImplicitTargets);
finish(false);
Finish(false);
return;
}
break;
@@ -802,14 +802,14 @@ namespace Game.Spells
float ground = m_caster.GetMap().GetHeight(m_caster.GetPhaseShift(), x, y, z, true, 50.0f);
float liquidLevel = MapConst.VMAPInvalidHeightValue;
LiquidData liquidData;
if (m_caster.GetMap().getLiquidStatus(m_caster.GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquidData) != 0)
if (m_caster.GetMap().GetLiquidStatus(m_caster.GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquidData) != 0)
liquidLevel = liquidData.level;
if (liquidLevel <= ground) // When there is no liquid Map.GetWaterOrGroundLevel returns ground level
{
SendCastResult(SpellCastResult.NotHere);
SendChannelUpdate(0);
finish(false);
Finish(false);
return;
}
@@ -817,7 +817,7 @@ namespace Game.Spells
{
SendCastResult(SpellCastResult.TooShallow);
SendChannelUpdate(0);
finish(false);
Finish(false);
return;
}
@@ -1045,7 +1045,7 @@ namespace Game.Spells
}
}
float tangent(float x)
float Tangent(float x)
{
x = (float)Math.Tan(x);
if (x < 100000.0f && x > -100000.0f) return x;
@@ -1077,7 +1077,7 @@ namespace Game.Spells
targets.Sort(new ObjectDistanceOrderPred(m_caster));
float b = tangent(m_targets.GetPitch());
float b = Tangent(m_targets.GetPitch());
float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d);
if (a > -0.0001f)
a = 0;
@@ -1424,7 +1424,7 @@ namespace Game.Spells
return searcher.GetTarget();
}
void prepareDataForTriggerSystem()
void PrepareDataForTriggerSystem()
{
//==========================================================================================
// Now fill data for trigger system, need know:
@@ -1733,7 +1733,7 @@ namespace Game.Spells
if (unit.IsAlive() != target.alive)
return;
if (getState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.LastSanctuaryTime)
if (GetState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.LastSanctuaryTime)
return; // No missinfo in that case
// Get original caster (if exist) and calculate damage/healing from him data
@@ -1869,7 +1869,7 @@ namespace Game.Spells
HealInfo healInfo = new HealInfo(caster, unitTarget, addhealth, m_spellInfo, m_spellInfo.GetSchoolMask());
caster.HealBySpell(healInfo, crit);
unitTarget.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo);
unitTarget.GetHostileRefManager().ThreatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo);
m_healing = (int)healInfo.GetEffectiveHeal();
// Do triggers for unit
@@ -2040,7 +2040,7 @@ namespace Game.Spells
if (unit.IsInCombat() && m_spellInfo.HasInitialAggro())
{
m_caster.SetInCombatState(unit.GetCombatTimer() > 0, unit);
unit.GetHostileRefManager().threatAssist(m_caster, 0.0f);
unit.GetHostileRefManager().ThreatAssist(m_caster, 0.0f);
}
}
}
@@ -2323,7 +2323,7 @@ namespace Game.Spells
return channelTargetEffectMask == 0;
}
public void prepare(SpellCastTargets targets, AuraEffect triggeredByAura = null)
public void Prepare(SpellCastTargets targets, AuraEffect triggeredByAura = null)
{
if (m_CastItem != null)
{
@@ -2338,7 +2338,7 @@ namespace Game.Spells
else
{
SendCastResult(SpellCastResult.EquippedItem);
finish(false);
Finish(false);
return;
}
}
@@ -2361,14 +2361,14 @@ namespace Game.Spells
if (!Convert.ToBoolean(_triggeredCastFlags & TriggerCastFlags.IgnoreCastInProgress) && m_caster.IsNonMeleeSpellCast(false, true, true) && !m_castId.IsEmpty())
{
SendCastResult(SpellCastResult.SpellInProgress);
finish(false);
Finish(false);
return;
}
if (Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, m_caster))
{
SendCastResult(SpellCastResult.SpellUnavailable);
finish(false);
Finish(false);
return;
}
LoadScripts();
@@ -2404,12 +2404,12 @@ namespace Game.Spells
else
SendCastResult(result);
finish(false);
Finish(false);
return;
}
// Prepare data for triggers
prepareDataForTriggerSystem();
PrepareDataForTriggerSystem();
if (m_caster.IsTypeId(TypeId.Player))
{
@@ -2446,7 +2446,7 @@ namespace Game.Spells
if (m_casttime != 0 || !m_spellInfo.IsMoveAllowedChannel())
{
SendCastResult(SpellCastResult.Moving);
finish(false);
Finish(false);
return;
}
}
@@ -2460,7 +2460,7 @@ namespace Game.Spells
// @todoApply this to all casted spells if needed
// Why check duration? 29350: channelled triggers channelled
if (_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.CastDirectly) && (!m_spellInfo.IsChanneled() || m_spellInfo.GetMaxDuration() == 0))
cast(true);
Cast(true);
else
{
// stealth must be removed at cast starting (at show channel bar)
@@ -2491,11 +2491,11 @@ namespace Game.Spells
// the easiest bug to observe is LoS check in AddUnitTarget, even if spell passed the CheckCast LoS check the situation can change in spell::update
// because target could be relocated in the meantime, making the spell fly to the air (no targets can be registered, so no effects processed, nothing in combat log)
if (m_casttime == 0 && /*m_spellInfo.StartRecoveryTime == 0 && */ m_castItemGUID.IsEmpty() && GetCurrentContainer() == CurrentSpellTypes.Generic)
cast(true);
Cast(true);
}
}
public void cancel()
public void Cancel()
{
if (m_spellState == SpellState.Finished)
return;
@@ -2547,10 +2547,10 @@ namespace Game.Spells
//set state back so finish will be processed
m_spellState = oldState;
finish(false);
Finish(false);
}
public void cast(bool skipCheck = false)
public void Cast(bool skipCheck = false)
{
Player modOwner = m_caster.GetSpellModOwner();
Spell lastSpellMod = null;
@@ -2572,14 +2572,14 @@ namespace Game.Spells
if (!UpdatePointers())
{
// cancel the spell if UpdatePointers() returned false, something wrong happened there
cancel();
Cancel();
return;
}
// cancel at lost explicit target during cast
if (!m_targets.GetObjectTargetGUID().IsEmpty() && m_targets.GetObjectTarget() == null)
{
cancel();
Cancel();
return;
}
@@ -2631,7 +2631,7 @@ namespace Game.Spells
if (m_caster.IsTypeId(TypeId.Player))
m_caster.ToPlayer().SetSpellModTakingSpell(this, false);
finish(false);
Finish(false);
SetExecutedCurrently(false);
return;
}
@@ -2654,7 +2654,7 @@ namespace Game.Spells
m_caster.ToPlayer().SetSpellModTakingSpell(this, false);
finish(false);
Finish(false);
SetExecutedCurrently(false);
return;
}
@@ -2685,7 +2685,7 @@ namespace Game.Spells
if (m_caster.IsTypeId(TypeId.Player))
m_caster.ToPlayer().SetSpellModTakingSpell(this, false);
finish(false);
Finish(false);
SetExecutedCurrently(false);
return;
}
@@ -2763,7 +2763,7 @@ namespace Game.Spells
else
{
// Immediate spell, no big deal
handle_immediate();
HandleImmediate();
}
CallScriptAfterCastHandlers();
@@ -2824,7 +2824,7 @@ namespace Game.Spells
caster.GetAI().OnSuccessfulSpellCast(GetSpellInfo());
}
void handle_immediate()
void HandleImmediate()
{
// start channeling if applicable
if (m_spellInfo.IsChanneled())
@@ -2878,15 +2878,15 @@ namespace Game.Spells
TakeCastItem();
if (m_spellState != SpellState.Casting)
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
Finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
}
public ulong handle_delayed(ulong t_offset)
public ulong HandleDelayed(ulong offset)
{
if (!UpdatePointers())
{
// finish the spell if UpdatePointers() returned false, something wrong happened there
finish(false);
Finish(false);
return 0;
}
@@ -2896,12 +2896,12 @@ namespace Game.Spells
if (!m_launchHandled)
{
ulong launchMoment = (ulong)Math.Floor(m_spellInfo.LaunchDelay * 1000.0f);
if (launchMoment > t_offset)
if (launchMoment > offset)
return launchMoment;
HandleLaunchPhase();
m_launchHandled = true;
if (m_delayMoment > t_offset)
if (m_delayMoment > offset)
{
if (single_missile)
return m_delayMoment;
@@ -2909,12 +2909,12 @@ namespace Game.Spells
next_time = m_delayMoment;
if ((m_UniqueTargetInfo.Count > 2 || (m_UniqueTargetInfo.Count == 1 && m_UniqueTargetInfo[0].targetGUID == m_caster.GetGUID())) || !m_UniqueGOTargetInfo.Empty())
{
t_offset = 0; // if LaunchDelay was present then the only target that has timeDelay = 0 is m_caster - and that is the only target we want to process now
offset = 0; // if LaunchDelay was present then the only target that has timeDelay = 0 is m_caster - and that is the only target we want to process now
}
}
}
if (single_missile && t_offset == 0)
if (single_missile && offset == 0)
return m_delayMoment;
if (m_caster.IsTypeId(TypeId.Player))
@@ -2922,7 +2922,7 @@ namespace Game.Spells
PrepareTargetProcessing();
if (!m_immediateHandled && t_offset != 0)
if (!m_immediateHandled && offset != 0)
{
_handle_immediate_phase();
m_immediateHandled = true;
@@ -2933,9 +2933,9 @@ namespace Game.Spells
{
if (!ihit.processed)
{
if (single_missile || ihit.timeDelay <= t_offset)
if (single_missile || ihit.timeDelay <= offset)
{
ihit.timeDelay = t_offset;
ihit.timeDelay = offset;
DoAllEffectOnTarget(ihit);
}
else if (next_time == 0 || ihit.timeDelay < next_time)
@@ -2948,7 +2948,7 @@ namespace Game.Spells
{
if (!ighit.processed)
{
if (single_missile || ighit.timeDelay <= t_offset)
if (single_missile || ighit.timeDelay <= offset)
DoAllEffectOnTarget(ighit);
else if (next_time == 0 || ighit.timeDelay < next_time)
next_time = ighit.timeDelay;
@@ -2966,7 +2966,7 @@ namespace Game.Spells
// spell is finished, perform some last features of the spell here
_handle_finish_phase();
finish(true); // successfully finish spell cast
Finish(true); // successfully finish spell cast
// return zero, spell is finished now
return 0;
@@ -3049,19 +3049,19 @@ namespace Game.Spells
m_caster.GetSpellHistory().HandleCooldowns(m_spellInfo, m_castItemEntry, this);
}
public void update(uint difftime)
public void Update(uint difftime)
{
if (!UpdatePointers())
{
// cancel the spell if UpdatePointers() returned false, something wrong happened there
cancel();
Cancel();
return;
}
if (!m_targets.GetUnitTargetGUID().IsEmpty() && m_targets.GetUnitTarget() == null)
{
Log.outDebug(LogFilter.Spells, "Spell {0} is cancelled due to removal of target.", m_spellInfo.Id);
cancel();
Cancel();
return;
}
@@ -3080,7 +3080,7 @@ namespace Game.Spells
// @todo this is a hack, "creature" movesplines don't differentiate turning/moving right now
// however, checking what type of movement the spline is for every single spline would be really expensive
if (!m_caster.GetCharmerGUID().IsCreature())
cancel();
Cancel();
}
}
@@ -3098,7 +3098,7 @@ namespace Game.Spells
if (m_timer == 0 && !m_spellInfo.IsNextMeleeSwingSpell() && !IsAutoRepeat())
// don't CheckCast for instant spells - done in spell.prepare, skip duplicate checks, needed for range checks for example
cast(m_casttime == 0);
Cast(m_casttime == 0);
break;
}
case SpellState.Casting:
@@ -3132,7 +3132,7 @@ namespace Game.Spells
if (m_timer == 0)
{
SendChannelUpdate(0);
finish();
Finish();
}
break;
}
@@ -3141,7 +3141,7 @@ namespace Game.Spells
}
}
public void finish(bool ok = true)
public void Finish(bool ok = true)
{
if (!m_caster)
return;
@@ -4258,7 +4258,7 @@ namespace Game.Spells
// positive spells distribute threat among all units that are in combat with target, like healing
if (m_spellInfo.IsPositive())
target.GetHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo);
target.GetHostileRefManager().ThreatAssist(m_caster, threatToAdd, m_spellInfo);
// for negative spells threat gets distributed among affected targets
else
{
@@ -4352,7 +4352,7 @@ namespace Game.Spells
return SpellCastResult.DontReport;
}
if (m_caster.IsTypeId(TypeId.Player) && Global.VMapMgr.isLineOfSightCalcEnabled())
if (m_caster.IsTypeId(TypeId.Player) && Global.VMapMgr.IsLineOfSightCalcEnabled())
{
if (m_spellInfo.HasAttribute(SpellAttr0.OutdoorsOnly) &&
!m_caster.GetMap().IsOutdoors(m_caster.GetPhaseShift(), m_caster.posX, m_caster.posY, m_caster.posZ))
@@ -4878,7 +4878,7 @@ namespace Game.Spells
return SpellCastResult.TargetUnskinnable;
Creature creature = m_targets.GetUnitTarget().ToCreature();
if (!creature.IsCritter() && !creature.loot.isLooted())
if (!creature.IsCritter() && !creature.loot.IsLooted())
return SpellCastResult.TargetNotLooted;
SkillType skill = creature.GetCreatureTemplate().GetRequiredLootSkill();
@@ -6282,7 +6282,7 @@ namespace Game.Spells
if (m_caster == null)
return;
if (isDelayableNoMore()) // Spells may only be delayed twice
if (IsDelayableNoMore()) // Spells may only be delayed twice
return;
//check pushback reduce
@@ -6314,10 +6314,10 @@ namespace Game.Spells
public void DelayedChannel()
{
if (m_caster == null || !m_caster.IsTypeId(TypeId.Player) || getState() != SpellState.Casting)
if (m_caster == null || !m_caster.IsTypeId(TypeId.Player) || GetState() != SpellState.Casting)
return;
if (isDelayableNoMore()) // Spells may only be delayed twice
if (IsDelayableNoMore()) // Spells may only be delayed twice
return;
//check pushback reduce
@@ -7131,11 +7131,11 @@ namespace Game.Spells
return m_caster.CalculateSpellDamage(target, m_spellInfo, i, out variance, basePoint, m_castItemLevel);
}
public SpellState getState()
public SpellState GetState()
{
return m_spellState;
}
public void setState(SpellState state)
public void SetState(SpellState state)
{
m_spellState = state;
}
@@ -7218,7 +7218,7 @@ namespace Game.Spells
return m_powerCost;
}
bool isDelayableNoMore()
bool IsDelayableNoMore()
{
if (m_delayAtDamageCount >= 2)
return true;
@@ -7801,11 +7801,11 @@ namespace Game.Spells
public override bool Execute(ulong e_time, uint p_time)
{
// update spell if it is not finished
if (m_Spell.getState() != SpellState.Finished)
m_Spell.update(p_time);
if (m_Spell.GetState() != SpellState.Finished)
m_Spell.Update(p_time);
// check spell state to process
switch (m_Spell.getState())
switch (m_Spell.GetState())
{
case SpellState.Finished:
{
@@ -7825,7 +7825,7 @@ namespace Game.Spells
{
// run the spell handler and think about what we can do next
ulong t_offset = e_time - m_Spell.GetDelayStart();
ulong n_offset = m_Spell.handle_delayed(t_offset);
ulong n_offset = m_Spell.HandleDelayed(t_offset);
if (n_offset != 0)
{
// re-add us to the queue
@@ -7840,7 +7840,7 @@ namespace Game.Spells
// delaying had just started, record the moment
m_Spell.SetDelayStart(e_time);
// handle effects on caster if the spell has travel time but also affects the caster in some way
ulong n_offset = m_Spell.handle_delayed(0);
ulong n_offset = m_Spell.HandleDelayed(0);
if (m_Spell.m_spellInfo.LaunchDelay != 0)
Cypher.Assert(n_offset == (ulong)Math.Floor(m_Spell.m_spellInfo.LaunchDelay * 1000.0f));
else
@@ -7867,8 +7867,8 @@ namespace Game.Spells
public override void Abort(ulong e_time)
{
// oops, the spell we try to do is aborted
if (m_Spell.getState() != SpellState.Finished)
m_Spell.cancel();
if (m_Spell.GetState() != SpellState.Finished)
m_Spell.Cancel();
}
public override bool IsDeletable()
{
+13 -13
View File
@@ -106,7 +106,7 @@ namespace Game.Spells
return;
if (m_caster == unitTarget) // prevent interrupt message
finish();
Finish();
SpellInstakillLog data = new SpellInstakillLog();
data.Target = unitTarget.GetGUID();
@@ -561,7 +561,7 @@ namespace Game.Spells
return;
}
finish();
Finish();
m_caster.CastSpell(null, spellInfo, false);
}
@@ -2336,7 +2336,7 @@ namespace Game.Spells
return;
// cast finish successfully
finish();
Finish();
Pet pet = m_caster.CreateTamedPetFrom(creatureTarget, m_spellInfo.Id);
if (pet == null) // in very specific state like near world end/etc.
@@ -2489,18 +2489,18 @@ namespace Game.Spells
return;
}
if (!unitTarget.GetThreatManager().getOnlineContainer().empty())
if (!unitTarget.GetThreatManager().GetOnlineContainer().Empty())
{
// Also use this effect to set the taunter's threat to the taunted creature's highest value
float myThreat = unitTarget.GetThreatManager().getThreat(m_caster);
float topThreat = unitTarget.GetThreatManager().getOnlineContainer().getMostHated().getThreat();
float myThreat = unitTarget.GetThreatManager().GetThreat(m_caster);
float topThreat = unitTarget.GetThreatManager().GetOnlineContainer().GetMostHated().GetThreat();
if (topThreat > myThreat)
unitTarget.GetThreatManager().addThreat(m_caster, topThreat - myThreat);
unitTarget.GetThreatManager().AddThreat(m_caster, topThreat - myThreat);
//Set aggro victim to caster
HostileReference forcedVictim = unitTarget.GetThreatManager().getOnlineContainer().getReferenceByTarget(m_caster);
HostileReference forcedVictim = unitTarget.GetThreatManager().GetOnlineContainer().GetReferenceByTarget(m_caster);
if (forcedVictim != null)
unitTarget.GetThreatManager().setCurrentVictim(forcedVictim);
unitTarget.GetThreatManager().SetCurrentVictim(forcedVictim);
}
if (unitTarget.ToCreature().IsAIEnabled && !unitTarget.ToCreature().HasReactState(ReactStates.Passive))
@@ -2774,8 +2774,8 @@ namespace Game.Spells
{
SpellInfo curSpellInfo = spell.m_spellInfo;
// check if we can interrupt spell
if ((spell.getState() == SpellState.Casting
|| (spell.getState() == SpellState.Preparing && spell.GetCastTime() > 0.0f))
if ((spell.GetState() == SpellState.Casting
|| (spell.GetState() == SpellState.Preparing && spell.GetCastTime() > 0.0f))
&& (curSpellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence))
&& ((i == CurrentSpellTypes.Generic && curSpellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Interrupt))
|| (i == CurrentSpellTypes.Channeled && curSpellInfo.HasChannelInterruptFlag(SpellChannelInterruptFlags.Interrupt))))
@@ -4329,7 +4329,7 @@ namespace Game.Spells
return;
Group group = player.GetGroup();
if (!group || (group.isRaidGroup() && !group.IsLeader(player.GetGUID()) && !group.IsAssistant(player.GetGUID())))
if (!group || (group.IsRaidGroup() && !group.IsLeader(player.GetGUID()) && !group.IsAssistant(player.GetGUID())))
return;
float x, y, z;
@@ -4513,7 +4513,7 @@ namespace Game.Spells
if (unitTarget == null)
return;
unitTarget.GetThreatManager().modifyThreatPercent(m_caster, damage);
unitTarget.GetThreatManager().ModifyThreatPercent(m_caster, damage);
}
[SpellEffectHandler(SpellEffectName.TransDoor)]
+12 -16
View File
@@ -1659,10 +1659,10 @@ namespace Game.Spells
public void _LoadSpellDiminishInfo()
{
SpellDiminishInfo diminishInfo = new SpellDiminishInfo();
diminishInfo.DiminishGroup = diminishingGroupCompute();
diminishInfo.DiminishReturnType = diminishingTypeCompute(diminishInfo.DiminishGroup);
diminishInfo.DiminishMaxLevel = diminishingMaxLevelCompute(diminishInfo.DiminishGroup);
diminishInfo.DiminishDurationLimit = diminishingLimitDurationCompute();
diminishInfo.DiminishGroup = DiminishingGroupCompute();
diminishInfo.DiminishReturnType = DiminishingTypeCompute(diminishInfo.DiminishGroup);
diminishInfo.DiminishMaxLevel = DiminishingMaxLevelCompute(diminishInfo.DiminishGroup);
diminishInfo.DiminishDurationLimit = DiminishingLimitDurationCompute();
_diminishInfo = diminishInfo;
}
@@ -1687,7 +1687,7 @@ namespace Game.Spells
return _diminishInfo.DiminishDurationLimit;
}
DiminishingGroup diminishingGroupCompute()
DiminishingGroup DiminishingGroupCompute()
{
if (IsPositive())
return DiminishingGroup.None;
@@ -2042,7 +2042,7 @@ namespace Game.Spells
return DiminishingGroup.None;
}
DiminishingReturnsType diminishingTypeCompute(DiminishingGroup group)
DiminishingReturnsType DiminishingTypeCompute(DiminishingGroup group)
{
switch (group)
{
@@ -2057,7 +2057,7 @@ namespace Game.Spells
}
}
DiminishingLevels diminishingMaxLevelCompute(DiminishingGroup group)
DiminishingLevels DiminishingMaxLevelCompute(DiminishingGroup group)
{
switch (group)
{
@@ -2070,7 +2070,7 @@ namespace Game.Spells
}
}
int diminishingLimitDurationCompute()
int DiminishingLimitDurationCompute()
{
// Explicit diminishing duration
switch (SpellFamilyName)
@@ -3378,7 +3378,7 @@ namespace Game.Spells
continue;
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
if (_IsPositiveTarget(eff.TargetA.getTarget(), eff.TargetB.getTarget()) && !spellTriggeredProto._IsPositiveEffect(eff.EffectIndex, true))
if (_IsPositiveTarget(eff.TargetA.GetTarget(), eff.TargetB.GetTarget()) && !spellTriggeredProto._IsPositiveEffect(eff.EffectIndex, true))
return false;
}
}
@@ -3483,7 +3483,7 @@ namespace Game.Spells
// non-positive targets
if (!_IsPositiveTarget(effect.TargetA.getTarget(), effect.TargetB.getTarget()))
if (!_IsPositiveTarget(effect.TargetA.GetTarget(), effect.TargetB.GetTarget()))
return false;
// negative spell if triggered spell is negative
@@ -3510,10 +3510,10 @@ namespace Game.Spells
return true;
}
bool _IsPositiveTarget(uint targetA, uint targetB)
bool _IsPositiveTarget(Targets targetA, Targets targetB)
{
// non-positive targets
switch ((Targets)targetA)
switch (targetA)
{
case Targets.UnitNearbyEnemy:
case Targets.UnitEnemy:
@@ -4630,10 +4630,6 @@ namespace Game.Spells
{
return _target;
}
public uint getTarget()
{
return (uint)_target;
}
public SpellCastTargetFlags GetExplicitTargetMask(bool srcSet, bool dstSet)
{
+17 -17
View File
@@ -58,13 +58,13 @@ namespace Game.Entities
continue;
}
if (AuraEffectHandlers.ContainsKey(auraEffect.auraType))
if (AuraEffectHandlers.ContainsKey(auraEffect.AuraType))
{
Log.outError(LogFilter.ServerLoading, "Tried to override AuraEffectHandler of {0} with {1} (AuraType {2}).", AuraEffectHandlers[auraEffect.auraType].ToString(), methodInfo.Name, auraEffect.auraType);
Log.outError(LogFilter.ServerLoading, "Tried to override AuraEffectHandler of {0} with {1} (AuraType {2}).", AuraEffectHandlers[auraEffect.AuraType].ToString(), methodInfo.Name, auraEffect.AuraType);
continue;
}
AuraEffectHandlers.Add(auraEffect.auraType, (AuraEffectHandler)methodInfo.CreateDelegate(typeof(AuraEffectHandler)));
AuraEffectHandlers.Add(auraEffect.AuraType, (AuraEffectHandler)methodInfo.CreateDelegate(typeof(AuraEffectHandler)));
}
@@ -86,13 +86,13 @@ namespace Game.Entities
continue;
}
if (SpellEffectsHandlers.ContainsKey(spellEffect.effectName))
if (SpellEffectsHandlers.ContainsKey(spellEffect.EffectName))
{
Log.outError(LogFilter.ServerLoading, "Tried to override SpellEffectsHandler of {0} with {1} (EffectName {2}).", SpellEffectsHandlers[spellEffect.effectName].ToString(), methodInfo.Name, spellEffect.effectName);
Log.outError(LogFilter.ServerLoading, "Tried to override SpellEffectsHandler of {0} with {1} (EffectName {2}).", SpellEffectsHandlers[spellEffect.EffectName].ToString(), methodInfo.Name, spellEffect.EffectName);
continue;
}
SpellEffectsHandlers.Add(spellEffect.effectName, (SpellEffectHandler)methodInfo.CreateDelegate(typeof(SpellEffectHandler)));
SpellEffectsHandlers.Add(spellEffect.EffectName, (SpellEffectHandler)methodInfo.CreateDelegate(typeof(SpellEffectHandler)));
}
}
}
@@ -1304,11 +1304,11 @@ namespace Game.Entities
if (auraName == 0)
continue;
if (!isTriggerAura(auraName))
if (!IsTriggerAura(auraName))
continue;
procSpellTypeMask |= getSpellTypeMask(auraName);
if (isAlwaysTriggeredAura(auraName))
procSpellTypeMask |= GetSpellTypeMask(auraName);
if (IsAlwaysTriggeredAura(auraName))
addTriggerFlag = true;
// many proc auras with taken procFlag mask don't have attribute "can proc with triggered"
@@ -1347,7 +1347,7 @@ namespace Game.Entities
procEntry.ProcFlags = spellInfo.ProcFlags;
procEntry.SpellFamilyName = 0;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None))
if (effect != null && effect.IsEffect() && isTriggerAura(effect.ApplyAuraName))
if (effect != null && effect.IsEffect() && IsTriggerAura(effect.ApplyAuraName))
procEntry.SpellFamilyMask |= effect.SpellClassMask;
if (procEntry.SpellFamilyMask)
@@ -3155,7 +3155,7 @@ namespace Game.Entities
}
#endregion
bool isTriggerAura(AuraType type)
bool IsTriggerAura(AuraType type)
{
switch (type)
{
@@ -3208,7 +3208,7 @@ namespace Game.Entities
}
return false;
}
bool isAlwaysTriggeredAura(AuraType type)
bool IsAlwaysTriggeredAura(AuraType type)
{
switch (type)
{
@@ -3227,7 +3227,7 @@ namespace Game.Entities
}
return false;
}
ProcFlagsSpellType getSpellTypeMask(AuraType type)
ProcFlagsSpellType GetSpellTypeMask(AuraType type)
{
switch (type)
{
@@ -3397,10 +3397,10 @@ namespace Game.Entities
{
public AuraEffectHandlerAttribute(AuraType type)
{
auraType = type;
AuraType = type;
}
public AuraType auraType { get; set; }
public AuraType AuraType { get; set; }
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
@@ -3408,10 +3408,10 @@ namespace Game.Entities
{
public SpellEffectHandlerAttribute(SpellEffectName effectName)
{
this.effectName = effectName;
EffectName = effectName;
}
public SpellEffectName effectName { get; set; }
public SpellEffectName EffectName { get; set; }
}
public class SpellInfoLoadHelper