Some cleanups. (might break build for scripts as they are a WIP)

This commit is contained in:
hondacrx
2023-10-08 10:35:31 -04:00
parent fa10b981bd
commit cda53c8e7f
208 changed files with 2266 additions and 2329 deletions
+1 -1
View File
@@ -330,7 +330,7 @@ namespace Scripts.Spells.DemonHunter
SpellCastResult CheckCast()
{
Unit caster = GetCaster();
if (caster.IsMounted() || caster.GetVehicleBase())
if (caster.IsMounted() || caster.GetVehicleBase() != null)
return SpellCastResult.DontReport;
if (!caster.IsFalling())
+2 -2
View File
@@ -1661,7 +1661,7 @@ namespace Scripts.Spells.Druid
void FilterTargets(List<WorldObject> targets)
{
if (!GetCaster().ToPlayer().GetGroup())
if (GetCaster().ToPlayer().GetGroup() == null)
{
targets.Clear();
targets.Add(GetCaster());
@@ -1715,7 +1715,7 @@ namespace Scripts.Spells.Druid
if (caster == null)
return false;
return caster.GetGroup() || caster != eventInfo.GetProcTarget();
return caster.GetGroup() != null || caster != eventInfo.GetProcTarget();
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
+8 -8
View File
@@ -266,7 +266,7 @@ namespace Scripts.Spells.Paladin
SpellCastResult CheckForbearance()
{
Unit target = GetExplTargetUnit();
if (!target || target.HasAura(SpellIds.Forbearance))
if (target == null || target.HasAura(SpellIds.Forbearance))
return SpellCastResult.TargetAurastate;
return SpellCastResult.SpellCastOk;
@@ -321,7 +321,7 @@ namespace Scripts.Spells.Paladin
void HandleEffectPeriodic(AuraEffect aurEff)
{
AreaTrigger at = GetTarget().GetAreaTrigger(SpellIds.Consecration);
if (at)
if (at != null)
GetTarget().CastSpell(at.GetPosition(), SpellIds.ConsecrationDamage);
}
@@ -826,7 +826,7 @@ namespace Scripts.Spells.Paladin
void HandleScript(uint effIndex)
{
Unit initialTarget = ObjAccessor.GetUnit(GetCaster(), _targetGUID);
if (initialTarget)
if (initialTarget != null)
initialTarget.CastSpell(GetHitUnit(), SpellIds.HolyPrismAreaBeamVisual, true);
}
@@ -879,7 +879,7 @@ namespace Scripts.Spells.Paladin
Unit caster = GetCaster();
Unit unitTarget = GetHitUnit();
if (unitTarget)
if (unitTarget != null)
{
if (caster.IsFriendlyTo(unitTarget))
caster.CastSpell(unitTarget, SpellIds.HolyShockHealing, GetSpell());
@@ -1015,7 +1015,7 @@ namespace Scripts.Spells.Paladin
SpellCastResult CheckForbearance()
{
Unit target = GetExplTargetUnit();
if (!target || target.HasAura(SpellIds.Forbearance))
if (target == null || target.HasAura(SpellIds.Forbearance))
return SpellCastResult.TargetAurastate;
return SpellCastResult.SpellCastOk;
@@ -1048,7 +1048,7 @@ namespace Scripts.Spells.Paladin
bool CheckProc(ProcEventInfo eventInfo)
{
if (!eventInfo.GetActionTarget())
if (eventInfo.GetActionTarget() == null)
return false;
if (eventInfo.GetActionTarget().HasAura(SpellIds.BeaconOfLight, eventInfo.GetActor().GetGUID()))
return false;
@@ -1102,7 +1102,7 @@ namespace Scripts.Spells.Paladin
foreach (var summonedObject in GetSpell().GetExecuteLogEffect(SpellEffectName.Summon).GenericVictimTargets)
{
Unit hammer = ObjAccessor.GetUnit(GetCaster(), summonedObject.Victim);
if (hammer)
if (hammer != null)
{
hammer.CastSpell(hammer, SpellIds.LightHammerCosmetic,
new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetTriggeringSpell(GetSpell()));
@@ -1130,7 +1130,7 @@ namespace Scripts.Spells.Paladin
{
Unit lightHammer = GetTarget();
Unit originalCaster = lightHammer.GetOwner();
if (originalCaster)
if (originalCaster != null)
{
originalCaster.CastSpell(lightHammer.GetPosition(), SpellIds.LightHammerDamage, TriggerCastFlags.IgnoreCastInProgress);
originalCaster.CastSpell(lightHammer.GetPosition(), SpellIds.LightHammerHealing, TriggerCastFlags.IgnoreCastInProgress);
+1 -1
View File
@@ -52,7 +52,7 @@ namespace Scripts.Spells.Azerite
Creature creatureTarget = GetHitCreature();
if (creatureTarget != null)
{
if (!creatureTarget.IsPet() && creatureTarget.GetEntry() == _originalEntry)
if (creatureTarget.IsPet() && creatureTarget.GetEntry() == _originalEntry)
{
creatureTarget.UpdateEntry(_newEntry);
if (_shouldAttack)
+7 -7
View File
@@ -87,7 +87,7 @@ namespace Scripts.Spells.Rogue
void HandleHitDamage(uint effIndex)
{
Unit hitUnit = GetHitUnit();
if (!hitUnit)
if (hitUnit == null)
return;
Unit caster = GetCaster();
@@ -208,7 +208,7 @@ namespace Scripts.Spells.Rogue
public override bool Load()
{
// at this point CastItem must already be initialized
return GetCaster().IsPlayer() && GetCastItem();
return GetCaster().IsPlayer() && GetCastItem() != null;
}
void HandleBeforeHit(SpellMissInfo missInfo)
@@ -242,7 +242,7 @@ namespace Scripts.Spells.Rogue
if (item == GetCastItem())
item = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
if (!item)
if (item == null)
return;
// item combat enchantments
@@ -446,7 +446,7 @@ namespace Scripts.Spells.Rogue
{
void FilterTargets(List<WorldObject> targets)
{
if (targets.Empty() || GetCaster().GetVehicleBase())
if (targets.Empty() || GetCaster().GetVehicleBase() != null)
FinishCast(SpellCastResult.OutOfRange);
}
@@ -492,7 +492,7 @@ namespace Scripts.Spells.Rogue
bool HandleCheckProc(ProcEventInfo eventInfo)
{
return eventInfo.GetDamageInfo()?.GetVictim();
return eventInfo.GetDamageInfo()?.GetVictim() != null;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
@@ -514,7 +514,7 @@ namespace Scripts.Spells.Rogue
{
SpellCastResult CheckCast()
{
if (!GetExplTargetUnit() || !GetCaster().IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
if (GetExplTargetUnit() == null || !GetCaster().IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
return SpellCastResult.BadTargets;
return SpellCastResult.SpellCastOk;
@@ -902,7 +902,7 @@ namespace Scripts.Spells.Rogue
if (script != null)
{
Unit explTarget = GetExplTargetUnit();
if (explTarget)
if (explTarget != null)
script.SetRedirectTarget(explTarget.GetGUID());
else
script.SetRedirectTarget(ObjectGuid.Empty);