Fixes build. Scripts are still being updated.

This commit is contained in:
hondacrx
2024-01-24 12:02:23 -05:00
parent 1c6563718e
commit 6f4b7ddd9d
51 changed files with 268 additions and 268 deletions
@@ -68,7 +68,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 1);
if (target)
if (target != null)
DoCast(target, SpellIds.HatefulBolt);
task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15));
});
@@ -175,7 +175,7 @@ namespace Scripts.EasternKingdoms.Karazhan
public override void OnUnitDeath(Unit unit)
{
Creature creature = unit.ToCreature();
if (!creature)
if (creature == null)
return;
switch (creature.GetEntry())
@@ -239,7 +239,7 @@ namespace Scripts.EasternKingdoms.Karazhan
HandleGameObject(StageDoorLeftGUID, true);
HandleGameObject(StageDoorRightGUID, true);
GameObject sideEntrance = instance.GetGameObject(SideEntranceDoor);
if (sideEntrance)
if (sideEntrance != null)
sideEntrance.RemoveFlag(GameObjectFlags.Locked);
UpdateEncounterStateForKilledCreature(16812, null);
}
@@ -59,14 +59,14 @@ namespace Scripts.EasternKingdoms.Karazhan.MaidenOfVirtue
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 50, true);
if (target)
if (target != null)
DoCast(target, SpellIds.Holyfire);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(19));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 80, true);
if (target)
if (target != null)
DoCast(target, SpellIds.Holywrath);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25));
});
@@ -75,7 +75,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
public override void EnterEvadeMode(EvadeReason why)
{
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight)
if (midnight != null)
base._DespawnAtEvade(TimeSpan.FromSeconds(10), midnight);
me.DespawnOrUnsummon();
@@ -92,7 +92,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
_scheduler.Schedule(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(45), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
if (target != null)
DoCast(target, SpellIds.IntangiblePresence);
task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(45));
@@ -116,7 +116,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
_phase = Phases.None;
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight)
if (midnight != null)
midnight.GetAI().DoCastAOE(SpellIds.Mount, new CastSpellExtraArgs(true));
}
}
@@ -131,7 +131,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
if (summon.GetEntry() == CreatureIds.AttumenMounted)
{
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight)
if (midnight != null)
{
if (midnight.GetHealth() > me.GetHealth())
summon.SetHealth(midnight.GetHealth());
@@ -164,7 +164,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
foreach (var refe in me.GetThreatManager().GetSortedThreatList())
{
target = refe.GetVictim();
if (target && !target.IsWithinDist(me, 8.00f, false) && target.IsWithinDist(me, 25.0f, false))
if (target != null && !target.IsWithinDist(me, 8.00f, false) && target.IsWithinDist(me, 25.0f, false))
targetList.Add(target);
target = null;
@@ -189,7 +189,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
{
Talk(TextIds.SayDeath);
Unit midnight = Global.ObjAccessor.GetUnit(me, _midnightGUID);
if (midnight)
if (midnight != null)
midnight.KillSelf();
_JustDied();
@@ -217,7 +217,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
if (spellInfo.Id == SpellIds.Mount)
{
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight)
if (midnight != null)
{
_phase = Phases.None;
_scheduler.CancelAll();
@@ -235,25 +235,25 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
Talk(TextIds.SayMount);
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight)
{
if (me.IsWithinDist2d(midnight, 5.0f))
{
DoCastAOE(SpellIds.SummonAttumenMounted);
me.SetVisible(false);
me.GetMotionMaster().Clear();
midnight.SetVisible(false);
}
else
{
midnight.GetMotionMaster().MoveFollow(me, 2.0f, 0.0f);
me.GetMotionMaster().MoveFollow(midnight, 2.0f, 0.0f);
task.Repeat();
}
}
});
{
Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID);
if (midnight != null)
{
if (me.IsWithinDist2d(midnight, 5.0f))
{
DoCastAOE(SpellIds.SummonAttumenMounted);
me.SetVisible(false);
me.GetMotionMaster().Clear();
midnight.SetVisible(false);
}
else
{
midnight.GetMotionMaster().MoveFollow(me, 2.0f, 0.0f);
me.GetMotionMaster().MoveFollow(midnight, 2.0f, 0.0f);
task.Repeat();
}
}
});
}
}
}
@@ -336,7 +336,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
if (_phase == Phases.AttumenEngages)
{
Unit unit = Global.ObjAccessor.GetUnit(me, _attumenGUID);
if (unit)
if (unit != null)
Talk(TextIds.SayMidnightKill, unit);
}
}
@@ -122,8 +122,8 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (!AddGUID[i].IsEmpty())
{
Creature temp = ObjectAccessor.GetCreature(me, AddGUID[i]);
if (temp && temp.IsAlive())
if (!temp.GetVictim())
if (temp != null && temp.IsAlive())
if (temp.GetVictim() == null)
temp.GetAI().AttackStart(me.GetVictim());
}
}
@@ -144,7 +144,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
Talk(TextIds.SaySpecial);
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
target.CastSpell(target, SpellIds.Garrote, true);
InVanish = false;
@@ -155,7 +155,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
_scheduler.Schedule(TimeSpan.FromSeconds(35), MiscConst.GroupNonEnrage, task =>
{
Unit target = SelectTarget(SelectTargetMethod.MinDistance, 0, 0.0f, true, false);
if (target)
if (target != null)
DoCast(target, SpellIds.Blind);
task.Repeat(TimeSpan.FromSeconds(40));
});
@@ -193,7 +193,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
for (var i = 0; i < 4; ++i)
{
Creature creature = me.SummonCreature(AddList[i], MiscConst.Locations[i], TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(10));
if (creature)
if (creature != null)
{
AddGUID[i] = creature.GetGUID();
AddId[i] = AddList[i];
@@ -205,7 +205,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
for (byte i = 0; i < 4; ++i)
{
Creature creature = me.SummonCreature(AddId[i], MiscConst.Locations[i], TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(10));
if (creature)
if (creature != null)
AddGUID[i] = creature.GetGUID();
}
}
@@ -227,7 +227,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (!AddGUID[i].IsEmpty())
{
Creature temp = ObjectAccessor.GetCreature(me, AddGUID[i]);
if (temp)
if (temp != null)
temp.DespawnOrUnsummon();
}
}
@@ -240,7 +240,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (!AddGUID[i].IsEmpty())
{
Creature temp = ObjectAccessor.GetCreature((me), AddGUID[i]);
if (temp && temp.IsAlive())
if (temp != null && temp.IsAlive())
{
temp.GetAI().AttackStart(me.GetVictim());
DoZoneInCombat(temp);
@@ -290,7 +290,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
public void AcquireGUID()
{
Creature Moroes = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Moroes));
if (Moroes)
if (Moroes != null)
{
for (byte i = 0; i < 4; ++i)
{
@@ -307,7 +307,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (!TempGUID.IsEmpty())
{
Unit unit = Global.ObjAccessor.GetUnit(me, TempGUID);
if (unit && unit.IsAlive())
if (unit != null && unit.IsAlive())
return unit;
}
@@ -369,7 +369,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (ManaBurn_Timer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
if (target.GetPowerType() == PowerType.Mana)
DoCast(target, SpellIds.Manaburn);
ManaBurn_Timer = 5000; // 3 sec cast
@@ -379,7 +379,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (ShadowWordPain_Timer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
{
DoCast(target, SpellIds.Swpain);
ShadowWordPain_Timer = 7000;
@@ -511,7 +511,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
if (DispelMagic_Timer <= diff)
{
Unit target = RandomHelper.RAND(SelectGuestTarget(), SelectTarget(SelectTargetMethod.Random, 0, 100, true));
if (target)
if (target != null)
DoCast(target, SpellIds.Dispelmagic);
DispelMagic_Timer = 25000;
@@ -92,7 +92,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
bool IsBetween(WorldObject u1, WorldObject target, WorldObject u2) // the in-line checker
{
if (!u1 || !u2 || !target)
if (u1 == null || u2 == null || target == null)
return false;
float xn, yn, xp, yp, xh, yh;
@@ -134,7 +134,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
for (int i = 0; i < 3; ++i)
{
Creature portal = me.SummonCreature(MiscConst.PortalID[i], MiscConst.PortalCoord[pos[i]].X, MiscConst.PortalCoord[pos[i]].Y, MiscConst.PortalCoord[pos[i]].Z, 0, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(1));
if (portal)
if (portal != null)
{
PortalGUID[i] = portal.GetGUID();
portal.AddAura(MiscConst.PortalVisual[i], portal);
@@ -147,11 +147,11 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
for (int i = 0; i < 3; ++i)
{
Creature portal = ObjectAccessor.GetCreature(me, PortalGUID[i]);
if (portal)
if (portal != null)
portal.DisappearAndDie();
Creature portal1 = ObjectAccessor.GetCreature(me, BeamerGUID[i]);
if (portal1)
if (portal1 != null)
portal1.DisappearAndDie();
PortalGUID[i].Clear();
@@ -164,7 +164,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
for (int j = 0; j < 3; ++j) // j = color
{
Creature portal = ObjectAccessor.GetCreature(me, PortalGUID[j]);
if (portal)
if (portal != null)
{
// the one who's been cast upon before
Unit current = Global.ObjAccessor.GetUnit(portal, BeamTarget[j]);
@@ -176,8 +176,8 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
// get the best suitable target
foreach (var player in players)
{
if (player && player.IsAlive() // alive
&& (!target || target.GetDistance2d(portal) > player.GetDistance2d(portal)) // closer than current best
if (player != null && player.IsAlive() // alive
&& (target == null || target.GetDistance2d(portal) > player.GetDistance2d(portal)) // closer than current best
&& !player.HasAura(MiscConst.PlayerDebuff[j]) // not exhausted
&& !player.HasAura(MiscConst.PlayerBuff[(j + 1) % 3]) // not on another beam
&& !player.HasAura(MiscConst.PlayerBuff[(j + 2) % 3])
@@ -192,12 +192,12 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
target.AddAura(MiscConst.NetherBuff[j], target);
// cast visual beam on the chosen target if switched
// simple target switching isn't working . using BeamerGUID to cast (workaround)
if (!current || target != current)
if (current == null || target != current)
{
BeamTarget[j] = target.GetGUID();
// remove currently beaming portal
Creature beamer = ObjectAccessor.GetCreature(portal, BeamerGUID[j]);
if (beamer)
if (beamer != null)
{
beamer.CastSpell(target, MiscConst.PortalBeam[j], false);
beamer.DisappearAndDie();
@@ -205,7 +205,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
}
// create new one and start beaming on the target
Creature beamer1 = portal.SummonCreature(MiscConst.PortalID[j], portal.GetPositionX(), portal.GetPositionY(), portal.GetPositionZ(), portal.GetOrientation(), TempSummonType.TimedDespawn, TimeSpan.FromMinutes(1));
if (beamer1)
if (beamer1 != null)
{
beamer1.CastSpell(target, MiscConst.PortalBeam[j], false);
BeamerGUID[j] = beamer1.GetGUID();
@@ -248,7 +248,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
void HandleDoors(bool open) // Massive Door switcher
{
GameObject Door = ObjectAccessor.GetGameObject(me, instance.GetGuidData(DataTypes.GoMassiveDoor));
if (Door)
if (Door != null)
Door.SetGoState(open ? GameObjectState.Active : GameObjectState.Ready);
}
@@ -321,7 +321,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite
if (NetherbreathTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 40, true);
if (target)
if (target != null)
DoCast(target, SpellIds.Netherbreath);
NetherbreathTimer = RandomHelper.URand(5000, 7000);
}
@@ -89,7 +89,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
me.SetDisableGravity(true);
HandleTerraceDoors(true);
GameObject urn = ObjectAccessor.GetGameObject(me, instance.GetGuidData(DataTypes.GoBlackenedUrn));
if (urn)
if (urn != null)
urn.RemoveFlag(GameObjectFlags.InUse);
}
@@ -135,7 +135,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
_scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(23), MiscConst.GroupGround, task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
if (!me.HasInArc(MathF.PI, target))
DoCast(target, SpellIds.TailSweep);
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(30));
@@ -147,7 +147,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
_scheduler.Schedule(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(18), MiscConst.GroupGround, task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
DoCast(target, SpellIds.CharredEarth);
task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(21));
});
@@ -159,7 +159,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
_scheduler.Schedule(TimeSpan.FromSeconds(82), MiscConst.GroupGround, task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
DoCast(target, SpellIds.DistractingAsh);
});
}
@@ -262,7 +262,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
{
ResetThreatList();
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
{
me.SetFacingToObject(target);
DoCast(target, SpellIds.RainOfBones);
@@ -272,14 +272,14 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
_scheduler.Schedule(TimeSpan.FromSeconds(21), MiscConst.GroupFly, task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
DoCast(target, SpellIds.SmokingBlastT);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(7));
});
_scheduler.Schedule(TimeSpan.FromSeconds(17), MiscConst.GroupFly, task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
if (target != null)
DoCast(target, SpellIds.SmokingBlast);
task.Repeat(TimeSpan.FromMilliseconds(1400));
});
@@ -361,7 +361,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane
return false;
Creature nightbane = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Nightbane));
if (nightbane)
if (nightbane != null)
{
me.SetFlag(GameObjectFlags.InUse);
nightbane.GetAI().DoAction(MiscConst.ActionSummon);
@@ -137,9 +137,9 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (instance.GetData(DataTypes.OperaOzDeathcount) == 4)
{
Creature pCrone = creature.SummonCreature(CreatureIds.Crone, -10891.96f, -1755.95f, creature.GetPositionZ(), 4.64f, TempSummonType.TimedOrDeadDespawn, TimeSpan.FromHours(2));
if (pCrone)
if (pCrone != null)
{
if (creature.GetVictim())
if (creature.GetVictim() != null)
pCrone.GetAI().AttackStart(creature.GetVictim());
}
}
@@ -162,7 +162,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
target.SetFullHealth();
target.SetStandState(UnitStandStateType.Stand);
target.CastSpell(target, SpellIds.ResVisual, true);
if (target.GetVictim())
if (target.GetVictim() != null)
{
target.GetMotionMaster().MoveChase(target.GetVictim());
target.GetAI().AttackStart(target.GetVictim());
@@ -291,7 +291,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
void SummonTito()
{
Creature pTito = me.SummonCreature(CreatureIds.Tito, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(30));
if (pTito)
if (pTito != null)
{
Talk(TextIds.SayDorotheeSummon);
pTito.GetAI<npc_tito>().DorotheeGUID = me.GetGUID();
@@ -331,7 +331,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (!DorotheeGUID.IsEmpty())
{
Creature Dorothee = ObjectAccessor.GetCreature(me, DorotheeGUID);
if (Dorothee && Dorothee.IsAlive())
if (Dorothee != null && Dorothee.IsAlive())
{
Dorothee.GetAI<boss_dorothee>().TitoDied = true;
Talk(TextIds.SayDorotheeTitoDeath, Dorothee);
@@ -451,7 +451,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (BrainWipeTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.BrainWipe);
BrainWipeTimer = 20000;
}
@@ -737,7 +737,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (CycloneTimer <= diff)
{
Creature Cyclone = DoSpawnCreature(CreatureIds.Cyclone, RandomHelper.URand(0, 9), RandomHelper.URand(0, 9), 0, 0, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(15));
if (Cyclone)
if (Cyclone != null)
Cyclone.CastSpell(Cyclone, SpellIds.CycloneVisual, true);
CycloneTimer = 30000;
}
@@ -808,7 +808,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
player.CloseGossipMenu();
Creature pBigBadWolf = me.SummonCreature(CreatureIds.BigBadWolf, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation(), TempSummonType.TimedOrDeadDespawn, TimeSpan.FromHours(2));
if (pBigBadWolf)
if (pBigBadWolf != null)
pBigBadWolf.GetAI().AttackStart(player);
me.DespawnOrUnsummon();
@@ -887,7 +887,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (!IsChasing)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
{
Talk(TextIds.SayWolfHood);
DoCast(target, SpellIds.LittleRedRidingHood, new CastSpellExtraArgs(true));
@@ -905,7 +905,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
IsChasing = false;
Unit target = Global.ObjAccessor.GetUnit(me, HoodGUID);
if (target)
if (target != null)
{
HoodGUID.Clear();
if (GetThreat(target) != 0f)
@@ -1068,7 +1068,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (RomuloDead)
{
Creature Romulo = ObjectAccessor.GetCreature(me, RomuloGUID);
if (Romulo)
if (Romulo != null)
{
Romulo.SetUninteractible(false);
Romulo.GetMotionMaster().Clear();
@@ -1082,7 +1082,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
//if not already returned, then romulo is alive and we can pretend die
Creature Romulo1 = (ObjectAccessor.GetCreature((me), RomuloGUID));
if (Romulo1)
if (Romulo1 != null)
{
MiscConst.PretendToDie(me);
IsFakingDeath = true;
@@ -1148,7 +1148,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (SummonRomuloTimer <= diff)
{
Creature pRomulo = me.SummonCreature(CreatureIds.Romulo, MiscConst.RomuloX, MiscConst.RomuloY, me.GetPositionZ(), 0, TempSummonType.TimedOrDeadDespawn, TimeSpan.FromHours(2));
if (pRomulo)
if (pRomulo != null)
{
RomuloGUID = pRomulo.GetGUID();
pRomulo.GetAI<boss_romulo>().JulianneGUID = me.GetGUID();
@@ -1170,7 +1170,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
Phase = RAJPhase.Both;
IsFakingDeath = false;
if (me.GetVictim())
if (me.GetVictim() != null)
AttackStart(me.GetVictim());
ResurrectSelfTimer = 0;
@@ -1187,7 +1187,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (ResurrectTimer <= diff)
{
Creature Romulo = ObjectAccessor.GetCreature(me, RomuloGUID);
if (Romulo && Romulo.GetAI<boss_romulo>().IsFakingDeath)
if (Romulo != null && Romulo.GetAI<boss_romulo>().IsFakingDeath)
{
Talk(TextIds.SayJulianneResurrect);
MiscConst.Resurrect(Romulo);
@@ -1202,7 +1202,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (BlindingPassionTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.BlindingPassion);
BlindingPassionTimer = RandomHelper.URand(30000, 45000);
}
@@ -1227,7 +1227,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (RandomHelper.URand(0, 1) != 0 && SummonedRomulo)
{
Creature Romulo = (ObjectAccessor.GetCreature((me), RomuloGUID));
if (Romulo && Romulo.IsAlive() && !RomuloDead)
if (Romulo != null && Romulo.IsAlive() && !RomuloDead)
DoCast(Romulo, SpellIds.EternalAffection);
}
else DoCast(me, SpellIds.EternalAffection);
@@ -1303,7 +1303,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
Phase = RAJPhase.Both;
Creature Julianne = ObjectAccessor.GetCreature(me, JulianneGUID);
if (Julianne)
if (Julianne != null)
{
Julianne.GetAI<boss_julianne>().RomuloDead = true;
Julianne.GetAI<boss_julianne>().ResurrectSelfTimer = 10000;
@@ -1318,7 +1318,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (JulianneDead)
{
Creature Julianne = ObjectAccessor.GetCreature(me, JulianneGUID);
if (Julianne)
if (Julianne != null)
{
Julianne.SetUninteractible(false);
Julianne.GetMotionMaster().Clear();
@@ -1330,7 +1330,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
}
Creature Julianne1 = ObjectAccessor.GetCreature(me, JulianneGUID);
if (Julianne1)
if (Julianne1 != null)
{
MiscConst.PretendToDie(me);
IsFakingDeath = true;
@@ -1350,7 +1350,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (!JulianneGUID.IsEmpty())
{
Creature Julianne = ObjectAccessor.GetCreature(me, JulianneGUID);
if (Julianne && Julianne.GetVictim())
if (Julianne != null && Julianne.GetVictim() != null)
{
AddThreat(Julianne.GetVictim(), 1.0f);
AttackStart(Julianne.GetVictim());
@@ -1387,7 +1387,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (ResurrectTimer <= diff)
{
Creature Julianne = (ObjectAccessor.GetCreature((me), JulianneGUID));
if (Julianne && Julianne.GetAI<boss_julianne>().IsFakingDeath)
if (Julianne != null && Julianne.GetAI<boss_julianne>().IsFakingDeath)
{
Talk(TextIds.SayRomuloResurrect);
MiscConst.Resurrect(Julianne);
@@ -1402,7 +1402,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (BackwardLungeTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 1, 100, true);
if (target && !me.HasInArc(MathF.PI, target))
if (target != null && !me.HasInArc(MathF.PI, target))
{
DoCast(target, SpellIds.BackwardLunge);
BackwardLungeTimer = RandomHelper.URand(15000, 30000);
@@ -1420,7 +1420,7 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera
if (DeadlySwatheTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.DeadlySwathe);
DeadlySwatheTimer = RandomHelper.URand(15000, 25000);
}
@@ -76,10 +76,10 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
public override void KilledUnit(Unit who)
{
Unit unit = Global.ObjAccessor.GetUnit(me, Malchezaar);
if (unit)
if (unit != null)
{
Creature creature = unit.ToCreature();
if (creature)
if (creature != null)
creature.GetAI().KilledUnit(who);
}
}
@@ -96,7 +96,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
{
Creature pMalchezaar = ObjectAccessor.GetCreature(me, Malchezaar);
if (pMalchezaar && pMalchezaar.IsAlive())
if (pMalchezaar != null && pMalchezaar.IsAlive())
pMalchezaar.GetAI<boss_malchezaar>().Cleanup(me, Point);
});
}
@@ -104,7 +104,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
public override void DamageTaken(Unit done_by, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (!done_by || done_by.GetGUID() != Malchezaar)
if (done_by == null || done_by.GetGUID() != Malchezaar)
damage = 0;
}
}
@@ -231,7 +231,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
foreach (var guid in infernals)
{
Unit pInfernal = Global.ObjAccessor.GetUnit(me, guid);
if (pInfernal && pInfernal.IsAlive())
if (pInfernal != null && pInfernal.IsAlive())
{
pInfernal.SetVisible(false);
pInfernal.SetDeathState(DeathState.JustDied);
@@ -246,7 +246,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
for (byte i = 0; i < 2; ++i)
{
Unit axe = Global.ObjAccessor.GetUnit(me, axes[i]);
if (axe && axe.IsAlive())
if (axe != null && axe.IsAlive())
axe.KillSelf();
axes[i].Clear();
}
@@ -283,7 +283,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
uint i = 0;
foreach (var target in targets)
{
if (target)
if (target != null)
{
enfeeble_targets[i] = target.GetGUID();
enfeeble_health[i] = target.GetHealth();
@@ -303,7 +303,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
for (byte i = 0; i < 5; ++i)
{
Unit target = Global.ObjAccessor.GetUnit(me, enfeeble_targets[i]);
if (target && target.IsAlive())
if (target != null && target.IsAlive())
target.SetHealth(enfeeble_health[i]);
enfeeble_targets[i].Clear();
enfeeble_health[i] = 0;
@@ -324,7 +324,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
Creature infernal = me.SummonCreature(MiscConst.NetherspiteInfernal, pos, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(3));
if (infernal)
if (infernal != null)
{
infernal.SetDisplayId(MiscConst.InfernalModelInvisible);
infernal.SetFaction(me.GetFaction());
@@ -354,7 +354,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
if (me.HasUnitState(UnitState.Stunned)) // While shifting to phase 2 malchezaar stuns himself
return;
if (me.GetVictim() && me.GetTarget() != me.GetVictim().GetGUID())
if (me.GetVictim() != null && me.GetTarget() != me.GetVictim().GetGUID())
me.SetTarget(me.GetVictim().GetGUID());
if (phase == 1)
@@ -400,12 +400,12 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
for (byte i = 0; i < 2; ++i)
{
Creature axe = me.SummonCreature(MiscConst.MalchezarsAxe, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), 0, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(1));
if (axe)
if (axe != null)
{
axe.SetUninteractible(true);
axe.SetFaction(me.GetFaction());
axes[i] = axe.GetGUID();
if (target)
if (target != null)
{
axe.GetAI().AttackStart(target);
AddThreat(target, 10000000.0f, axe);
@@ -440,14 +440,14 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
AxesTargetSwitchTimer = RandomHelper.URand(7500, 20000);
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
{
for (byte i = 0; i < 2; ++i)
{
Unit axe = Global.ObjAccessor.GetUnit(me, axes[i]);
if (axe)
if (axe != null)
{
if (axe.GetVictim())
if (axe.GetVictim() != null)
ResetThreat(axe.GetVictim(), axe);
AddThreat(target, 1000000.0f, axe);
}
@@ -459,7 +459,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
if (AmplifyDamageTimer <= diff)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.AmplifyDamage);
AmplifyDamageTimer = RandomHelper.URand(20000, 30000);
}
@@ -491,7 +491,7 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
else // anyone but the tank
target = SelectTarget(SelectTargetMethod.Random, 1, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.SwPain);
SWPainTimer = 20000;
@@ -522,13 +522,13 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar
if (me.IsWithinMeleeRange(me.GetVictim()) && !me.IsNonMeleeSpellCast(false))
{
//Check for base attack
if (me.IsAttackReady() && me.GetVictim())
if (me.IsAttackReady() && me.GetVictim() != null)
{
me.AttackerStateUpdate(me.GetVictim());
me.ResetAttackTimer();
}
//Check for offhand attack
if (me.IsAttackReady(WeaponAttackType.OffAttack) && me.GetVictim())
if (me.IsAttackReady(WeaponAttackType.OffAttack) && me.GetVictim() != null)
{
me.AttackerStateUpdate(me.GetVictim(), WeaponAttackType.OffAttack);
me.ResetAttackTimer(WeaponAttackType.OffAttack);
@@ -182,7 +182,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
uint i = 0;
foreach (var unit in targets)
{
if (unit)
if (unit != null)
{
FlameWreathTarget[i] = unit.GetGUID();
FWTargPosX[i] = unit.GetPositionX();
@@ -282,7 +282,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
if (!me.IsNonMeleeSpellCast(false))
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (!target)
if (target == null)
return;
uint[] Spells = new uint[3];
@@ -325,7 +325,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
break;
case 1:
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true);
if (target)
if (target != null)
DoCast(target, SpellIds.Chainsofice);
break;
}
@@ -387,7 +387,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
Talk(TextIds.SayBlizzard);
Creature pSpawn = me.SummonCreature(CreatureIds.AranBlizzard, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(25));
if (pSpawn)
if (pSpawn != null)
{
pSpawn.SetFaction(me.GetFaction());
pSpawn.CastSpell(pSpawn, SpellIds.CircularBlizzard, false);
@@ -406,7 +406,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
for (uint i = 0; i < 4; ++i)
{
Creature unit = me.SummonCreature(CreatureIds.WaterElemental, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(90));
if (unit)
if (unit != null)
{
unit.Attack(me.GetVictim(), true);
unit.SetFaction(me.GetFaction());
@@ -421,7 +421,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
for (uint i = 0; i < 5; ++i)
{
Creature unit = me.SummonCreature(CreatureIds.ShadowOfAran, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(5));
if (unit)
if (unit != null)
{
unit.Attack(me.GetVictim(), true);
unit.SetFaction(me.GetFaction());
@@ -449,7 +449,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
continue;
Unit unit = Global.ObjAccessor.GetUnit(me, FlameWreathTarget[i]);
if (unit && !unit.IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
if (unit != null && !unit.IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{
unit.CastSpell(unit, 20476, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
.SetOriginalCaster(me.GetGUID()));
@@ -500,7 +500,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
return;
Player player = who.ToPlayer();
if (!player)
if (player == null)
return;
foreach (uint id in AtieshStaves)
@@ -520,7 +520,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran
bool PlayerHasWeaponEquipped(Player player, uint itemEntry)
{
Item item = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
if (item && item.GetEntry() == itemEntry)
if (item != null && item.GetEntry() == itemEntry)
return true;
return false;
@@ -55,7 +55,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{
Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0);
if (target)
if (target != null)
DoCast(target, SpellIds.ShadowBolt);
task.Repeat(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(10));
});
@@ -67,7 +67,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true);
if (target)
if (target != null)
{
DoCast(target, SpellIds.Sacrifice, new CastSpellExtraArgs(true));
target.CastSpell(target, SpellIds.SummonDemonchains, true);
@@ -176,7 +176,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof
public override void JustDied(Unit killer)
{
Unit sacrifice = Global.ObjAccessor.GetUnit(me, _sacrificeGUID);
if (sacrifice)
if (sacrifice != null)
sacrifice.RemoveAurasDueToSpell(SpellIds.Sacrifice);
}
}