Ported .Net Core commits:

hondacrx:
- Initial commit: Switch to .Net Core 2.0
- Fix build and removed not needed files
Fabi:
- Updated solution platforms.
- Changed folder structure.
- Change library target framework to netstandard2.0.
- Updated solution platforms again...
- Removed windows specific kernel32 function usage (Ctrl-C handler).
This commit is contained in:
Fabian
2017-10-26 17:23:44 +02:00
parent 227702e19c
commit a3dc7b3f48
844 changed files with 26064 additions and 1824 deletions
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2012-2017 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/>.
*/
namespace Scripts.Northrend.Nexus.EyeOfEternity
{
class BossMalygos
{
}
}
@@ -0,0 +1,351 @@
/*
* Copyright (C) 2012-2017 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.GameMath;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System.Collections.Generic;
using System.Linq;
namespace Scripts.Northrend.Nexus.EyeOfEternity
{
struct EyeOfEternityConst
{
public const uint MaxEncounter = 1;
public const uint EventFocusingIris = 20711;
}
struct InstanceData
{
public const uint MalygosEvent = 1;
public const uint VortexHandling = 2;
public const uint PowerSparksHandling = 3;
public const uint RespawnIris = 4;
}
struct InstanceData64
{
public const uint Trigger = 0;
public const uint Malygos = 1;
public const uint Platform = 2;
public const uint AlexstraszaBunnyGUID = 3;
public const uint HeartOfMagicGUID = 4;
public const uint FocusingIrisGUID = 5;
public const uint GiftBoxBunnyGUID = 6;
}
struct InstanceNpcs
{
public const uint Malygos = 28859;
public const uint VortexTrigger = 30090;
public const uint PortalTrigger = 30118;
public const uint PowerSpark = 30084;
public const uint HoverDiskMelee = 30234;
public const uint HoverDiskCaster = 30248;
public const uint ArcaneOverload = 30282;
public const uint WyrmrestSkytalon = 30161;
public const uint Alexstrasza = 32295;
public const uint AlexstraszaBunny = 31253;
public const uint AlexstraszasGift = 32448;
public const uint SurgeOfPower = 30334;
}
struct InstanceGameObjects
{
public const uint NexusRaidPlatform = 193070;
public const uint ExitPortal = 193908;
public const uint FocusingIris10 = 193958;
public const uint FocusingIris25 = 193960;
public const uint AlexstraszaSGift10 = 193905;
public const uint AlexstraszaSGift25 = 193967;
public const uint HeartOfMagic10 = 194158;
public const uint HeartOfMagic25 = 194159;
}
struct InstanceSpells
{
public const uint Vortex4 = 55853; // Damage | Used To Enter To The Vehicle
public const uint Vortex5 = 56263; // Damage | Used To Enter To The Vehicle
public const uint PortalOpened = 61236;
public const uint RideRedDragonTriggered = 56072;
public const uint IrisOpened = 61012; // Visual When Starting Encounter
public const uint SummomRedDragonBuddy = 56070;
}
[Script]
class instance_eye_of_eternity : InstanceMapScript
{
public instance_eye_of_eternity() : base("instance_eye_of_eternity", 616) { }
class instance_eye_of_eternity_InstanceMapScript : InstanceScript
{
public instance_eye_of_eternity_InstanceMapScript(Map map) : base(map)
{
SetHeaders("EOE");
SetBossNumber(EyeOfEternityConst.MaxEncounter);
}
public override void OnPlayerEnter(Player player)
{
if (GetBossState(0) == EncounterState.Done)
player.CastSpell(player, InstanceSpells.SummomRedDragonBuddy, true);
}
public override bool SetBossState(uint type, EncounterState state)
{
if (!base.SetBossState(type, state))
return false;
if (type == InstanceData.MalygosEvent)
{
if (state == EncounterState.Fail)
{
foreach (var triggerGuid in portalTriggers)
{
Creature trigger = instance.GetCreature(triggerGuid);
if (trigger)
{
// just in case
trigger.RemoveAllAuras();
trigger.GetAI().Reset();
}
}
SpawnGameObject(InstanceGameObjects.ExitPortal, exitPortalPosition);
GameObject platform = instance.GetGameObject(platformGUID);
if (platform)
platform.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.Destroyed);
}
else if (state == EncounterState.Done)
SpawnGameObject(InstanceGameObjects.ExitPortal, exitPortalPosition);
}
return true;
}
/// @todo this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
void SpawnGameObject(uint entry, Position pos)
{
GameObject go = new GameObject();
if (go.Create(entry, instance, PhaseMasks.Normal, pos, Quaternion.WAxis, 255, GameObjectState.Ready))
instance.AddToMap(go);
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case InstanceGameObjects.NexusRaidPlatform:
platformGUID = go.GetGUID();
break;
case InstanceGameObjects.FocusingIris10:
case InstanceGameObjects.FocusingIris25:
irisGUID = go.GetGUID();
focusingIrisPosition = go.GetPosition();
break;
case InstanceGameObjects.ExitPortal:
exitPortalGUID = go.GetGUID();
exitPortalPosition = go.GetPosition();
break;
case InstanceGameObjects.HeartOfMagic10:
case InstanceGameObjects.HeartOfMagic25:
heartOfMagicGUID = go.GetGUID();
break;
default:
break;
}
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case InstanceNpcs.VortexTrigger:
vortexTriggers.Add(creature.GetGUID());
break;
case InstanceNpcs.Malygos:
malygosGUID = creature.GetGUID();
break;
case InstanceNpcs.PortalTrigger:
portalTriggers.Add(creature.GetGUID());
break;
case InstanceNpcs.AlexstraszaBunny:
alexstraszaBunnyGUID = creature.GetGUID();
break;
case InstanceNpcs.AlexstraszasGift:
giftBoxBunnyGUID = creature.GetGUID();
break;
}
}
public override void OnUnitDeath(Unit unit)
{
if (!unit.IsTypeId(TypeId.Player))
return;
// Player continues to be moving after death no matter if spline will be cleared along with all movements,
// so on next world tick was all about delay if box will pop or not (when new movement will be registered)
// since in EoE you never stop falling. However root at this precise* moment works,
// it will get cleared on release. If by any chance some lag happen "Reload()" and "RepopMe()" works,
// last test I made now gave me 50/0 of this bug so I can't do more about it.
unit.SetControlled(true, UnitState.Root);
}
public override void ProcessEvent(WorldObject obj, uint eventId)
{
if (eventId == EyeOfEternityConst.EventFocusingIris)
{
Creature alexstraszaBunny = instance.GetCreature(alexstraszaBunnyGUID);
if (alexstraszaBunny)
alexstraszaBunny.CastSpell(alexstraszaBunny, InstanceSpells.IrisOpened);
GameObject iris = instance.GetGameObject(irisGUID);
if (iris)
iris.SetFlag(GameObjectFields.Flags, GameObjectFlags.InUse);
Creature malygos = instance.GetCreature(malygosGUID);
if (malygos)
malygos.GetAI().DoAction(0); // ACTION_LAND_ENCOUNTER_START
GameObject exitPortal = instance.GetGameObject(exitPortalGUID);
if (exitPortal)
exitPortal.Delete();
}
}
void VortexHandling()
{
Creature malygos = instance.GetCreature(malygosGUID);
if (malygos)
{
var threatList = malygos.GetThreatManager().getThreatList();
foreach (var guid in vortexTriggers)
{
if (threatList.Empty())
return;
byte counter = 0;
Creature trigger = instance.GetCreature(guid);
if (trigger)
{
// each trigger have to cast the spell to 5 players.
foreach (var refe in threatList)
{
if (counter >= 5)
break;
Unit target = refe.getTarget();
if (target)
{
Player player = target.ToPlayer();
if (!player || player.IsGameMaster() || player.HasAura(InstanceSpells.Vortex4))
continue;
player.CastSpell(trigger, InstanceSpells.Vortex4, true);
counter++;
}
}
}
}
}
}
void PowerSparksHandling()
{
bool next = (lastPortalGUID == portalTriggers.Last() || !lastPortalGUID.IsEmpty() ? true : false);
foreach (var guid in portalTriggers)
{
if (next)
{
Creature trigger = instance.GetCreature(guid);
if (trigger)
{
lastPortalGUID = trigger.GetGUID();
trigger.CastSpell(trigger, InstanceSpells.PortalOpened, true);
return;
}
}
if (guid == lastPortalGUID)
next = true;
}
}
public override void SetData(uint data, uint value)
{
switch (data)
{
case InstanceData.VortexHandling:
VortexHandling();
break;
case InstanceData.PowerSparksHandling:
PowerSparksHandling();
break;
case InstanceData.RespawnIris:
SpawnGameObject(instance.GetDifficultyID() == Difficulty.Raid10N ? InstanceGameObjects.FocusingIris10 : InstanceGameObjects.FocusingIris25, focusingIrisPosition);
break;
}
}
public override ObjectGuid GetGuidData(uint data)
{
switch (data)
{
case InstanceData64.Trigger:
return vortexTriggers.First();
case InstanceData64.Malygos:
return malygosGUID;
case InstanceData64.Platform:
return platformGUID;
case InstanceData64.AlexstraszaBunnyGUID:
return alexstraszaBunnyGUID;
case InstanceData64.HeartOfMagicGUID:
return heartOfMagicGUID;
case InstanceData64.FocusingIrisGUID:
return irisGUID;
case InstanceData64.GiftBoxBunnyGUID:
return giftBoxBunnyGUID;
}
return ObjectGuid.Empty;
}
List<ObjectGuid> vortexTriggers = new List<ObjectGuid>();
List<ObjectGuid> portalTriggers = new List<ObjectGuid>();
ObjectGuid malygosGUID;
ObjectGuid irisGUID;
ObjectGuid lastPortalGUID;
ObjectGuid platformGUID;
ObjectGuid exitPortalGUID;
ObjectGuid heartOfMagicGUID;
ObjectGuid alexstraszaBunnyGUID;
ObjectGuid giftBoxBunnyGUID;
Position focusingIrisPosition;
Position exitPortalPosition;
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_eye_of_eternity_InstanceMapScript(map);
}
}
}
@@ -0,0 +1,271 @@
/*
* Copyright (C) 2012-2017 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.Northrend.Nexus.Nexus
{
struct AnomalusConst
{
//Spells
public const uint SpellSpark = 47751;
public const uint SpellSparkHeroic = 57062;
public const uint SpellRiftShield = 47748;
public const uint SpellChargeRift = 47747; // Works Wrong (Affect Players; Not Rifts)
public const uint SpellCreateRift = 47743; // Don'T Work; Using Wa
public const uint SpellArcaneAttraction = 57063; // No Idea; When It'S Used
public const uint SpellChaoticEnergyBurst = 47688;
public const uint SpellChargedChaoticEnergyBurst = 47737;
public const uint SpellArcaneform = 48019; // Chaotic Rift Visual
//Texts
public const uint SayAggro = 0;
public const uint SayDeath = 1;
public const uint SayRift = 2;
public const uint SayShield = 3;
public const uint SayRiftEmote = 4; // Needs To Be Added To Script
public const uint SayShieldEmote = 5; // Needs To Be Added To Script
//Misc
public const uint NpcCrazedManaWraith = 26746;
public const uint NpcChaoticRift = 26918;
public const uint DataChaosTheory = 1;
public static Position[] RiftLocation =
{
new Position(652.64f, -273.70f, -8.75f, 0.0f),
new Position(634.45f, -265.94f, -8.44f, 0.0f),
new Position(620.73f, -281.17f, -9.02f, 0.0f),
new Position(626.10f, -304.67f, -9.44f, 0.0f),
new Position(639.87f, -314.11f, -9.49f, 0.0f),
new Position(651.72f, -297.44f, -9.37f, 0.0f)
};
}
[Script]
class boss_anomalus : ScriptedAI
{
public boss_anomalus(Creature creature) : base(creature)
{
instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, AnomalusConst.SpellSpark);
task.Repeat(TimeSpan.FromSeconds(5));
});
Phase = 0;
uiChaoticRiftGUID.Clear();
chaosTheory = true;
}
public override void Reset()
{
Initialize();
instance.SetBossState(DataTypes.Anomalus, EncounterState.NotStarted);
}
public override void EnterCombat(Unit who)
{
Talk(AnomalusConst.SayAggro);
instance.SetBossState(DataTypes.Anomalus, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(AnomalusConst.SayDeath);
instance.SetBossState(DataTypes.Anomalus, EncounterState.Done);
}
public override uint GetData(uint type)
{
if (type == AnomalusConst.DataChaosTheory)
return chaosTheory ? 1 : 0u;
return 0;
}
public override void SummonedCreatureDies(Creature summoned, Unit who)
{
if (summoned.GetEntry() == AnomalusConst.NpcChaoticRift)
chaosTheory = false;
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.GetDistance(me.GetHomePosition()) > 60.0f)
{
// Not blizzlike, hack to avoid an exploit
EnterEvadeMode();
return;
}
if (me.HasAura(AnomalusConst.SpellRiftShield))
{
if (!uiChaoticRiftGUID.IsEmpty())
{
Creature Rift = ObjectAccessor.GetCreature(me, uiChaoticRiftGUID);
if (Rift && Rift.IsDead())
{
me.RemoveAurasDueToSpell(AnomalusConst.SpellRiftShield);
uiChaoticRiftGUID.Clear();
}
return;
}
}
else
uiChaoticRiftGUID.Clear();
if ((Phase == 0) && HealthBelowPct(50))
{
Phase = 1;
Talk(AnomalusConst.SayShield);
DoCast(me, AnomalusConst.SpellRiftShield);
Creature Rift = me.SummonCreature(AnomalusConst.NpcChaoticRift, AnomalusConst.RiftLocation[RandomHelper.IRand(0, 5)], TempSummonType.TimedDespawnOOC, 1000);
if (Rift)
{
//DoCast(Rift, SPELL_CHARGE_RIFT);
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
Rift.GetAI().AttackStart(target);
uiChaoticRiftGUID = Rift.GetGUID();
Talk(AnomalusConst.SayRift);
}
}
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
InstanceScript instance;
byte Phase;
ObjectGuid uiChaoticRiftGUID;
bool chaosTheory;
}
[Script]
class npc_chaotic_rift : ScriptedAI
{
public npc_chaotic_rift(Creature creature) : base(creature)
{
Initialize();
instance = me.GetInstanceScript();
SetCombatMovement(false);
}
void Initialize()
{
uiChaoticEnergyBurstTimer = 1000;
uiSummonCrazedManaWraithTimer = 5000;
}
public override void Reset()
{
Initialize();
me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
DoCast(me, AnomalusConst.SpellArcaneform, false);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (uiChaoticEnergyBurstTimer <= diff)
{
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
DoCast(target, AnomalusConst.SpellChargedChaoticEnergyBurst);
else
DoCast(target, AnomalusConst.SpellChaoticEnergyBurst);
}
uiChaoticEnergyBurstTimer = 1000;
}
else
uiChaoticEnergyBurstTimer -= diff;
if (uiSummonCrazedManaWraithTimer <= diff)
{
Creature Wraith = me.SummonCreature(AnomalusConst.NpcCrazedManaWraith, me.GetPositionX() + 1, me.GetPositionY() + 1, me.GetPositionZ(), 0, TempSummonType.TimedDespawnOOC, 1000);
if (Wraith)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
Wraith.GetAI().AttackStart(target);
}
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
uiSummonCrazedManaWraithTimer = 5000;
else
uiSummonCrazedManaWraithTimer = 10000;
}
else
uiSummonCrazedManaWraithTimer -= diff;
}
InstanceScript instance;
uint uiChaoticEnergyBurstTimer;
uint uiSummonCrazedManaWraithTimer;
}
[Script]
class achievement_chaos_theory : AchievementCriteriaScript
{
public achievement_chaos_theory() : base("achievement_chaos_theory")
{
}
public override bool OnCheck(Player player, Unit target)
{
if (!target)
return false;
Creature Anomalus = target.ToCreature();
if (Anomalus)
if (Anomalus.GetAI().GetData(AnomalusConst.DataChaosTheory) != 0)
return true;
return false;
}
}
}
@@ -0,0 +1,257 @@
/*
* Copyright (C) 2012-2017 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;
using System.Collections.Generic;
namespace Scripts.Northrend.Nexus.Nexus
{
struct KeristraszaConst
{
//Spells
public const uint SpellFrozenPrison = 47854;
public const uint SpellTailSweep = 50155;
public const uint SpellCrystalChains = 50997;
public const uint SpellEnrage = 8599;
public const uint SpellCrystalFireBreath = 48096;
public const uint SpellCrystalize = 48179;
public const uint SpellIntenseCold = 48094;
public const uint SpellIntenseColdTriggered = 48095;
//Yells
public const uint SayAggro = 0;
public const uint SaySlay = 1;
public const uint SayEnrage = 2;
public const uint SayDeath = 3;
public const uint SayCrystalNova = 4;
public const uint SayFrenzy = 5;
//Misc
public const uint DataIntenseCold = 1;
public const uint DataContainmentSpheres = 3;
}
[Script]
public class boss_keristrasza : BossAI
{
public boss_keristrasza(Creature creature) : base(creature, DataTypes.Keristrasza)
{
Initialize();
}
void Initialize()
{
_enrage = false;
//Crystal FireBreath
_scheduler.Schedule(TimeSpan.FromSeconds(14), task =>
{
DoCastVictim(KeristraszaConst.SpellCrystalFireBreath);
task.Repeat(TimeSpan.FromSeconds(14));
});
//CrystalChainsCrystalize
_scheduler.Schedule(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)), task =>
{
Talk(KeristraszaConst.SayCrystalNova);
if (IsHeroic())
DoCast(me, KeristraszaConst.SpellCrystalize);
else
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, KeristraszaConst.SpellCrystalChains);
}
task.Repeat(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)));
});
//TailSweep
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCast(me, KeristraszaConst.SpellTailSweep);
task.Repeat(TimeSpan.FromSeconds(5));
});
}
public override void Reset()
{
Initialize();
_intenseColdList.Clear();
me.RemoveFlag(UnitFields.Flags, UnitFlags.Stunned);
RemovePrison(CheckContainmentSpheres());
_Reset();
}
public override void EnterCombat(Unit who)
{
Talk(KeristraszaConst.SayAggro);
DoCastAOE(KeristraszaConst.SpellIntenseCold);
_EnterCombat();
}
public override void JustDied(Unit killer)
{
Talk(KeristraszaConst.SayDeath);
_JustDied();
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(KeristraszaConst.SaySlay);
}
public bool CheckContainmentSpheres(bool removePrison = false)
{
for (uint i = DataTypes.AnomalusContainmetSphere; i < (DataTypes.AnomalusContainmetSphere + KeristraszaConst.DataContainmentSpheres); ++i)
{
GameObject containmentSpheres = ObjectAccessor.GetGameObject(me, instance.GetGuidData(i));
if (!containmentSpheres || containmentSpheres.GetGoState() != GameObjectState.Active)
return false;
}
if (removePrison)
RemovePrison(true);
return true;
}
void RemovePrison(bool remove)
{
if (remove)
{
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasAura(KeristraszaConst.SpellFrozenPrison))
me.RemoveAurasDueToSpell(KeristraszaConst.SpellFrozenPrison);
}
else
{
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
DoCast(me, KeristraszaConst.SpellFrozenPrison, false);
}
}
public override void SetGUID(ObjectGuid guid, int id = 0)
{
if (id == KeristraszaConst.DataIntenseCold)
_intenseColdList.Add(guid);
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!_enrage && me.HealthBelowPctDamaged(25, damage))
{
Talk(KeristraszaConst.SayEnrage);
Talk(KeristraszaConst.SayFrenzy);
DoCast(me, KeristraszaConst.SpellEnrage);
_enrage = true;
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool _enrage;
public List<ObjectGuid> _intenseColdList = new List<ObjectGuid>();
}
[Script]
class containment_sphere : GameObjectScript
{
public containment_sphere() : base("containment_sphere") { }
public override bool OnGossipHello(Player player, GameObject go)
{
InstanceScript instance = go.GetInstanceScript();
Creature pKeristrasza = ObjectAccessor.GetCreature(go, instance.GetGuidData(DataTypes.Keristrasza));
if (pKeristrasza && pKeristrasza.IsAlive())
{
// maybe these are hacks :(
go.SetFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
go.SetGoState(GameObjectState.Active);
((boss_keristrasza)pKeristrasza.GetAI()).CheckContainmentSpheres(true);
}
return true;
}
}
[Script]
class spell_intense_cold : AuraScript
{
void HandlePeriodicTick(AuraEffect aurEff)
{
if (aurEff.GetBase().GetStackAmount() < 2)
return;
Unit caster = GetCaster();
/// @todo the caster should be boss but not the player
if (!caster || caster.GetAI() == null)
return;
caster.GetAI().SetGUID(GetTarget().GetGUID(), (int)KeristraszaConst.DataIntenseCold);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 1, AuraType.PeriodicDamage));
}
}
[Script]
class achievement_intense_cold : AchievementCriteriaScript
{
public achievement_intense_cold() : base("achievement_intense_cold") { }
public override bool OnCheck(Player player, Unit target)
{
if (!target)
return false;
var _intenseColdList = ((boss_keristrasza)target.ToCreature().GetAI())._intenseColdList;
if (!_intenseColdList.Empty())
{
foreach (var guid in _intenseColdList)
if (player.GetGUID() == guid)
return false;
}
return true;
}
}
}
@@ -0,0 +1,314 @@
/*
* Copyright (C) 2012-2017 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;
namespace Scripts.Northrend.Nexus.Nexus
{
struct MagusTelestraConst
{
//Spells
public const uint SpellIceNova = 47772;
public const uint SpellIceNovaH = 56935;
public const uint SpellFirebomb = 47773;
public const uint SpellFirebombH = 56934;
public const uint SpellGravityWell = 47756;
public const uint SpellTelestraBack = 47714;
public const uint SpellFireMagusVisual = 47705;
public const uint SpellFrostMagusVisual = 47706;
public const uint SpellArcaneMagusVisual = 47704;
public const uint SpellWearChristmasHat = 61400;
//Npcs
public const uint NpcFireMagus = 26928;
public const uint NpcFrostMagus = 26930;
public const uint NpcArcaneMagus = 26929;
//Texts
public const uint SayAggro = 0;
public const uint SayKill = 1;
public const uint SayDeath = 2;
public const uint SayMerge = 3;
public const uint SaySplit = 4;
//Misc
public const uint DataSplitPersonality = 1;
public const ushort GameEventWinterVeil = 2;
}
[Script]
class boss_magus_telestra : ScriptedAI
{
public boss_magus_telestra(Creature creature) : base(creature)
{
instance = creature.GetInstanceScript();
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
uiIsWaitingToAppearTimer = 0;
}
void Initialize()
{
Phase = 0;
uiIceNovaTimer = 7 * Time.InMilliseconds;
uiFireBombTimer = 0;
uiGravityWellTimer = 15 * Time.InMilliseconds;
uiCooldown = 0;
for (byte n = 0; n < 3; ++n)
time[n] = 0;
splitPersonality = 0;
bIsWaitingToAppear = false;
}
public override void Reset()
{
Initialize();
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.NotStarted);
if (IsHeroic() && Global.GameEventMgr.IsActiveEvent(MagusTelestraConst.GameEventWinterVeil) && !me.HasAura(MagusTelestraConst.SpellWearChristmasHat))
me.AddAura(MagusTelestraConst.SpellWearChristmasHat, me);
}
public override void EnterCombat(Unit who)
{
Talk(MagusTelestraConst.SayAggro);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(MagusTelestraConst.SayDeath);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.Done);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(MagusTelestraConst.SayKill);
}
public override uint GetData(uint type)
{
if (type == MagusTelestraConst.DataSplitPersonality)
return splitPersonality;
return 0;
}
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (bIsWaitingToAppear)
{
me.StopMoving();
me.AttackStop();
if (uiIsWaitingToAppearTimer <= diff)
{
me.CastSpell(me, 47714, true);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bIsWaitingToAppear = false;
InVanish = false;
me.SendAIReaction(AiReaction.Hostile);
}
else
uiIsWaitingToAppearTimer -= diff;
return;
}
if ((Phase == 1) || (Phase == 3))
{
if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
{
for (byte n = 0; n < 3; ++n)
time[n] = 0;
me.GetMotionMaster().Clear();
DoCast(me, MagusTelestraConst.SpellTelestraBack);
if (Phase == 1)
Phase = 2;
if (Phase == 3)
Phase = 4;
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4 * Time.InMilliseconds;
Talk(MagusTelestraConst.SayMerge);
}
else
return;
}
if ((Phase == 0) && HealthBelowPct(50))
{
InVanish = true;
Phase = 1;
me.CastStop();
me.RemoveAllAuras();
me.CastSpell(me, 47710, false);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(MagusTelestraConst.SaySplit);
return;
}
if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
{
InVanish = true;
Phase = 3;
me.CastStop();
me.RemoveAllAuras();
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(MagusTelestraConst.SaySplit);
return;
}
if (uiCooldown != 0)
{
if (uiCooldown <= diff)
uiCooldown = 0;
else
{
uiCooldown -= diff;
return;
}
}
if (uiIceNovaTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
DoCast(target, MagusTelestraConst.SpellIceNova, false);
uiCooldown = 1500;
}
uiIceNovaTimer = 15 * Time.InMilliseconds;
}
else uiIceNovaTimer -= diff;
if (uiGravityWellTimer <= diff)
{
Unit target = me.GetVictim();
if (target)
{
DoCast(target, MagusTelestraConst.SpellGravityWell);
uiCooldown = 6 * Time.InMilliseconds;
}
uiGravityWellTimer = 15 * Time.InMilliseconds;
}
else uiGravityWellTimer -= diff;
if (uiFireBombTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
DoCast(target, MagusTelestraConst.SpellFirebomb, false);
uiCooldown = 2 * Time.InMilliseconds;
}
uiFireBombTimer = 2 * Time.InMilliseconds;
}
else uiFireBombTimer -= diff;
if (!InVanish)
DoMeleeAttackIfReady();
}
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (summon.IsAlive())
return;
switch (summon.GetEntry())
{
case MagusTelestraConst.NpcFireMagus:
bFireMagusDead = true;
break;
case MagusTelestraConst.NpcFrostMagus:
bFrostMagusDead = true;
break;
case MagusTelestraConst.NpcArcaneMagus:
bArcaneMagusDead = true;
break;
}
byte i = 0;
while (time[i] != 0)
++i;
time[i] = Global.WorldMgr.GetGameTime();
if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
++splitPersonality;
}
InstanceScript instance;
bool bFireMagusDead;
bool bFrostMagusDead;
bool bArcaneMagusDead;
bool bIsWaitingToAppear;
bool InVanish;
uint uiIsWaitingToAppearTimer;
uint uiIceNovaTimer;
uint uiFireBombTimer;
uint uiGravityWellTimer;
uint uiCooldown;
byte Phase;
byte splitPersonality;
long[] time = new long[3];
}
[Script]
class achievement_split_personality : AchievementCriteriaScript
{
public achievement_split_personality() : base("achievement_split_personality") { }
public override bool OnCheck(Player player, Unit target)
{
if (!target)
return false;
Creature Telestra = target.ToCreature();
if (Telestra)
if (Telestra.GetAI().GetData(MagusTelestraConst.DataSplitPersonality) == 2)
return true;
return false;
}
}
}
@@ -0,0 +1,103 @@
/*
* Copyright (C) 2012-2017 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 System;
namespace Scripts.Northrend.Nexus.Nexus
{
struct NexusCommandersConst
{
//Spells
public const uint SpellBattleShout = 31403;
public const uint SpellCharge = 60067;
public const uint SpellFrighteningShout = 19134;
public const uint SpellWhirlwind = 38618;
public const uint SpellFrozenPrison = 47543;
//Texts
public const uint SayAggro = 0;
public const uint SayKill = 1;
public const uint SayDeath = 2;
}
[Script]
class boss_nexus_commanders : BossAI
{
boss_nexus_commanders(Creature creature) : base(creature, DataTypes.Commander) { }
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(NexusCommandersConst.SayAggro);
me.RemoveAurasDueToSpell(NexusCommandersConst.SpellFrozenPrison);
DoCast(me, NexusCommandersConst.SpellBattleShout);
//Charge
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, NexusCommandersConst.SpellCharge);
task.Repeat(TimeSpan.FromSeconds(11), TimeSpan.FromSeconds(15));
});
//Whirlwind
_scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(8), task =>
{
DoCast(me, NexusCommandersConst.SpellWhirlwind);
task.Repeat(TimeSpan.FromSeconds(19.5), TimeSpan.FromSeconds(25));
});
//Frightening Shout
_scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(15), task =>
{
DoCastAOE(NexusCommandersConst.SpellFrighteningShout);
task.Repeat(TimeSpan.FromSeconds(45), TimeSpan.FromSeconds(55));
});
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(NexusCommandersConst.SayDeath);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(NexusCommandersConst.SayKill);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
}
}
@@ -0,0 +1,261 @@
/*
* Copyright (C) 2012-2017 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.Northrend.Nexus.Nexus
{
struct OrmorokConst
{
//Spells
public const uint SpellReflection = 47981;
public const uint SpellTrample = 48016;
public const uint SpellFrenzy = 48017;
public const uint SpellSummonCrystallineTangler = 61564;
public const uint SpellCrystalSpikes = 47958;
//Texts
public const uint SayAggro = 1;
public const uint SayDeath = 2;
public const uint SayReflect = 3;
public const uint SayCrystalSpikes = 4;
public const uint SayKill = 5;
public const uint SayFrenzy = 6;
}
[Script]
class boss_ormorok : BossAI
{
public boss_ormorok(Creature creature) : base(creature, DataTypes.Ormorok)
{
Initialize();
}
void Initialize()
{
frenzy = false;
}
public override void Reset()
{
base.Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
//Crystal Spikes
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
Talk(OrmorokConst.SayCrystalSpikes);
DoCast(OrmorokConst.SpellCrystalSpikes);
task.Repeat(TimeSpan.FromSeconds(12));
});
//Trample
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCast(me, OrmorokConst.SpellTrample);
task.Repeat(TimeSpan.FromSeconds(10));
});
//Spell Reflection
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Talk(OrmorokConst.SayReflect);
DoCast(me, OrmorokConst.SpellReflection);
task.Repeat(TimeSpan.FromSeconds(30));
});
//Heroic Crystalline Tangler
if (IsHeroic())
{
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, new OrmorokTanglerPredicate(me));
if (target)
DoCast(target, OrmorokConst.SpellSummonCrystallineTangler);
task.Repeat(TimeSpan.FromSeconds(17));
});
}
Talk(OrmorokConst.SayAggro);
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!frenzy && HealthBelowPct(25))
{
Talk(OrmorokConst.SayFrenzy);
DoCast(me, OrmorokConst.SpellFrenzy);
frenzy = true;
}
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(OrmorokConst.SayDeath);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(OrmorokConst.SayKill);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool frenzy;
}
class OrmorokTanglerPredicate : ISelector
{
public OrmorokTanglerPredicate(Unit unit)
{
me = unit;
}
public bool Check(Unit target)
{
return target.GetDistance2d(me) >= 5.0f;
}
Unit me;
}
struct CrystalSpikesConst
{
public const uint NpcCrystalSpikeInitial = 27101;
public const uint NpcCrystalSpikeTrigger = 27079;
public const uint DataCount = 1;
public const uint MaxCount = 5;
public const uint SpellCrystalSpikeDamage = 47944;
public const uint GoCrystalSpikeTrap = 188537;
public static uint[] CrystalSpikeSummon =
{
47936,
47942,
7943
};
}
[Script]
class npc_crystal_spike_trigger : ScriptedAI
{
public npc_crystal_spike_trigger(Creature creature) : base(creature) { }
public override void IsSummonedBy(Unit owner)
{
switch (me.GetEntry())
{
case CrystalSpikesConst.NpcCrystalSpikeInitial:
_count = 0;
me.SetFacingToObject(owner);
break;
case CrystalSpikesConst.NpcCrystalSpikeTrigger:
Creature trigger = owner.ToCreature();
if (trigger)
_count = trigger.GetAI().GetData(CrystalSpikesConst.DataCount) + 1;
break;
default:
_count = CrystalSpikesConst.MaxCount;
break;
}
if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{
GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f);
if (trap)
trap.Use(me);
}
//Despawn
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{
GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f);
if (trap)
trap.Delete();
}
me.DespawnOrUnsummon();
});
}
public override uint GetData(uint type)
{
return type == CrystalSpikesConst.DataCount ? _count : 0;
}
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff);
}
uint _count;
}
[Script]
class spell_crystal_spike : AuraScript
{
void HandlePeriodic(AuraEffect aurEff)
{
Unit target = GetTarget();
if (target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial || target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{
Creature trigger = target.ToCreature();
if (trigger)
{
uint spell = target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial ? CrystalSpikesConst.CrystalSpikeSummon[0] : CrystalSpikesConst.CrystalSpikeSummon[RandomHelper.IRand(0, 2)];
if (trigger.GetAI().GetData(CrystalSpikesConst.DataCount) < CrystalSpikesConst.MaxCount)
trigger.CastSpell(trigger, spell, true);
}
}
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy));
}
}
}
@@ -0,0 +1,227 @@
/*
* Copyright (C) 2012-2017 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.Entities;
using Game.Maps;
using Game.Scripting;
namespace Scripts.Northrend.Nexus.Nexus
{
struct DataTypes
{
public const uint Commander = 0;
public const uint MagusTelestra = 1;
public const uint Anomalus = 2;
public const uint Ormorok = 3;
public const uint Keristrasza = 4;
public const uint AnomalusContainmetSphere = 5;
public const uint OrmorokContainmetSphere = 6;
public const uint TelestraContainmetSphere = 7;
}
struct CreatureIds
{
public const uint Anomalus = 26763;
public const uint Keristrasza = 26723;
// Alliance
public const uint AllianceBerserker = 26800;
public const uint AllianceRanger = 26802;
public const uint AllianceCleric = 26805;
public const uint AllianceCommander = 27949;
public const uint CommanderStoutbeard = 26796;
// Horde
public const uint HordeBerserker = 26799;
public const uint HordeRanger = 26801;
public const uint HordeCleric = 26803;
public const uint HordeCommander = 27947;
public const uint CommanderKolurg = 26798;
}
struct GameObjectIds
{
public const uint AnomalusContainmetSphere = 188527;
public const uint OrmoroksContainmetSphere = 188528;
public const uint TelestrasContainmetSphere = 188526;
}
[Script]
class instance_nexus : InstanceMapScript
{
public instance_nexus() : base(nameof(instance_nexus), 576) { }
class instance_nexus_InstanceMapScript : InstanceScript
{
public instance_nexus_InstanceMapScript(Map map) : base(map)
{
SetHeaders("NEX");
SetBossNumber(DataTypes.Keristrasza + 1);
_teamInInstance = 0;
}
public override void OnPlayerEnter(Player player)
{
if (_teamInInstance == 0)
_teamInInstance = player.GetTeam();
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case CreatureIds.Anomalus:
AnomalusGUID = creature.GetGUID();
break;
case CreatureIds.Keristrasza:
KeristraszaGUID = creature.GetGUID();
break;
// Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs.
case CreatureIds.AllianceBerserker:
if (ServerAllowsTwoSideGroups())
creature.SetFaction(16);
if (_teamInInstance == Team.Alliance)
creature.UpdateEntry(CreatureIds.HordeBerserker);
break;
case CreatureIds.AllianceRanger:
if (ServerAllowsTwoSideGroups())
creature.SetFaction(16);
if (_teamInInstance == Team.Alliance)
creature.UpdateEntry(CreatureIds.HordeRanger);
break;
case CreatureIds.AllianceCleric:
if (ServerAllowsTwoSideGroups())
creature.SetFaction(16);
if (_teamInInstance == Team.Alliance)
creature.UpdateEntry(CreatureIds.HordeCleric);
break;
case CreatureIds.AllianceCommander:
if (ServerAllowsTwoSideGroups())
creature.SetFaction(16);
if (_teamInInstance == Team.Alliance)
creature.UpdateEntry(CreatureIds.HordeCommander);
break;
case CreatureIds.CommanderStoutbeard:
if (ServerAllowsTwoSideGroups())
creature.SetFaction(16);
if (_teamInInstance == Team.Alliance)
creature.UpdateEntry(CreatureIds.CommanderKolurg);
break;
default:
break;
}
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case GameObjectIds.AnomalusContainmetSphere:
AnomalusContainmentSphere = go.GetGUID();
if (GetBossState(DataTypes.Anomalus) == EncounterState.Done)
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
break;
case GameObjectIds.OrmoroksContainmetSphere:
OrmoroksContainmentSphere = go.GetGUID();
if (GetBossState(DataTypes.Ormorok) == EncounterState.Done)
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
break;
case GameObjectIds.TelestrasContainmetSphere:
TelestrasContainmentSphere = go.GetGUID();
if (GetBossState(DataTypes.MagusTelestra) == EncounterState.Done)
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
break;
default:
break;
}
}
public override bool SetBossState(uint type, EncounterState state)
{
if (!base.SetBossState(type, state))
return false;
switch (type)
{
case DataTypes.MagusTelestra:
if (state == EncounterState.Done)
{
GameObject sphere = instance.GetGameObject(TelestrasContainmentSphere);
if (sphere)
sphere.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
}
break;
case DataTypes.Anomalus:
if (state == EncounterState.Done)
{
GameObject sphere = instance.GetGameObject(AnomalusContainmentSphere);
if (sphere)
sphere.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
}
break;
case DataTypes.Ormorok:
if (state == EncounterState.Done)
{
GameObject sphere = instance.GetGameObject(OrmoroksContainmentSphere);
if (sphere)
sphere.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
}
break;
default:
break;
}
return true;
}
public override ObjectGuid GetGuidData(uint type)
{
switch (type)
{
case DataTypes.Anomalus:
return AnomalusGUID;
case DataTypes.Keristrasza:
return KeristraszaGUID;
case DataTypes.AnomalusContainmetSphere:
return AnomalusContainmentSphere;
case DataTypes.OrmorokContainmetSphere:
return OrmoroksContainmentSphere;
case DataTypes.TelestraContainmetSphere:
return TelestrasContainmentSphere;
default:
break;
}
return ObjectGuid.Empty;
}
ObjectGuid AnomalusGUID;
ObjectGuid KeristraszaGUID;
ObjectGuid AnomalusContainmentSphere;
ObjectGuid OrmoroksContainmentSphere;
ObjectGuid TelestrasContainmentSphere;
Team _teamInInstance;
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_nexus_InstanceMapScript(map);
}
}
}
@@ -0,0 +1,352 @@
/*
* Copyright (C) 2012-2017 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/>.
*/
namespace Scripts.Northrend.Nexus.Oculus
{
/*
struct DataTypes
{
// Encounter States/Boss GUIDs
public const uint Drakos = 0;
public const uint Varos = 1;
public const uint Urom = 2;
public const uint Eregos = 3;
// GPS System
public const uint Constructs = 4;
}
class instance_oculus : InstanceMapScript
{
public instance_oculus() : base(nameof(instance_oculus), 578) { }
class instance_oculus_InstanceMapScript : InstanceScript
{
public instance_oculus_InstanceMapScript(Map map) : base(map)
{
SetHeaders("OC");
SetBossNumber(DataTypes.Eregos + 1);
LoadDoorData(doorData);
CentrifugueConstructCounter = 0;
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case NPC_DRAKOS:
DrakosGUID = creature.GetGUID();
break;
case NPC_VAROS:
VarosGUID = creature.GetGUID();
if (GetBossState(DATA_DRAKOS) == EncounterState.Done)
creature.SetPhaseMask(1, true);
break;
case NPC_UROM:
UromGUID = creature.GetGUID();
if (GetBossState(DATA_VAROS) == EncounterState.Done)
creature.SetPhaseMask(1, true);
break;
case NPC_EREGOS:
EregosGUID = creature.GetGUID();
if (GetBossState(DATA_UROM) == EncounterState.Done)
creature.SetPhaseMask(1, true);
break;
case NPC_CENTRIFUGE_CONSTRUCT:
if (creature.IsAlive())
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++CentrifugueConstructCounter);
break;
case NPC_BELGARISTRASZ:
BelgaristraszGUID = creature.GetGUID();
if (GetBossState(DATA_DRAKOS) == EncounterState.Done)
{
creature.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
creature.Relocate(BelgaristraszMove);
}
break;
case NPC_ETERNOS:
EternosGUID = creature.GetGUID();
if (GetBossState(DATA_DRAKOS) == EncounterState.Done)
{
creature.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
creature.Relocate(EternosMove);
}
break;
case NPC_VERDISA:
VerdisaGUID = creature.GetGUID();
if (GetBossState(DATA_DRAKOS) == EncounterState.Done)
{
creature.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
creature.Relocate(VerdisaMove);
}
break;
case NPC_GREATER_WHELP:
if (GetBossState(DATA_UROM) == EncounterState.Done)
{
creature.SetPhaseMask(1, true);
GreaterWhelpList.Add(creature.GetGUID());
}
break;
default:
break;
}
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case GO_DRAGON_CAGE_DOOR:
AddDoor(go, true);
break;
case GO_EREGOS_CACHE_N:
case GO_EREGOS_CACHE_H:
EregosCacheGUID = go.GetGUID();
break;
default:
break;
}
}
public override void OnGameObjectRemove(GameObject go)
{
switch (go.GetEntry())
{
case GO_DRAGON_CAGE_DOOR:
AddDoor(go, false);
break;
default:
break;
}
}
public override void OnUnitDeath(Unit unit)
{
Creature creature = unit.ToCreature();
if (!creature)
return;
if (creature.GetEntry() == NPC_CENTRIFUGE_CONSTRUCT)
{
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --CentrifugueConstructCounter);
if (CentrifugueConstructCounter == 0)
{
Creature varos = instance.GetCreature(VarosGUID);
if (varos)
varos.RemoveAllAuras();
}
}
}
public override void FillInitialWorldStates(InitWorldStates packet)
{
if (GetBossState(DATA_DRAKOS) == EncounterState.Done && GetBossState(DATA_VAROS) != EncounterState.Done)
{
packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter);
}
else
{
packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0);
}
}
public override void ProcessEvent(WorldObject Unit, uint eventId)
{
if (eventId != EVENT_CALL_DRAGON)
return;
Creature varos = instance.GetCreature(VarosGUID);
if (varos)
{
Creature drake = varos.SummonCreature(NPC_AZURE_RING_GUARDIAN, varos.GetPositionX(), varos.GetPositionY(), varos.GetPositionZ() + 40);
if (drake)
drake.GetAI().DoAction(ACTION_CALL_DRAGON_EVENT);
}
}
public override bool SetBossState(uint type, EncounterState state)
{
if (!base.SetBossState(type, state))
return false;
switch (type)
{
case DATA_DRAKOS:
if (state == EncounterState.Done)
{
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter);
FreeDragons();
Creature varos = instance.GetCreature(VarosGUID);
if (varos)
varos.SetPhaseMask(1, true);
events.ScheduleEvent(EVENT_VAROS_INTRO, 15000);
}
break;
case DATA_VAROS:
if (state == EncounterState.Done)
{
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
Creature urom = instance.GetCreature(UromGUID);
if (urom)
urom.SetPhaseMask(1, true);
}
break;
case DATA_UROM:
if (state == EncounterState.Done)
{
Creature eregos = instance.GetCreature(EregosGUID);
if (eregos)
{
eregos.SetPhaseMask(1, true);
GreaterWhelps();
events.ScheduleEvent(EVENT_EREGOS_INTRO, 5000);
}
}
break;
case DATA_EREGOS:
if (state == EncounterState.Done)
{
GameObject cache = instance.GetGameObject(EregosCacheGUID);
if (cache)
{
cache.SetRespawnTime((int)cache.GetRespawnDelay());
cache.RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
}
break;
}
return true;
}
public override uint GetData(uint type)
{
if (type == DATA_CONSTRUCTS)
{
if (CentrifugueConstructCounter == 0)
return KILL_NO_CONSTRUCT;
else if (CentrifugueConstructCounter == 1)
return KILL_ONE_CONSTRUCT;
else if (CentrifugueConstructCounter > 1)
return KILL_MORE_CONSTRUCT;
}
return KILL_NO_CONSTRUCT;
}
public override ObjectGuid GetGuidData(uint type)
{
switch (type)
{
case DATA_DRAKOS:
return DrakosGUID;
case DATA_VAROS:
return VarosGUID;
case DATA_UROM:
return UromGUID;
case DATA_EREGOS:
return EregosGUID;
default:
break;
}
return ObjectGuid.Empty;
}
void FreeDragons()
{
Creature belgaristrasz = instance.GetCreature(BelgaristraszGUID);
if (belgaristrasz)
{
belgaristrasz.SetWalk(true);
belgaristrasz.GetMotionMaster().MovePoint(POINT_MOVE_OUT, BelgaristraszMove);
}
Creature eternos = instance.GetCreature(EternosGUID);
if (eternos)
{
eternos.SetWalk(true);
eternos.GetMotionMaster().MovePoint(POINT_MOVE_OUT, EternosMove);
}
Creature verdisa = instance.GetCreature(VerdisaGUID);
if (verdisa)
{
verdisa.SetWalk(true);
verdisa.GetMotionMaster().MovePoint(POINT_MOVE_OUT, VerdisaMove);
}
}
public override void Update(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EVENT_VAROS_INTRO:
Creature varos = instance.GetCreature(VarosGUID);
if (varos)
varos.GetAI().Talk(SAY_VAROS_INTRO_TEXT);
break;
case EVENT_EREGOS_INTRO:
Creature eregos = instance.GetCreature(EregosGUID);
if (eregos)
eregos.GetAI().Talk(SAY_EREGOS_INTRO_TEXT);
break;
default:
break;
}
});
}
void GreaterWhelps()
{
foreach (ObjectGuid guid in GreaterWhelpList)
{
Creature gwhelp = instance.GetCreature(guid);
if (gwhelp)
gwhelp.SetPhaseMask(1, true);
}
}
ObjectGuid DrakosGUID;
ObjectGuid VarosGUID;
ObjectGuid UromGUID;
ObjectGuid EregosGUID;
ObjectGuid BelgaristraszGUID;
ObjectGuid EternosGUID;
ObjectGuid VerdisaGUID;
byte CentrifugueConstructCounter;
ObjectGuid EregosCacheGUID;
List<ObjectGuid> GreaterWhelpList = new List<ObjectGuid>();
EventMap events = new EventMap();
}
*/
}