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,251 @@
/*
* 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.DraktharonKeep.KingDred
{
struct SpellIds
{
public const uint BellowingRoar = 22686; // Fears The Group; Can Be Resisted/Dispelled
public const uint GrievousBite = 48920;
public const uint ManglingSlash = 48873; // Cast On The Current Tank; Adds Debuf
public const uint FearsomeRoar = 48849;
public const uint PiercingSlash = 48878; // Debuff --> Armor Reduced By 75%
public const uint RaptorCall = 59416; // Dummy
public const uint GutRip = 49710;
public const uint Rend = 13738;
}
struct Misc
{
public const int ActionRaptorKilled = 1;
public const uint DataRaptorsKilled = 2;
}
[Script]
class boss_king_dred : BossAI
{
public boss_king_dred(Creature creature) : base(creature, DTKDataTypes.KingDred)
{
Initialize();
}
void Initialize()
{
raptorsKilled = 0;
}
public override void Reset()
{
Initialize();
_Reset();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(33), task =>
{
DoCastAOE(SpellIds.BellowingRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.GrievousBite);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(18.5), task =>
{
DoCastVictim(SpellIds.ManglingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20), task =>
{
DoCastAOE(SpellIds.FearsomeRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
DoCastVictim(SpellIds.PiercingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
{
DoCastVictim(SpellIds.RaptorCall);
float x, y, z;
me.GetClosePoint(out x, out y, out z, me.GetObjectSize() / 3, 10.0f);
me.SummonCreature(RandomHelper.RAND(DTKCreatureIds.DrakkariGutripper, DTKCreatureIds.DrakkariScytheclaw), x, y, z, 0, TempSummonType.DeadDespawn, 1000);
task.Repeat();
});
}
public override void DoAction(int action)
{
if (action == Misc.ActionRaptorKilled)
++raptorsKilled;
}
public override uint GetData(uint type)
{
if (type == Misc.DataRaptorsKilled)
return raptorsKilled;
return 0;
}
public override void JustDied(Unit killer)
{
_JustDied();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
byte raptorsKilled;
}
[Script]
class npc_drakkari_gutripper : ScriptedAI
{
public npc_drakkari_gutripper(Creature creature) : base(creature)
{
Initialize();
instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.GutRip, false);
task.Repeat();
});
}
public override void Reset()
{
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
}
[Script]
class npc_drakkari_scytheclaw : ScriptedAI
{
public npc_drakkari_scytheclaw(Creature creature) : base(creature)
{
Initialize();
instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.Rend, false);
task.Repeat();
});
}
public override void Reset()
{
_scheduler.CancelAll();
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
}
[Script]
class achievement_king_dred : AchievementCriteriaScript
{
public achievement_king_dred() : base("achievement_king_dred") { }
public override bool OnCheck(Player player, Unit target)
{
if (!target)
return false;
Creature dred = target.ToCreature();
if (dred)
if (dred.GetAI().GetData(Misc.DataRaptorsKilled) >= 6)
return true;
return false;
}
}
}
@@ -0,0 +1,410 @@
/*
* 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;
namespace Scripts.Northrend.DraktharonKeep.Novos
{
struct TextIds
{
public const uint SayAggro = 0;
public const uint SayKill = 1;
public const uint SayDeath = 2;
public const uint SaySummoningAdds = 3; // Unused
public const uint SayArcaneField = 4;
public const uint EmoteSummoningAdds = 5; // Unused
}
struct SpellIds
{
public const uint BeamChannel = 52106;
public const uint ArcaneField = 47346;
public const uint SummonRisenShadowcaster = 49105;
public const uint SummonFetidTrollCorpse = 49103;
public const uint SummonHulkingCorpse = 49104;
public const uint SummonCrystalHandler = 49179; //not used
public const uint SummonCopyOfMinions = 59933; //not used
public const uint ArcaneBlast = 49198;
public const uint Blizzard = 49034;
public const uint Frostbolt = 49037;
public const uint WrathOfMisery = 50089;
public const uint SummonMinions = 59910;
}
struct Misc
{
public const int ActionResetCrystals = 0;
public const int ActionActivateCrystal = 1;
public const int ActionDeactivate = 2;
public const uint EventAttack = 3;
public const uint EventSummonMinions = 4;
public const uint EventSummonRisenShadowcaster = 5;
public const uint EventSummonFetidTrollCorpse = 6;
public const uint EventSummonHulkingCorpse = 7;
public const uint EventSummonCrystalHandler = 8;
public const uint DataNovosAchiev = 9;
public static SummonerInfo[] summoners =
{
new SummonerInfo(EventSummonRisenShadowcaster, 7),
new SummonerInfo(EventSummonFetidTrollCorpse, 3),
new SummonerInfo(EventSummonHulkingCorpse, 30),
new SummonerInfo(EventSummonCrystalHandler, 15)
};
public struct SummonerInfo
{
public SummonerInfo(uint _eventid, uint _timer)
{
eventId = _eventid;
timer = _timer;
}
public uint eventId;
public uint timer;
}
public static Position[] SummonPositions =
{
new Position(-306.8209f, -703.7687f, 27.2919f, 3.401838f),
new Position(-421.395f, -705.7863f, 28.57594f, 4.830696f),
new Position(-308.1955f, -704.8419f, 27.2919f, 3.010279f),
new Position(-424.1306f, -705.7354f, 28.57594f, 5.325676f)
};
public const float MaxYCoordOhNovosMAX = -771.95f;
}
[Script]
class boss_novos : BossAI
{
public boss_novos(Creature creature) : base(creature, DTKDataTypes.Novos)
{
Initialize();
_bubbled = false;
}
void Initialize()
{
_ohNovos = true;
}
public override void Reset()
{
_Reset();
Initialize();
SetCrystalsStatus(false);
SetSummonerStatus(false);
SetBubbled(false);
}
public override void EnterCombat(Unit victim)
{
_EnterCombat();
Talk(TextIds.SayAggro);
SetCrystalsStatus(true);
SetSummonerStatus(true);
SetBubbled(true);
}
public override void AttackStart(Unit target)
{
if (!target)
return;
if (me.Attack(target, true))
DoStartNoMovement(target);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim() || _bubbled)
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Misc.EventSummonMinions:
DoCast(SpellIds.SummonMinions);
_events.ScheduleEvent(Misc.EventSummonMinions, 15000);
break;
case Misc.EventAttack:
Unit victim = SelectTarget(SelectAggroTarget.Random);
if (victim)
DoCast(victim, RandomHelper.RAND(SpellIds.ArcaneBlast, SpellIds.Blizzard, SpellIds.Frostbolt, SpellIds.WrathOfMisery));
_events.ScheduleEvent(Misc.EventAttack, 3000);
break;
default:
break;
}
if (me.HasUnitState(UnitState.Casting))
return;
});
}
public override void DoAction(int action)
{
if (action == DTKDataTypes.ActionCrystalHandlerDied)
{
Talk(TextIds.SayArcaneField);
SetSummonerStatus(false);
SetBubbled(false);
_events.ScheduleEvent(Misc.EventAttack, 3000);
if (IsHeroic())
_events.ScheduleEvent(Misc.EventSummonMinions, 15000);
}
}
public override void MoveInLineOfSight(Unit who)
{
base.MoveInLineOfSight(who);
if (!_ohNovos || !who || !who.IsTypeId(TypeId.Player) || who.GetPositionY() > Misc.MaxYCoordOhNovosMAX)
return;
uint entry = who.GetEntry();
if (entry == DTKCreatureIds.HulkingCorpse || entry == DTKCreatureIds.RisenShadowcaster || entry == DTKCreatureIds.FetidTrollCorpse)
_ohNovos = false;
}
public override uint GetData(uint type)
{
return type == Misc.DataNovosAchiev && _ohNovos ? 1 : 0u;
}
public override void JustSummoned(Creature summon)
{
me.Yell(TextIds.SaySummoningAdds, summon);
me.TextEmote(TextIds.EmoteSummoningAdds, summon);
summon.SelectNearestTargetInAttackDistance(50f);
summons.Summon(summon);
}
void SetBubbled(bool state)
{
_bubbled = state;
if (!state)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasUnitState(UnitState.Casting))
me.CastStop();
}
else
{
if (!me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
DoCast(SpellIds.ArcaneField);
}
}
void SetSummonerStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosSummoner1 + i);
if (!guid.IsEmpty())
{
Creature crystalChannelTarget = ObjectAccessor.GetCreature(me, guid);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.GetAI().SetData(Misc.summoners[i].eventId, Misc.summoners[i].timer);
else
crystalChannelTarget.GetAI().Reset();
}
}
}
}
void SetCrystalsStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosCrystal1 + i);
if (!guid.IsEmpty())
{
GameObject crystal = ObjectAccessor.GetGameObject(me, guid);
if (crystal)
SetCrystalStatus(crystal, active);
}
}
}
void SetCrystalStatus(GameObject crystal, bool active)
{
crystal.SetGoState(active ? GameObjectState.Active : GameObjectState.Ready);
Creature crystalChannelTarget = crystal.FindNearestCreature(DTKCreatureIds.CrystalChannelTarget, 5.0f);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.CastSpell(null, SpellIds.BeamChannel);
else if (crystalChannelTarget.HasUnitState(UnitState.Casting))
crystalChannelTarget.CastStop();
}
}
bool _ohNovos;
bool _bubbled;
}
[Script]
class npc_crystal_channel_target : ScriptedAI
{
public npc_crystal_channel_target(Creature creature) : base(creature) { }
public override void Reset()
{
_events.Reset();
_crystalHandlerCount = 0;
}
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Misc.EventSummonCrystalHandler:
me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]);
if (_crystalHandlerCount < 4)
_events.Repeat(TimeSpan.FromSeconds(15));
break;
case Misc.EventSummonRisenShadowcaster:
DoCast(SpellIds.SummonRisenShadowcaster);
_events.Repeat(TimeSpan.FromSeconds(7));
break;
case Misc.EventSummonFetidTrollCorpse:
DoCast(SpellIds.SummonFetidTrollCorpse);
_events.Repeat(TimeSpan.FromSeconds(3));
break;
case Misc.EventSummonHulkingCorpse:
DoCast(SpellIds.SummonHulkingCorpse);
_events.Repeat(TimeSpan.FromSeconds(30));
break;
}
});
}
public override void SetData(uint id, uint value)
{
_events.ScheduleEvent(id, TimeSpan.FromSeconds(value));
}
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (_crystalHandlerCount < 4)
return;
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
if (!guid.IsEmpty())
{
Creature novos = ObjectAccessor.GetCreature(me, guid);
if (novos)
novos.GetAI().DoAction(DTKDataTypes.ActionCrystalHandlerDied);
}
}
}
public override void JustSummoned(Creature summon)
{
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
if (!guid.IsEmpty())
{
Creature novos = ObjectAccessor.GetCreature(me, guid);
if (novos)
novos.GetAI().JustSummoned(summon);
}
}
if (summon)
summon.GetMotionMaster().MovePath(summon.GetEntry() * 100, false);
}
uint _crystalHandlerCount;
}
[Script]
class achievement_oh_novos : AchievementCriteriaScript
{
public achievement_oh_novos() : base("achievement_oh_novos") { }
public override bool OnCheck(Player player, Unit target)
{
return target && target.IsTypeId(TypeId.Unit) && target.ToCreature().GetAI().GetData(Misc.DataNovosAchiev) != 0;
}
}
[Script]
class spell_novos_summon_minions : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.SummonCopyOfMinions);
}
void HandleScript(uint effIndex)
{
for (byte i = 0; i < 2; ++i)
GetCaster().CastSpell((Unit)null, SpellIds.SummonCopyOfMinions, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
}
}
}
@@ -0,0 +1,231 @@
/*
* 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.DraktharonKeep.TharonJa
{
struct SpellIds
{
// Skeletal Spells (Phase 1)
public const uint CurseOfLife = 49527;
public const uint RainOfFire = 49518;
public const uint ShadowVolley = 49528;
public const uint DecayFlesh = 49356; // Cast At End Of Phase 1; Starts Phase 2
// Flesh Spells (Phase 2)
public const uint GiftOfTharonJa = 52509;
public const uint ClearGiftOfTharonJa = 53242;
public const uint EyeBeam = 49544;
public const uint LightningBreath = 49537;
public const uint PoisonCloud = 49548;
public const uint ReturnFlesh = 53463; // Channeled Spell Ending Phase Two And Returning To Phase 1. This Ability Will Stun The Party For 6 Seconds.
public const uint AchievementCheck = 61863;
public const uint FleshVisual = 52582;
public const uint Dummy = 49551;
}
struct EventIds
{
public const uint CurseOfLife = 1;
public const uint RainOfFire = 2;
public const uint ShadowVolley = 3;
public const uint EyeBeam = 4;
public const uint LightningBreath = 5;
public const uint PoisonCloud = 6;
public const uint DecayFlesh = 7;
public const uint GoingFlesh = 8;
public const uint ReturnFlesh = 9;
public const uint GoingSkeletal = 10;
}
struct TextIds
{
public const uint SayAggro = 0;
public const uint SayKill = 1;
public const uint SayFlesh = 2;
public const uint SaySkeleton = 3;
public const uint SayDeath = 4;
}
struct Misc
{
public const uint ModelFlesh = 27073;
}
[Script]
class boss_tharon_ja : BossAI
{
public boss_tharon_ja(Creature creature) : base(creature, DTKDataTypes.TharonJa) { }
public override void Reset()
{
_Reset();
me.RestoreDisplayId();
}
public override void EnterCombat(Unit who)
{
Talk(TextIds.SayAggro);
_EnterCombat();
_events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1));
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
DoCastAOE(SpellIds.AchievementCheck, true);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventIds.CurseOfLife:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.CurseOfLife);
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
}
return;
case EventIds.ShadowVolley:
DoCastVictim(SpellIds.ShadowVolley);
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
return;
case EventIds.RainOfFire:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.RainOfFire);
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
}
return;
case EventIds.LightningBreath:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.LightningBreath);
_events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
}
return;
case EventIds.EyeBeam:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.EyeBeam);
_events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(6));
}
return;
case EventIds.PoisonCloud:
DoCastAOE(SpellIds.PoisonCloud);
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12));
return;
case EventIds.DecayFlesh:
DoCastAOE(SpellIds.DecayFlesh);
_events.ScheduleEvent(EventIds.GoingFlesh, TimeSpan.FromSeconds(6));
return;
case EventIds.GoingFlesh:
Talk(TextIds.SayFlesh);
me.SetDisplayId(Misc.ModelFlesh);
DoCastAOE(SpellIds.GiftOfTharonJa, true);
DoCast(me, SpellIds.FleshVisual, true);
DoCast(me, SpellIds.Dummy, true);
_events.Reset();
_events.ScheduleEvent(EventIds.ReturnFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4));
_events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8));
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
break;
case EventIds.ReturnFlesh:
DoCastAOE(SpellIds.ReturnFlesh);
_events.ScheduleEvent(EventIds.GoingSkeletal, 6000);
return;
case EventIds.GoingSkeletal:
Talk(TextIds.SaySkeleton);
me.RestoreDisplayId();
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
_events.Reset();
_events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1));
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
break;
default:
break;
}
if (me.HasUnitState(UnitState.Casting))
return;
});
DoMeleeAttackIfReady();
}
}
[Script]
class spell_tharon_ja_clear_gift_of_tharon_ja : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.GiftOfTharonJa);
}
void HandleScript(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.RemoveAura(SpellIds.GiftOfTharonJa);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
}
}
}
@@ -0,0 +1,283 @@
/*
* 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.DraktharonKeep.Trollgore
{
struct SpellIds
{
public const uint InfectedWound = 49637;
public const uint Crush = 49639;
public const uint CorpseExplode = 49555;
public const uint CorpseExplodeDamage = 49618;
public const uint Consume = 49380;
public const uint ConsumeBuff = 49381;
public const uint ConsumeBuffH = 59805;
public const uint SummonInvaderA = 49456;
public const uint SummonInvaderB = 49457;
public const uint SummonInvaderC = 49458; // Can'T Find Any Sniffs
public const uint InvaderTaunt = 49405;
}
struct TextIds
{
public const uint SayAggro = 0;
public const uint SayKill = 1;
public const uint SayConsume = 2;
public const uint SayExplode = 3;
public const uint SayDeath = 4;
}
struct Misc
{
public const uint DataConsumptionJunction = 1;
public const uint PointLanding = 1;
public static Position Landing = new Position(-263.0534f, -660.8658f, 26.50903f, 0.0f);
}
[Script]
class boss_trollgore : BossAI
{
public boss_trollgore(Creature creature) : base(creature, DTKDataTypes.Trollgore)
{
Initialize();
}
void Initialize()
{
_consumptionJunction = true;
}
public override void Reset()
{
_Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(TextIds.SayAggro);
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
Talk(TextIds.SayConsume);
DoCastAOE(SpellIds.Consume);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(SpellIds.Crush);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60), task =>
{
DoCastVictim(SpellIds.InfectedWound);
task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35));
});
_scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{
Talk(TextIds.SayExplode);
DoCastAOE(SpellIds.CorpseExplode);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19));
});
_scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(40), task =>
{
for (byte i = 0; i < 3; ++i)
{
Creature trigger = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.TrollgoreInvaderSummoner1 + i));
if (trigger)
trigger.CastSpell(trigger, RandomHelper.RAND(SpellIds.SummonInvaderA, SpellIds.SummonInvaderB, SpellIds.SummonInvaderC), true, null, null, me.GetGUID());
}
task.Repeat();
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
if (_consumptionJunction)
{
Aura ConsumeAura = me.GetAura(DungeonMode(SpellIds.ConsumeBuff, SpellIds.ConsumeBuffH));
if (ConsumeAura != null && ConsumeAura.GetStackAmount() > 9)
_consumptionJunction = false;
}
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override uint GetData(uint type)
{
if (type == Misc.DataConsumptionJunction)
return _consumptionJunction ? 1 : 0u;
return 0;
}
public override void KilledUnit(Unit victim)
{
if (victim.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustSummoned(Creature summon)
{
summon.GetMotionMaster().MovePoint(Misc.PointLanding, Misc.Landing);
summons.Summon(summon);
}
bool _consumptionJunction;
}
[Script]
class npc_drakkari_invader : ScriptedAI
{
public npc_drakkari_invader(Creature creature) : base(creature) { }
public override void MovementInform(MovementGeneratorType type, uint pointId)
{
if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding)
{
me.Dismount();
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
DoCastAOE(SpellIds.InvaderTaunt);
}
}
}
[Script] // 49380, 59803 - Consume
class spell_trollgore_consume : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.ConsumeBuff);
}
void HandleConsume(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), SpellIds.ConsumeBuff, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleConsume, 1, SpellEffectName.ScriptEffect));
}
}
[Script] // 49555, 59807 - Corpse Explode
class spell_trollgore_corpse_explode : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CorpseExplodeDamage);
}
void PeriodicTick(AuraEffect aurEff)
{
if (aurEff.GetTickNumber() == 2)
{
Unit caster = GetCaster();
if (caster)
caster.CastSpell(GetTarget(), SpellIds.CorpseExplodeDamage, true, null, aurEff);
}
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Creature target = GetTarget().ToCreature();
if (target)
target.DespawnOrUnsummon();
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.Dummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
}
[Script] // 49405 - Invader Taunt Trigger
class spell_trollgore_invader_taunt : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
}
void HandleTaunt(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), (uint)GetEffectValue(), true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleTaunt, 0, SpellEffectName.ScriptEffect));
}
}
[Script]
class achievement_consumption_junction : AchievementCriteriaScript
{
public achievement_consumption_junction() : base("achievement_consumption_junction") { }
public override bool OnCheck(Player source, Unit target)
{
if (!target)
return false;
Creature Trollgore = target.ToCreature();
if (Trollgore)
if (Trollgore.GetAI().GetData(Misc.DataConsumptionJunction) != 0)
return true;
return false;
}
}
}
@@ -0,0 +1,224 @@
/*
* 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 Game.Entities;
using Game.Maps;
using Game.Scripting;
namespace Scripts.Northrend.DraktharonKeep
{
struct DTKDataTypes
{
// Encounter States/Boss Guids
public const uint Trollgore = 0;
public const uint Novos = 1;
public const uint KingDred = 2;
public const uint TharonJa = 3;
// Additional Data
//public const uint KingDredAchiev;
public const uint TrollgoreInvaderSummoner1 = 4;
public const uint TrollgoreInvaderSummoner2 = 5;
public const uint TrollgoreInvaderSummoner3 = 6;
public const uint NovosCrystal1 = 7;
public const uint NovosCrystal2 = 8;
public const uint NovosCrystal3 = 9;
public const uint NovosCrystal4 = 10;
public const uint NovosSummoner1 = 11;
public const uint NovosSummoner2 = 12;
public const uint NovosSummoner3 = 13;
public const uint NovosSummoner4 = 14;
public const int ActionCrystalHandlerDied = 15;
}
struct DTKCreatureIds
{
public const uint Trollgore = 26630;
public const uint Novos = 26631;
public const uint KingDred = 27483;
public const uint TharonJa = 26632;
// Trollgore
public const uint DrakkariInvaderA = 27709;
public const uint DrakkariInvaderB = 27753;
public const uint DrakkariInvaderC = 27754;
// Novos
public const uint CrystalChannelTarget = 26712;
public const uint CrystalHandler = 26627;
public const uint HulkingCorpse = 27597;
public const uint FetidTrollCorpse = 27598;
public const uint RisenShadowcaster = 27600;
// King Dred
public const uint DrakkariGutripper = 26641;
public const uint DrakkariScytheclaw = 26628;
public const uint WorldTrigger = 22515;
}
struct DTKGameObjectIds
{
public const uint NovosCrystal1 = 189299;
public const uint NovosCrystal2 = 189300;
public const uint NovosCrystal3 = 189301;
public const uint NovosCrystal4 = 189302;
}
[Script]
class instance_drak_tharon_keep : InstanceMapScript
{
public instance_drak_tharon_keep() : base(nameof(instance_drak_tharon_keep), 600) { }
class instance_drak_tharon_keep_InstanceScript : InstanceScript
{
public instance_drak_tharon_keep_InstanceScript(Map map) : base(map)
{
SetHeaders("DTK");
SetBossNumber(4);
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case DTKCreatureIds.Trollgore:
TrollgoreGUID = creature.GetGUID();
break;
case DTKCreatureIds.Novos:
NovosGUID = creature.GetGUID();
break;
case DTKCreatureIds.KingDred:
KingDredGUID = creature.GetGUID();
break;
case DTKCreatureIds.TharonJa:
TharonJaGUID = creature.GetGUID();
break;
case DTKCreatureIds.WorldTrigger:
InitializeTrollgoreInvaderSummoner(creature);
break;
case DTKCreatureIds.CrystalChannelTarget:
InitializeNovosSummoner(creature);
break;
default:
break;
}
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case DTKGameObjectIds.NovosCrystal1:
NovosCrystalGUIDs[0] = go.GetGUID();
break;
case DTKGameObjectIds.NovosCrystal2:
NovosCrystalGUIDs[1] = go.GetGUID();
break;
case DTKGameObjectIds.NovosCrystal3:
NovosCrystalGUIDs[2] = go.GetGUID();
break;
case DTKGameObjectIds.NovosCrystal4:
NovosCrystalGUIDs[3] = go.GetGUID();
break;
default:
break;
}
}
void InitializeTrollgoreInvaderSummoner(Creature creature)
{
float y = creature.GetPositionY();
float z = creature.GetPositionZ();
if (z < 50.0f)
return;
if (y < -650.0f && y > -660.0f)
TrollgoreInvaderSummonerGuids[0] = creature.GetGUID();
else if (y < -660.0f && y > -670.0f)
TrollgoreInvaderSummonerGuids[1] = creature.GetGUID();
else if (y < -675.0f && y > -685.0f)
TrollgoreInvaderSummonerGuids[2] = creature.GetGUID();
}
void InitializeNovosSummoner(Creature creature)
{
float x = creature.GetPositionX();
float y = creature.GetPositionY();
float z = creature.GetPositionZ();
if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
NovosSummonerGUIDs[0] = creature.GetGUID();
else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
NovosSummonerGUIDs[1] = creature.GetGUID();
else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f)
NovosSummonerGUIDs[2] = creature.GetGUID();
else if (x < -338.0f && x > -380.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f)
NovosSummonerGUIDs[3] = creature.GetGUID();
}
public override ObjectGuid GetGuidData(uint type)
{
switch (type)
{
case DTKDataTypes.Trollgore:
return TrollgoreGUID;
case DTKDataTypes.Novos:
return NovosGUID;
case DTKDataTypes.KingDred:
return KingDredGUID;
case DTKDataTypes.TharonJa:
return TharonJaGUID;
case DTKDataTypes.TrollgoreInvaderSummoner1:
case DTKDataTypes.TrollgoreInvaderSummoner2:
case DTKDataTypes.TrollgoreInvaderSummoner3:
return TrollgoreInvaderSummonerGuids[type - DTKDataTypes.TrollgoreInvaderSummoner1];
case DTKDataTypes.NovosCrystal1:
case DTKDataTypes.NovosCrystal2:
case DTKDataTypes.NovosCrystal3:
case DTKDataTypes.NovosCrystal4:
return NovosCrystalGUIDs[type - DTKDataTypes.NovosCrystal1];
case DTKDataTypes.NovosSummoner1:
case DTKDataTypes.NovosSummoner2:
case DTKDataTypes.NovosSummoner3:
case DTKDataTypes.NovosSummoner4:
return NovosSummonerGUIDs[type - DTKDataTypes.NovosSummoner1];
}
return ObjectGuid.Empty;
}
ObjectGuid TrollgoreGUID;
ObjectGuid NovosGUID;
ObjectGuid KingDredGUID;
ObjectGuid TharonJaGUID;
ObjectGuid[] TrollgoreInvaderSummonerGuids = new ObjectGuid[3];
ObjectGuid[] NovosCrystalGUIDs = new ObjectGuid[4];
ObjectGuid[] NovosSummonerGUIDs = new ObjectGuid[4];
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_drak_tharon_keep_InstanceScript(map);
}
}
}