diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs index 0a831533d..5f92eb4c5 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs @@ -63,7 +63,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal if (instance != null) { Creature alizabal = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.Alizabal)); - if (alizabal) + if (alizabal != null) alizabal.GetAI().DoAction(ActionIds.Intro); } return true; @@ -157,7 +157,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal if (!_skewer) { Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0); - if (target) + if (target != null) { DoCast(target, SpellIds.Skewer, new CastSpellExtraArgs(true)); Talk(TextIds.SaySkewer); @@ -169,7 +169,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal else if (!_hate) { Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me)); - if (target) + if (target != null) { DoCast(target, SpellIds.SeethingHate, new CastSpellExtraArgs(true)); Talk(TextIds.SayHate); @@ -191,7 +191,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal if (!_hate) { Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me)); - if (target) + if (target != null) { DoCast(target, SpellIds.SeethingHate, new CastSpellExtraArgs(true)); Talk(TextIds.SayHate); @@ -202,7 +202,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal else if (!_skewer) { Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0); - if (target) + if (target != null) { DoCast(target, SpellIds.Skewer, new CastSpellExtraArgs(true)); Talk(TextIds.SaySkewer); @@ -229,7 +229,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal me.SetSpeedRate(UnitMoveType.Run, 4.0f); me.SetSpeedRate(UnitMoveType.Walk, 4.0f); Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me)); - if (target) + if (target != null) me.GetMotionMaster().MovePoint(PointIds.Storm, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ()); _events.ScheduleEvent(EventIds.MoveStorm, TimeSpan.FromMilliseconds(4050)); break; diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs index 87e60e405..b90d20da9 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs @@ -85,7 +85,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar for (sbyte i = 0; i < MiscConst.MaxOccutharVehicleSeats; ++i) { Unit vehicle = _vehicle.GetPassenger(i); - if (vehicle) + if (vehicle != null) vehicle.CastSpell(summon, SpellIds.FocusedFireVisual); } } @@ -259,13 +259,13 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar { public override bool Load() { - return GetCaster() && GetCaster().GetTypeId() == TypeId.Unit; + return GetCaster() != null && GetCaster().GetTypeId() == TypeId.Unit; } void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { Unit caster = GetCaster(); - if (caster) + if (caster != null) { if (IsExpired()) caster.CastSpell((WorldObject)null, SpellIds.OccutharsDestuction, new CastSpellExtraArgs(aurEff)); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs index dd0a769db..ac24cc14f 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs @@ -56,7 +56,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.RomoggBonec Talk(TextIds.YellDeath); Creature raz = instance.GetCreature(DataTypes.RazTheCrazed); - if (raz) + if (raz != null) raz.GetAI().SetData(MiscConst.TypeRaz, MiscConst.DataRomoggDead); } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs index b5e931c06..3c5e90890 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs @@ -41,7 +41,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.AmbassadorFl void SummonSpirit(Unit victim) { Creature spirit = DoSpawnCreature(9178, RandomHelper.FRand(-9, 9), RandomHelper.FRand(-9, 9), 0, 0, Framework.Constants.TempSummonType.TimedOrCorpseDespawn, TimeSpan.FromSeconds(60)); - if (spirit) + if (spirit != null) spirit.GetAI().AttackStart(victim); } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs index 6a53aad91..7f79cfd02 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs @@ -219,7 +219,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre if (!players.Empty()) { Group group = players[0].GetGroup(); - if (group) + if (group != null) if (group.IsLFGGroup()) Global.LFGMgr.FinishDungeon(group.GetGUID(), 287, me.GetMap()); } @@ -228,7 +228,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre void SummonSister(uint entry) { Creature sister = me.SummonCreature(entry, me.GetPosition(), TempSummonType.DeadDespawn); - if (sister) + if (sister != null) DoZoneInCombat(sister); } @@ -275,7 +275,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre _scheduler.Schedule(TimeSpan.FromSeconds(2), mugChuck => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, false, true, -(int)SpellIds.HasDarkBrewmaidensBrew); - if (target) + if (target != null) DoCast(target, SpellIds.ChuckMug); mugChuck.Repeat(TimeSpan.FromSeconds(4)); }); @@ -305,7 +305,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre public override void IsSummonedBy(WorldObject summoner) { Creature coren = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.DataCoren)); - if (coren) + if (coren != null) coren.GetAI().JustSummoned(me); } } @@ -356,7 +356,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre _scheduler.Schedule(TimeSpan.FromSeconds(4), context => { GameObject trap = me.GetLinkedTrap(); - if (trap) + if (trap != null) { trap.SetLootState(LootState.Activated); trap.UseDoorOrButton(); @@ -396,7 +396,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre { Unit caster = GetCaster(); - targets.RemoveAll(new UnitAuraCheck(true, SpellIds.HasDarkBrewmaidensBrew)); + targets.RemoveAll(new UnitAuraCheck(true, SpellIds.HasDarkBrewmaidensBrew)); if (targets.Count > 1) { diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs index 9750db178..b31691f9c 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs @@ -46,7 +46,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Draganthauri _scheduler.Schedule(TimeSpan.FromSeconds(4), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) DoCast(target, SpellIds.Handofthaurissan); task.Repeat(TimeSpan.FromSeconds(5)); }); @@ -66,7 +66,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Draganthauri public override void JustDied(Unit killer) { Creature moira = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.DataMoira)); - if (moira) + if (moira != null) { moira.GetAI().EnterEvadeMode(); moira.SetFaction((uint)FactionTemplates.Friendly); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs index bdfc23bb4..fb8a2e459 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs @@ -77,14 +77,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.GeneralAnger void SummonAdd(Unit victim) { Creature SummonedAdd = DoSpawnCreature(8901, RandomHelper.IRand(-14, 14), RandomHelper.IRand(-14, 14), 0, 0, TempSummonType.TimedOrCorpseDespawn, TimeSpan.FromSeconds(120)); - if (SummonedAdd) + if (SummonedAdd != null) SummonedAdd.GetAI().AttackStart(victim); } void SummonMedic(Unit victim) { Creature SummonedMedic = DoSpawnCreature(8894, RandomHelper.IRand(-9, 9), RandomHelper.IRand(-9, 9), 0, 0, TempSummonType.TimedOrCorpseDespawn, TimeSpan.FromSeconds(120)); - if (SummonedMedic) + if (SummonedMedic != null) SummonedMedic.GetAI().AttackStart(victim); } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs index 6055e2737..f57148917 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs @@ -32,14 +32,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.HighInterrog _scheduler.Schedule(TimeSpan.FromSeconds(4), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.Shadowwordpain); task.Repeat(TimeSpan.FromSeconds(7)); }); _scheduler.Schedule(TimeSpan.FromSeconds(14), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.Manaburn); task.Repeat(TimeSpan.FromSeconds(10)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/InstanceBlackrockDepths.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/InstanceBlackrockDepths.cs index 9cf5f05d0..2ece9f62c 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/InstanceBlackrockDepths.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/InstanceBlackrockDepths.cs @@ -322,12 +322,12 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths if (GhostKillCount < MiscConst.TombOfSevenBossNum && !TombBossGUIDs[TombEventCounter].IsEmpty()) { Creature boss = instance.GetCreature(TombBossGUIDs[TombEventCounter]); - if (boss) + if (boss != null) { boss.SetFaction((uint)FactionTemplates.DarkIronDwarves); boss.SetImmuneToPC(false); Unit target = boss.SelectNearestTarget(500); - if (target) + if (target != null) boss.GetAI().AttackStart(target); } } @@ -340,7 +340,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths for (byte i = 0; i < MiscConst.TombOfSevenBossNum; ++i) { Creature boss = instance.GetCreature(TombBossGUIDs[i]); - if (boss) + if (boss != null) { if (!boss.IsAlive()) boss.Respawn(); @@ -388,7 +388,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths for (byte i = 0; i < MiscConst.TombOfSevenBossNum; ++i) { Creature boss = instance.GetCreature(TombBossGUIDs[i]); - if (boss) + if (boss != null) { if (!boss.IsAlive()) { diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs index 22b9de9ba..fc6873001 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs @@ -147,7 +147,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.TombOfSeven _scheduler.Schedule(TimeSpan.FromSeconds(18), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.Immolate); task.Repeat(TimeSpan.FromSeconds(25)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs index 74166b201..465d71c37 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs @@ -92,10 +92,10 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Gyth { me.AddAura(SpellIds.RendMounts, me); GameObject portcullis = me.FindNearestGameObject(GameObjectsIds.DrPortcullis, 40.0f); - if (portcullis) + if (portcullis != null) portcullis.UseDoorOrButton(); Creature victor = me.FindNearestCreature(CreaturesIds.LordVictorNefarius, 75.0f, true); - if (victor) + if (victor != null) victor.GetAI().SetData(1, 1); task.Schedule(TimeSpan.FromSeconds(2), summonTask2 => diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/InstanceBlackrockSpire.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/InstanceBlackrockSpire.cs index 7f5476e8c..912c48fe5 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/InstanceBlackrockSpire.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/InstanceBlackrockSpire.cs @@ -365,7 +365,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire if (GetBossState(DataTypes.PyrogaurdEmberseer) == EncounterState.NotStarted) { Creature Emberseer = instance.GetCreature(PyroguardEmberseer); - if (Emberseer) + if (Emberseer != null) Emberseer.GetAI().SetData(1, 1); } break; @@ -395,7 +395,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire foreach (var itr in _incarceratorList) { Creature creature = instance.GetCreature(itr); - if (creature) + if (creature != null) creature.Respawn(); } break; @@ -513,13 +513,13 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire runecreaturelist[i].Clear(); GameObject rune = instance.GetGameObject(go_roomrunes[i]); - if (rune) + if (rune != null) { for (byte j = 0; j < 3; ++j) { List creatureList = rune.GetCreatureListWithEntryInGrid(BRSMiscConst.DragonspireMobs[j], 15.0f); foreach (var creature in creatureList) - if (creature) + if (creature != null) runecreaturelist[i].Add(creature.GetGUID()); } } @@ -535,7 +535,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire { bool _mobAlive = false; rune = instance.GetGameObject(go_roomrunes[i]); - if (!rune) + if (rune == null) continue; if (rune.GetGoState() == GameObjectState.Active) @@ -543,7 +543,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire foreach (ObjectGuid guid in runecreaturelist[i]) { mob = instance.GetCreature(guid); - if (mob && mob.IsAlive()) + if (mob != null && mob.IsAlive()) _mobAlive = true; } } @@ -587,10 +587,10 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire { SetBossState(DataTypes.DragonspireRoom, EncounterState.Done); GameObject door1 = instance.GetGameObject(go_emberseerin); - if (door1) + if (door1 != null) HandleGameObject(ObjectGuid.Empty, true, door1); GameObject door2 = instance.GetGameObject(go_doors); - if (door2) + if (door2 != null) HandleGameObject(ObjectGuid.Empty, true, door2); } } @@ -636,7 +636,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) { - if (player && player.IsAlive()) + if (player != null && player.IsAlive()) { InstanceScript instance = player.GetInstanceScript(); if (instance != null) @@ -657,14 +657,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) { - if (player && player.IsAlive()) + if (player != null && player.IsAlive()) { InstanceScript instance = player.GetInstanceScript(); if (instance == null) return false; Creature rend = player.FindNearestCreature(CreaturesIds.WarchiefRendBlackhand, 50.0f); - if (rend) + if (rend != null) { rend.GetAI().SetData(BRSMiscConst.Areatrigger, BRSMiscConst.AreatriggerBlackrockStadium); return true; @@ -688,7 +688,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire if (instance != null) { Creature infiltrator = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.ScarshieldInfiltrator)); - if (infiltrator) + if (infiltrator != null) { if (player.GetLevel() >= 57) infiltrator.GetAI().SetData(1, 1); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs index 7c1ffeb42..271067591 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs @@ -86,13 +86,13 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.OverlordWyrmt if (!Summoned && HealthBelowPct(51)) { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true); - if (target) + if (target != null) { Creature warlord = me.SummonCreature(MiscConst.NpcSpirestoneWarlord, MiscConst.SummonLocation1, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(5)); - if (warlord) + if (warlord != null) warlord.GetAI().AttackStart(target); Creature berserker = me.SummonCreature(MiscConst.NpcSmolderthornBerserker, MiscConst.SummonLocation2, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(5)); - if (berserker) + if (berserker != null) berserker.GetAI().AttackStart(target); Summoned = true; } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs index c399145ca..de5637e0b 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs @@ -96,7 +96,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe List creatureList = me.GetCreatureListWithEntryInGrid(CreaturesIds.BlackhandIncarcerator, 35.0f); foreach (var creature in creatureList) { - if (creature) + if (creature != null) { creature.SetImmuneToAll(false); creature.InterruptSpell(CurrentSpellTypes.Channeled); @@ -136,7 +136,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe _scheduler.Schedule(TimeSpan.FromSeconds(14), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true); - if (target) + if (target != null) DoCast(target, SpellIds.Pyroblast); task.Repeat(TimeSpan.FromSeconds(15)); }); @@ -186,25 +186,25 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe { // update all runes GameObject rune1 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune1)); - if (rune1) + if (rune1 != null) rune1.SetGoState(state); GameObject rune2 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune2)); - if (rune2) + if (rune2 != null) rune2.SetGoState(state); GameObject rune3 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune3)); - if (rune3) + if (rune3 != null) rune3.SetGoState(state); GameObject rune4 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune4)); - if (rune4) + if (rune4 != null) rune4.SetGoState(state); GameObject rune5 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune5)); - if (rune5) + if (rune5 != null) rune5.SetGoState(state); GameObject rune6 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune6)); - if (rune6) + if (rune6 != null) rune6.SetGoState(state); GameObject rune7 = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GameObjectsIds.EmberseerRune7)); - if (rune7) + if (rune7 != null) rune7.SetGoState(state); } @@ -234,7 +234,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe // Had to do this because CallForHelp will ignore any npcs without Los List creatureList = me.GetCreatureListWithEntryInGrid(CreaturesIds.BlackhandIncarcerator, 60.0f); foreach (var creature in creatureList) - if (creature) + if (creature != null) DoZoneInCombat(creature); // GetAI().AttackStart(me.GetVictim()); _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(16), task => diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs index 40add4d3b..d855765bc 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs @@ -224,7 +224,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.RendBlackhand break; case 11: Creature gyth = me.FindNearestCreature(CreaturesIds.Gyth, 10.0f, true); - if (gyth) + if (gyth != null) gyth.GetAI().SetData(1, 1); me.DespawnOrUnsummon(TimeSpan.FromSeconds(1), TimeSpan.FromDays(7)); break; diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs index 7e16e1ddc..aa43f1b2e 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs @@ -39,7 +39,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.ShadowHunterV _scheduler.Schedule(TimeSpan.FromSeconds(8), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true); - if (target) + if (target != null) DoCast(target, SpellIds.Hex); task.Repeat(TimeSpan.FromSeconds(15)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs index 1542c6388..16c9ad875 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs @@ -38,7 +38,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Thebeast _scheduler.Schedule(TimeSpan.FromSeconds(3), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100, true); - if (target) + if (target != null) DoCast(target, SpellIds.Immolate); task.Repeat(TimeSpan.FromSeconds(8)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs index f79747565..51240bf23 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs @@ -205,7 +205,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair var players = me.GetMap().GetPlayers(); foreach (var player in players) { - if (player) + if (player != null) { DoCast(player, RandomHelper.RAND(SpellIds.BroodafBlue, SpellIds.BroodafBlack, SpellIds.BroodafRed, SpellIds.BroodafBronze, SpellIds.BroodafGreen), new CastSpellExtraArgs(true)); @@ -265,11 +265,11 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair _instance.SetBossState(DataTypes.Chromaggus, EncounterState.InProgress); Creature creature = _instance.GetCreature(DataTypes.Chromaggus); - if (creature) + if (creature != null) creature.GetAI().JustEngagedWith(player); GameObject go = _instance.GetGameObject(DataTypes.GoChromaggusDoor); - if (go) + if (go != null) _instance.HandleGameObject(ObjectGuid.Empty, true, go); } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/InstanceBlackwingLair.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/InstanceBlackwingLair.cs index e975cbb9b..10b03c8e1 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/InstanceBlackwingLair.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/InstanceBlackwingLair.cs @@ -253,7 +253,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair foreach (var guid in EggList) { GameObject egg = instance.GetGameObject(guid); - if (egg) + if (egg != null) egg.SetLootState(LootState.JustDeactivated); } } @@ -264,7 +264,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair { case EncounterState.NotStarted: Creature nefarian = GetCreature(DataTypes.Nefarian); - if (nefarian) + if (nefarian != null) nefarian.DespawnOrUnsummon(); break; case EncounterState.Fail: @@ -299,7 +299,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair if (++EggCount == 15) { Creature razor = GetCreature(DataTypes.RazorgoreTheUntamed); - if (razor) + if (razor != null) { SetData(BWLMisc.DataEggEvent, (uint)EncounterState.Done); razor.RemoveAurasDueToSpell(42013); // MindControl @@ -337,7 +337,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair for (uint i = RandomHelper.URand(2, 5); i > 0; --i) { Creature summon = instance.SummonCreature(BWLMisc.Entry[RandomHelper.URand(0, 4)], BWLMisc.SummonPosition[RandomHelper.URand(0, 7)]); - if (summon) + if (summon != null) summon.GetAI().DoZoneInCombat(); } _events.ScheduleEvent(EventIds.RazorSpawn, TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(17)); @@ -345,12 +345,12 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair case EventIds.RazorPhaseTwo: _events.CancelEvent(EventIds.RazorSpawn); Creature razor = GetCreature(DataTypes.RazorgoreTheUntamed); - if (razor) + if (razor != null) razor.GetAI().DoAction(BWLMisc.ActionPhaseTwo); break; case EventIds.RespawnNefarius: Creature nefarius = GetCreature(DataTypes.LordVictorNefarius); - if (nefarius) + if (nefarius != null) { nefarius.SetActive(true); nefarius.SetFarVisible(true); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs index 91beb9bf4..c337997f6 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs @@ -165,7 +165,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius if (me.GetMapId() == 469) { - if (!me.FindNearestCreature(BWLCreatureIds.Nefarian, 1000.0f, true)) + if (me.FindNearestCreature(BWLCreatureIds.Nefarian, 1000.0f, true) == null) _Reset(); me.SetVisible(true); @@ -240,7 +240,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius break; case EventIds.Chaos1: Creature gyth = me.FindNearestCreature(CreatureIds.Gyth, 75.0f, true); - if (gyth) + if (gyth != null) { me.SetFacingToObject(gyth); Talk(TextIds.SayChaosSpell); @@ -253,15 +253,15 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius break; case EventIds.Success1: Unit player = me.SelectNearestPlayer(60.0f); - if (player) + if (player != null) { me.SetFacingToObject(player); Talk(TextIds.SaySuccess); GameObject portcullis1 = me.FindNearestGameObject(GameObjectIds.PortcullisActive, 65.0f); - if (portcullis1) + if (portcullis1 != null) portcullis1.SetGoState(GameObjectState.Active); GameObject portcullis2 = me.FindNearestGameObject(GameObjectIds.PortcullisTobossrooms, 80.0f); - if (portcullis2) + if (portcullis2 != null) portcullis2.SetGoState(GameObjectState.Active); } _events.ScheduleEvent(EventIds.Success2, TimeSpan.FromSeconds(4)); @@ -300,7 +300,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius break; case 1: Unit target = SelectTarget(SelectTargetMethod.Random, 0, 40, true); - if (target) + if (target != null) DoCast(target, SpellIds.Shadowbolt); break; } @@ -310,7 +310,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius case EventIds.Fear: { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 40, true); - if (target) + if (target != null) DoCast(target, SpellIds.Fear); _events.ScheduleEvent(EventIds.Fear, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20)); break; @@ -318,7 +318,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius case EventIds.MindControl: { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 40, true); - if (target) + if (target != null) DoCast(target, SpellIds.ShadowCommand); _events.ScheduleEvent(EventIds.MindControl, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); break; @@ -332,7 +332,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius else CreatureID = MiscConst.Entry[RandomHelper.URand(0, 4)]; Creature dragon = me.SummonCreature(CreatureID, MiscConst.DrakeSpawnLoc[i]); - if (dragon) + if (dragon != null) { dragon.SetFaction((uint)FactionTemplates.DragonflightBlack); dragon.GetAI().AttackStart(me.GetVictim()); @@ -341,7 +341,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius if (++SpawnedAdds >= 42) { Creature nefarian = me.SummonCreature(BWLCreatureIds.Nefarian, MiscConst.NefarianLoc[0]); - if (nefarian) + if (nefarian != null) { nefarian.SetActive(true); nefarian.SetFarVisible(true); @@ -441,7 +441,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius if (id == 1) { DoZoneInCombat(); - if (me.GetVictim()) + if (me.GetVictim() != null) AttackStart(me.GetVictim()); } } @@ -497,7 +497,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius break; case EventIds.Classcall: Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true); - if (target) + if (target != null) switch (target.GetClass()) { case Class.Mage: diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs index 7829b660f..6fc481f5d 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs @@ -142,7 +142,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Razorgore if (instance.GetData(BWLMisc.DataEggEvent) != (uint)EncounterState.Done) { Creature razorgore = instance.GetCreature(DataTypes.RazorgoreTheUntamed); - if (razorgore) + if (razorgore != null) { razorgore.Attack(player, true); player.CastSpell(razorgore, SpellIds.Mindcontrol); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs index f7c7eec2e..d86fc2697 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs @@ -97,7 +97,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Vaelastrasz { //selects a random target that isn't the current victim and is a mana user (selects mana users) but not pets //it also ignores targets who have the aura. We don't want to place the debuff on the same target twice. - Unit target = SelectTarget(SelectTargetMethod.Random, 1, u => { return u && !u.IsPet() && u.GetPowerType() == PowerType.Mana && !u.HasAura(SpellIds.Burningadrenaline); }); + Unit target = SelectTarget(SelectTargetMethod.Random, 1, u => { return u != null && !u.IsPet() && u.GetPowerType() == PowerType.Mana && !u.HasAura(SpellIds.Burningadrenaline); }); if (target != null) me.CastSpell(target, SpellIds.Burningadrenaline, true); @@ -132,7 +132,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Vaelastrasz { me.SetFaction((uint)FactionTemplates.DragonflightBlack); Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID); - if (player) + if (player != null) AttackStart(player); }); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs index 5cd07b675..8e1ac5ee0 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs @@ -41,14 +41,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.BaronGeddon _scheduler.Schedule(TimeSpan.FromSeconds(30), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.IgniteMana); - if (target) + if (target != null) DoCast(target, SpellIds.IgniteMana); task.Repeat(TimeSpan.FromSeconds(30)); }); _scheduler.Schedule(TimeSpan.FromSeconds(35), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.LivingBomb); task.Repeat(TimeSpan.FromSeconds(35)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs index 4245bbcac..b94febfc1 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs @@ -64,7 +64,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Garr _scheduler.Schedule(TimeSpan.FromSeconds(4), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) DoCast(target, SpellIds.Immolate); task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); @@ -74,7 +74,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Garr // ...and enrage if he is not. _scheduler.Schedule(TimeSpan.FromSeconds(3), task => { - if (!me.FindNearestCreature(MCCreatureIds.Garr, 20.0f)) + if (me.FindNearestCreature(MCCreatureIds.Garr, 20.0f) == null) DoCastSelf(SpellIds.SeparationAnxiety); else if (me.HasAura(SpellIds.SeparationAnxiety)) me.RemoveAurasDueToSpell(SpellIds.SeparationAnxiety); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs index 399395628..1e0a824be 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs @@ -33,14 +33,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Gehennas _scheduler.Schedule(TimeSpan.FromSeconds(10), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) DoCast(target, SpellIds.RainOfFire); task.Repeat(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(12)); }); _scheduler.Schedule(TimeSpan.FromSeconds(6), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 1); - if (target) + if (target != null) DoCast(target, SpellIds.ShadowBolt); task.Repeat(TimeSpan.FromSeconds(7)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs index d5f633632..1114bc31a 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs @@ -46,7 +46,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Golemagg _scheduler.Schedule(TimeSpan.FromSeconds(7), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) DoCast(target, SpellIds.Pyroblast); task.Repeat(TimeSpan.FromSeconds(7)); }); @@ -104,7 +104,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Golemagg return; Creature pGolemagg = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.GolemaggTheIncinerator)); - if (pGolemagg) + if (pGolemagg != null) { if (pGolemagg.IsAlive()) { diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/InstanceMoltenCore.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/InstanceMoltenCore.cs index 955fb540e..d7a3158d9 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/InstanceMoltenCore.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/InstanceMoltenCore.cs @@ -214,7 +214,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore else { TempSummon summon = instance.SummonCreature(MCCreatureIds.MajordomoExecutus, MCMiscConst.RagnarosTelePos); - if (summon) + if (summon != null) summon.GetAI().DoAction(ActionIds.StartRagnarosAlt); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs index 0de800c2f..0dcb33b60 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs @@ -52,7 +52,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Magmadar _scheduler.Schedule(TimeSpan.FromSeconds(12), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.LavaBomb); - if (target) + if (target != null) DoCast(target, SpellIds.LavaBomb); task.Repeat(TimeSpan.FromSeconds(12)); }); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs index d085a2a4b..3aff9b042 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs @@ -69,7 +69,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Majordomo _scheduler.Schedule(TimeSpan.FromSeconds(20), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 1); - if (target) + if (target != null) DoCast(target, SpellIds.Teleport); task.Repeat(TimeSpan.FromSeconds(20)); }); @@ -84,7 +84,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Majordomo if (!UpdateVictim()) return; - if (!me.FindNearestCreature(MCCreatureIds.FlamewakerHealer, 100.0f) && !me.FindNearestCreature(MCCreatureIds.FlamewakerElite, 100.0f)) + if (me.FindNearestCreature(MCCreatureIds.FlamewakerHealer, 100.0f) == null && me.FindNearestCreature(MCCreatureIds.FlamewakerElite, 100.0f) == null) { instance.UpdateEncounterStateForKilledCreature(me.GetEntry(), me); me.SetFaction((uint)FactionTemplates.Friendly); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs index dc4212df8..8aceee53c 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs @@ -140,7 +140,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore case EventIds.Intro4: Talk(TextIds.SayArrival5Rag); Creature executus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.MajordomoExecutus)); - if (executus) + if (executus != null) Unit.Kill(me, executus); break; case EventIds.Intro5: @@ -165,7 +165,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore me.SetEmoteState(Emote.OneshotNone); me.HandleEmoteCommand(Emote.OneshotEmerge); Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) AttackStart(target); instance.SetData(MCMiscConst.DataRagnarosAdds, 0); diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs index 48fa097ab..4f3ba66c8 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs @@ -70,7 +70,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Shazzrah break; case EventIds.ShazzrahCurse: Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.ShazzrahCurse); - if (target) + if (target != null) DoCast(target, SpellIds.ShazzrahCurse); _events.ScheduleEvent(EventIds.ShazzrahCurse, TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(30)); break; @@ -123,11 +123,11 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Shazzrah void HandleScript(uint effIndex) { Unit target = GetHitUnit(); - if (target) + if (target != null) { target.CastSpell(GetCaster(), SpellIds.ShazzrahGate, true); Creature creature = GetCaster().ToCreature(); - if (creature) + if (creature != null) creature.GetAI().AttackStart(target); // Attack the target which caster will teleport to. } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs index 3b7eec8b9..2e5c47e63 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs @@ -61,7 +61,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Sulfuron _scheduler.Schedule(TimeSpan.FromSeconds(2), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.Flamespear); task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16)); }); @@ -100,21 +100,21 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Sulfuron _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), task => { Unit target = DoSelectLowestHpFriendly(60.0f, 1); - if (target) + if (target != null) DoCast(target, SpellIds.Heal); task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20)); }); _scheduler.Schedule(TimeSpan.FromSeconds(2), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.Shadowwordpain); - if (target) + if (target != null) DoCast(target, SpellIds.Shadowwordpain); task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(26)); }); _scheduler.Schedule(TimeSpan.FromSeconds(8), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.Immolate); - if (target) + if (target != null) DoCast(target, SpellIds.Immolate); task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25)); }); diff --git a/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs b/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs index 412b45321..2379bada3 100644 --- a/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs +++ b/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs @@ -86,7 +86,7 @@ namespace Scripts.EasternKingdoms.Deadmines return; GameObject pIronCladDoor = instance.GetGameObject(IronCladDoorGUID); - if (!pIronCladDoor) + if (pIronCladDoor == null) return; switch (State) @@ -127,7 +127,7 @@ namespace Scripts.EasternKingdoms.Deadmines void SummonCreatures() { GameObject pIronCladDoor = instance.GetGameObject(IronCladDoorGUID); - if (pIronCladDoor) + if (pIronCladDoor != null) { Creature DefiasPirate1 = pIronCladDoor.SummonCreature(657, pIronCladDoor.GetPositionX() - 2, pIronCladDoor.GetPositionY() - 7, pIronCladDoor.GetPositionZ(), 0, TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(3)); Creature DefiasPirate2 = pIronCladDoor.SummonCreature(657, pIronCladDoor.GetPositionX() + 3, pIronCladDoor.GetPositionY() - 6, pIronCladDoor.GetPositionZ(), 0, TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(3)); @@ -144,7 +144,7 @@ namespace Scripts.EasternKingdoms.Deadmines Creature pDefiasPirate1 = instance.GetCreature(DefiasPirate1GUID); Creature pDefiasPirate2 = instance.GetCreature(DefiasPirate2GUID); - if (!pDefiasPirate1 || !pDefiasPirate2) + if (pDefiasPirate1 == null || pDefiasPirate2 == null) return; MoveCreatureInside(pDefiasPirate1); @@ -160,7 +160,7 @@ namespace Scripts.EasternKingdoms.Deadmines void ShootCannon() { GameObject pDefiasCannon = instance.GetGameObject(DefiasCannonGUID); - if (pDefiasCannon) + if (pDefiasCannon != null) { pDefiasCannon.SetGoState(GameObjectState.Active); pDefiasCannon.PlayDirectSound(SoundIds.Cannonfire); @@ -170,7 +170,7 @@ namespace Scripts.EasternKingdoms.Deadmines void BlastOutDoor() { GameObject pIronCladDoor = instance.GetGameObject(IronCladDoorGUID); - if (pIronCladDoor) + if (pIronCladDoor != null) { pIronCladDoor.SetGoState(GameObjectState.Destroyed); pIronCladDoor.PlayDirectSound(SoundIds.Destroydoor); @@ -180,7 +180,7 @@ namespace Scripts.EasternKingdoms.Deadmines void LeverStucked() { GameObject pDoorLever = instance.GetGameObject(DoorLeverGUID); - if (pDoorLever) + if (pDoorLever != null) pDoorLever.SetFlag(GameObjectFlags.InteractCond); } @@ -218,7 +218,7 @@ namespace Scripts.EasternKingdoms.Deadmines if (data == (uint)EncounterState.Done) { GameObject go = instance.GetGameObject(FactoryDoorGUID); - if (go) + if (go != null) go.SetGoState(GameObjectState.Active); } break; diff --git a/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs b/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs index 5e6015af1..29eff9655 100644 --- a/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs +++ b/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs @@ -143,7 +143,7 @@ namespace Scripts.EasternKingdoms.Deadmines break; GameObject go = ObjectAccessor.GetGameObject(me, instance.GetGuidData(DataTypes.SmiteChest)); - if (go) + if (go != null) { me.GetMotionMaster().Clear(); me.GetMotionMaster().MovePoint(1, go.GetPositionX() - 1.5f, go.GetPositionY() + 1.4f, go.GetPositionZ()); diff --git a/Source/Scripts/EasternKingdoms/Gnomeregan/InstanceGnomeregan.cs b/Source/Scripts/EasternKingdoms/Gnomeregan/InstanceGnomeregan.cs index 879f2f87e..3e214e06a 100644 --- a/Source/Scripts/EasternKingdoms/Gnomeregan/InstanceGnomeregan.cs +++ b/Source/Scripts/EasternKingdoms/Gnomeregan/InstanceGnomeregan.cs @@ -93,7 +93,7 @@ namespace Scripts.EasternKingdoms.Gnomeregan public override void OnUnitDeath(Unit unit) { Creature creature = unit.ToCreature(); - if (creature) + if (creature != null) switch (creature.GetEntry()) { case GNOCreatureIds.ViciousFallout: diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs index 3e9939178..2914dddf4 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs @@ -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)); }); diff --git a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs b/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs index 6d250aa7d..c1345864a 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs @@ -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); } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs b/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs index b50c6acd7..e2f26d99e 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs @@ -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)); }); diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs b/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs index 5d94ed363..b9e77274f 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs @@ -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); } } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs index f1dfc7736..49dbd92b4 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs @@ -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; diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs b/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs index 74d1ab69a..be7460600 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs @@ -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); } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs b/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs index 2b4ef2ef9..8b94fff3a 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs @@ -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); diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs b/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs index 6abdf849f..7f11ca68b 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs @@ -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().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().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().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().IsFakingDeath) + if (Romulo != null && Romulo.GetAI().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().RomuloDead = true; Julianne.GetAI().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().IsFakingDeath) + if (Julianne != null && Julianne.GetAI().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); } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs b/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs index c0f3eb4fc..88ec2dc7d 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs @@ -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().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); diff --git a/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs b/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs index 049734c4f..fa0c942b3 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs @@ -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; diff --git a/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs b/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs index d1c97702c..68387e2a3 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs @@ -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); } } diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs index 0ac843acf..434b677c1 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs @@ -120,7 +120,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas { Talk(TextIds.SayFlameStrike); Unit target = SelectTarget(SelectTargetMethod.Random, 0, 40.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.FlameStrike); task.Repeat(); }); @@ -284,7 +284,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas public override void SpellHitTarget(WorldObject target, SpellInfo spellInfo) { Unit unitTarget = target.ToUnit(); - if (!unitTarget) + if (unitTarget == null) return; switch (spellInfo.Id) @@ -318,7 +318,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas { case CreatureIds.ArcaneSphere: Unit target = SelectTarget(SelectTargetMethod.Random, 0, 70.0f, true); - if (target) + if (target != null) summon.GetMotionMaster().MoveFollow(target, 0.0f, 0.0f); break; case CreatureIds.FlameStrike: @@ -382,10 +382,10 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas DoCastSelf(SpellIds.EmberBlast); // DoCastSelf(SpellSummonPhoenixEgg); -- We do a manual summon for now. Feel free to move it to spelleffect_dbc Creature egg = DoSummon(CreatureIds.PhoenixEgg, me.GetPosition(), TimeSpan.FromSeconds(0)); - if (egg) + if (egg != null) { Creature kaelthas = _instance.GetCreature(DataTypes.KaelthasSunstrider); - if (kaelthas) + if (kaelthas != null) { kaelthas.GetAI().JustSummoned(egg); _eggGUID = egg.GetGUID(); @@ -395,7 +395,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas _scheduler.Schedule(TimeSpan.FromSeconds(15), task => { Creature egg = ObjectAccessor.GetCreature(me, _eggGUID); - if (egg) + if (egg != null) egg.DespawnOrUnsummon(); me.RemoveAllAuras(); @@ -445,7 +445,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { Unit target = GetTarget(); - if (target) + if (target != null) target.CastSpell(target, SpellIds.FlameStrikeDamage); } diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/InstanceMagistersTerrace.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/InstanceMagistersTerrace.cs index 02bc5bb32..c629fb2aa 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/InstanceMagistersTerrace.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/InstanceMagistersTerrace.cs @@ -195,7 +195,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace if (_kaelthasPreTrashGUIDs.Count == 0) { Creature kaelthas = GetCreature(DataTypes.KaelthasSunstrider); - if (kaelthas) + if (kaelthas != null) kaelthas.GetAI().SetData(DataTypes.KaelthasIntro, (uint)EncounterState.InProgress); } } @@ -223,7 +223,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace public override void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker) { if (eventId == MiscConst.EventSpawnKalecgos) - if (!GetCreature(DataTypes.Kalecgos) && _events.Empty()) + if (GetCreature(DataTypes.Kalecgos) == null && _events.Empty()) _events.ScheduleEvent(MiscConst.EventSpawnKalecgos, TimeSpan.FromMinutes(1)); } @@ -234,7 +234,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace if (_events.ExecuteEvent() == MiscConst.EventSpawnKalecgos) { Creature kalecgos = instance.SummonCreature(CreatureIds.Kalecgos, MiscConst.KalecgosSpawnPos); - if (kalecgos) + if (kalecgos != null) { kalecgos.GetMotionMaster().MovePath(MiscConst.PathKalecgosFlight, false); kalecgos.GetAI().Talk(MiscConst.SayKalecgosSpawn); diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs index b52e31520..8ef02624b 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs @@ -223,7 +223,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa } } - if (target) + if (target != null) DoCast(target, SpellIds.DispelMagic); task.Repeat(TimeSpan.FromSeconds(12)); @@ -261,7 +261,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa foreach (var lackeyGuid in m_auiLackeyGUID) { Unit pAdd = Global.ObjAccessor.GetUnit(me, lackeyGuid); - if (pAdd && !pAdd.IsEngaged()) + if (pAdd != null && !pAdd.IsEngaged()) AddThreat(who, 0.0f, pAdd); } @@ -303,7 +303,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa Unit pAdd = Global.ObjAccessor.GetUnit(me, m_auiLackeyGUID[j]); //object already removed, not exist - if (!pAdd) + if (pAdd == null) { pAdd = me.SummonCreature(guid, MiscConst.LackeyLocations[j][0], MiscConst.LackeyLocations[j][1], MiscConst.fZLocation, MiscConst.fOrientation, TempSummonType.CorpseDespawn); if (pAdd != null) @@ -380,7 +380,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa // in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her) Creature delrissa = instance.GetCreature(DataTypes.PriestessDelrissa); - if (delrissa) + if (delrissa != null) { if (!delrissa.IsAlive()) delrissa.Respawn(); @@ -389,7 +389,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa public override void JustEngagedWith(Unit who) { - if (!who) + if (who == null) return; foreach (var guid in m_auiLackeyGUIDs) @@ -400,7 +400,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa } Creature delrissa = instance.GetCreature(DataTypes.PriestessDelrissa); - if (delrissa) + if (delrissa != null) if (delrissa.IsAlive() && !delrissa.IsEngaged()) AddThreat(who, 0.0f, delrissa); } @@ -410,7 +410,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa Creature delrissa = instance.GetCreature(DataTypes.PriestessDelrissa); uint uiLackeyDeathCount = instance.GetData(DataTypes.DelrissaDeathCount); - if (!delrissa) + if (delrissa == null) return; //should delrissa really yell if dead? @@ -436,14 +436,14 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa public override void KilledUnit(Unit victim) { Creature delrissa = instance.GetCreature(DataTypes.PriestessDelrissa); - if (delrissa) + if (delrissa != null) delrissa.GetAI().KilledUnit(victim); } void AcquireGUIDs() { Creature delrissa = instance.GetCreature(DataTypes.PriestessDelrissa); - if (delrissa) + if (delrissa != null) { for (byte i = 0; i < MiscConst.MaxActiveLackey; ++i) m_auiLackeyGUIDs[i] = (delrissa.GetAI() as boss_priestess_delrissa).m_auiLackeyGUID[i]; @@ -493,7 +493,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa ResetThreatList(); - if (unit) + if (unit != null) AddThreat(unit, 1000.0f); InVanish = true; @@ -565,7 +565,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(2), task => { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.SeedOfCorruption); task.Repeat(TimeSpan.FromSeconds(10)); @@ -573,7 +573,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(1), task => { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.CurseOfAgony); task.Repeat(TimeSpan.FromSeconds(13)); @@ -582,7 +582,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(10), task => { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.Fear); task.Repeat(); @@ -671,7 +671,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(1), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) + if (target != null) { DoCast(target, SpellIds.Polymorph); task.Repeat(TimeSpan.FromSeconds(20)); @@ -680,7 +680,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(8), task => { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.Blizzard); task.Repeat(); @@ -771,7 +771,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa if (!InMeleeRange) { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.InterceptStun); } @@ -873,7 +873,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa GameObject go = me.GetGameObject(SpellIds.FreezingTrap); //if we have a go, we need to wait (only one trap at a time) - if (go) + if (go != null) task.Repeat(TimeSpan.FromSeconds(2.5)); else { @@ -889,7 +889,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa Initialize(); Unit pPet = Global.ObjAccessor.GetUnit(me, m_uiPetGUID); - if (!pPet) + if (pPet == null) me.SummonCreature(CreatureIds.Sliver, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.CorpseDespawn); base.Reset(); @@ -942,7 +942,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa _scheduler.Schedule(TimeSpan.FromSeconds(8), task => { Unit unit = SelectTarget(SelectTargetMethod.Random, 0); - if (unit) + if (unit != null) DoCast(unit, SpellIds.Purge); task.Repeat(TimeSpan.FromSeconds(15)); diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs index 789f06d12..964d72390 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs @@ -92,7 +92,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.SelinFireheart void SelectNearestCrystal() { Creature crystal = me.FindNearestCreature(CreatureIds.FelCrystal, 250.0f); - if (crystal) + if (crystal != null) { Talk(TextIds.SayEnergy); Talk(TextIds.EmoteCrystal); @@ -197,7 +197,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.SelinFireheart Talk(TextIds.SayEmpowered); Creature CrystalChosen = ObjectAccessor.GetCreature(me, CrystalGUID); - if (CrystalChosen && CrystalChosen.IsAlive()) + if (CrystalChosen != null && CrystalChosen.IsAlive()) CrystalChosen.KillSelf(); CrystalGUID.Clear(); @@ -247,7 +247,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.SelinFireheart if (instance != null) { Creature selin = instance.GetCreature(DataTypes.SelinFireheart); - if (selin && selin.IsAlive()) + if (selin != null && selin.IsAlive()) selin.GetAI().DoAction(MiscConst.ActionSwitchPhase); } } diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs index cda438966..11c8182b1 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs @@ -73,14 +73,14 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.Vexallus _scheduler.Schedule(TimeSpan.FromSeconds(8), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.ChainLightning); task.Repeat(); }); _scheduler.Schedule(TimeSpan.FromSeconds(5), task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0, 20.0f, true); - if (target) + if (target != null) DoCast(target, SpellIds.ArcaneShock); task.Repeat(TimeSpan.FromSeconds(8)); }); @@ -89,7 +89,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.Vexallus public override void JustSummoned(Creature summoned) { Unit temp = SelectTarget(SelectTargetMethod.Random, 0); - if (temp) + if (temp != null) summoned.GetMotionMaster().MoveFollow(temp, 0, 0); summons.Summon(summoned); @@ -150,7 +150,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.Vexallus public override void JustDied(Unit killer) { - if (killer) + if (killer != null) killer.CastSpell(killer, SpellIds.EnergyFeedback, true); me.RemoveAurasDueToSpell(SpellIds.PureEnergyPassive); }