Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -74,7 +74,7 @@ namespace Game.AI
|
||||
else if (creature.IsCritter() && !creature.HasUnitTypeMask(UnitTypeMask.Guardian))
|
||||
return new CritterAI(creature);
|
||||
|
||||
if (!creature.IsCivilian() && !creature.IsNeutralToAll())
|
||||
if (creature.IsCivilian() && !creature.IsNeutralToAll())
|
||||
return new AggressorAI(creature);
|
||||
|
||||
if (creature.IsCivilian() || creature.IsNeutralToAll())
|
||||
|
||||
@@ -331,15 +331,15 @@ namespace Game.AI
|
||||
if (_conditionsTimer <= diff)
|
||||
{
|
||||
Vehicle vehicleKit = me.GetVehicleKit();
|
||||
if (vehicleKit)
|
||||
if (vehicleKit != null)
|
||||
{
|
||||
foreach (var pair in vehicleKit.Seats)
|
||||
{
|
||||
Unit passenger = Global.ObjAccessor.GetUnit(me, pair.Value.Passenger.Guid);
|
||||
if (passenger)
|
||||
if (passenger != null)
|
||||
{
|
||||
Player player = passenger.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.CreatureTemplateVehicle, me.GetEntry(), player, me))
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Game.AI
|
||||
public void TriggerAlert(Unit who)
|
||||
{
|
||||
// If there's no target, or target isn't a player do nothing
|
||||
if (!who || !who.IsTypeId(TypeId.Player))
|
||||
if (who == null || !who.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
// If this unit isn't an NPC, is already distracted, is fighting, is confused, stunned or fleeing, do nothing
|
||||
@@ -178,7 +178,7 @@ namespace Game.AI
|
||||
if (summon != null)
|
||||
{
|
||||
// Only apply this to specific types of summons
|
||||
if (!summon.GetVehicle() && ShouldFollowOnSpawn(summon.m_Properties) && summon.CanFollowOwner())
|
||||
if (summon.GetVehicle() == null && ShouldFollowOnSpawn(summon.m_Properties) && summon.CanFollowOwner())
|
||||
{
|
||||
Unit owner = summon.GetCharmerOrOwner();
|
||||
if (owner != null)
|
||||
@@ -311,7 +311,7 @@ namespace Game.AI
|
||||
|
||||
public CypherStrings VisualizeBoundary(TimeSpan duration, Unit owner = null, bool fill = false)
|
||||
{
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
return 0;
|
||||
|
||||
if (_boundary.Empty())
|
||||
@@ -368,7 +368,7 @@ namespace Game.AI
|
||||
{
|
||||
var pos = new Position(startPosition.GetPositionX() + front.Key * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionY() + front.Value * SharedConst.BoundaryVisualizeStepSize, spawnZ);
|
||||
TempSummon point = owner.SummonCreature(SharedConst.BoundaryVisualizeCreature, pos, TempSummonType.TimedDespawn, duration);
|
||||
if (point)
|
||||
if (point != null)
|
||||
{
|
||||
point.SetObjectScale(SharedConst.BoundaryVisualizeCreatureScale);
|
||||
point.SetUnitFlag(UnitFlags.Stunned);
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace Game.AI
|
||||
else
|
||||
_updateAlliesTimer -= diff;
|
||||
|
||||
if (me.GetVictim() && me.GetVictim().IsAlive())
|
||||
if (me.GetVictim() != null && me.GetVictim().IsAlive())
|
||||
{
|
||||
// is only necessary to stop casting, the pet must not exit combat
|
||||
if (me.GetCurrentSpell(CurrentSpellTypes.Channeled) == null && // ignore channeled spells (Pin, Seduction)
|
||||
(me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)))
|
||||
(me.GetVictim() != null && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)))
|
||||
{
|
||||
me.InterruptNonMeleeSpells(false);
|
||||
return;
|
||||
@@ -71,7 +71,7 @@ namespace Game.AI
|
||||
// All other cases (ie: defensive) - Targets are assigned by DamageTaken(), OwnerAttackedBy(), OwnerAttacked(), etc.
|
||||
Unit nextTarget = SelectNextTarget(me.HasReactState(ReactStates.Aggressive));
|
||||
|
||||
if (nextTarget)
|
||||
if (nextTarget != null)
|
||||
AttackStart(nextTarget);
|
||||
else
|
||||
HandleReturnMovement();
|
||||
@@ -117,10 +117,10 @@ namespace Game.AI
|
||||
// Some spells can target enemy or friendly (DK Ghoul's Leap)
|
||||
// Check for enemy first (pet then owner)
|
||||
Unit target = me.GetAttackerForHelper();
|
||||
if (!target && owner)
|
||||
if (target == null && owner != null)
|
||||
target = owner.GetAttackerForHelper();
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (CanAttack(target) && spell.CanAutoCast(target))
|
||||
{
|
||||
@@ -144,7 +144,7 @@ namespace Game.AI
|
||||
Unit ally = Global.ObjAccessor.GetUnit(me, tar);
|
||||
|
||||
//only buff targets that are in combat, unless the spell can only be cast while out of combat
|
||||
if (!ally)
|
||||
if (ally == null)
|
||||
continue;
|
||||
|
||||
if (spell.CanAutoCast(ally))
|
||||
@@ -160,7 +160,7 @@ namespace Game.AI
|
||||
if (!spellUsed)
|
||||
spell.Dispose();
|
||||
}
|
||||
else if (me.GetVictim() && CanAttack(me.GetVictim()) && spellInfo.CanBeUsedInCombat(me))
|
||||
else if (me.GetVictim() != null && CanAttack(me.GetVictim()) && spellInfo.CanBeUsedInCombat(me))
|
||||
{
|
||||
Spell spell = new(me, spellInfo, TriggerCastFlags.None);
|
||||
if (spell.CanAutoCast(me.GetVictim()))
|
||||
@@ -201,7 +201,7 @@ namespace Game.AI
|
||||
{
|
||||
// Called from Unit.Kill() in case where pet or owner kills something
|
||||
// if owner killed this victim, pet may still be attacking something else
|
||||
if (me.GetVictim() && me.GetVictim() != victim)
|
||||
if (me.GetVictim() != null && me.GetVictim() != victim)
|
||||
return;
|
||||
|
||||
// Clear target just in case. May help problem where health / focus / mana
|
||||
@@ -213,7 +213,7 @@ namespace Game.AI
|
||||
|
||||
// Before returning to owner, see if there are more things to attack
|
||||
Unit nextTarget = SelectNextTarget(false);
|
||||
if (nextTarget)
|
||||
if (nextTarget != null)
|
||||
AttackStart(nextTarget);
|
||||
else
|
||||
HandleReturnMovement(); // Return
|
||||
@@ -254,7 +254,7 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
// Prevent pet from disengaging from current target
|
||||
if (me.GetVictim() && me.GetVictim().IsAlive())
|
||||
if (me.GetVictim() != null && me.GetVictim().IsAlive())
|
||||
return;
|
||||
|
||||
// Continue to evaluate and attack if necessary
|
||||
@@ -275,7 +275,7 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
// Prevent pet from disengaging from current target
|
||||
if (me.GetVictim() && me.GetVictim().IsAlive())
|
||||
if (me.GetVictim() != null && me.GetVictim().IsAlive())
|
||||
return;
|
||||
|
||||
// Continue to evaluate and attack if necessary
|
||||
@@ -295,24 +295,24 @@ namespace Game.AI
|
||||
|
||||
// Check pet attackers first so we don't drag a bunch of targets to the owner
|
||||
Unit myAttacker = me.GetAttackerForHelper();
|
||||
if (myAttacker)
|
||||
if (myAttacker != null)
|
||||
if (!myAttacker.HasBreakableByDamageCrowdControlAura())
|
||||
return myAttacker;
|
||||
|
||||
// Not sure why we wouldn't have an owner but just in case...
|
||||
if (!me.GetCharmerOrOwner())
|
||||
if (me.GetCharmerOrOwner() == null)
|
||||
return null;
|
||||
|
||||
// Check owner attackers
|
||||
Unit ownerAttacker = me.GetCharmerOrOwner().GetAttackerForHelper();
|
||||
if (ownerAttacker)
|
||||
if (ownerAttacker != null)
|
||||
if (!ownerAttacker.HasBreakableByDamageCrowdControlAura())
|
||||
return ownerAttacker;
|
||||
|
||||
// Check owner victim
|
||||
// 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
|
||||
Unit ownerVictim = me.GetCharmerOrOwner().GetVictim();
|
||||
if (ownerVictim)
|
||||
if (ownerVictim != null)
|
||||
return ownerVictim;
|
||||
|
||||
// Neither pet or owner had a target and aggressive pets can pick any target
|
||||
@@ -323,7 +323,7 @@ namespace Game.AI
|
||||
if (!me.GetCharmInfo().IsReturning() || me.GetCharmInfo().IsFollowing() || me.GetCharmInfo().IsAtStay())
|
||||
{
|
||||
Unit nearTarget = me.SelectNearestHostileUnitInAggroRange(true, true);
|
||||
if (nearTarget)
|
||||
if (nearTarget != null)
|
||||
return nearTarget;
|
||||
}
|
||||
}
|
||||
@@ -443,7 +443,7 @@ namespace Game.AI
|
||||
{
|
||||
// If data is owner's GUIDLow then we've reached follow point,
|
||||
// otherwise we're probably chasing a creature
|
||||
if (me.GetCharmerOrOwner() && me.GetCharmInfo() != null && id == me.GetCharmerOrOwner().GetGUID().GetCounter() && me.GetCharmInfo().IsReturning())
|
||||
if (me.GetCharmerOrOwner() != null && me.GetCharmInfo() != null && id == me.GetCharmerOrOwner().GetGUID().GetCounter() && me.GetCharmInfo().IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me.GetCharmInfo().SetIsFollowing(true);
|
||||
@@ -461,7 +461,7 @@ namespace Game.AI
|
||||
// IMPORTANT: The order in which things are checked is important, be careful if you add or remove checks
|
||||
|
||||
// Hmmm...
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return false;
|
||||
|
||||
if (!victim.IsAlive())
|
||||
@@ -496,18 +496,18 @@ namespace Game.AI
|
||||
return (me.IsWithinMeleeRange(victim) || me.GetCharmInfo().IsCommandAttack());
|
||||
|
||||
// Pets attacking something (or chasing) should only switch targets if owner tells them to
|
||||
if (me.GetVictim() && me.GetVictim() != victim)
|
||||
if (me.GetVictim() != null && me.GetVictim() != victim)
|
||||
{
|
||||
// Check if our owner selected this target and clicked "attack"
|
||||
Unit ownerTarget;
|
||||
Player owner = me.GetCharmerOrOwner().ToPlayer();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
ownerTarget = owner.GetSelectedUnit();
|
||||
else
|
||||
ownerTarget = me.GetCharmerOrOwner().GetVictim();
|
||||
|
||||
if (ownerTarget && me.GetCharmInfo().IsCommandAttack())
|
||||
return (victim.GetGUID() == ownerTarget.GetGUID());
|
||||
if (ownerTarget != null && me.GetCharmInfo().IsCommandAttack())
|
||||
return victim.GetGUID() == ownerTarget.GetGUID();
|
||||
}
|
||||
|
||||
// Follow
|
||||
@@ -552,7 +552,7 @@ namespace Game.AI
|
||||
|
||||
// dont allow pets to follow targets far away from owner
|
||||
Unit owner = me.GetCharmerOrOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
if (owner.GetExactDist(me) >= (owner.GetVisibilityRange() - 10.0f))
|
||||
return true;
|
||||
|
||||
@@ -581,30 +581,30 @@ namespace Game.AI
|
||||
_updateAlliesTimer = 10 * Time.InMilliseconds; // update friendly targets every 10 seconds, lesser checks increase performance
|
||||
|
||||
Unit owner = me.GetCharmerOrOwner();
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
return;
|
||||
|
||||
Group group = null;
|
||||
Player player = owner.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
group = player.GetGroup();
|
||||
|
||||
// only pet and owner/not in group.ok
|
||||
if (_allySet.Count == 2 && !group)
|
||||
if (_allySet.Count == 2 && group == null)
|
||||
return;
|
||||
|
||||
// owner is in group; group members filled in already (no raid . subgroupcount = whole count)
|
||||
if (group && !group.IsRaidGroup() && _allySet.Count == (group.GetMembersCount() + 2))
|
||||
if (group != null && !group.IsRaidGroup() && _allySet.Count == (group.GetMembersCount() + 2))
|
||||
return;
|
||||
|
||||
_allySet.Clear();
|
||||
_allySet.Add(me.GetGUID());
|
||||
if (group) // add group
|
||||
if (group != null) // add group
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player target = refe.GetSource();
|
||||
if (!target || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target))
|
||||
if (target == null || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target))
|
||||
continue;
|
||||
|
||||
if (target.GetGUID() == owner.GetGUID())
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace Game.AI
|
||||
|
||||
bool IsPlayerHealer(Player who)
|
||||
{
|
||||
if (!who)
|
||||
if (who == null)
|
||||
return false;
|
||||
|
||||
var chrSpec = who.GetPrimarySpecializationEntry();
|
||||
@@ -400,7 +400,7 @@ namespace Game.AI
|
||||
|
||||
bool IsPlayerRangedAttacker(Player who)
|
||||
{
|
||||
if (!who)
|
||||
if (who == null)
|
||||
return false;
|
||||
|
||||
var chrSpec = who.GetPrimarySpecializationEntry();
|
||||
@@ -455,12 +455,12 @@ namespace Game.AI
|
||||
break;
|
||||
case SpellTarget.Victim:
|
||||
pTarget = me.GetVictim();
|
||||
if (!pTarget)
|
||||
if (pTarget == null)
|
||||
return null;
|
||||
break;
|
||||
case SpellTarget.Charmer:
|
||||
pTarget = me.GetCharmer();
|
||||
if (!pTarget)
|
||||
if (pTarget == null)
|
||||
return null;
|
||||
break;
|
||||
case SpellTarget.Self:
|
||||
@@ -526,13 +526,13 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
Unit victim = me.GetVictim();
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return;
|
||||
|
||||
uint rangedAttackSpell = 0;
|
||||
|
||||
Item rangedItem = me.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.Ranged);
|
||||
ItemTemplate rangedTemplate = rangedItem ? rangedItem.GetTemplate() : null;
|
||||
ItemTemplate rangedTemplate = rangedItem != null ? rangedItem.GetTemplate() : null;
|
||||
if (rangedTemplate != null)
|
||||
{
|
||||
switch ((ItemSubClassWeapon)rangedTemplate.GetSubClass())
|
||||
@@ -610,13 +610,13 @@ namespace Game.AI
|
||||
// helper functions to determine player info
|
||||
public bool IsHealer(Player who = null)
|
||||
{
|
||||
return (!who || who == me) ? _isSelfHealer : IsPlayerHealer(who);
|
||||
return (who == null || who == me) ? _isSelfHealer : IsPlayerHealer(who);
|
||||
}
|
||||
public bool IsRangedAttacker(Player who = null) { return (!who || who == me) ? _isSelfRangedAttacker : IsPlayerRangedAttacker(who); }
|
||||
public ChrSpecialization GetSpec(Player who = null) { return (!who || who == me) ? _selfSpec : who.GetPrimarySpecialization(); }
|
||||
public bool IsRangedAttacker(Player who = null) { return (who == null || who == me) ? _isSelfRangedAttacker : IsPlayerRangedAttacker(who); }
|
||||
public ChrSpecialization GetSpec(Player who = null) { return (who == null || who == me) ? _selfSpec : who.GetPrimarySpecialization(); }
|
||||
public void SetIsRangedAttacker(bool state) { _isSelfRangedAttacker = state; } // this allows overriding of the default ranged attacker detection
|
||||
|
||||
public virtual Unit SelectAttackTarget() { return me.GetCharmer() ? me.GetCharmer().GetVictim() : null; }
|
||||
public virtual Unit SelectAttackTarget() { return me.GetCharmer() != null ? me.GetCharmer().GetVictim() : null; }
|
||||
|
||||
public enum SpellTarget
|
||||
{
|
||||
@@ -659,7 +659,7 @@ namespace Game.AI
|
||||
public override Unit SelectAttackTarget()
|
||||
{
|
||||
Unit charmer = me.GetCharmer();
|
||||
if (charmer)
|
||||
if (charmer != null)
|
||||
{
|
||||
UnitAI charmerAI = charmer.GetAI();
|
||||
if (charmerAI != null)
|
||||
@@ -925,7 +925,7 @@ namespace Game.AI
|
||||
VerifyAndPushSpellCast(spells, SPELL_RUNE_TAP, TARGET_NONE, 2);
|
||||
VerifyAndPushSpellCast(spells, SPELL_HYSTERIA, TARGET_SELF, 5);
|
||||
if (Creature* creatureCharmer = GetCharmer())
|
||||
if (!creatureCharmer.IsDungeonBoss() && !creatureCharmer.isWorldBoss())
|
||||
if (creature == nullCharmer.IsDungeonBoss() && !creatureCharmer.isWorldBoss())
|
||||
VerifyAndPushSpellCast(spells, SPELL_HYSTERIA, creatureCharmer, 15);
|
||||
VerifyAndPushSpellCast(spells, SPELL_HEART_STRIKE, TARGET_VICTIM, 2);
|
||||
if (hasFF && hasBP)
|
||||
@@ -1115,9 +1115,9 @@ namespace Game.AI
|
||||
{
|
||||
VerifyAndPushSpellCast(spells, SPELL_NOURISH, creatureCharmer, 5);
|
||||
VerifyAndPushSpellCast(spells, SPELL_WILD_GROWTH, creatureCharmer, 5);
|
||||
if (!creatureCharmer.GetAuraApplicationOfRankedSpell(SPELL_REJUVENATION, me.GetGUID()))
|
||||
if (creature == nullCharmer.GetAuraApplicationOfRankedSpell(SPELL_REJUVENATION, me.GetGUID()))
|
||||
VerifyAndPushSpellCast(spells, SPELL_REJUVENATION, creatureCharmer, 8);
|
||||
if (!creatureCharmer.GetAuraApplicationOfRankedSpell(SPELL_REGROWTH, me.GetGUID()))
|
||||
if (creature == nullCharmer.GetAuraApplicationOfRankedSpell(SPELL_REGROWTH, me.GetGUID()))
|
||||
VerifyAndPushSpellCast(spells, SPELL_REGROWTH, creatureCharmer, 8);
|
||||
uint8 lifebloomStacks = 0;
|
||||
if (Aura const* lifebloom = creatureCharmer.GetAura(SPELL_LIFEBLOOM, me.GetGUID()))
|
||||
@@ -1200,7 +1200,7 @@ namespace Game.AI
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
Creature charmer = GetCharmer();
|
||||
if (!charmer)
|
||||
if (charmer == null)
|
||||
return;
|
||||
|
||||
//kill self if charm aura has infinite duration
|
||||
@@ -1220,10 +1220,10 @@ namespace Game.AI
|
||||
if (charmer.IsEngaged())
|
||||
{
|
||||
Unit target = me.GetVictim();
|
||||
if (!target || !CanAIAttack(target))
|
||||
if (target == null || !CanAIAttack(target))
|
||||
{
|
||||
target = SelectAttackTarget();
|
||||
if (!target || !CanAIAttack(target))
|
||||
if (target == null || !CanAIAttack(target))
|
||||
{
|
||||
if (!_isFollowing)
|
||||
{
|
||||
|
||||
@@ -109,10 +109,10 @@ namespace Game.AI
|
||||
/// <param name="who"></param>
|
||||
public void AddThreat(Unit victim, float amount, Unit who = null)
|
||||
{
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return;
|
||||
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
who.GetThreatManager().AddThreat(victim, amount, null, true, true);
|
||||
@@ -126,10 +126,10 @@ namespace Game.AI
|
||||
/// <param name="who"></param>
|
||||
public void ModifyThreatByPercent(Unit victim, int pct, Unit who = null)
|
||||
{
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return;
|
||||
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
who.GetThreatManager().ModifyThreatByPercent(victim, pct);
|
||||
@@ -142,10 +142,10 @@ namespace Game.AI
|
||||
/// <param name="who"></param>
|
||||
public void ResetThreat(Unit victim, Unit who)
|
||||
{
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return;
|
||||
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
who.GetThreatManager().ResetThreat(victim);
|
||||
@@ -157,7 +157,7 @@ namespace Game.AI
|
||||
/// <param name="who"></param>
|
||||
public void ResetThreatList(Unit who = null)
|
||||
{
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
who.GetThreatManager().ResetAllThreat();
|
||||
@@ -171,10 +171,10 @@ namespace Game.AI
|
||||
/// <returns></returns>
|
||||
public float GetThreat(Unit victim, Unit who = null)
|
||||
{
|
||||
if (!victim)
|
||||
if (victim == null)
|
||||
return 0.0f;
|
||||
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
return who.GetThreatManager().GetThreat(victim);
|
||||
@@ -645,11 +645,11 @@ namespace Game.AI
|
||||
delayToRespawn = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
|
||||
if (!who)
|
||||
if (who == null)
|
||||
who = me;
|
||||
|
||||
TempSummon whoSummon = who.ToTempSummon();
|
||||
if (whoSummon)
|
||||
if (whoSummon != null)
|
||||
{
|
||||
Log.outWarn(LogFilter.ScriptsAi, $"BossAI::_DespawnAtEvade: called on a temporary summon (who: {who.GetGUID()})");
|
||||
whoSummon.UnSummon();
|
||||
@@ -705,7 +705,7 @@ namespace Game.AI
|
||||
void _JustEngagedWith()
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
if (target != null)
|
||||
AttackStart(target);
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ namespace Game.AI
|
||||
{
|
||||
summons.Summon(summon);
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
if (target != null)
|
||||
summon.GetAI().AttackStart(target);
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ namespace Game.AI
|
||||
foreach (var id in this)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(_me, id);
|
||||
if (summon && summon.IsAIEnabled() && (entry == 0 || summon.GetEntry() == entry))
|
||||
if (summon != null && summon.IsAIEnabled() && (entry == 0 || summon.GetEntry() == entry))
|
||||
{
|
||||
summon.GetAI().DoZoneInCombat();
|
||||
}
|
||||
@@ -784,7 +784,7 @@ namespace Game.AI
|
||||
foreach (var id in this)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(_me, id);
|
||||
if (!summon)
|
||||
if (summon == null)
|
||||
Remove(id);
|
||||
else if (summon.GetEntry() == entry)
|
||||
{
|
||||
@@ -800,7 +800,7 @@ namespace Game.AI
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(_me, this.FirstOrDefault());
|
||||
RemoveAt(0);
|
||||
if (summon)
|
||||
if (summon != null)
|
||||
summon.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
@@ -821,7 +821,7 @@ namespace Game.AI
|
||||
{
|
||||
foreach (var id in this)
|
||||
{
|
||||
if (!ObjectAccessor.GetCreature(_me, id))
|
||||
if (ObjectAccessor.GetCreature(_me, id) == null)
|
||||
Remove(id);
|
||||
}
|
||||
}
|
||||
@@ -847,7 +847,7 @@ namespace Game.AI
|
||||
foreach (var id in this)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(_me, id);
|
||||
if (summon && summon.GetEntry() == entry)
|
||||
if (summon != null && summon.GetEntry() == entry)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ namespace Game.AI
|
||||
foreach (var guid in summons)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(_me, guid);
|
||||
if (summon && summon.IsAIEnabled())
|
||||
if (summon != null && summon.IsAIEnabled())
|
||||
summon.GetAI().DoAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game.AI
|
||||
//see followerAI
|
||||
bool AssistPlayerInCombatAgainst(Unit who)
|
||||
{
|
||||
if (!who || !who.GetVictim())
|
||||
if (who == null || who.GetVictim() == null)
|
||||
return false;
|
||||
|
||||
if (me.HasReactState(ReactStates.Passive))
|
||||
@@ -44,7 +44,7 @@ namespace Game.AI
|
||||
return false;
|
||||
|
||||
//not a player
|
||||
if (!who.GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (who.GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself() == null)
|
||||
return false;
|
||||
|
||||
//never attack friendly
|
||||
@@ -78,15 +78,15 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
Player player = GetPlayerForEscort();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
Player member = groupRef.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
if (member.IsInMap(player))
|
||||
member.FailQuest(_escortQuest.Id);
|
||||
}
|
||||
@@ -145,15 +145,15 @@ namespace Game.AI
|
||||
bool IsPlayerOrGroupInRange()
|
||||
{
|
||||
Player player = GetPlayerForEscort();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
Player member = groupRef.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
if (me.IsWithinDistInMap(member, GetMaxPlayerDistance()))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,15 +47,15 @@ namespace Game.AI
|
||||
|
||||
// @todo need a better check for quests with time limit.
|
||||
Player player = GetLeaderForFollower();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
Player member = groupRef.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
if (member.IsInMap(player))
|
||||
member.FailQuest(_questForFollow);
|
||||
}
|
||||
@@ -104,10 +104,10 @@ namespace Game.AI
|
||||
bool questAbandoned = (_questForFollow != 0);
|
||||
|
||||
Player player = GetLeaderForFollower();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null && (maxRangeExceeded || questAbandoned); groupRef = groupRef.Next())
|
||||
{
|
||||
@@ -247,19 +247,19 @@ namespace Game.AI
|
||||
Player GetLeaderForFollower()
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(me, _leaderGUID);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.IsAlive())
|
||||
return player;
|
||||
else
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
Player member = groupRef.GetSource();
|
||||
if (member && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive())
|
||||
if (member != null && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive())
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, $"FollowerAI::GetLeaderForFollower: GetLeader changed and returned new leader. ({me.GetGUID()})");
|
||||
_leaderGUID = member.GetGUID();
|
||||
@@ -279,7 +279,7 @@ namespace Game.AI
|
||||
//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate.
|
||||
bool ShouldAssistPlayerInCombatAgainst(Unit who)
|
||||
{
|
||||
if (!who || !who.GetVictim())
|
||||
if (who == null || who.GetVictim() == null)
|
||||
return false;
|
||||
|
||||
//experimental (unknown) flag not present
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Game.AI
|
||||
// Do not use AddEscortState, removing everything from previous
|
||||
_escortState = SmartEscortState.Escorting;
|
||||
|
||||
if (invoker && invoker.IsPlayer())
|
||||
if (invoker != null && invoker.IsPlayer())
|
||||
{
|
||||
_escortNPCFlags = (uint)me.GetNpcFlags();
|
||||
me.ReplaceAllNpcFlags(NPCFlags.None);
|
||||
@@ -226,7 +226,7 @@ namespace Game.AI
|
||||
player.FailQuest(EscortQuestID);
|
||||
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
@@ -234,7 +234,7 @@ namespace Game.AI
|
||||
if (!groupGuy.IsInMap(player))
|
||||
continue;
|
||||
|
||||
if (!fail && groupGuy.IsAtGroupRewardDistance(me) && !groupGuy.GetCorpse())
|
||||
if (!fail && groupGuy.IsAtGroupRewardDistance(me) && groupGuy.GetCorpse() == null)
|
||||
groupGuy.AreaExploredOrEventHappens(EscortQuestID);
|
||||
else if (fail)
|
||||
groupGuy.FailQuest(EscortQuestID);
|
||||
@@ -340,7 +340,7 @@ namespace Game.AI
|
||||
return true;
|
||||
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
@@ -458,7 +458,7 @@ namespace Game.AI
|
||||
else
|
||||
{
|
||||
Unit target = !_followGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, _followGuid) : null;
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
me.GetMotionMaster().MoveFollow(target, _followDist, _followAngle);
|
||||
// evade is not cleared in MoveFollow, so we can't keep it
|
||||
@@ -832,7 +832,7 @@ namespace Game.AI
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
if (!me.HasReactState(ReactStates.Passive) && me.GetVictim() && !me.GetMotionMaster().HasMovementGenerator(movement =>
|
||||
if (!me.HasReactState(ReactStates.Passive) && me.GetVictim() != null && !me.GetMotionMaster().HasMovementGenerator(movement =>
|
||||
{
|
||||
return movement.GetMovementGeneratorType() == MovementGeneratorType.Chase && movement.Mode == MovementGeneratorMode.Default && movement.Priority == MovementGeneratorPriority.Normal;
|
||||
}))
|
||||
@@ -1013,7 +1013,7 @@ namespace Game.AI
|
||||
{
|
||||
if (_followArrivedTimer < diff)
|
||||
{
|
||||
if (me.FindNearestCreature(_followArrivedEntry, SharedConst.InteractionDistance, true))
|
||||
if (me.FindNearestCreature(_followArrivedEntry, SharedConst.InteractionDistance, true) != null)
|
||||
{
|
||||
StopFollow(true);
|
||||
return;
|
||||
|
||||
@@ -323,17 +323,17 @@ namespace Game.AI
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(e.Action.questOffer.questId);
|
||||
if (quest != null)
|
||||
{
|
||||
if (_me && e.Action.questOffer.directAdd == 0)
|
||||
if (_me != null && e.Action.questOffer.directAdd == 0)
|
||||
{
|
||||
if (player.CanTakeQuest(quest, true))
|
||||
{
|
||||
WorldSession session = player.GetSession();
|
||||
if (session)
|
||||
if (session != null)
|
||||
{
|
||||
PlayerMenu menu = new(session);
|
||||
menu.SendQuestGiverQuestDetails(quest, _me.GetGUID(), true, false);
|
||||
@@ -464,7 +464,7 @@ namespace Game.AI
|
||||
triggerFlag = TriggerCastFlags.FullMask;
|
||||
}
|
||||
|
||||
if (_me)
|
||||
if (_me != null)
|
||||
{
|
||||
if (e.Action.cast.castFlags.HasAnyFlag((uint)SmartCastFlags.InterruptPrevious))
|
||||
_me.InterruptNonMeleeSpells(false);
|
||||
@@ -480,7 +480,7 @@ namespace Game.AI
|
||||
else
|
||||
successfulSpellCast = true;
|
||||
}
|
||||
else if (_go)
|
||||
else if (_go != null)
|
||||
_go.CastSpell(target.ToUnit(), e.Action.cast.spell, new CastSpellExtraArgs(triggerFlag));
|
||||
}
|
||||
else
|
||||
@@ -671,7 +671,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartActions.FleeForAssist:
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
break;
|
||||
|
||||
_me.DoFleeToGetAssistance();
|
||||
@@ -690,7 +690,7 @@ namespace Game.AI
|
||||
|
||||
// If invoker was pet or charm
|
||||
Player playerCharmed = unit.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (playerCharmed && GetBaseObject() != null)
|
||||
if (playerCharmed != null && GetBaseObject() != null)
|
||||
{
|
||||
playerCharmed.GroupEventHappens(e.Action.quest.questId, GetBaseObject());
|
||||
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player {0}, group credit for quest {1}",
|
||||
@@ -712,7 +712,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartActions.CombatStop:
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
break;
|
||||
|
||||
_me.CombatStop(true);
|
||||
@@ -1174,7 +1174,7 @@ namespace Game.AI
|
||||
case SmartActions.SummonGo:
|
||||
{
|
||||
WorldObject summoner = GetBaseObjectOrUnitInvoker(unit);
|
||||
if (!summoner)
|
||||
if (summoner == null)
|
||||
break;
|
||||
|
||||
foreach (var target in targets)
|
||||
@@ -1814,7 +1814,7 @@ namespace Game.AI
|
||||
target = targets.SelectRandom();
|
||||
|
||||
Position pos = new(e.Target.x, e.Target.y, e.Target.z);
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
float x, y, z;
|
||||
target.GetPosition(out x, out y, out z);
|
||||
@@ -1889,9 +1889,9 @@ namespace Game.AI
|
||||
e.Action.sendGossipMenu.gossipMenuId, e.Action.sendGossipMenu.gossipNpcTextId);
|
||||
|
||||
// override default gossip
|
||||
if (_me)
|
||||
if (_me != null)
|
||||
((SmartAI)_me.GetAI()).SetGossipReturn(true);
|
||||
else if (_go)
|
||||
else if (_go != null)
|
||||
((SmartGameObjectAI)_go.GetAI()).SetGossipReturn(true);
|
||||
|
||||
foreach (var target in targets)
|
||||
@@ -2217,7 +2217,7 @@ namespace Game.AI
|
||||
else if (!targets.Empty())
|
||||
map = targets.First().GetMap();
|
||||
|
||||
if (map)
|
||||
if (map != null)
|
||||
map.Respawn((SpawnObjectType)e.Action.respawnData.spawnType, e.Action.respawnData.spawnId);
|
||||
else
|
||||
Log.outError(LogFilter.Sql, $"SmartScript.ProcessAction: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()}, Event {e.EventId} - tries to respawn by spawnId but does not provide a map");
|
||||
@@ -2264,7 +2264,7 @@ namespace Game.AI
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget)
|
||||
if (playerTarget != null)
|
||||
playerTarget.GetSceneMgr().PlayScene(e.Action.scene.sceneId);
|
||||
}
|
||||
|
||||
@@ -2275,7 +2275,7 @@ namespace Game.AI
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget)
|
||||
if (playerTarget != null)
|
||||
playerTarget.GetSceneMgr().CancelSceneBySceneId(e.Action.scene.sceneId);
|
||||
}
|
||||
|
||||
@@ -2370,7 +2370,7 @@ namespace Game.AI
|
||||
{
|
||||
Conversation conversation = Conversation.CreateConversation(e.Action.conversation.id, playerTarget,
|
||||
playerTarget, playerTarget.GetGUID(), null);
|
||||
if (!conversation)
|
||||
if (conversation == null)
|
||||
Log.outWarn(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CREATE_CONVERSATION: id {e.Action.conversation.id}, baseObject {baseObject?.GetName()}, target {playerTarget.GetName()} - failed to create");
|
||||
}
|
||||
}
|
||||
@@ -2652,7 +2652,7 @@ namespace Game.AI
|
||||
}
|
||||
break;
|
||||
case SmartTargets.Farthest:
|
||||
if (_me)
|
||||
if (_me != null)
|
||||
{
|
||||
Unit u = _me.GetAI().SelectTarget(SelectTargetMethod.MaxDistance, 0, new FarthestTargetSelector(_me, (float)e.Target.farthest.maxDist, e.Target.farthest.playerOnly != 0, e.Target.farthest.isInLos != 0));
|
||||
if (u != null)
|
||||
@@ -2674,12 +2674,12 @@ namespace Game.AI
|
||||
if (player != null)
|
||||
{
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
|
||||
{
|
||||
Player member = groupRef.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
if (member.IsInMap(player))
|
||||
targets.Add(member);
|
||||
}
|
||||
@@ -2797,7 +2797,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
Creature target = FindCreatureNear(scriptTrigger != null ? scriptTrigger : baseObject, e.Target.unitGUID.dbGuid);
|
||||
if (target)
|
||||
if (target != null)
|
||||
if (target != null && (e.Target.unitGUID.entry == 0 || target.GetEntry() == e.Target.unitGUID.entry))
|
||||
targets.Add(target);
|
||||
break;
|
||||
@@ -2811,7 +2811,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
GameObject target = FindGameObjectNear(scriptTrigger != null ? scriptTrigger : baseObject, e.Target.goGUID.dbGuid);
|
||||
if (target)
|
||||
if (target != null)
|
||||
if (target != null && (e.Target.goGUID.entry == 0 || target.GetEntry() == e.Target.goGUID.entry))
|
||||
targets.Add(target);
|
||||
break;
|
||||
@@ -2865,7 +2865,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
Creature target = refObj.FindNearestCreature(e.Target.unitClosest.entry, e.Target.unitClosest.dist != 0 ? e.Target.unitClosest.dist : 100, e.Target.unitClosest.dead == 0);
|
||||
if (target)
|
||||
if (target != null)
|
||||
targets.Add(target);
|
||||
break;
|
||||
}
|
||||
@@ -2882,7 +2882,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
GameObject target = refObj.FindNearestGameObject(e.Target.goClosest.entry, e.Target.goClosest.dist != 0 ? e.Target.goClosest.dist : 100);
|
||||
if (target)
|
||||
if (target != null)
|
||||
targets.Add(target);
|
||||
break;
|
||||
}
|
||||
@@ -2899,7 +2899,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
Player target = refObj.SelectNearestPlayer(e.Target.playerDistance.dist);
|
||||
if (target)
|
||||
if (target != null)
|
||||
targets.Add(target);
|
||||
break;
|
||||
}
|
||||
@@ -2911,10 +2911,10 @@ namespace Game.AI
|
||||
if (charmerOrOwnerGuid.IsEmpty())
|
||||
{
|
||||
TempSummon tempSummon = _me.ToTempSummon();
|
||||
if (tempSummon)
|
||||
if (tempSummon != null)
|
||||
{
|
||||
WorldObject summoner = tempSummon.GetSummoner();
|
||||
if (summoner)
|
||||
if (summoner != null)
|
||||
charmerOrOwnerGuid = summoner.GetGUID();
|
||||
}
|
||||
}
|
||||
@@ -2929,7 +2929,7 @@ namespace Game.AI
|
||||
else if (_go != null)
|
||||
{
|
||||
Unit owner = Global.ObjAccessor.GetUnit(_go, _go.GetOwnerGUID());
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
targets.Add(owner);
|
||||
}
|
||||
|
||||
@@ -2978,7 +2978,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartTargets.LootRecipients:
|
||||
{
|
||||
if (_me)
|
||||
if (_me != null)
|
||||
{
|
||||
foreach (ObjectGuid tapperGuid in _me.GetTapList())
|
||||
{
|
||||
@@ -2991,7 +2991,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartTargets.VehiclePassenger:
|
||||
{
|
||||
if (_me && _me.IsVehicle())
|
||||
if (_me != null && _me.IsVehicle())
|
||||
{
|
||||
foreach (var pair in _me.GetVehicleKit().Seats)
|
||||
{
|
||||
@@ -3527,7 +3527,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartEvents.DistanceCreature:
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
return;
|
||||
|
||||
Creature creature = null;
|
||||
@@ -3536,7 +3536,7 @@ namespace Game.AI
|
||||
{
|
||||
creature = FindCreatureNear(_me, e.Event.distance.guid);
|
||||
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return;
|
||||
|
||||
if (!_me.IsInRange(creature, 0, e.Event.distance.dist))
|
||||
@@ -3550,14 +3550,14 @@ namespace Game.AI
|
||||
creature = list.FirstOrDefault();
|
||||
}
|
||||
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
ProcessTimedAction(e, e.Event.distance.repeat, e.Event.distance.repeat, creature);
|
||||
|
||||
break;
|
||||
}
|
||||
case SmartEvents.DistanceGameobject:
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
return;
|
||||
|
||||
GameObject gameobject = null;
|
||||
@@ -3566,7 +3566,7 @@ namespace Game.AI
|
||||
{
|
||||
gameobject = FindGameObjectNear(_me, e.Event.distance.guid);
|
||||
|
||||
if (!gameobject)
|
||||
if (gameobject == null)
|
||||
return;
|
||||
|
||||
if (!_me.IsInRange(gameobject, 0, e.Event.distance.dist))
|
||||
@@ -3580,7 +3580,7 @@ namespace Game.AI
|
||||
gameobject = list.FirstOrDefault();
|
||||
}
|
||||
|
||||
if (gameobject)
|
||||
if (gameobject != null)
|
||||
ProcessTimedAction(e, e.Event.distance.repeat, e.Event.distance.repeat, null, 0, 0, false, null, gameobject);
|
||||
|
||||
break;
|
||||
@@ -3675,7 +3675,7 @@ namespace Game.AI
|
||||
// Delay flee for assist event if stunned or rooted
|
||||
if (e.GetActionType() == SmartActions.FleeForAssist)
|
||||
{
|
||||
if (_me && _me.HasUnitState(UnitState.Root | UnitState.LostControl))
|
||||
if (_me != null && _me.HasUnitState(UnitState.Root | UnitState.LostControl))
|
||||
{
|
||||
e.Timer = 1;
|
||||
return;
|
||||
@@ -3766,7 +3766,7 @@ namespace Game.AI
|
||||
{
|
||||
if ((_scriptType == SmartScriptType.Creature || _scriptType == SmartScriptType.GameObject
|
||||
|| _scriptType == SmartScriptType.AreaTriggerEntity || _scriptType == SmartScriptType.AreaTriggerEntityServerside)
|
||||
&& !GetBaseObject())
|
||||
&& GetBaseObject() == null)
|
||||
return;
|
||||
|
||||
if (_me != null && _me.IsInEvadeMode())
|
||||
@@ -4093,7 +4093,7 @@ namespace Game.AI
|
||||
|
||||
Unit DoSelectLowestHpFriendly(float range, uint MinHPDiff)
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
return null;
|
||||
|
||||
var u_check = new MostHPMissingInRange<Unit>(_me, range, MinHPDiff);
|
||||
@@ -4144,7 +4144,7 @@ namespace Game.AI
|
||||
|
||||
Unit DoFindClosestFriendlyInRange(float range)
|
||||
{
|
||||
if (!_me)
|
||||
if (_me == null)
|
||||
return null;
|
||||
|
||||
var u_check = new AnyFriendlyUnitInObjectRangeCheck(_me, _me, range);
|
||||
@@ -4230,11 +4230,11 @@ namespace Game.AI
|
||||
|
||||
public bool IsCharmedCreature(WorldObject obj)
|
||||
{
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
Creature creatureObj = obj.ToCreature();
|
||||
if (creatureObj)
|
||||
if (creatureObj != null)
|
||||
return creatureObj.IsCharmed();
|
||||
|
||||
return false;
|
||||
@@ -4352,10 +4352,10 @@ namespace Game.AI
|
||||
void ResetBaseObject()
|
||||
{
|
||||
WorldObject lookupRoot = _me;
|
||||
if (!lookupRoot)
|
||||
if (lookupRoot == null)
|
||||
lookupRoot = _go;
|
||||
|
||||
if (lookupRoot)
|
||||
if (lookupRoot != null)
|
||||
{
|
||||
if (!_meOrigGUID.IsEmpty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user