Start adding missing scripts Part3

This commit is contained in:
hondacrx
2022-07-06 23:53:47 -04:00
parent 8cfd263fea
commit ba6c30add4
39 changed files with 5180 additions and 27 deletions
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.AmbassadorFlamelash
{
struct SpellIds
{
public const uint Fireblast = 15573;
}
[Script]
class boss_ambassador_flamelash : ScriptedAI
{
public boss_ambassador_flamelash(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
DoCastVictim(SpellIds.Fireblast);
task.Repeat(TimeSpan.FromSeconds(7));
});
_scheduler.Schedule(TimeSpan.FromSeconds(24), task =>
{
for (uint i = 0; i < 4; ++i)
SummonSpirit(me.GetVictim());
task.Repeat(TimeSpan.FromSeconds(30));
});
}
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)
spirit.GetAI().AttackStart(victim);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,531 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Groups;
using Game.Maps;
using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebrew
{
struct SpellIds
{
public const uint MoleMachineEmerge = 50313;
public const uint DirebrewDisarmPreCast = 47407;
public const uint MoleMachineTargetPicker = 47691;
public const uint MoleMachineMinionSummoner = 47690;
public const uint DirebrewDisarmGrow = 47409;
public const uint DirebrewDisarm = 47310;
public const uint ChuckMug = 50276;
public const uint PortToCoren = 52850;
public const uint SendMugControlAura = 47369;
public const uint SendMugTargetPicker = 47370;
public const uint SendFirstMug = 47333;
public const uint SendSecondMug = 47339;
public const uint RequestSecondMug = 47344;
public const uint HasDarkBrewmaidensBrew = 47331;
public const uint BarreledControlAura = 50278;
public const uint Barreled = 47442;
}
struct TextIds
{
public const uint SayIntro = 0;
public const uint SayIntro1 = 1;
public const uint SayIntro2 = 2;
public const uint SayInsult = 3;
public const uint SayAntagonist1 = 0;
public const uint SayAntagonist2 = 1;
public const uint SayAntagonistCombat = 2;
}
struct ActionIds
{
public const int StartFight = -1;
public const int AntagonistSay1 = -2;
public const int AntagonistSay2 = -3;
public const int AntagonistHostile = -4;
}
struct CreatureIds
{
public const uint IlsaDirebrew = 26764;
public const uint UrsulaDirebrew = 26822;
public const uint Antagonist = 23795;
}
enum DirebrewPhases
{
All = 1,
Intro,
One,
Two,
Three
}
struct MiscConst
{
public const uint GossipId = 11388;
public const uint GoMoleMachineTrap = 188509;
public const uint GossipOptionFight = 0;
public const uint GossipOptionApologize = 1;
public const int DataTargetGuid = 1;
public const uint MaxAntagonists = 3;
public static Position[] AntagonistPos =
{
new Position(895.3782f, -132.1722f, -49.66423f, 2.6529f),
new Position(893.9837f, -133.2879f, -49.66541f, 2.583087f),
new Position(896.2667f, -130.483f, -49.66249f, 2.600541f)
};
}
[Script]
class boss_coren_direbrew : BossAI
{
DirebrewPhases phase;
public boss_coren_direbrew(Creature creature) : base(creature, DataTypes.DataCoren) { }
public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId != MiscConst.GossipId)
return false;
if (gossipListId == MiscConst.GossipOptionFight)
{
Talk(TextIds.SayInsult, player);
DoAction(ActionIds.StartFight);
}
else if (gossipListId == MiscConst.GossipOptionApologize)
player.CloseGossipMenu();
return false;
}
public override void Reset()
{
_Reset();
me.SetImmuneToPC(true);
me.SetFaction((uint)FactionTemplates.Friendly);
phase = DirebrewPhases.All;
_scheduler.CancelAll();
for (byte i = 0; i < MiscConst.MaxAntagonists; ++i)
me.SummonCreature(CreatureIds.Antagonist, MiscConst.AntagonistPos[i], TempSummonType.DeadDespawn);
}
public override void EnterEvadeMode(EvadeReason why)
{
_EnterEvadeMode();
summons.DespawnAll();
_DespawnAtEvade(TimeSpan.FromSeconds(10));
}
public override void MoveInLineOfSight(Unit who)
{
if (phase != DirebrewPhases.All || !who.IsPlayer())
return;
phase = DirebrewPhases.Intro;
_scheduler.Schedule(TimeSpan.FromSeconds(6), introTask1 =>
{
Talk(TextIds.SayIntro1);
introTask1.Schedule(TimeSpan.FromSeconds(4), introTask2 =>
{
EntryCheckPredicate pred = new(CreatureIds.Antagonist);
summons.DoAction(ActionIds.AntagonistSay1, pred);
introTask2.Schedule(TimeSpan.FromSeconds(3), introlTask3 =>
{
Talk(TextIds.SayIntro2);
EntryCheckPredicate pred = new(CreatureIds.Antagonist);
summons.DoAction(ActionIds.AntagonistSay2, pred);
});
});
});
Talk(TextIds.SayIntro);
}
public override void DoAction(int action)
{
if (action == ActionIds.StartFight)
{
phase = DirebrewPhases.One;
//events.SetPhase(PhaseOne);
me.SetImmuneToPC(false);
me.SetFaction((uint)FactionTemplates.GoblinDarkIronBarPatron);
DoZoneInCombat();
EntryCheckPredicate pred = new(CreatureIds.Antagonist);
summons.DoAction(ActionIds.AntagonistHostile, pred);
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.MaxTargets, 1);
me.CastSpell((WorldObject)null, SpellIds.MoleMachineTargetPicker, args);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastSelf(SpellIds.DirebrewDisarmPreCast, new CastSpellExtraArgs(true));
task.Repeat();
});
}
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (me.HealthBelowPctDamaged(66, damage) && phase == DirebrewPhases.One)
{
phase = DirebrewPhases.Two;
SummonSister(CreatureIds.IlsaDirebrew);
}
else if (me.HealthBelowPctDamaged(33, damage) && phase == DirebrewPhases.Two)
{
phase = DirebrewPhases.Three;
SummonSister(CreatureIds.UrsulaDirebrew);
}
}
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (summon.GetEntry() == CreatureIds.IlsaDirebrew)
{
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{
SummonSister(CreatureIds.IlsaDirebrew);
});
}
else if (summon.GetEntry() == CreatureIds.UrsulaDirebrew)
{
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{
SummonSister(CreatureIds.UrsulaDirebrew);
});
}
}
public override void JustDied(Unit killer)
{
_JustDied();
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{
Group group = players[0].GetGroup();
if (group)
if (group.IsLFGGroup())
Global.LFGMgr.FinishDungeon(group.GetGUID(), 287, me.GetMap());
}
}
void SummonSister(uint entry)
{
Creature sister = me.SummonCreature(entry, me.GetPosition(), TempSummonType.DeadDespawn);
if (sister)
DoZoneInCombat(sister);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim() && phase != DirebrewPhases.Intro)
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
class npc_coren_direbrew_sisters : ScriptedAI
{
ObjectGuid _targetGUID;
public npc_coren_direbrew_sisters(Creature creature) : base(creature) { }
public override void SetGUID(ObjectGuid guid, int id)
{
if (id == MiscConst.DataTargetGuid)
_targetGUID = guid;
}
public override ObjectGuid GetGUID(int data)
{
if (data == MiscConst.DataTargetGuid)
return _targetGUID;
return ObjectGuid.Empty;
}
public override void JustEngagedWith(Unit who)
{
DoCastSelf(SpellIds.PortToCoren);
if (me.GetEntry() == CreatureIds.UrsulaDirebrew)
DoCastSelf(SpellIds.BarreledControlAura);
else
DoCastSelf(SpellIds.SendMugControlAura);
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(2), mugChuck =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, false, true, -(int)SpellIds.HasDarkBrewmaidensBrew);
if (target)
DoCast(target, SpellIds.ChuckMug);
mugChuck.Repeat(TimeSpan.FromSeconds(4));
});
}
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
class npc_direbrew_minion : ScriptedAI
{
InstanceScript _instance;
public npc_direbrew_minion(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
me.SetFaction((uint)FactionTemplates.GoblinDarkIronBarPatron);
DoZoneInCombat();
}
public override void IsSummonedBy(WorldObject summoner)
{
Creature coren = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.DataCoren));
if (coren)
coren.GetAI().JustSummoned(me);
}
}
class npc_direbrew_antagonist : ScriptedAI
{
public npc_direbrew_antagonist(Creature creature) : base(creature) { }
public override void DoAction(int action)
{
switch (action)
{
case ActionIds.AntagonistSay1:
Talk(TextIds.SayAntagonist1);
break;
case ActionIds.AntagonistSay2:
Talk(TextIds.SayAntagonist2);
break;
case ActionIds.AntagonistHostile:
me.SetImmuneToPC(false);
me.SetFaction((uint)FactionTemplates.GoblinDarkIronBarPatron);
DoZoneInCombat();
break;
default:
break;
}
}
public override void JustEngagedWith(Unit who)
{
Talk(TextIds.SayAntagonistCombat, who);
base.JustEngagedWith(who);
}
}
class go_direbrew_mole_machineAI : GameObjectAI
{
public go_direbrew_mole_machineAI(GameObject go) : base(go) { }
public override void Reset()
{
me.SetLootState(LootState.Ready);
_scheduler.Schedule(TimeSpan.FromSeconds(1), context =>
{
me.UseDoorOrButton(10000);
me.CastSpell(null, SpellIds.MoleMachineEmerge, true);
});
_scheduler.Schedule(TimeSpan.FromSeconds(4), context =>
{
GameObject trap = me.GetLinkedTrap();
if (trap)
{
trap.SetLootState(LootState.Activated);
trap.UseDoorOrButton();
}
});
}
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff);
}
}
// 47691 - Summon Mole Machine Target Picker
class spell_direbrew_summon_mole_machine_target_picker : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.MoleMachineMinionSummoner);
}
void HandleScriptEffect(uint effIndex)
{
GetCaster().CastSpell(GetHitUnit(), SpellIds.MoleMachineMinionSummoner, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
}
}
// 47370 - Send Mug Target Picker
class spell_send_mug_target_picker : SpellScript
{
void FilterTargets(List<WorldObject> targets)
{
Unit caster = GetCaster();
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.HasDarkBrewmaidensBrew));
if (targets.Count > 1)
{
targets.RemoveAll(obj =>
{
if (obj.GetGUID() == caster.GetAI().GetGUID(MiscConst.DataTargetGuid))
return true;
return false;
});
}
if (targets.Empty())
return;
WorldObject target = targets.SelectRandom();
targets.Clear();
targets.Add(target);
}
void HandleDummy(uint effIndex)
{
Unit caster = GetCaster();
caster.GetAI().SetGUID(GetHitUnit().GetGUID(), MiscConst.DataTargetGuid);
caster.CastSpell(GetHitUnit(), SpellIds.SendFirstMug, true);
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry));
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
}
}
// 47344 - Request Second Mug
class spell_request_second_mug : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.SendSecondMug);
}
void HandleScriptEffect(uint effIndex)
{
GetHitUnit().CastSpell(GetCaster(), SpellIds.SendSecondMug, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
}
}
// 47369 - Send Mug Control Aura
class spell_send_mug_control_aura : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.SendMugTargetPicker);
}
void PeriodicTick(AuraEffect aurEff)
{
GetTarget().CastSpell(GetTarget(), SpellIds.SendMugTargetPicker, true);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDummy));
}
}
// 50278 - Barreled Control Aura
class spell_barreled_control_aura : AuraScript
{
void PeriodicTick(AuraEffect aurEff)
{
PreventDefaultAction();
GetTarget().CastSpell(null, SpellIds.Barreled, true);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell));
}
}
// 47407 - Direbrew's Disarm (precast)
class spell_direbrew_disarm : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.DirebrewDisarm, SpellIds.DirebrewDisarmGrow);
}
void PeriodicTick(AuraEffect aurEff)
{
Aura aura = GetTarget().GetAura(SpellIds.DirebrewDisarmGrow);
if (aura != null)
{
aura.SetStackAmount((byte)(aura.GetStackAmount() + 1));
aura.SetDuration(aura.GetDuration() - 1500);
}
}
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.DirebrewDisarmGrow, true);
GetTarget().CastSpell(GetTarget(), SpellIds.DirebrewDisarm);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicDummy));
OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
}
}
@@ -0,0 +1,100 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Draganthaurissan
{
struct SpellIds
{
public const uint Handofthaurissan = 17492;
public const uint Avatarofflame = 15636;
}
struct TextIds
{
public const uint SayAggro = 0;
public const uint SaySlay = 1;
public const uint EmoteShaken = 0;
}
[Script]
class boss_draganthaurissan : ScriptedAI
{
InstanceScript _instance;
public boss_draganthaurissan(Creature creature) : base(creature)
{
_instance = me.GetInstanceScript();
}
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
Talk(TextIds.SayAggro);
me.CallForHelp(166.0f);
_scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
DoCast(target, SpellIds.Handofthaurissan);
task.Repeat(TimeSpan.FromSeconds(5));
});
_scheduler.Schedule(TimeSpan.FromSeconds(25), task =>
{
DoCastVictim(SpellIds.Avatarofflame);
task.Repeat(TimeSpan.FromSeconds(18));
});
}
public override void KilledUnit(Unit who)
{
if (who.IsPlayer())
Talk(TextIds.SaySlay);
}
public override void JustDied(Unit killer)
{
Creature moira = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.DataMoira));
if (moira)
{
moira.GetAI().EnterEvadeMode();
moira.SetFaction((uint)FactionTemplates.Friendly);
moira.GetAI().Talk(TextIds.EmoteShaken);
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,114 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.GeneralAngerforge
{
struct SpellIds
{
public const uint Mightyblow = 14099;
public const uint Hamstring = 9080;
public const uint Cleave = 20691;
}
enum Phases
{
One = 1,
Two = 2
}
[Script]
class boss_general_angerforge : ScriptedAI
{
Phases phase;
public boss_general_angerforge(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
phase = Phases.One;
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
DoCastVictim(SpellIds.Mightyblow);
task.Repeat(TimeSpan.FromSeconds(18));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
DoCastVictim(SpellIds.Hamstring);
task.Repeat(TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
{
DoCastVictim(SpellIds.Cleave);
task.Repeat(TimeSpan.FromSeconds(9));
});
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (me.HealthBelowPctDamaged(20, damage) && phase == Phases.One)
{
phase = Phases.Two;
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
for (byte i = 0; i < 2; ++i)
SummonMedic(me.GetVictim());
});
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
for (byte i = 0; i < 3; ++i)
SummonAdd(me.GetVictim());
task.Repeat(TimeSpan.FromSeconds(25));
});
}
}
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)
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)
SummonedMedic.GetAI().AttackStart(victim);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,80 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.HighInterrogatorGerstahn
{
struct SpellIds
{
public const uint Shadowwordpain = 10894;
public const uint Manaburn = 10876;
public const uint Psychicscream = 8122;
public const uint Shadowshield = 22417;
}
[Script]
class boss_high_interrogator_gerstahn : ScriptedAI
{
public boss_high_interrogator_gerstahn(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
_scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true);
if (target)
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)
DoCast(target, SpellIds.Manaburn);
task.Repeat(TimeSpan.FromSeconds(10));
});
_scheduler.Schedule(TimeSpan.FromSeconds(32), task =>
{
DoCastVictim(SpellIds.Psychicscream);
task.Repeat(TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
DoCast(me, SpellIds.Shadowshield);
task.Repeat(TimeSpan.FromSeconds(25));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,474 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths
{
struct CreatureIds
{
public const uint Emperor = 9019;
public const uint Phalanx = 9502;
public const uint Angerrel = 9035;
public const uint Doperel = 9040;
public const uint Haterel = 9034;
public const uint Vilerel = 9036;
public const uint Seethrel = 9038;
public const uint Gloomrel = 9037;
public const uint Doomrel = 9039;
public const uint Magmus = 9938;
public const uint Moira = 8929;
public const uint Coren = 23872;
}
struct GameObjectIds
{
public const uint Arena1 = 161525;
public const uint Arena2 = 161522;
public const uint Arena3 = 161524;
public const uint Arena4 = 161523;
public const uint ShadowLock = 161460;
public const uint ShadowMechanism = 161461;
public const uint ShadowGiantDoor = 157923;
public const uint ShadowDummy = 161516;
public const uint BarKegShot = 170607;
public const uint BarKegTrap = 171941;
public const uint BarDoor = 170571;
public const uint TombEnter = 170576;
public const uint TombExit = 170577;
public const uint Lyceum = 170558;
public const uint SfN = 174745; // Shadowforge Brazier North
public const uint SfS = 174744; // Shadowforge Brazier South
public const uint GolemRoomN = 170573; // Magmus door North
public const uint GolemRoomS = 170574; // Magmus door Soutsh
public const uint ThroneRoom = 170575; // Throne door
public const uint SpectralChalice = 164869;
public const uint ChestSeven = 169243;
}
struct DataTypes
{
public const uint TypeRingOfLaw = 1;
public const uint TypeVault = 2;
public const uint TypeBar = 3;
public const uint TypeTombOfSeven = 4;
public const uint TypeLyceum = 5;
public const uint TypeIronHall = 6;
public const uint DataEmperor = 10;
public const uint DataPhalanx = 11;
public const uint DataArena1 = 12;
public const uint DataArena2 = 13;
public const uint DataArena3 = 14;
public const uint DataArena4 = 15;
public const uint DataGoBarKeg = 16;
public const uint DataGoBarKegTrap = 17;
public const uint DataGoBarDoor = 18;
public const uint DataGoChalice = 19;
public const uint DataGhostkill = 20;
public const uint DataEvenstarter = 21;
public const uint DataGolemDoorN = 22;
public const uint DataGolemDoorS = 23;
public const uint DataThroneDoor = 24;
public const uint DataSfBrazierN = 25;
public const uint DataSfBrazierS = 26;
public const uint DataMoira = 27;
public const uint DataCoren = 28;
}
struct MiscConst
{
public const uint TimerTombOfTheSeven = 15000;
public const uint MaxEncounter = 6;
public const uint TombOfSevenBossNum = 7;
}
class instance_blackrock_depths : InstanceMapScript
{
public instance_blackrock_depths() : base(nameof(instance_blackrock_depths), 230) { }
class instance_blackrock_depths_InstanceMapScript : InstanceScript
{
uint[] encounter = new uint[MiscConst.MaxEncounter];
string str_data;
ObjectGuid EmperorGUID;
ObjectGuid PhalanxGUID;
ObjectGuid MagmusGUID;
ObjectGuid MoiraGUID;
ObjectGuid CorenGUID;
ObjectGuid GoArena1GUID;
ObjectGuid GoArena2GUID;
ObjectGuid GoArena3GUID;
ObjectGuid GoArena4GUID;
ObjectGuid GoShadowLockGUID;
ObjectGuid GoShadowMechGUID;
ObjectGuid GoShadowGiantGUID;
ObjectGuid GoShadowDummyGUID;
ObjectGuid GoBarKegGUID;
ObjectGuid GoBarKegTrapGUID;
ObjectGuid GoBarDoorGUID;
ObjectGuid GoTombEnterGUID;
ObjectGuid GoTombExitGUID;
ObjectGuid GoLyceumGUID;
ObjectGuid GoSFSGUID;
ObjectGuid GoSFNGUID;
ObjectGuid GoGolemNGUID;
ObjectGuid GoGolemSGUID;
ObjectGuid GoThroneGUID;
ObjectGuid GoChestGUID;
ObjectGuid GoSpectralChaliceGUID;
uint BarAleCount;
uint GhostKillCount;
ObjectGuid[] TombBossGUIDs = new ObjectGuid[MiscConst.TombOfSevenBossNum];
ObjectGuid TombEventStarterGUID;
uint TombTimer;
uint TombEventCounter;
public instance_blackrock_depths_InstanceMapScript(InstanceMap map) : base(map)
{
SetHeaders("BRD");
BarAleCount = 0;
GhostKillCount = 0;
TombTimer = MiscConst.TimerTombOfTheSeven;
TombEventCounter = 0;
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case CreatureIds.Emperor: EmperorGUID = creature.GetGUID(); break;
case CreatureIds.Phalanx: PhalanxGUID = creature.GetGUID(); break;
case CreatureIds.Moira: MoiraGUID = creature.GetGUID(); break;
case CreatureIds.Coren: CorenGUID = creature.GetGUID(); break;
case CreatureIds.Doomrel: TombBossGUIDs[0] = creature.GetGUID(); break;
case CreatureIds.Doperel: TombBossGUIDs[1] = creature.GetGUID(); break;
case CreatureIds.Haterel: TombBossGUIDs[2] = creature.GetGUID(); break;
case CreatureIds.Vilerel: TombBossGUIDs[3] = creature.GetGUID(); break;
case CreatureIds.Seethrel: TombBossGUIDs[4] = creature.GetGUID(); break;
case CreatureIds.Gloomrel: TombBossGUIDs[5] = creature.GetGUID(); break;
case CreatureIds.Angerrel: TombBossGUIDs[6] = creature.GetGUID(); break;
case CreatureIds.Magmus:
MagmusGUID = creature.GetGUID();
if (!creature.IsAlive())
HandleGameObject(GetGuidData(DataTypes.DataThroneDoor), true); // if Magmus is dead open door to last boss
break;
}
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case GameObjectIds.Arena1: GoArena1GUID = go.GetGUID(); break;
case GameObjectIds.Arena2: GoArena2GUID = go.GetGUID(); break;
case GameObjectIds.Arena3: GoArena3GUID = go.GetGUID(); break;
case GameObjectIds.Arena4: GoArena4GUID = go.GetGUID(); break;
case GameObjectIds.ShadowLock: GoShadowLockGUID = go.GetGUID(); break;
case GameObjectIds.ShadowMechanism: GoShadowMechGUID = go.GetGUID(); break;
case GameObjectIds.ShadowGiantDoor: GoShadowGiantGUID = go.GetGUID(); break;
case GameObjectIds.ShadowDummy: GoShadowDummyGUID = go.GetGUID(); break;
case GameObjectIds.BarKegShot: GoBarKegGUID = go.GetGUID(); break;
case GameObjectIds.BarKegTrap: GoBarKegTrapGUID = go.GetGUID(); break;
case GameObjectIds.BarDoor: GoBarDoorGUID = go.GetGUID(); break;
case GameObjectIds.TombEnter: GoTombEnterGUID = go.GetGUID(); break;
case GameObjectIds.TombExit:
GoTombExitGUID = go.GetGUID();
if (GhostKillCount >= MiscConst.TombOfSevenBossNum)
HandleGameObject(ObjectGuid.Empty, true, go);
else
HandleGameObject(ObjectGuid.Empty, false, go);
break;
case GameObjectIds.Lyceum: GoLyceumGUID = go.GetGUID(); break;
case GameObjectIds.SfS: GoSFSGUID = go.GetGUID(); break;
case GameObjectIds.SfN: GoSFNGUID = go.GetGUID(); break;
case GameObjectIds.GolemRoomN: GoGolemNGUID = go.GetGUID(); break;
case GameObjectIds.GolemRoomS: GoGolemSGUID = go.GetGUID(); break;
case GameObjectIds.ThroneRoom: GoThroneGUID = go.GetGUID(); break;
case GameObjectIds.ChestSeven: GoChestGUID = go.GetGUID(); break;
case GameObjectIds.SpectralChalice: GoSpectralChaliceGUID = go.GetGUID(); break;
}
}
public override void SetGuidData(uint type, ObjectGuid data)
{
switch (type)
{
case DataTypes.DataEvenstarter:
TombEventStarterGUID = data;
if (TombEventStarterGUID.IsEmpty())
TombOfSevenReset();//reset
else
TombOfSevenStart();//start
break;
}
}
public override void SetData(uint type, uint data)
{
switch (type)
{
case DataTypes.TypeRingOfLaw:
encounter[0] = data;
break;
case DataTypes.TypeVault:
encounter[1] = data;
break;
case DataTypes.TypeBar:
if (data == (uint)EncounterState.Special)
++BarAleCount;
else
encounter[2] = data;
break;
case DataTypes.TypeTombOfSeven:
encounter[3] = data;
break;
case DataTypes.TypeLyceum:
encounter[4] = data;
break;
case DataTypes.TypeIronHall:
encounter[5] = data;
break;
case DataTypes.DataGhostkill:
GhostKillCount += data;
break;
}
if (data == (uint)EncounterState.Done || GhostKillCount >= MiscConst.TombOfSevenBossNum)
{
OutSaveInstData();
str_data = $"{encounter[0]} {encounter[1]} {encounter[2]} {encounter[3]} {encounter[4]} {encounter[5]} {GhostKillCount}";
SaveToDB();
OutSaveInstDataComplete();
}
}
public override uint GetData(uint type)
{
switch (type)
{
case DataTypes.TypeRingOfLaw:
return encounter[0];
case DataTypes.TypeVault:
return encounter[1];
case DataTypes.TypeBar:
if (encounter[2] == (uint)EncounterState.InProgress && BarAleCount == 3)
return (uint)EncounterState.Special;
else
return encounter[2];
case DataTypes.TypeTombOfSeven:
return encounter[3];
case DataTypes.TypeLyceum:
return encounter[4];
case DataTypes.TypeIronHall:
return encounter[5];
case DataTypes.DataGhostkill:
return GhostKillCount;
}
return 0;
}
public override ObjectGuid GetGuidData(uint data)
{
switch (data)
{
case DataTypes.DataEmperor:
return EmperorGUID;
case DataTypes.DataPhalanx:
return PhalanxGUID;
case DataTypes.DataMoira:
return MoiraGUID;
case DataTypes.DataCoren:
return CorenGUID;
case DataTypes.DataArena1:
return GoArena1GUID;
case DataTypes.DataArena2:
return GoArena2GUID;
case DataTypes.DataArena3:
return GoArena3GUID;
case DataTypes.DataArena4:
return GoArena4GUID;
case DataTypes.DataGoBarKeg:
return GoBarKegGUID;
case DataTypes.DataGoBarKegTrap:
return GoBarKegTrapGUID;
case DataTypes.DataGoBarDoor:
return GoBarDoorGUID;
case DataTypes.DataEvenstarter:
return TombEventStarterGUID;
case DataTypes.DataSfBrazierN:
return GoSFNGUID;
case DataTypes.DataSfBrazierS:
return GoSFSGUID;
case DataTypes.DataThroneDoor:
return GoThroneGUID;
case DataTypes.DataGolemDoorN:
return GoGolemNGUID;
case DataTypes.DataGolemDoorS:
return GoGolemSGUID;
case DataTypes.DataGoChalice:
return GoSpectralChaliceGUID;
}
return ObjectGuid.Empty;
}
public override string GetSaveData()
{
return str_data;
}
public override void Load(string str)
{
if (str.IsEmpty())
{
OutLoadInstDataFail();
return;
}
OutLoadInstData(str);
StringArguments loadStream = new(str);
for (var i = 0; i < encounter.Length; ++i)
encounter[i] = loadStream.NextUInt32();
GhostKillCount = loadStream.NextUInt32();
for (byte i = 0; i < encounter.Length; ++i)
if (encounter[i] == (uint)EncounterState.InProgress)
encounter[i] = (uint)EncounterState.NotStarted;
if (GhostKillCount > 0 && GhostKillCount < MiscConst.TombOfSevenBossNum)
GhostKillCount = 0;//reset tomb of seven event
if (GhostKillCount >= MiscConst.TombOfSevenBossNum)
GhostKillCount = MiscConst.TombOfSevenBossNum;
OutLoadInstDataComplete();
}
void TombOfSevenEvent()
{
if (GhostKillCount < MiscConst.TombOfSevenBossNum && !TombBossGUIDs[TombEventCounter].IsEmpty())
{
Creature boss = instance.GetCreature(TombBossGUIDs[TombEventCounter]);
if (boss)
{
boss.SetFaction((uint)FactionTemplates.DarkIronDwarves);
boss.SetImmuneToPC(false);
Unit target = boss.SelectNearestTarget(500);
if (target)
boss.GetAI().AttackStart(target);
}
}
}
void TombOfSevenReset()
{
HandleGameObject(GoTombExitGUID, false);//event reseted, close exit door
HandleGameObject(GoTombEnterGUID, true);//event reseted, open entrance door
for (byte i = 0; i < MiscConst.TombOfSevenBossNum; ++i)
{
Creature boss = instance.GetCreature(TombBossGUIDs[i]);
if (boss)
{
if (!boss.IsAlive())
boss.Respawn();
else
boss.SetFaction((uint)FactionTemplates.Friendly);
}
}
GhostKillCount = 0;
TombEventStarterGUID.Clear();
TombEventCounter = 0;
TombTimer = MiscConst.TimerTombOfTheSeven;
SetData(DataTypes.TypeTombOfSeven, (uint)EncounterState.NotStarted);
}
void TombOfSevenStart()
{
HandleGameObject(GoTombExitGUID, false);//event started, close exit door
HandleGameObject(GoTombEnterGUID, false);//event started, close entrance door
SetData(DataTypes.TypeTombOfSeven, (uint)EncounterState.InProgress);
}
void TombOfSevenEnd()
{
DoRespawnGameObject(GoChestGUID, TimeSpan.FromHours(24));
HandleGameObject(GoTombExitGUID, true);//event done, open exit door
HandleGameObject(GoTombEnterGUID, true);//event done, open entrance door
TombEventStarterGUID.Clear();
SetData(DataTypes.TypeTombOfSeven, (uint)EncounterState.Done);
}
public override void Update(uint diff)
{
if (!TombEventStarterGUID.IsEmpty() && GhostKillCount < MiscConst.TombOfSevenBossNum)
{
if (TombTimer <= diff)
{
TombTimer = MiscConst.TimerTombOfTheSeven;
if (TombEventCounter < MiscConst.TombOfSevenBossNum)
{
TombOfSevenEvent();
++TombEventCounter;
}
// Check Killed bosses
for (byte i = 0; i < MiscConst.TombOfSevenBossNum; ++i)
{
Creature boss = instance.GetCreature(TombBossGUIDs[i]);
if (boss)
{
if (!boss.IsAlive())
{
GhostKillCount = i + 1u;
}
}
}
}
else TombTimer -= diff;
}
if (GhostKillCount >= MiscConst.TombOfSevenBossNum && !TombEventStarterGUID.IsEmpty())
TombOfSevenEnd();
}
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_blackrock_depths_InstanceMapScript(map);
}
}
}
@@ -0,0 +1,137 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Magmus
{
struct SpellIds
{
//Magmus
public const uint Fieryburst = 13900;
public const uint Warstomp = 24375;
//IronhandGuardian
public const uint Goutofflame = 15529;
}
enum Phases
{
One = 1,
Two = 2
}
[Script]
class boss_magmus : ScriptedAI
{
Phases phase;
public boss_magmus(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
instance.SetData(DataTypes.TypeIronHall, (uint)EncounterState.InProgress);
phase = Phases.One;
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(SpellIds.Fieryburst);
task.Repeat(TimeSpan.FromSeconds(6));
});
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (me.HealthBelowPctDamaged(50, damage) && phase == Phases.One)
{
phase = Phases.Two;
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
DoCastVictim(SpellIds.Warstomp);
task.Repeat(TimeSpan.FromSeconds(8));
});
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
public override void JustDied(Unit killer)
{
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{
instance.HandleGameObject(instance.GetGuidData(DataTypes.DataThroneDoor), true);
instance.SetData(DataTypes.TypeIronHall, (uint)EncounterState.Done);
}
}
}
[Script]
class npc_ironhand_guardianAI : ScriptedAI
{
InstanceScript _instance;
bool _active;
public npc_ironhand_guardianAI(Creature creature) : base(creature)
{
_instance = me.GetInstanceScript();
_active = false;
}
public override void Reset()
{
_scheduler.CancelAll();
}
public override void UpdateAI(uint diff)
{
if (!_active)
{
if (_instance.GetData(DataTypes.TypeIronHall) == (uint)EncounterState.NotStarted)
return;
// Once the boss is engaged, the guardians will stay activated until the next instance reset
_scheduler.Schedule(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), task =>
{
DoCastAOE(SpellIds.Goutofflame);
task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(21));
});
_active = true;
}
_scheduler.Update(diff);
}
}
}
@@ -0,0 +1,74 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.MoiraBronzebeard
{
struct SpellIds
{
public const uint Heal = 10917;
public const uint Renew = 10929;
public const uint Shield = 10901;
public const uint Mindblast = 10947;
public const uint Shadowwordpain = 10894;
public const uint Smite = 10934;
}
[Script]
class boss_moira_bronzebeard : ScriptedAI
{
public boss_moira_bronzebeard(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
//_scheduler.Schedule(EventHeal, TimeSpan.FromSeconds(12s)); // not used atm // These times are probably wrong
_scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
{
DoCastVictim(SpellIds.Mindblast);
task.Repeat(TimeSpan.FromSeconds(14));
});
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
DoCastVictim(SpellIds.Shadowwordpain);
task.Repeat(TimeSpan.FromSeconds(18));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
DoCastVictim(SpellIds.Smite);
task.Repeat(TimeSpan.FromSeconds(10));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
}
}
}
@@ -0,0 +1,242 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.TombOfSeven
{
struct SpellIds
{
//Gloomrel
public const uint SmeltDarkIron = 14891;
public const uint LearnSmelt = 14894;
//Doomrel
public const uint Shadowboltvolley = 15245;
public const uint Immolate = 12742;
public const uint Curseofweakness = 12493;
public const uint Demonarmor = 13787;
public const uint SummonVoidwalkers = 15092;
}
struct QuestIds
{
public const uint SpectralChalice = 4083;
}
struct TextIds
{
public const uint GossipSelectDoomrel = 1828;
public const uint GossipMenuIdContinue = 1;
public const uint GossipMenuChallenge = 1947;
public const uint GossipMenuIdChallenge = 0;
}
struct MiscConst
{
public const uint DataSkillpointMin = 230;
public const string GossipItemTeach1 = "Teach me the art of smelting dark iron";
public const string GossipItemTeach2 = "Continue...";
public const string GossipItemTeach3 = "[PH] Continue...";
public const string GossipItemTribute = "I want to pay tribute";
}
enum Phases
{
PhaseOne = 1,
PhaseTwo = 2
}
[Script]
class boss_gloomrel : ScriptedAI
{
InstanceScript instance;
public boss_gloomrel(Creature creature) : base(creature)
{
instance = creature.GetInstanceScript();
}
public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId)
{
uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
player.ClearGossipMenu();
switch (action)
{
case eTradeskill.GossipActionInfoDef + 1:
player.AddGossipItem(GossipOptionIcon.None, MiscConst.GossipItemTeach2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 11);
player.SendGossipMenu(2606, me.GetGUID());
break;
case eTradeskill.GossipActionInfoDef + 11:
player.CloseGossipMenu();
player.CastSpell(player, SpellIds.LearnSmelt, false);
break;
case eTradeskill.GossipActionInfoDef + 2:
player.AddGossipItem(GossipOptionIcon.None, MiscConst.GossipItemTeach3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 22);
player.SendGossipMenu(2604, me.GetGUID());
break;
case eTradeskill.GossipActionInfoDef + 22:
player.CloseGossipMenu();
//are 5 minutes expected? go template may have data to despawn when used at quest
instance.DoRespawnGameObject(instance.GetGuidData(DataTypes.DataGoChalice), TimeSpan.FromMinutes(5));
break;
}
return true;
}
public override bool OnGossipHello(Player player)
{
if (player.GetQuestRewardStatus(QuestIds.SpectralChalice) && player.GetSkillValue(SkillType.Mining) >= MiscConst.DataSkillpointMin && !player.HasSpell(SpellIds.SmeltDarkIron))
player.AddGossipItem(GossipOptionIcon.None, MiscConst.GossipItemTeach1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
if (!player.GetQuestRewardStatus(QuestIds.SpectralChalice) && player.GetSkillValue(SkillType.Mining) >= MiscConst.DataSkillpointMin)
player.AddGossipItem(GossipOptionIcon.None, MiscConst.GossipItemTribute, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
player.SendGossipMenu(player.GetGossipTextId(me), me.GetGUID());
return true;
}
}
[Script]
class boss_doomrel : ScriptedAI
{
InstanceScript _instance;
bool _voidwalkers;
public boss_doomrel(Creature creature) : base(creature)
{
Initialize();
_instance = creature.GetInstanceScript();
}
void Initialize()
{
_voidwalkers = false;
}
public override void Reset()
{
Initialize();
me.SetFaction((uint)FactionTemplates.Friendly);
// was set before event start, so set again
me.SetImmuneToPC(true);
if (_instance.GetData(DataTypes.DataGhostkill) >= 7)
me.ReplaceAllNpcFlags(NPCFlags.None);
else
me.ReplaceAllNpcFlags(NPCFlags.Gossip);
}
public override void JustEngagedWith(Unit who)
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCastVictim(SpellIds.Shadowboltvolley);
task.Repeat(TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(18), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.Immolate);
task.Repeat(TimeSpan.FromSeconds(25));
});
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(SpellIds.Curseofweakness);
task.Repeat(TimeSpan.FromSeconds(45));
});
_scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
{
DoCast(me, SpellIds.Demonarmor);
task.Repeat(TimeSpan.FromMinutes(5));
});
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (!_voidwalkers && !HealthAbovePct(50))
{
DoCastVictim(SpellIds.SummonVoidwalkers, new CastSpellExtraArgs(true));
_voidwalkers = true;
}
}
public override void EnterEvadeMode(EvadeReason why)
{
base.EnterEvadeMode(why);
_instance.SetGuidData(DataTypes.DataEvenstarter, ObjectGuid.Empty);
}
public override void JustDied(Unit killer)
{
_instance.SetData(DataTypes.DataGhostkill, 1);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId)
{
uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
player.ClearGossipMenu();
switch (action)
{
case eTradeskill.GossipActionInfoDef + 1:
player.AddGossipItem(TextIds.GossipSelectDoomrel, TextIds.GossipMenuIdContinue, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
player.SendGossipMenu(2605, me.GetGUID());
break;
case eTradeskill.GossipActionInfoDef + 2:
player.CloseGossipMenu();
//start event here
me.SetFaction((int)FactionTemplates.DarkIronDwarves);
me.SetImmuneToPC(false);
me.GetAI().AttackStart(player);
_instance.SetGuidData(DataTypes.DataEvenstarter, player.GetGUID());
break;
}
return true;
}
public override bool OnGossipHello(Player player)
{
player.AddGossipItem(TextIds.GossipMenuChallenge, TextIds.GossipMenuIdChallenge, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
player.SendGossipMenu(2601, me.GetGUID());
return true;
}
}
}