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:
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* 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.Gundrak.DrakkariColossus
|
||||
{
|
||||
struct TextIds
|
||||
{
|
||||
// Drakkari Elemental
|
||||
public const uint EmoteMojo = 0;
|
||||
public const uint EmoteActivateAltar = 1;
|
||||
}
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint Emerge = 54850;
|
||||
public const uint ElementalSpawnEffect = 54888;
|
||||
public const uint MojoVolley = 54849;
|
||||
public const uint SurgeVisual = 54827;
|
||||
public const uint Merge = 54878;
|
||||
public const uint MightyBlow = 54719;
|
||||
public const uint Surge = 54801;
|
||||
public const uint FreezeAnim = 16245;
|
||||
public const uint MojoPuddle = 55627;
|
||||
public const uint MojoWave = 55626;
|
||||
}
|
||||
|
||||
struct Misc
|
||||
{
|
||||
public const uint EventMightyBlow = 1;
|
||||
public const uint EventSurge = 1;
|
||||
|
||||
public const int ActionSummonElemental = 1;
|
||||
public const int ActionFreezeColossus = 2;
|
||||
public const int ActionUnfreezeColossus = 3;
|
||||
public const int ActionReturnToColossus = 1;
|
||||
|
||||
public const byte ColossusPhaseNormal = 1;
|
||||
public const byte ColossusPhaseFirstElementalSummon = 2;
|
||||
public const byte ColossusPhaseSecondElementalSummon = 3;
|
||||
|
||||
public const uint DataColossusPhase = 1;
|
||||
public const uint DataIntroDone = 2;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_drakkari_colossus : BossAI
|
||||
{
|
||||
public boss_drakkari_colossus(Creature creature) : base(creature, GDDataTypes.DrakkariColossus)
|
||||
{
|
||||
Initialize();
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
introDone = false;
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
phase = Misc.ColossusPhaseNormal;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
|
||||
if (GetData(Misc.DataIntroDone) != 0)
|
||||
{
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
}
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MightyBlow);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case Misc.ActionSummonElemental:
|
||||
DoCast(SpellIds.Emerge);
|
||||
break;
|
||||
case Misc.ActionFreezeColossus:
|
||||
me.GetMotionMaster().Clear();
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
DoCast(me, SpellIds.FreezeAnim);
|
||||
break;
|
||||
case Misc.ActionUnfreezeColossus:
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
return;
|
||||
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
|
||||
me.SetInCombatWithZone();
|
||||
|
||||
if (me.GetVictim())
|
||||
me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (me.HasFlag(UnitFields.Flags, UnitFlags.ImmuneToPc))
|
||||
damage = 0;
|
||||
|
||||
if (phase == Misc.ColossusPhaseNormal ||
|
||||
phase == Misc.ColossusPhaseFirstElementalSummon)
|
||||
{
|
||||
if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5))
|
||||
{
|
||||
damage = 0;
|
||||
phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon);
|
||||
DoAction(Misc.ActionFreezeColossus);
|
||||
DoAction(Misc.ActionSummonElemental);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override uint GetData(uint data)
|
||||
{
|
||||
if (data == Misc.DataColossusPhase)
|
||||
return phase;
|
||||
else if (data == Misc.DataIntroDone)
|
||||
return introDone ? 1 : 0u;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void SetData(uint type, uint data)
|
||||
{
|
||||
if (type == Misc.DataIntroDone)
|
||||
introDone = data != 0;
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summon)
|
||||
{
|
||||
summon.SetInCombatWithZone();
|
||||
|
||||
if (phase == Misc.ColossusPhaseSecondElementalSummon)
|
||||
summon.SetHealth(summon.GetMaxHealth() / 2);
|
||||
}
|
||||
|
||||
byte phase;
|
||||
bool introDone;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_drakkari_elemental : ScriptedAI
|
||||
{
|
||||
public boss_drakkari_elemental(Creature creature) : base(creature)
|
||||
{
|
||||
DoCast(me, SpellIds.ElementalSpawnEffect);
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task =>
|
||||
{
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.Surge);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
me.AddAura(SpellIds.MojoVolley, me);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
Talk(TextIds.EmoteActivateAltar);
|
||||
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
killer.Kill(colossus);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case Misc.ActionReturnToColossus:
|
||||
Talk(TextIds.EmoteMojo);
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
// what if the elemental is more than 80 yards from drakkari colossus ?
|
||||
DoCast(colossus, SpellIds.Merge, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (HealthBelowPct(50))
|
||||
{
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon)
|
||||
{
|
||||
damage = 0;
|
||||
|
||||
// to prevent spell spaming
|
||||
if (me.HasUnitState(UnitState.Charging))
|
||||
return;
|
||||
|
||||
// not sure about this, the idea of this code is to prevent bug the elemental
|
||||
// if it is not in a acceptable distance to cast the charge spell.
|
||||
if (me.GetDistance(colossus) > 80.0f)
|
||||
{
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ());
|
||||
return;
|
||||
}
|
||||
DoAction(Misc.ActionReturnToColossus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell)
|
||||
{
|
||||
if (spell.Id == SpellIds.Merge)
|
||||
{
|
||||
Creature colossus = target.ToCreature();
|
||||
if (colossus)
|
||||
{
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_living_mojo : ScriptedAI
|
||||
{
|
||||
public npc_living_mojo(Creature creature) : base(creature)
|
||||
{
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MojoWave);
|
||||
task.Repeat(TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MojoPuddle);
|
||||
task.Repeat(TimeSpan.FromSeconds(18));
|
||||
});
|
||||
}
|
||||
|
||||
void MoveMojos(Creature boss)
|
||||
{
|
||||
List<Creature> mojosList = new List<Creature>();
|
||||
boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f);
|
||||
if (!mojosList.Empty())
|
||||
{
|
||||
foreach (var mojo in mojosList)
|
||||
{
|
||||
if (mojo)
|
||||
mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint id)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
if (id == 1)
|
||||
{
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0)
|
||||
colossus.GetAI().SetData(Misc.DataIntroDone, 1);
|
||||
colossus.SetInCombatWithZone();
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit attacker)
|
||||
{
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
// we do this checks to see if the creature is one of the creatures that sorround the boss
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
Position homePosition = me.GetHomePosition();
|
||||
|
||||
float distance = homePosition.GetExactDist(colossus.GetHomePosition());
|
||||
|
||||
if (distance < 12.0f)
|
||||
{
|
||||
MoveMojos(colossus);
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
else
|
||||
base.AttackStart(attacker);
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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.Gundrak.EckTheFerocious
|
||||
{
|
||||
struct TextIds
|
||||
{
|
||||
public const uint EmoteSpawn = 0;
|
||||
}
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint Berserk = 55816; // Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%.
|
||||
public const uint Bite = 55813; // Eck bites down hard, inflicting 150% of his normal damage to an enemy.
|
||||
public const uint Spit = 55814; // Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec.
|
||||
public const uint Spring1 = 55815; // Eck leaps at a distant target. --> Drops aggro and charges a random player. Tank can simply taunt him back.
|
||||
public const uint Spring2 = 55837; // Eck leaps at a distant target.
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_eck : BossAI
|
||||
{
|
||||
public boss_eck(Creature creature) : base(creature, GDDataTypes.EckTheFerocious)
|
||||
{
|
||||
Initialize();
|
||||
Talk(TextIds.EmoteSpawn);
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_berserk = false;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Bite);
|
||||
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Spit);
|
||||
task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true);
|
||||
if (target)
|
||||
DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2));
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
|
||||
});
|
||||
|
||||
// 60-90 secs according to wowwiki
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task =>
|
||||
{
|
||||
DoCast(me, SpellIds.Berserk);
|
||||
_berserk = true;
|
||||
});
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!_berserk && me.HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1));
|
||||
_berserk = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
bool _berserk;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
* 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.IO;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Scripts.Northrend.Gundrak
|
||||
{
|
||||
struct GDInstanceMisc
|
||||
{
|
||||
public const uint TimerStatueActivation = 3500;
|
||||
|
||||
public static DoorData[] doorData =
|
||||
{
|
||||
new DoorData(GDGameObjectIds.GalDarahDoor1, GDDataTypes.GalDarah, DoorType.Passage),
|
||||
new DoorData(GDGameObjectIds.GalDarahDoor2, GDDataTypes.GalDarah, DoorType.Passage),
|
||||
new DoorData(GDGameObjectIds.GalDarahDoor3, GDDataTypes.GalDarah, DoorType.Room),
|
||||
new DoorData(GDGameObjectIds.EckTheFerociousDoor, GDDataTypes.Moorabi, DoorType.Passage),
|
||||
new DoorData(GDGameObjectIds.EckTheFerociousDoorBehind, GDDataTypes.EckTheFerocious, DoorType.Passage),
|
||||
};
|
||||
|
||||
public static ObjectData[] creatureData =
|
||||
{
|
||||
new ObjectData(GDCreatureIds.DrakkariColossus, GDDataTypes.DrakkariColossus),
|
||||
};
|
||||
|
||||
public static ObjectData[] gameObjectData =
|
||||
{
|
||||
new ObjectData(GDGameObjectIds.SladRanAltar, GDDataTypes.SladRanAltar),
|
||||
new ObjectData(GDGameObjectIds.MoorabiAltar, GDDataTypes.MoorabiAltar),
|
||||
new ObjectData(GDGameObjectIds.DrakkariColossusAltar, GDDataTypes.DrakkariColossusAltar),
|
||||
new ObjectData(GDGameObjectIds.SladRanStatue, GDDataTypes.SladRanStatue),
|
||||
new ObjectData(GDGameObjectIds.MoorabiStatue, GDDataTypes.MoorabiStatue),
|
||||
new ObjectData(GDGameObjectIds.DrakkariColossusStatue, GDDataTypes.DrakkariColossusStatue),
|
||||
new ObjectData(GDGameObjectIds.GalDarahStatue, GDDataTypes.GalDarahStatue),
|
||||
new ObjectData(GDGameObjectIds.Trapdoor, GDDataTypes.Trapdoor),
|
||||
new ObjectData(GDGameObjectIds.Collision, GDDataTypes.Collision)
|
||||
};
|
||||
|
||||
public static Position EckSpawnPoint = new Position(1643.877930f, 936.278015f, 107.204948f, 0.668432f);
|
||||
}
|
||||
|
||||
struct GDDataTypes
|
||||
{
|
||||
// Encounter Ids // Encounter States // Boss Guids
|
||||
public const uint SladRan = 0;
|
||||
public const uint DrakkariColossus = 1;
|
||||
public const uint Moorabi = 2;
|
||||
public const uint GalDarah = 3;
|
||||
public const uint EckTheFerocious = 4;
|
||||
|
||||
// Additional Objects
|
||||
public const uint SladRanAltar = 5;
|
||||
public const uint DrakkariColossusAltar = 6;
|
||||
public const uint MoorabiAltar = 7;
|
||||
|
||||
public const uint SladRanStatue = 8;
|
||||
public const uint DrakkariColossusStatue = 9;
|
||||
public const uint MoorabiStatue = 10;
|
||||
public const uint GalDarahStatue = 11;
|
||||
|
||||
public const uint Trapdoor = 12;
|
||||
public const uint Collision = 13;
|
||||
public const uint Bridge = 14;
|
||||
|
||||
public const uint StatueActivate = 15;
|
||||
}
|
||||
|
||||
struct GDCreatureIds
|
||||
{
|
||||
public const uint SladRan = 29304;
|
||||
public const uint Moorabi = 29305;
|
||||
public const uint GalDarah = 29306;
|
||||
public const uint DrakkariColossus = 29307;
|
||||
public const uint RuinDweller = 29920;
|
||||
public const uint EckTheFerocious = 29932;
|
||||
public const uint AltarTrigger = 30298;
|
||||
}
|
||||
|
||||
struct GDGameObjectIds
|
||||
{
|
||||
public const uint SladRanAltar = 192518;
|
||||
public const uint MoorabiAltar = 192519;
|
||||
public const uint DrakkariColossusAltar = 192520;
|
||||
public const uint SladRanStatue = 192564;
|
||||
public const uint MoorabiStatue = 192565;
|
||||
public const uint GalDarahStatue = 192566;
|
||||
public const uint DrakkariColossusStatue = 192567;
|
||||
public const uint EckTheFerociousDoor = 192632;
|
||||
public const uint EckTheFerociousDoorBehind = 192569;
|
||||
public const uint GalDarahDoor1 = 193208;
|
||||
public const uint GalDarahDoor2 = 193209;
|
||||
public const uint GalDarahDoor3 = 192568;
|
||||
public const uint Trapdoor = 193188;
|
||||
public const uint Collision = 192633;
|
||||
}
|
||||
|
||||
struct GDSpellIds
|
||||
{
|
||||
public const uint FireBeamMammoth = 57068;
|
||||
public const uint FireBeamSnake = 57071;
|
||||
public const uint FireBeamElemental = 57072;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class instance_gundrak : InstanceMapScript
|
||||
{
|
||||
public instance_gundrak() : base(nameof(instance_gundrak), 604) { }
|
||||
|
||||
class instance_gundrak_InstanceMapScript : InstanceScript
|
||||
{
|
||||
public instance_gundrak_InstanceMapScript(Map map) : base(map)
|
||||
{
|
||||
SetHeaders("GD");
|
||||
SetBossNumber(5);
|
||||
LoadDoorData(GDInstanceMisc.doorData);
|
||||
LoadObjectData(GDInstanceMisc.creatureData, GDInstanceMisc.gameObjectData);
|
||||
|
||||
SladRanStatueState = GameObjectState.Active;
|
||||
DrakkariColossusStatueState = GameObjectState.Active;
|
||||
MoorabiStatueState = GameObjectState.Active;
|
||||
}
|
||||
|
||||
public override void OnCreatureCreate(Creature creature)
|
||||
{
|
||||
switch (creature.GetEntry())
|
||||
{
|
||||
case GDCreatureIds.RuinDweller:
|
||||
if (creature.IsAlive())
|
||||
DwellerGUIDs.Add(creature.GetGUID());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnCreatureCreate(creature);
|
||||
}
|
||||
|
||||
public override void OnGameObjectCreate(GameObject go)
|
||||
{
|
||||
switch (go.GetEntry())
|
||||
{
|
||||
case GDGameObjectIds.SladRanAltar:
|
||||
if (GetBossState(GDDataTypes.SladRan) == EncounterState.Done)
|
||||
{
|
||||
if (SladRanStatueState == GameObjectState.Active)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
else
|
||||
go.SetGoState(GameObjectState.Active);
|
||||
}
|
||||
break;
|
||||
case GDGameObjectIds.MoorabiAltar:
|
||||
if (GetBossState(GDDataTypes.Moorabi) == EncounterState.Done)
|
||||
{
|
||||
if (MoorabiStatueState == GameObjectState.Active)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
else
|
||||
go.SetGoState(GameObjectState.Active);
|
||||
}
|
||||
break;
|
||||
case GDGameObjectIds.DrakkariColossusAltar:
|
||||
if (GetBossState(GDDataTypes.DrakkariColossus) == EncounterState.Done)
|
||||
{
|
||||
if (DrakkariColossusStatueState == GameObjectState.Active)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
else
|
||||
go.SetGoState(GameObjectState.Active);
|
||||
}
|
||||
break;
|
||||
case GDGameObjectIds.SladRanStatue:
|
||||
go.SetGoState(SladRanStatueState);
|
||||
break;
|
||||
case GDGameObjectIds.MoorabiStatue:
|
||||
go.SetGoState(MoorabiStatueState);
|
||||
break;
|
||||
case GDGameObjectIds.GalDarahStatue:
|
||||
go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.ActiveAlternative : GameObjectState.Ready);
|
||||
break;
|
||||
case GDGameObjectIds.DrakkariColossusStatue:
|
||||
go.SetGoState(DrakkariColossusStatueState);
|
||||
break;
|
||||
case GDGameObjectIds.EckTheFerociousDoor:
|
||||
// Don't store door on non-heroic
|
||||
if (!instance.IsHeroic())
|
||||
return;
|
||||
break;
|
||||
case GDGameObjectIds.Trapdoor:
|
||||
go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.Ready : GameObjectState.Active);
|
||||
break;
|
||||
case GDGameObjectIds.Collision:
|
||||
go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.Active : GameObjectState.Ready);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnGameObjectCreate(go);
|
||||
}
|
||||
|
||||
public override void OnUnitDeath(Unit unit)
|
||||
{
|
||||
if (unit.GetEntry() == GDCreatureIds.RuinDweller)
|
||||
{
|
||||
DwellerGUIDs.Remove(unit.GetGUID());
|
||||
|
||||
if (DwellerGUIDs.Empty())
|
||||
unit.SummonCreature(GDCreatureIds.EckTheFerocious, GDInstanceMisc.EckSpawnPoint, TempSummonType.CorpseTimedDespawn, 300 * Time.InMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SetBossState(uint type, EncounterState state)
|
||||
{
|
||||
if (!base.SetBossState(type, state))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDDataTypes.SladRan:
|
||||
if (state == EncounterState.Done)
|
||||
{
|
||||
GameObject go = GetGameObject(GDDataTypes.SladRanAltar);
|
||||
if (go)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
}
|
||||
break;
|
||||
case GDDataTypes.DrakkariColossus:
|
||||
if (state == EncounterState.Done)
|
||||
{
|
||||
GameObject go = GetGameObject(GDDataTypes.DrakkariColossusAltar);
|
||||
if (go)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
}
|
||||
break;
|
||||
case GDDataTypes.Moorabi:
|
||||
if (state == EncounterState.Done)
|
||||
{
|
||||
GameObject go = GetGameObject(GDDataTypes.MoorabiAltar);
|
||||
if (go)
|
||||
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckRequiredBosses(uint bossId, Player player = null)
|
||||
{
|
||||
if (_SkipCheckRequiredBosses(player))
|
||||
return true;
|
||||
|
||||
switch (bossId)
|
||||
{
|
||||
case GDDataTypes.EckTheFerocious:
|
||||
if (!instance.IsHeroic() || GetBossState(GDDataTypes.Moorabi) != EncounterState.Done)
|
||||
return false;
|
||||
break;
|
||||
case GDDataTypes.GalDarah:
|
||||
if (SladRanStatueState != GameObjectState.ActiveAlternative
|
||||
|| DrakkariColossusStatueState != GameObjectState.ActiveAlternative
|
||||
|| MoorabiStatueState != GameObjectState.ActiveAlternative)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsBridgeReady()
|
||||
{
|
||||
return SladRanStatueState == GameObjectState.Ready && DrakkariColossusStatueState == GameObjectState.Ready && MoorabiStatueState == GameObjectState.Ready;
|
||||
}
|
||||
|
||||
public override void SetData(uint type, uint data)
|
||||
{
|
||||
if (type == GDDataTypes.StatueActivate)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case GDGameObjectIds.SladRanAltar:
|
||||
_events.ScheduleEvent(GDDataTypes.SladRanStatue, GDInstanceMisc.TimerStatueActivation);
|
||||
break;
|
||||
case GDGameObjectIds.DrakkariColossusAltar:
|
||||
_events.ScheduleEvent(GDDataTypes.DrakkariColossusStatue, GDInstanceMisc.TimerStatueActivation);
|
||||
break;
|
||||
case GDGameObjectIds.MoorabiAltar:
|
||||
_events.ScheduleEvent(GDDataTypes.MoorabiStatue, GDInstanceMisc.TimerStatueActivation);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteSaveDataMore(StringBuilder data)
|
||||
{
|
||||
data.AppendFormat("{0} {1} {2} ", (uint)SladRanStatueState, (uint)DrakkariColossusStatueState, (uint)MoorabiStatueState);
|
||||
}
|
||||
|
||||
public override void ReadSaveDataMore(StringArguments data)
|
||||
{
|
||||
SladRanStatueState = (GameObjectState)data.NextUInt32();
|
||||
DrakkariColossusStatueState = (GameObjectState)data.NextUInt32();
|
||||
MoorabiStatueState = (GameObjectState)data.NextUInt32();
|
||||
|
||||
if (IsBridgeReady())
|
||||
_events.ScheduleEvent(GDDataTypes.Bridge, GDInstanceMisc.TimerStatueActivation);
|
||||
}
|
||||
|
||||
void ToggleGameObject(uint type, GameObjectState state)
|
||||
{
|
||||
GameObject go = GetGameObject(type);
|
||||
if (go)
|
||||
go.SetGoState(state);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDDataTypes.SladRanStatue:
|
||||
SladRanStatueState = state;
|
||||
break;
|
||||
case GDDataTypes.DrakkariColossusStatue:
|
||||
DrakkariColossusStatueState = state;
|
||||
break;
|
||||
case GDDataTypes.MoorabiStatue:
|
||||
MoorabiStatueState = state;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
uint spellId = 0;
|
||||
uint altarId = 0;
|
||||
switch (eventId)
|
||||
{
|
||||
case GDDataTypes.SladRanStatue:
|
||||
spellId = GDSpellIds.FireBeamSnake;
|
||||
altarId = GDDataTypes.SladRanAltar;
|
||||
break;
|
||||
case GDDataTypes.DrakkariColossusStatue:
|
||||
spellId = GDSpellIds.FireBeamElemental;
|
||||
altarId = GDDataTypes.DrakkariColossusAltar;
|
||||
break;
|
||||
case GDDataTypes.MoorabiStatue:
|
||||
spellId = GDSpellIds.FireBeamMammoth;
|
||||
altarId = GDDataTypes.MoorabiAltar;
|
||||
break;
|
||||
case GDDataTypes.Bridge:
|
||||
for (uint type = GDDataTypes.SladRanStatue; type <= GDDataTypes.GalDarahStatue; ++type)
|
||||
ToggleGameObject(type, GameObjectState.ActiveAlternative);
|
||||
ToggleGameObject(GDDataTypes.Trapdoor, GameObjectState.Ready);
|
||||
ToggleGameObject(GDDataTypes.Collision, GameObjectState.Active);
|
||||
SaveToDB();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject altar = GetGameObject(altarId);
|
||||
if (altar)
|
||||
{
|
||||
Creature trigger = altar.FindNearestCreature(GDCreatureIds.AltarTrigger, 10.0f);
|
||||
if (trigger)
|
||||
trigger.CastSpell((Unit)null, spellId, true);
|
||||
}
|
||||
|
||||
// eventId equals statueId
|
||||
ToggleGameObject(eventId, GameObjectState.Ready);
|
||||
|
||||
if (IsBridgeReady())
|
||||
_events.ScheduleEvent(GDDataTypes.Bridge, GDInstanceMisc.TimerStatueActivation);
|
||||
|
||||
SaveToDB();
|
||||
});
|
||||
}
|
||||
|
||||
List<ObjectGuid> DwellerGUIDs = new List<ObjectGuid>();
|
||||
|
||||
GameObjectState SladRanStatueState;
|
||||
GameObjectState DrakkariColossusStatueState;
|
||||
GameObjectState MoorabiStatueState;
|
||||
}
|
||||
|
||||
public override InstanceScript GetInstanceScript(InstanceMap map)
|
||||
{
|
||||
return new instance_gundrak_InstanceMapScript(map);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class go_gundrak_altar : GameObjectScript
|
||||
{
|
||||
public go_gundrak_altar() : base("go_gundrak_altar") { }
|
||||
|
||||
public override bool OnGossipHello(Player player, GameObject go)
|
||||
{
|
||||
go.SetFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
|
||||
go.SetGoState(GameObjectState.Active);
|
||||
|
||||
InstanceScript instance = go.GetInstanceScript();
|
||||
if (instance != null)
|
||||
{
|
||||
instance.SetData(GDDataTypes.StatueActivate, go.GetEntry());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user