Fixes build. Scripts are still being updated.

This commit is contained in:
hondacrx
2024-01-24 12:02:23 -05:00
parent 1c6563718e
commit 6f4b7ddd9d
51 changed files with 268 additions and 268 deletions
@@ -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);
}
@@ -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);
}
@@ -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<WorldObject>(true, SpellIds.HasDarkBrewmaidensBrew));
targets.RemoveAll(new UnitAuraCheck(true, SpellIds.HasDarkBrewmaidensBrew));
if (targets.Count > 1)
{
@@ -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);
@@ -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);
}
@@ -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));
});
@@ -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())
{
@@ -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));
});
@@ -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 =>
@@ -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<Creature> 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);
@@ -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;
}
@@ -96,7 +96,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe
List<Creature> 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<Creature> 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 =>
@@ -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;
@@ -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));
});
@@ -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));
});
@@ -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);
}
@@ -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);
@@ -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:
@@ -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);
@@ -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);
});
});
@@ -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));
});
@@ -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);
@@ -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));
});
@@ -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())
{
@@ -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);
}
}
@@ -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));
});
@@ -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);
@@ -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);
@@ -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.
}
}
@@ -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));
});