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,650 @@
|
||||
/*
|
||||
* 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.Dynamic;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
|
||||
{
|
||||
struct TrialOfChampionSpells
|
||||
{
|
||||
//Vehicle
|
||||
public const uint CHARGE = 63010;
|
||||
public const uint SHIELD_BREAKER = 68504;
|
||||
public const uint SHIELD = 66482;
|
||||
|
||||
// Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior
|
||||
public const uint MORTAL_STRIKE = 68783;
|
||||
public const uint MORTAL_STRIKE_H = 68784;
|
||||
public const uint BLADESTORM = 63784;
|
||||
public const uint INTERCEPT = 67540;
|
||||
public const uint ROLLING_THROW = 47115; //not implemented in the AI yet...
|
||||
|
||||
// Ambrose Boltspark && Eressea Dawnsinger || Mage
|
||||
public const uint FIREBALL = 66042;
|
||||
public const uint FIREBALL_H = 68310;
|
||||
public const uint BLAST_WAVE = 66044;
|
||||
public const uint BLAST_WAVE_H = 68312;
|
||||
public const uint HASTE = 66045;
|
||||
public const uint POLYMORPH = 66043;
|
||||
public const uint POLYMORPH_H = 68311;
|
||||
|
||||
// Colosos && Runok Wildmane || Shaman
|
||||
public const uint CHAIN_LIGHTNING = 67529;
|
||||
public const uint CHAIN_LIGHTNING_H = 68319;
|
||||
public const uint EARTH_SHIELD = 67530;
|
||||
public const uint HEALING_WAVE = 67528;
|
||||
public const uint HEALING_WAVE_H = 68318;
|
||||
public const uint HEX_OF_MENDING = 67534;
|
||||
|
||||
// Jaelyne Evensong && Zul'tore || Hunter
|
||||
public const uint DISENGAGE = 68340; //not implemented in the AI yet...
|
||||
public const uint LIGHTNING_ARROWS = 66083;
|
||||
public const uint MULTI_SHOT = 66081;
|
||||
public const uint SHOOT = 65868;
|
||||
public const uint SHOOT_H = 67988;
|
||||
|
||||
// Lana Stouthammer Evensong && Deathstalker Visceri || Rouge
|
||||
public const uint EVISCERATE = 67709;
|
||||
public const uint EVISCERATE_H = 68317;
|
||||
public const uint FAN_OF_KNIVES = 67706;
|
||||
public const uint POISON_BOTTLE = 67701;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class generic_vehicleAI_toc5 : npc_escortAI
|
||||
{
|
||||
public generic_vehicleAI_toc5(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
SetDespawnAtEnd(false);
|
||||
uiWaypointPath = 0;
|
||||
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
uiChargeTimer = 5000;
|
||||
uiShieldBreakerTimer = 8000;
|
||||
uiBuffTimer = RandomHelper.URand(30000, 60000);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void SetData(uint uiType, uint uiData)
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case 1:
|
||||
AddWaypoint(0, 747.36f, 634.07f, 411.572f);
|
||||
AddWaypoint(1, 780.43f, 607.15f, 411.82f);
|
||||
AddWaypoint(2, 785.99f, 599.41f, 411.92f);
|
||||
AddWaypoint(3, 778.44f, 601.64f, 411.79f);
|
||||
uiWaypointPath = 1;
|
||||
break;
|
||||
case 2:
|
||||
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
|
||||
AddWaypoint(1, 768.72f, 581.01f, 411.92f);
|
||||
AddWaypoint(2, 763.55f, 590.52f, 411.71f);
|
||||
uiWaypointPath = 2;
|
||||
break;
|
||||
case 3:
|
||||
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
|
||||
AddWaypoint(1, 784.02f, 645.33f, 412.39f);
|
||||
AddWaypoint(2, 775.67f, 641.91f, 411.91f);
|
||||
uiWaypointPath = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (uiType <= 3)
|
||||
Start(false, true);
|
||||
}
|
||||
|
||||
public override void WaypointReached(uint waypointId)
|
||||
{
|
||||
switch (waypointId)
|
||||
{
|
||||
case 2:
|
||||
if (uiWaypointPath == 3 || uiWaypointPath == 2)
|
||||
instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1);
|
||||
break;
|
||||
case 3:
|
||||
instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
DoCastSpellShield();
|
||||
}
|
||||
|
||||
void DoCastSpellShield()
|
||||
{
|
||||
for (byte i = 0; i < 3; ++i)
|
||||
DoCast(me, TrialOfChampionSpells.SHIELD, true);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint uiDiff)
|
||||
{
|
||||
base.UpdateAI(uiDiff);
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiBuffTimer <= uiDiff)
|
||||
{
|
||||
if (!me.HasAura(TrialOfChampionSpells.SHIELD))
|
||||
DoCastSpellShield();
|
||||
|
||||
uiBuffTimer = RandomHelper.URand(30000, 45000);
|
||||
}
|
||||
else
|
||||
uiBuffTimer -= uiDiff;
|
||||
|
||||
if (uiChargeTimer <= uiDiff)
|
||||
{
|
||||
var players = me.GetMap().GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false))
|
||||
{
|
||||
DoResetThreat();
|
||||
me.AddThreat(player, 1.0f);
|
||||
DoCast(player, TrialOfChampionSpells.CHARGE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
uiChargeTimer = 5000;
|
||||
}
|
||||
else
|
||||
uiChargeTimer -= uiDiff;
|
||||
|
||||
//dosen't work at all
|
||||
if (uiShieldBreakerTimer <= uiDiff)
|
||||
{
|
||||
Vehicle pVehicle = me.GetVehicleKit();
|
||||
if (!pVehicle)
|
||||
return;
|
||||
|
||||
Unit pPassenger = pVehicle.GetPassenger(0);
|
||||
if (pPassenger)
|
||||
{
|
||||
var players = me.GetMap().GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (player && !player.IsGameMaster() && me.IsInRange(player, 10.0f, 30.0f, false))
|
||||
{
|
||||
pPassenger.CastSpell(player, TrialOfChampionSpells.SHIELD_BREAKER, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uiShieldBreakerTimer = 7000;
|
||||
}
|
||||
else
|
||||
uiShieldBreakerTimer -= uiDiff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
|
||||
uint uiChargeTimer;
|
||||
uint uiShieldBreakerTimer;
|
||||
uint uiBuffTimer;
|
||||
|
||||
uint uiWaypointPath;
|
||||
}
|
||||
|
||||
abstract class boss_basic_toc5AI : ScriptedAI
|
||||
{
|
||||
public boss_basic_toc5AI(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
instance = creature.GetInstanceScript();
|
||||
|
||||
bDone = false;
|
||||
bHome = false;
|
||||
|
||||
uiPhase = 0;
|
||||
uiPhaseTimer = 0;
|
||||
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
// THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.ImmuneToPc);
|
||||
}
|
||||
|
||||
public abstract void Initialize();
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void JustReachedHome()
|
||||
{
|
||||
base.JustReachedHome();
|
||||
|
||||
if (!bHome)
|
||||
return;
|
||||
|
||||
uiPhaseTimer = 15000;
|
||||
uiPhase = 1;
|
||||
|
||||
bHome = false;
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
instance.SetData((uint)Data.BOSS_GRAND_CHAMPIONS, (uint)EncounterState.Done);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!bDone && GrandChampionsOutVehicle(me))
|
||||
{
|
||||
bDone = true;
|
||||
|
||||
if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1))
|
||||
me.SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
|
||||
else if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2))
|
||||
me.SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
|
||||
else if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3))
|
||||
me.SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
|
||||
|
||||
EnterEvadeMode();
|
||||
bHome = true;
|
||||
}
|
||||
|
||||
if (uiPhaseTimer <= diff)
|
||||
{
|
||||
if (uiPhase == 1)
|
||||
{
|
||||
AggroAllPlayers(me);
|
||||
uiPhase = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
uiPhaseTimer -= diff;
|
||||
}
|
||||
|
||||
public bool InVehicle()
|
||||
{
|
||||
return !me.m_movementInfo.transport.guid.IsEmpty();
|
||||
}
|
||||
|
||||
void AggroAllPlayers(Creature temp)
|
||||
{
|
||||
var PlList = temp.GetMap().GetPlayers();
|
||||
|
||||
if (PlList.Empty())
|
||||
return;
|
||||
|
||||
foreach (var player in PlList)
|
||||
{
|
||||
if (player)
|
||||
{
|
||||
if (player.IsGameMaster())
|
||||
continue;
|
||||
|
||||
if (player.IsAlive())
|
||||
{
|
||||
temp.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.ImmuneToPc);
|
||||
temp.SetReactState(ReactStates.Aggressive);
|
||||
temp.SetInCombatWith(player);
|
||||
player.SetInCombatWith(temp);
|
||||
temp.AddThreat(player, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GrandChampionsOutVehicle(Creature me)
|
||||
{
|
||||
InstanceScript instance = me.GetInstanceScript();
|
||||
|
||||
if (instance == null)
|
||||
return false;
|
||||
|
||||
Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1));
|
||||
Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2));
|
||||
Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3));
|
||||
|
||||
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
|
||||
{
|
||||
if (pGrandChampion1.m_movementInfo.transport.guid.IsEmpty() &&
|
||||
pGrandChampion2.m_movementInfo.transport.guid.IsEmpty() &&
|
||||
pGrandChampion3.m_movementInfo.transport.guid.IsEmpty())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public TaskScheduler NonCombatEvents = new TaskScheduler();
|
||||
|
||||
public InstanceScript instance;
|
||||
|
||||
public byte uiPhase;
|
||||
public uint uiPhaseTimer;
|
||||
|
||||
bool bDone;
|
||||
public bool bHome;
|
||||
}
|
||||
|
||||
[Script]
|
||||
// Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior
|
||||
class boss_warrior_toc5 : boss_basic_toc5AI
|
||||
{
|
||||
public boss_warrior_toc5(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task =>
|
||||
{
|
||||
DoCastVictim(TrialOfChampionSpells.BLADESTORM);
|
||||
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
|
||||
{
|
||||
var players = me.GetMap().GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false))
|
||||
{
|
||||
DoResetThreat();
|
||||
me.AddThreat(player, 5.0f);
|
||||
DoCast(player, TrialOfChampionSpells.INTERCEPT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
task.Repeat(TimeSpan.FromSeconds(7));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
DoCastVictim(TrialOfChampionSpells.MORTAL_STRIKE);
|
||||
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (!UpdateVictim() || InVehicle())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Script]
|
||||
// Ambrose Boltspark && Eressea Dawnsinger || Mage
|
||||
class boss_mage_toc5 : boss_basic_toc5AI
|
||||
{
|
||||
public boss_mage_toc5(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
DoCastVictim(TrialOfChampionSpells.FIREBALL);
|
||||
task.Repeat(TimeSpan.FromSeconds(5));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
|
||||
if (target)
|
||||
DoCast(target, TrialOfChampionSpells.POLYMORPH);
|
||||
task.Repeat(TimeSpan.FromSeconds(8));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
DoCastAOE(TrialOfChampionSpells.BLAST_WAVE, false);
|
||||
task.Repeat(TimeSpan.FromSeconds(13));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(22), task =>
|
||||
{
|
||||
me.InterruptNonMeleeSpells(true);
|
||||
|
||||
DoCast(me, TrialOfChampionSpells.HASTE);
|
||||
task.Repeat(TimeSpan.FromSeconds(22));
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (!UpdateVictim() || InVehicle())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
// Colosos && Runok Wildmane || Shaman
|
||||
class boss_shaman_toc5 : boss_basic_toc5AI
|
||||
{
|
||||
public boss_shaman_toc5(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
|
||||
if (target)
|
||||
DoCast(target, TrialOfChampionSpells.CHAIN_LIGHTNING);
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(16));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
bool bChance = RandomHelper.randChance(50);
|
||||
|
||||
if (!bChance)
|
||||
{
|
||||
Unit pFriend = DoSelectLowestHpFriendly(40);
|
||||
if (pFriend)
|
||||
DoCast(pFriend, TrialOfChampionSpells.HEALING_WAVE);
|
||||
}
|
||||
else
|
||||
DoCast(me, TrialOfChampionSpells.HEALING_WAVE);
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(12));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), task =>
|
||||
{
|
||||
DoCast(me, TrialOfChampionSpells.EARTH_SHIELD);
|
||||
task.Repeat(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
|
||||
{
|
||||
DoCastVictim(TrialOfChampionSpells.HEX_OF_MENDING, true);
|
||||
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25));
|
||||
});
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
DoCast(me, TrialOfChampionSpells.EARTH_SHIELD);
|
||||
DoCast(who, TrialOfChampionSpells.HEX_OF_MENDING);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (!UpdateVictim() || InVehicle())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
// Jaelyne Evensong && Zul'tore || Hunter
|
||||
class boss_hunter_toc5 : boss_basic_toc5AI
|
||||
{
|
||||
public boss_hunter_toc5(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
|
||||
{
|
||||
DoCastAOE(TrialOfChampionSpells.LIGHTNING_ARROWS, false);
|
||||
task.Repeat(TimeSpan.FromSeconds(7));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
ObjectGuid uiTargetGUID = ObjectGuid.Empty;
|
||||
Unit target = SelectTarget(SelectAggroTarget.Farthest, 0, 30.0f);
|
||||
if (target)
|
||||
{
|
||||
uiTargetGUID = target.GetGUID();
|
||||
DoCast(target, TrialOfChampionSpells.SHOOT);
|
||||
}
|
||||
|
||||
bool bShoot = true;
|
||||
task.Repeat(TimeSpan.FromSeconds(12));
|
||||
task.Schedule(TimeSpan.FromSeconds(3), task1 =>
|
||||
{
|
||||
if (bShoot)
|
||||
{
|
||||
me.InterruptNonMeleeSpells(true);
|
||||
|
||||
Unit target1 = Global.ObjAccessor.GetUnit(me, uiTargetGUID);
|
||||
if (target1 && me.IsInRange(target1, 5.0f, 30.0f, false))
|
||||
{
|
||||
DoCast(target1, TrialOfChampionSpells.MULTI_SHOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
var players = me.GetMap().GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (player && !player.IsGameMaster() && me.IsInRange(player, 5.0f, 30.0f, false))
|
||||
{
|
||||
DoCast(player, TrialOfChampionSpells.MULTI_SHOT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bShoot = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (!UpdateVictim() || InVehicle())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
// Lana Stouthammer Evensong && Deathstalker Visceri || Rouge
|
||||
class boss_rouge_toc5 : boss_basic_toc5AI
|
||||
{
|
||||
public boss_rouge_toc5(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
DoCastVictim(TrialOfChampionSpells.EVISCERATE);
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(8));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(14), task =>
|
||||
{
|
||||
DoCastAOE(TrialOfChampionSpells.FAN_OF_KNIVES, false);
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(14));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(19), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
|
||||
if (target)
|
||||
DoCast(target, TrialOfChampionSpells.POISON_BOTTLE);
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(19));
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (!UpdateVictim() || !me.m_movementInfo.transport.guid.IsEmpty())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
/*
|
||||
* 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 Framework.IO;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Game.AI;
|
||||
|
||||
namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
|
||||
{
|
||||
[Script]
|
||||
class instance_trial_of_the_champion : InstanceMapScript
|
||||
{
|
||||
public instance_trial_of_the_champion() : base("instance_trial_of_the_champion", 650) { }
|
||||
|
||||
class instance_trial_of_the_champion_InstanceMapScript : InstanceScript
|
||||
{
|
||||
public instance_trial_of_the_champion_InstanceMapScript(Map map) : base(map)
|
||||
{
|
||||
SetHeaders("TC");
|
||||
uiMovementDone = 0;
|
||||
uiGrandChampionsDeaths = 0;
|
||||
uiArgentSoldierDeaths = 0;
|
||||
|
||||
//bDone = false;
|
||||
}
|
||||
|
||||
public override bool IsEncounterInProgress()
|
||||
{
|
||||
for (byte i = 0; i < 4; ++i)
|
||||
{
|
||||
if (m_auiEncounter[i] == EncounterState.InProgress)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnCreatureCreate(Creature creature)
|
||||
{
|
||||
var players = instance.GetPlayers();
|
||||
Team TeamInInstance = 0;
|
||||
|
||||
if (!players.Empty())
|
||||
{
|
||||
Player player = players.First();
|
||||
if (player)
|
||||
TeamInInstance = player.GetTeam();
|
||||
}
|
||||
|
||||
switch (creature.GetEntry())
|
||||
{
|
||||
// Champions
|
||||
case VehicleIds.MOKRA_SKILLCRUSHER_MOUNT:
|
||||
if (TeamInInstance == Team.Horde)
|
||||
creature.UpdateEntry(VehicleIds.MARSHAL_JACOB_ALERIUS_MOUNT);
|
||||
break;
|
||||
case VehicleIds.ERESSEA_DAWNSINGER_MOUNT:
|
||||
if (TeamInInstance == Team.Horde)
|
||||
creature.UpdateEntry(VehicleIds.AMBROSE_BOLTSPARK_MOUNT);
|
||||
break;
|
||||
case VehicleIds.RUNOK_WILDMANE_MOUNT:
|
||||
if (TeamInInstance == Team.Horde)
|
||||
creature.UpdateEntry(VehicleIds.COLOSOS_MOUNT);
|
||||
break;
|
||||
case VehicleIds.ZUL_TORE_MOUNT:
|
||||
if (TeamInInstance == Team.Horde)
|
||||
creature.UpdateEntry(VehicleIds.EVENSONG_MOUNT);
|
||||
break;
|
||||
case VehicleIds.DEATHSTALKER_VESCERI_MOUNT:
|
||||
if (TeamInInstance == Team.Horde)
|
||||
creature.UpdateEntry(VehicleIds.LANA_STOUTHAMMER_MOUNT);
|
||||
break;
|
||||
// Coliseum Announcer || Just NPC_JAEREN must be spawned.
|
||||
case CreatureIds.JAEREN:
|
||||
uiAnnouncerGUID = creature.GetGUID();
|
||||
if (TeamInInstance == Team.Alliance)
|
||||
creature.UpdateEntry(CreatureIds.ARELAS);
|
||||
break;
|
||||
case VehicleIds.ARGENT_WARHORSE:
|
||||
case VehicleIds.ARGENT_BATTLEWORG:
|
||||
VehicleList.Add(creature.GetGUID());
|
||||
break;
|
||||
case CreatureIds.EADRIC:
|
||||
case CreatureIds.PALETRESS:
|
||||
uiArgentChampionGUID = creature.GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGameObjectCreate(GameObject go)
|
||||
{
|
||||
switch (go.GetEntry())
|
||||
{
|
||||
case GameObjectIds.MAIN_GATE:
|
||||
uiMainGateGUID = go.GetGUID();
|
||||
break;
|
||||
case GameObjectIds.CHAMPIONS_LOOT:
|
||||
case GameObjectIds.CHAMPIONS_LOOT_H:
|
||||
uiChampionLootGUID = go.GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetData(uint uiType, uint uiData)
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case (uint)Data.DATA_MOVEMENT_DONE:
|
||||
uiMovementDone = (ushort)uiData;
|
||||
if (uiMovementDone == 3)
|
||||
{
|
||||
Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID);
|
||||
if (pAnnouncer)
|
||||
pAnnouncer.GetAI().SetData((uint)Data.DATA_IN_POSITION, 0);
|
||||
}
|
||||
break;
|
||||
case (uint)Data.BOSS_GRAND_CHAMPIONS:
|
||||
m_auiEncounter[0] = (EncounterState)uiData;
|
||||
if (uiData == (uint)EncounterState.InProgress)
|
||||
{
|
||||
foreach (var guid in VehicleList)
|
||||
{
|
||||
Creature summon = instance.GetCreature(guid);
|
||||
if (summon)
|
||||
summon.RemoveFromWorld();
|
||||
}
|
||||
}
|
||||
else if (uiData == (uint)EncounterState.Done)
|
||||
{
|
||||
++uiGrandChampionsDeaths;
|
||||
if (uiGrandChampionsDeaths == 3)
|
||||
{
|
||||
Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID);
|
||||
if (pAnnouncer)
|
||||
{
|
||||
pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f);
|
||||
pAnnouncer.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
|
||||
pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.CHAMPIONS_LOOT_H : GameObjectIds.CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.WAxis, 90000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (uint)Data.DATA_ARGENT_SOLDIER_DEFEATED:
|
||||
uiArgentSoldierDeaths = (byte)uiData;
|
||||
if (uiArgentSoldierDeaths == 9)
|
||||
{
|
||||
Creature pBoss = instance.GetCreature(uiArgentChampionGUID);
|
||||
if (pBoss)
|
||||
{
|
||||
pBoss.GetMotionMaster().MovePoint(0, 746.88f, 618.74f, 411.06f);
|
||||
pBoss.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
pBoss.SetReactState(ReactStates.Aggressive);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (uint)Data.BOSS_ARGENT_CHALLENGE_E:
|
||||
{
|
||||
m_auiEncounter[1] = (EncounterState)uiData;
|
||||
Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID);
|
||||
if (pAnnouncer)
|
||||
{
|
||||
pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f);
|
||||
pAnnouncer.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
|
||||
pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.EADRIC_LOOT_H : GameObjectIds.EADRIC_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.WAxis, 90000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (uint)Data.BOSS_ARGENT_CHALLENGE_P:
|
||||
{
|
||||
m_auiEncounter[2] = (EncounterState)uiData;
|
||||
Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID);
|
||||
if (pAnnouncer)
|
||||
{
|
||||
pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f);
|
||||
pAnnouncer.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
|
||||
pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.PALETRESS_LOOT_H : GameObjectIds.PALETRESS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.WAxis, 90000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (uiData == (uint)EncounterState.Done)
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
public override uint GetData(uint uiData)
|
||||
{
|
||||
switch (uiData)
|
||||
{
|
||||
case (uint)Data.BOSS_GRAND_CHAMPIONS:
|
||||
return (uint)m_auiEncounter[0];
|
||||
case (uint)Data.BOSS_ARGENT_CHALLENGE_E:
|
||||
return (uint)m_auiEncounter[1];
|
||||
case (uint)Data.BOSS_ARGENT_CHALLENGE_P:
|
||||
return (uint)m_auiEncounter[2];
|
||||
case (uint)Data.BOSS_BLACK_KNIGHT:
|
||||
return (uint)m_auiEncounter[3];
|
||||
|
||||
case (uint)Data.DATA_MOVEMENT_DONE:
|
||||
return uiMovementDone;
|
||||
case (uint)Data.DATA_ARGENT_SOLDIER_DEFEATED:
|
||||
return uiArgentSoldierDeaths;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override ObjectGuid GetGuidData(uint uiData)
|
||||
{
|
||||
switch (uiData)
|
||||
{
|
||||
case (uint)Data64.DATA_ANNOUNCER:
|
||||
return uiAnnouncerGUID;
|
||||
case (uint)Data64.DATA_MAIN_GATE:
|
||||
return uiMainGateGUID;
|
||||
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_1:
|
||||
return uiGrandChampion1GUID;
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_2:
|
||||
return uiGrandChampion2GUID;
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_3:
|
||||
return uiGrandChampion3GUID;
|
||||
}
|
||||
|
||||
return ObjectGuid.Empty;
|
||||
}
|
||||
|
||||
public override void SetGuidData(uint uiType, ObjectGuid uiData)
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_1:
|
||||
uiGrandChampion1GUID = uiData;
|
||||
break;
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_2:
|
||||
uiGrandChampion2GUID = uiData;
|
||||
break;
|
||||
case (uint)Data64.DATA_GRAND_CHAMPION_3:
|
||||
uiGrandChampion3GUID = uiData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA();
|
||||
|
||||
string str_data = string.Format("T C {0} {1} {2} {3} {4} {5}", m_auiEncounter[0], m_auiEncounter[1], m_auiEncounter[2], m_auiEncounter[3], uiGrandChampionsDeaths, uiMovementDone);
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE();
|
||||
return str_data;
|
||||
}
|
||||
|
||||
public override void Load(string str)
|
||||
{
|
||||
if (str.IsEmpty())
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL();
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
StringArguments loadStream = new StringArguments(str);
|
||||
string dataHead = loadStream.NextString();
|
||||
|
||||
if (dataHead[0] == 'T' && dataHead[1] == 'C')
|
||||
{
|
||||
for (byte i = 0; i < 4; ++i)
|
||||
{
|
||||
m_auiEncounter[i] = (EncounterState)loadStream.NextUInt32();
|
||||
if (m_auiEncounter[i] == EncounterState.InProgress)
|
||||
m_auiEncounter[i] = EncounterState.NotStarted;
|
||||
|
||||
}
|
||||
|
||||
uiGrandChampionsDeaths = loadStream.NextUInt16();
|
||||
uiMovementDone = loadStream.NextUInt16();
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL();
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE();
|
||||
}
|
||||
|
||||
EncounterState[] m_auiEncounter = new EncounterState[4];
|
||||
|
||||
ushort uiMovementDone;
|
||||
ushort uiGrandChampionsDeaths;
|
||||
byte uiArgentSoldierDeaths;
|
||||
|
||||
ObjectGuid uiAnnouncerGUID;
|
||||
ObjectGuid uiMainGateGUID;
|
||||
//ObjectGuid uiGrandChampionVehicle1GUID;
|
||||
//ObjectGuid uiGrandChampionVehicle2GUID;
|
||||
//ObjectGuid uiGrandChampionVehicle3GUID;
|
||||
ObjectGuid uiGrandChampion1GUID;
|
||||
ObjectGuid uiGrandChampion2GUID;
|
||||
ObjectGuid uiGrandChampion3GUID;
|
||||
ObjectGuid uiChampionLootGUID;
|
||||
ObjectGuid uiArgentChampionGUID;
|
||||
|
||||
List<ObjectGuid> VehicleList = new List<ObjectGuid>();
|
||||
|
||||
//bool bDone;
|
||||
}
|
||||
|
||||
public override InstanceScript GetInstanceScript(InstanceMap map)
|
||||
{
|
||||
return new instance_trial_of_the_champion_InstanceMapScript(map);
|
||||
}
|
||||
|
||||
public static T GetTrialOfTheChampionAI<T>(Creature creature) where T : CreatureAI
|
||||
{
|
||||
return GetInstanceAI<T>(creature, "instance_trial_of_the_champion");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
|
||||
|
||||
namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
|
||||
{
|
||||
struct TrialOfTheChampionConst
|
||||
{
|
||||
public const uint SAY_INTRO_1 = 0;
|
||||
public const uint SAY_INTRO_2 = 1;
|
||||
public const uint SAY_INTRO_3 = 2;
|
||||
public const uint SAY_AGGRO = 3;
|
||||
public const uint SAY_PHASE_2 = 4;
|
||||
public const uint SAY_PHASE_3 = 5;
|
||||
public const uint SAY_KILL_PLAYER = 6;
|
||||
public const uint SAY_DEATH = 7;
|
||||
|
||||
public const string GOSSIP_START_EVENT1 = "I'm ready to start challenge.";
|
||||
public const string GOSSIP_START_EVENT2 = "I'm ready for the next challenge.";
|
||||
}
|
||||
|
||||
enum Data
|
||||
{
|
||||
BOSS_GRAND_CHAMPIONS,
|
||||
BOSS_ARGENT_CHALLENGE_E,
|
||||
BOSS_ARGENT_CHALLENGE_P,
|
||||
BOSS_BLACK_KNIGHT,
|
||||
DATA_MOVEMENT_DONE,
|
||||
DATA_LESSER_CHAMPIONS_DEFEATED,
|
||||
DATA_START,
|
||||
DATA_IN_POSITION,
|
||||
DATA_ARGENT_SOLDIER_DEFEATED
|
||||
};
|
||||
|
||||
enum Data64
|
||||
{
|
||||
DATA_ANNOUNCER,
|
||||
DATA_MAIN_GATE,
|
||||
|
||||
DATA_GRAND_CHAMPION_VEHICLE_1,
|
||||
DATA_GRAND_CHAMPION_VEHICLE_2,
|
||||
DATA_GRAND_CHAMPION_VEHICLE_3,
|
||||
|
||||
DATA_GRAND_CHAMPION_1,
|
||||
DATA_GRAND_CHAMPION_2,
|
||||
DATA_GRAND_CHAMPION_3
|
||||
};
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
// Horde Champions
|
||||
public const uint MOKRA = 35572;
|
||||
public const uint ERESSEA = 35569;
|
||||
public const uint RUNOK = 35571;
|
||||
public const uint ZULTORE = 35570;
|
||||
public const uint VISCERI = 35617;
|
||||
|
||||
// Alliance Champions
|
||||
public const uint JACOB = 34705;
|
||||
public const uint AMBROSE = 34702;
|
||||
public const uint COLOSOS = 34701;
|
||||
public const uint JAELYNE = 34657;
|
||||
public const uint LANA = 34703;
|
||||
|
||||
public const uint EADRIC = 35119;
|
||||
public const uint PALETRESS = 34928;
|
||||
|
||||
public const uint ARGENT_LIGHWIELDER = 35309;
|
||||
public const uint ARGENT_MONK = 35305;
|
||||
public const uint PRIESTESS = 35307;
|
||||
|
||||
public const uint BLACK_KNIGHT = 35451;
|
||||
|
||||
public const uint RISEN_JAEREN = 35545;
|
||||
public const uint RISEN_ARELAS = 35564;
|
||||
|
||||
public const uint JAEREN = 35004;
|
||||
public const uint ARELAS = 35005;
|
||||
}
|
||||
|
||||
struct GameObjectIds
|
||||
{
|
||||
public const uint MAIN_GATE = 195647;
|
||||
|
||||
public const uint CHAMPIONS_LOOT = 195709;
|
||||
public const uint CHAMPIONS_LOOT_H = 195710;
|
||||
|
||||
public const uint EADRIC_LOOT = 195374;
|
||||
public const uint EADRIC_LOOT_H = 195375;
|
||||
|
||||
public const uint PALETRESS_LOOT = 195323;
|
||||
public const uint PALETRESS_LOOT_H = 195324;
|
||||
}
|
||||
|
||||
struct VehicleIds
|
||||
{
|
||||
//Grand Champions Alliance Vehicles
|
||||
public const uint MARSHAL_JACOB_ALERIUS_MOUNT = 35637;
|
||||
public const uint AMBROSE_BOLTSPARK_MOUNT = 35633;
|
||||
public const uint COLOSOS_MOUNT = 35768;
|
||||
public const uint EVENSONG_MOUNT = 34658;
|
||||
public const uint LANA_STOUTHAMMER_MOUNT = 35636;
|
||||
//Faction Champions (ALLIANCE)
|
||||
public const uint DARNASSIA_NIGHTSABER = 33319;
|
||||
public const uint EXODAR_ELEKK = 33318;
|
||||
public const uint STORMWIND_STEED = 33217;
|
||||
public const uint GNOMEREGAN_MECHANOSTRIDER = 33317;
|
||||
public const uint IRONFORGE_RAM = 33316;
|
||||
//Grand Champions Horde Vehicles
|
||||
public const uint MOKRA_SKILLCRUSHER_MOUNT = 35638;
|
||||
public const uint ERESSEA_DAWNSINGER_MOUNT = 35635;
|
||||
public const uint RUNOK_WILDMANE_MOUNT = 35640;
|
||||
public const uint ZUL_TORE_MOUNT = 35641;
|
||||
public const uint DEATHSTALKER_VESCERI_MOUNT = 35634;
|
||||
//Faction Champions (HORDE)
|
||||
public const uint FORSAKE_WARHORSE = 33324;
|
||||
public const uint THUNDER_BLUFF_KODO = 33322;
|
||||
public const uint ORGRIMMAR_WOLF = 33320;
|
||||
public const uint SILVERMOON_HAWKSTRIDER = 33323;
|
||||
public const uint DARKSPEAR_RAPTOR = 33321;
|
||||
|
||||
public const uint ARGENT_WARHORSE = 35644;
|
||||
public const uint ARGENT_BATTLEWORG = 36558;
|
||||
|
||||
public const uint BLACK_KNIGHT = 35491;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_announcer_toc5 : CreatureScript
|
||||
{
|
||||
public npc_announcer_toc5() : base("npc_announcer_toc5") { }
|
||||
|
||||
class npc_announcer_toc5AI : ScriptedAI
|
||||
{
|
||||
public npc_announcer_toc5AI(Creature creature) : base(creature)
|
||||
{
|
||||
instance = creature.GetInstanceScript();
|
||||
|
||||
uiSummonTimes = 0;
|
||||
uiLesserChampions = 0;
|
||||
|
||||
uiFirstBoss = 0;
|
||||
uiSecondBoss = 0;
|
||||
uiThirdBoss = 0;
|
||||
|
||||
uiArgentChampion = 0;
|
||||
|
||||
uiPhase = 0;
|
||||
uiTimer = 0;
|
||||
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
me.SetFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
|
||||
|
||||
SetGrandChampionsForEncounter();
|
||||
SetArgentChampion();
|
||||
}
|
||||
|
||||
void NextStep(uint uiTimerStep, bool bNextStep = true, byte uiPhaseStep = 0)
|
||||
{
|
||||
uiTimer = uiTimerStep;
|
||||
if (bNextStep)
|
||||
++uiPhase;
|
||||
else
|
||||
uiPhase = uiPhaseStep;
|
||||
}
|
||||
|
||||
public override void SetData(uint uiType, uint uiData)
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case (uint)Data.DATA_START:
|
||||
DoSummonGrandChampion(uiFirstBoss);
|
||||
NextStep(10000, false, 1);
|
||||
break;
|
||||
case (uint)Data.DATA_IN_POSITION: //movement EncounterState.Done.
|
||||
me.GetMotionMaster().MovePoint(1, 735.81f, 661.92f, 412.39f);
|
||||
GameObject go = ObjectAccessor.GetGameObject(me, instance.GetGuidData((uint)Data64.DATA_MAIN_GATE));
|
||||
if (go)
|
||||
instance.HandleGameObject(go.GetGUID(), false);
|
||||
NextStep(10000, false, 3);
|
||||
break;
|
||||
case (uint)Data.DATA_LESSER_CHAMPIONS_DEFEATED:
|
||||
{
|
||||
++uiLesserChampions;
|
||||
List<ObjectGuid> TempList = new List<ObjectGuid>();
|
||||
if (uiLesserChampions == 3 || uiLesserChampions == 6)
|
||||
{
|
||||
switch (uiLesserChampions)
|
||||
{
|
||||
case 3:
|
||||
TempList = Champion2List;
|
||||
break;
|
||||
case 6:
|
||||
TempList = Champion3List;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var guid in TempList)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(me, guid);
|
||||
if (summon)
|
||||
AggroAllPlayers(summon);
|
||||
}
|
||||
}
|
||||
else if (uiLesserChampions == 9)
|
||||
StartGrandChampionsAttack();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StartGrandChampionsAttack()
|
||||
{
|
||||
Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, uiVehicle1GUID);
|
||||
Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, uiVehicle2GUID);
|
||||
Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, uiVehicle3GUID);
|
||||
|
||||
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
|
||||
{
|
||||
AggroAllPlayers(pGrandChampion1);
|
||||
AggroAllPlayers(pGrandChampion2);
|
||||
AggroAllPlayers(pGrandChampion3);
|
||||
}
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType uiType, uint uiPointId)
|
||||
{
|
||||
if (uiType != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
if (uiPointId == 1)
|
||||
me.SetFacingTo(4.714f);
|
||||
}
|
||||
|
||||
void DoSummonGrandChampion(uint uiBoss)
|
||||
{
|
||||
++uiSummonTimes;
|
||||
uint VEHICLE_TO_SUMMON1 = 0;
|
||||
uint VEHICLE_TO_SUMMON2 = 0;
|
||||
switch (uiBoss)
|
||||
{
|
||||
case 0:
|
||||
VEHICLE_TO_SUMMON1 = VehicleIds.MOKRA_SKILLCRUSHER_MOUNT;
|
||||
VEHICLE_TO_SUMMON2 = VehicleIds.ORGRIMMAR_WOLF;
|
||||
break;
|
||||
case 1:
|
||||
VEHICLE_TO_SUMMON1 = VehicleIds.ERESSEA_DAWNSINGER_MOUNT;
|
||||
VEHICLE_TO_SUMMON2 = VehicleIds.SILVERMOON_HAWKSTRIDER;
|
||||
break;
|
||||
case 2:
|
||||
VEHICLE_TO_SUMMON1 = VehicleIds.RUNOK_WILDMANE_MOUNT;
|
||||
VEHICLE_TO_SUMMON2 = VehicleIds.THUNDER_BLUFF_KODO;
|
||||
break;
|
||||
case 3:
|
||||
VEHICLE_TO_SUMMON1 = VehicleIds.ZUL_TORE_MOUNT;
|
||||
VEHICLE_TO_SUMMON2 = VehicleIds.DARKSPEAR_RAPTOR;
|
||||
break;
|
||||
case 4:
|
||||
VEHICLE_TO_SUMMON1 = VehicleIds.DEATHSTALKER_VESCERI_MOUNT;
|
||||
VEHICLE_TO_SUMMON2 = VehicleIds.FORSAKE_WARHORSE;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Creature pBoss = me.SummonCreature(VEHICLE_TO_SUMMON1, SpawnPosition);
|
||||
if (pBoss)
|
||||
{
|
||||
ObjectGuid uiGrandChampionBoss = ObjectGuid.Empty;
|
||||
Vehicle pVehicle = pBoss.GetVehicleKit();
|
||||
if (pVehicle)
|
||||
{
|
||||
Unit unit = pVehicle.GetPassenger(0);
|
||||
if (unit)
|
||||
uiGrandChampionBoss = unit.GetGUID();
|
||||
}
|
||||
|
||||
switch (uiSummonTimes)
|
||||
{
|
||||
case 1:
|
||||
uiVehicle1GUID = pBoss.GetGUID();
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1, uiGrandChampionBoss);
|
||||
break;
|
||||
case 2:
|
||||
|
||||
uiVehicle2GUID = pBoss.GetGUID();
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2, uiGrandChampionBoss);
|
||||
break;
|
||||
case 3:
|
||||
uiVehicle3GUID = pBoss.GetGUID();
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
|
||||
instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3, uiGrandChampionBoss);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
pBoss.GetAI().SetData(uiSummonTimes, 0);
|
||||
|
||||
for (byte i = 0; i < 3; ++i)
|
||||
{
|
||||
Creature pAdd = me.SummonCreature(VEHICLE_TO_SUMMON2, SpawnPosition, TempSummonType.CorpseDespawn);
|
||||
if (pAdd)
|
||||
{
|
||||
switch (uiSummonTimes)
|
||||
{
|
||||
case 1:
|
||||
Champion1List.Add(pAdd.GetGUID());
|
||||
break;
|
||||
case 2:
|
||||
Champion2List.Add(pAdd.GetGUID());
|
||||
break;
|
||||
case 3:
|
||||
Champion3List.Add(pAdd.GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI);
|
||||
break;
|
||||
case 1:
|
||||
pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI / 2);
|
||||
break;
|
||||
case 2:
|
||||
pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI / 2 + MathFunctions.PI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoStartArgentChampionEncounter()
|
||||
{
|
||||
me.GetMotionMaster().MovePoint(1, 735.81f, 661.92f, 412.39f);
|
||||
|
||||
if (me.SummonCreature(uiArgentChampion, SpawnPosition))
|
||||
{
|
||||
for (byte i = 0; i < 3; ++i)
|
||||
{
|
||||
Creature lightwielderTrash = me.SummonCreature(CreatureIds.ARGENT_LIGHWIELDER, SpawnPosition);
|
||||
if (lightwielderTrash)
|
||||
lightwielderTrash.GetAI().SetData(i, 0);
|
||||
|
||||
Creature monkTrash = me.SummonCreature(CreatureIds.ARGENT_MONK, SpawnPosition);
|
||||
if (monkTrash)
|
||||
monkTrash.GetAI().SetData(i, 0);
|
||||
|
||||
Creature priestessTrash = me.SummonCreature(CreatureIds.PRIESTESS, SpawnPosition);
|
||||
if (priestessTrash)
|
||||
priestessTrash.GetAI().SetData(i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetGrandChampionsForEncounter()
|
||||
{
|
||||
uiFirstBoss = RandomHelper.URand(0, 4);
|
||||
|
||||
while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss)
|
||||
{
|
||||
uiSecondBoss = RandomHelper.URand(0, 4);
|
||||
uiThirdBoss = RandomHelper.URand(0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void SetArgentChampion()
|
||||
{
|
||||
byte uiTempBoss = (byte)RandomHelper.URand(0, 1);
|
||||
|
||||
switch (uiTempBoss)
|
||||
{
|
||||
case 0:
|
||||
uiArgentChampion = CreatureIds.EADRIC;
|
||||
break;
|
||||
case 1:
|
||||
uiArgentChampion = CreatureIds.PALETRESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartEncounter()
|
||||
{
|
||||
me.RemoveFlag(UnitFields.NpcFlags, NPCFlags.Gossip);
|
||||
|
||||
if (instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted)
|
||||
{
|
||||
if (instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted && instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted)
|
||||
{
|
||||
if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted)
|
||||
SetData((uint)Data.DATA_START, 0);
|
||||
|
||||
if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done)
|
||||
DoStartArgentChampionEncounter();
|
||||
}
|
||||
|
||||
if ((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done &&
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) ||
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done)
|
||||
me.SummonCreature(VehicleIds.BLACK_KNIGHT, 769.834f, 651.915f, 447.035f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void AggroAllPlayers(Creature temp)
|
||||
{
|
||||
var PlList = me.GetMap().GetPlayers();
|
||||
|
||||
if (PlList.Empty())
|
||||
return;
|
||||
|
||||
foreach (var player in PlList)
|
||||
{
|
||||
if (player.IsGameMaster())
|
||||
continue;
|
||||
|
||||
if (player.IsAlive())
|
||||
{
|
||||
temp.SetHomePosition(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation());
|
||||
temp.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
temp.SetReactState(ReactStates.Aggressive);
|
||||
temp.SetInCombatWith(player);
|
||||
player.SetInCombatWith(temp);
|
||||
temp.AddThreat(player, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
base.UpdateAI(diff);
|
||||
|
||||
if (uiTimer <= diff)
|
||||
{
|
||||
switch (uiPhase)
|
||||
{
|
||||
case 1:
|
||||
DoSummonGrandChampion(uiSecondBoss);
|
||||
NextStep(10000, true);
|
||||
break;
|
||||
case 2:
|
||||
DoSummonGrandChampion(uiThirdBoss);
|
||||
NextStep(0, false);
|
||||
break;
|
||||
case 3:
|
||||
if (!Champion1List.Empty())
|
||||
{
|
||||
foreach (var guid in Champion1List)
|
||||
{
|
||||
Creature summon = ObjectAccessor.GetCreature(me, guid);
|
||||
if (summon)
|
||||
AggroAllPlayers(summon);
|
||||
}
|
||||
NextStep(0, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
uiTimer -= diff;
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summon)
|
||||
{
|
||||
if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted)
|
||||
{
|
||||
summon.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
summon.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SummonedCreatureDespawn(Creature summon)
|
||||
{
|
||||
switch (summon.GetEntry())
|
||||
{
|
||||
case VehicleIds.DARNASSIA_NIGHTSABER:
|
||||
case VehicleIds.EXODAR_ELEKK:
|
||||
case VehicleIds.STORMWIND_STEED:
|
||||
case VehicleIds.GNOMEREGAN_MECHANOSTRIDER:
|
||||
case VehicleIds.IRONFORGE_RAM:
|
||||
case VehicleIds.FORSAKE_WARHORSE:
|
||||
case VehicleIds.THUNDER_BLUFF_KODO:
|
||||
case VehicleIds.ORGRIMMAR_WOLF:
|
||||
case VehicleIds.SILVERMOON_HAWKSTRIDER:
|
||||
case VehicleIds.DARKSPEAR_RAPTOR:
|
||||
SetData((uint)Data.DATA_LESSER_CHAMPIONS_DEFEATED, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
|
||||
byte uiSummonTimes;
|
||||
byte uiLesserChampions;
|
||||
|
||||
uint uiArgentChampion;
|
||||
|
||||
uint uiFirstBoss;
|
||||
uint uiSecondBoss;
|
||||
uint uiThirdBoss;
|
||||
|
||||
uint uiPhase;
|
||||
uint uiTimer;
|
||||
|
||||
ObjectGuid uiVehicle1GUID;
|
||||
ObjectGuid uiVehicle2GUID;
|
||||
ObjectGuid uiVehicle3GUID;
|
||||
|
||||
List<ObjectGuid> Champion1List = new List<ObjectGuid>();
|
||||
List<ObjectGuid> Champion2List = new List<ObjectGuid>();
|
||||
List<ObjectGuid> Champion3List = new List<ObjectGuid>();
|
||||
|
||||
Position SpawnPosition = new Position(746.261f, 657.401f, 411.681f, 4.65f);
|
||||
}
|
||||
|
||||
public override bool OnGossipHello(Player player, Creature creature)
|
||||
{
|
||||
InstanceScript instance = creature.GetInstanceScript();
|
||||
|
||||
if (instance != null &&
|
||||
((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done &&
|
||||
instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.Done &&
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) ||
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done))
|
||||
return false;
|
||||
|
||||
if (instance != null &&
|
||||
instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted &&
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted &&
|
||||
instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted &&
|
||||
instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted)
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
|
||||
else if (instance != null)
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
|
||||
|
||||
player.SEND_GOSSIP_MENU(player.GetGossipTextId(creature), creature.GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
|
||||
{
|
||||
player.PlayerTalkClass.ClearMenus();
|
||||
if (action == eTradeskill.GossipActionInfoDef + 1)
|
||||
{
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
((npc_announcer_toc5AI)creature.GetAI()).StartEncounter();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return instance_trial_of_the_champion.GetTrialOfTheChampionAI<npc_announcer_toc5AI>(creature);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user