Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -336,12 +336,12 @@ namespace Game.Spells
|
||||
m_castItemGuid = createInfo.CastItemGUID;
|
||||
m_castItemId = createInfo.CastItemId;
|
||||
m_castItemLevel = createInfo.CastItemLevel;
|
||||
m_spellVisual = new SpellCastVisual(createInfo.Caster ? createInfo.Caster.GetCastSpellXSpellVisualId(createInfo._spellInfo) : createInfo._spellInfo.GetSpellXSpellVisualId(), 0);
|
||||
m_spellVisual = new SpellCastVisual(createInfo.Caster != null ? createInfo.Caster.GetCastSpellXSpellVisualId(createInfo._spellInfo) : createInfo._spellInfo.GetSpellXSpellVisualId(), 0);
|
||||
m_applyTime = GameTime.GetGameTime();
|
||||
m_owner = createInfo._owner;
|
||||
m_timeCla = 0;
|
||||
m_updateTargetMapInterval = 0;
|
||||
m_casterLevel = createInfo.Caster ? createInfo.Caster.GetLevel() : m_spellInfo.SpellLevel;
|
||||
m_casterLevel = createInfo.Caster != null ? createInfo.Caster.GetLevel() : m_spellInfo.SpellLevel;
|
||||
m_procCharges = 0;
|
||||
m_stackAmount = 1;
|
||||
m_isRemoved = false;
|
||||
@@ -452,7 +452,7 @@ namespace Game.Spells
|
||||
if (app == null)
|
||||
{
|
||||
Log.outError(LogFilter.Spells, "Aura._UnapplyForTarget, target: {0}, caster: {1}, spell: {2} was not found in owners application map!",
|
||||
target.GetGUID().ToString(), caster ? caster.GetGUID().ToString() : "", auraApp.GetBase().GetSpellInfo().Id);
|
||||
target.GetGUID().ToString(), caster != null ? caster.GetGUID().ToString() : "", auraApp.GetBase().GetSpellInfo().Id);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
@@ -773,10 +773,10 @@ namespace Game.Spells
|
||||
if (withMods)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
Player modOwner = caster.GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
modOwner.ApplySpellMod(GetSpellInfo(), SpellModOp.Duration, ref duration);
|
||||
}
|
||||
}
|
||||
@@ -788,7 +788,7 @@ namespace Game.Spells
|
||||
public void RefreshDuration(bool withMods = false)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (withMods && caster)
|
||||
if (withMods && caster != null)
|
||||
{
|
||||
int duration = m_spellInfo.GetMaxDuration();
|
||||
// Calculate duration of periodics affected by haste.
|
||||
@@ -872,7 +872,7 @@ namespace Game.Spells
|
||||
|
||||
// only units have events
|
||||
Unit owner = m_owner.ToUnit();
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
return;
|
||||
|
||||
m_dropEvent = new ChargeDropEvent(this, removeMode);
|
||||
@@ -1589,10 +1589,10 @@ namespace Game.Spells
|
||||
if (HasEffectType(AuraType.ControlVehicle) && existingAura.HasEffectType(AuraType.ControlVehicle))
|
||||
{
|
||||
Vehicle veh = null;
|
||||
if (GetOwner().ToUnit())
|
||||
if (GetOwner().ToUnit() != null)
|
||||
veh = GetOwner().ToUnit().GetVehicleKit();
|
||||
|
||||
if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
|
||||
if (veh == null) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
|
||||
return true;
|
||||
|
||||
if (veh.GetAvailableSeatCount() == 0)
|
||||
@@ -1803,7 +1803,7 @@ namespace Game.Spells
|
||||
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
|
||||
}
|
||||
|
||||
if (!item || item.IsBroken() || !item.IsFitToSpellRequirements(GetSpellInfo()))
|
||||
if (item == null || item.IsBroken() || !item.IsFitToSpellRequirements(GetSpellInfo()))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2717,7 +2717,7 @@ namespace Game.Spells
|
||||
if (target == null && targetPair.Key == GetUnitOwner().GetGUID())
|
||||
target = GetUnitOwner();
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
targets.Add(target, targetPair.Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Game.Spells
|
||||
amount = (int)mountCapability.Id;
|
||||
break;
|
||||
case AuraType.ShowConfirmationPromptWithDifficulty:
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
amount = (int)caster.GetMap().GetDifficultyID();
|
||||
m_canBeRecalculated = false;
|
||||
break;
|
||||
@@ -144,7 +144,7 @@ namespace Game.Spells
|
||||
|
||||
public float? CalculateEstimatedAmount(Unit caster, int amount)
|
||||
{
|
||||
if (!caster || GetBase().GetAuraType() != AuraObjectType.Unit)
|
||||
if (caster == null || GetBase().GetAuraType() != AuraObjectType.Unit)
|
||||
return null;
|
||||
|
||||
return CalculateEstimatedAmount(caster, GetBase().GetUnitOwner(), GetSpellInfo(), GetSpellEffectInfo(), amount, GetBase().GetStackAmount(), this);
|
||||
@@ -2422,7 +2422,7 @@ namespace Game.Spells
|
||||
Unit caster = GetCaster();
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if (!caster || !caster.IsAlive() || !target.IsAlive() || !caster.CanHaveThreatList())
|
||||
if (caster == null || !caster.IsAlive() || !target.IsAlive() || !caster.CanHaveThreatList())
|
||||
return;
|
||||
|
||||
caster.GetThreatManager().TauntUpdate();
|
||||
@@ -2863,7 +2863,7 @@ namespace Game.Spells
|
||||
if (player.InBattleground())
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.EventPlayerDroppedFlag(player);
|
||||
}
|
||||
else
|
||||
@@ -3228,7 +3228,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player player = aurApp.GetTarget().ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.UpdateHealingDonePercentMod();
|
||||
}
|
||||
|
||||
@@ -3300,7 +3300,7 @@ namespace Game.Spells
|
||||
|
||||
// only players have primary stats
|
||||
Player player = aurApp.GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.UpdateArmor();
|
||||
@@ -3359,7 +3359,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.ApplyModOverrideSpellPowerByAPPercent(GetAmount(), apply);
|
||||
@@ -3373,7 +3373,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.ApplyModOverrideAPBySpellPowerPercent(GetAmount(), apply);
|
||||
@@ -3388,7 +3388,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
target.SetVersatilityBonus(target.GetTotalAuraModifier(AuraType.ModVersatility));
|
||||
target.UpdateHealingDonePercentMod();
|
||||
@@ -3790,7 +3790,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.UpdateAllWeaponDependentCritAuras();
|
||||
@@ -4116,7 +4116,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
Guardian pet = playerTarget.GetGuardianPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.UpdateAttackPowerAndDamage();
|
||||
}
|
||||
}
|
||||
@@ -4177,7 +4177,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -4463,7 +4463,7 @@ namespace Game.Spells
|
||||
case 57821: // Champion of the Kirin Tor
|
||||
case 57822: // Wyrmrest Champion
|
||||
{
|
||||
if (!caster || !caster.IsTypeId(TypeId.Player))
|
||||
if (caster == null || !caster.IsTypeId(TypeId.Player))
|
||||
break;
|
||||
|
||||
uint FactionID = 0;
|
||||
@@ -4724,7 +4724,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Unit caster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
if (mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
@@ -4861,7 +4861,7 @@ namespace Game.Spells
|
||||
target.m_invisibilityDetect.AddValue(InvisibilityType.Drunk, GetAmount());
|
||||
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget)
|
||||
if (playerTarget != null)
|
||||
playerTarget.ApplyModFakeInebriation(GetAmount(), true);
|
||||
}
|
||||
else
|
||||
@@ -5189,7 +5189,7 @@ namespace Game.Spells
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
uint damage = (uint)Math.Max(GetAmount(), 0);
|
||||
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
damage = (uint)caster.SpellDamageBonusDone(target, GetSpellInfo(), (int)damage, DamageEffectType.DOT, GetSpellEffectInfo(), stackAmountForBonuses, null, this);
|
||||
|
||||
damage = (uint)target.SpellDamageBonusTaken(caster, GetSpellInfo(), (int)damage, DamageEffectType.DOT);
|
||||
@@ -5249,7 +5249,7 @@ namespace Game.Spells
|
||||
Unit.ProcSkillsAndAuras(caster, target, procAttacker, procVictim, ProcFlagsSpellType.Damage, ProcFlagsSpellPhase.Hit, hitMask, null, damageInfo, null);
|
||||
|
||||
// process caster heal from now on (must be in world)
|
||||
if (!caster || !caster.IsAlive())
|
||||
if (caster == null || !caster.IsAlive())
|
||||
return;
|
||||
|
||||
float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
|
||||
@@ -5533,11 +5533,11 @@ namespace Game.Spells
|
||||
|
||||
float CalcPeriodicCritChance(Unit caster)
|
||||
{
|
||||
if (!caster || !CanPeriodicTickCrit())
|
||||
if (caster == null || !CanPeriodicTickCrit())
|
||||
return 0.0f;
|
||||
|
||||
Player modOwner = caster.GetSpellModOwner();
|
||||
if (!modOwner)
|
||||
if (modOwner == null)
|
||||
return 0.0f;
|
||||
|
||||
float critChance = modOwner.SpellCritChanceDone(null, this, GetSpellInfo().GetSchoolMask(), GetSpellInfo().GetAttackType());
|
||||
@@ -5678,7 +5678,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player player = aurApp.GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -5694,14 +5694,14 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player player = aurApp.GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (player.GetClass() != Class.Hunter)
|
||||
return;
|
||||
|
||||
Pet pet = player.GetPet();
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
return;
|
||||
|
||||
ChrSpecializationRecord currSpec = CliDB.ChrSpecializationStorage.LookupByKey(pet.GetSpecialization());
|
||||
@@ -5734,7 +5734,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player player = aurApp.GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -5758,7 +5758,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
caster.RemoveAreaTrigger(this);
|
||||
}
|
||||
}
|
||||
@@ -5770,7 +5770,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = auraApp.GetTarget().ToPlayer();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (apply)
|
||||
target.TogglePvpTalents(true);
|
||||
@@ -5827,7 +5827,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
TempSummon tempSummon = creature.ToTempSummon();
|
||||
if (tempSummon)
|
||||
if (tempSummon != null)
|
||||
{
|
||||
if (tempSummon.GetSummonerGUID() == target.GetGUID())
|
||||
{
|
||||
@@ -5848,7 +5848,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Player target = aurApp.GetTarget().ToPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.UpdatePvPState(true);
|
||||
|
||||
Reference in New Issue
Block a user