fix(Scripts/AhnQiraj): Implemented General Andorov event. (#12645)

This commit is contained in:
UltraNix
2022-08-21 06:34:34 +02:00
committed by GitHub
parent 39386c2228
commit c65d4bbe56
5 changed files with 326 additions and 7 deletions
@@ -0,0 +1,47 @@
--
UPDATE `creature_template` SET `ScriptName`='npc_general_andorov' WHERE `entry`=15471;
UPDATE `creature_template` SET `npcflag`=129, `speed_walk`=1.4, `speed_run`=1.4, `gossip_menu_id`=7048, `type_flags`=`type_flags`|0x08000000 WHERE `entry`=15471;
UPDATE `creature_template` SET `speed_walk`=1.4, `speed_run`=1.4 WHERE `entry`=15473;
DELETE FROM `script_waypoint` WHERE `entry`=15471;
INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES
(15471,0,-8623.171,1470.4077,32.006413,0,'Andorov'),
(15471,1,-8657.297,1506.1847,32.586697,0,'Andorov'),
(15471,2,-8679.187,1535.1178,31.96736,0,'Andorov'),
(15471,3,-8701.477,1561.7574,32.17472,0,'Andorov'),
(15471,4,-8720.072,1580.9626,21.511324,0,'Andorov'),
(15471,5,-8746.162,1603.494,21.613367,0,'Andorov'),
(15471,6,-8780.431,1617.8787,21.455776,0,'Andorov'),
(15471,7,-8823.478,1624.6688,19.80574,0,'Andorov'),
(15471,8,-8855.329,1637.9473,19.790516,0,'Andorov'),
(15471,9,-8870.721,1648.4009,21.511328,0,'Andorov'),
(15471,10,-8870.721,1648.4009,21.511328,0,'Andorov'),
(15471,11,-8886.095,1598.713,21.4053,0,'Andorov'),
(15471,12,-8904.383,1578.6167,21.511332,0,'Andorov'),
(15471,13,-8920.576,1551.9479,21.407932,0,'Andorov'),
(15471,14,-8939.951,1551.127,21.566868,0,'Andorov');
DELETE FROM `gossip_menu_option` WHERE `menuid`=7048;
INSERT INTO `gossip_menu_option` (`menuid`, `optionId`, `optionicon`, `optiontext`, `optiontype`, `optionnpcflag`, `actionmenuid`, `actionpoiid`, `boxcoded`, `boxmoney`, `boxtext`) VALUES
(7048, 0, 1, 'Let me see your goods', 3, 128, 0, 0, 0, 0, ''), -- 15471
(7048, 1, 0, 'Let\'s find out.', 1, 1, 0, 0, 0, 0, '');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup`=7048;
INSERT INTO `conditions` VALUES
(14,7048,7883,0,0,13,0,1,3,2,1,0,0,'','Show gossip option if Rajaxx is not done'),
(14,7048,8304,0,0,13,0,1,3,2,0,0,0,'','Show gossip option if Rajaxx is not done'),
(14,7048,8305,0,0,13,0,1,3,2,0,0,0,'','Show gossip option if Rajaxx is done'),
(15,7048,0,0,0,13,0,1,3,2,0,0,0,'','Show gossip option if Rajaxx is done'),
(15,7048,1,0,0,13,0,1,3,2,1,0,0,'','Show gossip option if Rajaxx is not done');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=23 AND `SourceGroup`=15471;
INSERT INTO `conditions` VALUES
(23,15471,0,0,0,13,0,1,3,2,0,0,0,'','Show vendor npc flag option if Rajaxx is done');
-- Kaldorei Elite SAI
SET @ENTRY := 15473;
UPDATE `creature_template` SET `ScriptName`='', `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,6000,9000,6000,9000,11,26350,0,0,0,0,0,2,0,0,0,0,0,0,0,"Kaldorei Elite - In Combat - Cast 'Cleave'"),
(@ENTRY,0,1,0,0,0,100,0,9000,13000,9000,13000,11,16856,0,0,0,0,0,2,0,0,0,0,0,0,0,"Kaldorei Elite - In Combat - Cast 'Mortal Strike'");
@@ -77,8 +77,15 @@ struct boss_kurinnaxx : public BossAI
void JustDied(Unit* killer) override void JustDied(Unit* killer) override
{ {
if (killer) if (killer)
{
killer->GetMap()->LoadGrid(-9502.80f, 2042.65f); // Ossirian grid killer->GetMap()->LoadGrid(-9502.80f, 2042.65f); // Ossirian grid
if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
{
player->SummonCreature(NPC_ANDOROV, -8538.177f, 1486.0956f, 32.39054f, 3.7638654f, TEMPSUMMON_CORPSE_DESPAWN, 600000000);
}
}
if (Creature* ossirian = instance->GetCreature(DATA_OSSIRIAN)) if (Creature* ossirian = instance->GetCreature(DATA_OSSIRIAN))
{ {
ossirian->setActive(true); ossirian->setActive(true);
@@ -15,21 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "SmartAI.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellScript.h" #include "SpellScript.h"
#include "ruins_of_ahnqiraj.h" #include "ruins_of_ahnqiraj.h"
enum Yells enum Yells
{ {
SAY_UNK1 = 6, // The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! Sound: 8645 Emote: 35
SAY_UNK2 = 7,
SAY_UNK3 = 8,
SAY_DEATH = 9, SAY_DEATH = 9,
SAY_CHANGEAGGRO = 10, SAY_CHANGEAGGRO = 10,
SAY_KILLS_ANDOROV = 11, SAY_KILLS_ANDOROV = 11,
SAY_COMPLETE_QUEST = 12 // Yell when realm complete quest 8743 for world event SAY_COMPLETE_QUEST = 12 // Yell when realm complete quest 8743 for world event
// Warriors, Captains, continue the fight! Sound: 8640 // Warriors, Captains, continue the fight! Sound: 8640
}; };
enum Spells enum Spells
@@ -60,6 +61,12 @@ struct boss_rajaxx : public BossAI
{ {
Talk(SAY_DEATH); Talk(SAY_DEATH);
_JustDied(); _JustDied();
if (Creature* andorov = instance->instance->GetCreature(instance->GetGuidData(DATA_ANDOROV)))
{
andorov->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_VENDOR);
andorov->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS);
}
} }
void EnterCombat(Unit* /*victim*/) override void EnterCombat(Unit* /*victim*/) override
@@ -123,8 +130,236 @@ class spell_rajaxx_thundercrash : public SpellScript
} }
}; };
enum AndorovMisc
{
// Factions
FACTION_ANDOROV_ESCORT = 250,
// Spells
SPELL_AURA_OF_COMMAND = 25516,
SPELL_BASH = 25515,
SPELL_STRIKE = 22591,
// Texts
SAY_ANDOROV_INTRO = 0, // Before for the first wave
SAY_ANDOROV_ATTACK = 1, // Beginning the event
// Gossips
GOSSIP_ANDRNOV = 7047,
// Events
EVENT_BASH = 1,
EVENT_COMMAND_AURA,
EVENT_STRIKE
};
struct npc_general_andorov : public npc_escortAI
{
npc_general_andorov(Creature* creature) : npc_escortAI(creature), _summons(me)
{
instance = creature->GetInstanceScript();
SetDespawnAtEnd(false);
SetDespawnAtFar(false);
}
void sGossipSelect(Player* player, uint32 /*uiSender*/, uint32 uiAction) override
{
if (uiAction)
{
CloseGossipMenuFor(player);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
SetEscortPaused(false);
}
}
void InitializeAI() override
{
me->SetReactState(REACT_PASSIVE);
for (uint8 i = 0; i < 4; ++i)
{
if (Creature* kaldoreielitist = me->SummonCreature(NPC_KALDOREI_ELITE, *me))
{
kaldoreielitist->SetImmuneToNPC(true);
kaldoreielitist->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
kaldoreielitist->SetReactState(REACT_PASSIVE);
kaldoreielitist->SetFaction(FACTION_ESCORT_H_ACTIVE);
CAST_AI(SmartAI, kaldoreielitist->AI())->SetFollow(me, 2.5f, 0.f + i * (M_PI / 2));
}
}
me->SetFaction(FACTION_ANDOROV_ESCORT);
Endwaypoint = false;
_initialAttackTimer = 5 * IN_MILLISECONDS;
_paused = false;
Start(false, true);
me->SetImmuneToNPC(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
void JustSummoned(Creature* summon) override
{
_summons.Summon(summon);
}
void EnterCombat(Unit* /*who*/) override
{
events.ScheduleEvent(EVENT_BASH, urand(8, 11) * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_COMMAND_AURA, urand(1, 3) * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_STRIKE, urand(2, 5) * IN_MILLISECONDS);
}
void WaypointReached(uint32 waypointId) override
{
switch (waypointId)
{
case 10:
me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
SetEscortPaused(true);
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
_paused = true;
break;
case 14:
SetEscortPaused(true);
if (!Endwaypoint)
{
Endwaypoint = true;
Talk(SAY_ANDOROV_INTRO);
me->SetImmuneToNPC(false);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
for (ObjectGuid const& guid : _summons)
{
if (Creature* kaldoreielitist = ObjectAccessor::GetCreature(*me, guid))
{
kaldoreielitist->SetImmuneToNPC(false);
kaldoreielitist->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
kaldoreielitist->SetReactState(REACT_AGGRESSIVE);
}
}
}
break;
}
}
void JustDied(Unit* /*killer*/) override
{
_summons.DespawnAll();
if (Creature* rajaxx = instance->GetCreature(DATA_RAJAXX))
{
rajaxx->AI()->Talk(SAY_KILLS_ANDOROV);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetEntry() == NPC_RAJAXX)
{
Talk(SAY_ANDOROV_ATTACK);
}
}
void MoveInLineOfSight(Unit* who) override
{
// If Rajaxx is in range attack him
if (who->GetEntry() == NPC_RAJAXX && me->IsWithinDistInMap(who, 50.0f))
{
AttackStart(who);
}
ScriptedAI::MoveInLineOfSight(who);
}
uint32 GetData(uint32 type) const override
{
if (type == DATA_ANDOROV)
{
return Endwaypoint;
}
return 0;
}
void UpdateEscortAI(uint32 diff) override
{
if (Endwaypoint && _initialAttackTimer)
{
me->SetFacingTo(2.8772139f);
if (_initialAttackTimer <= diff)
{
_initialAttackTimer = 0;
if (Creature* queez = instance->GetCreature(DATA_QUUEZ))
{
queez->AI()->AttackStart(me);
}
}
else
{
_initialAttackTimer -= diff;
}
}
if (_paused)
{
_paused = false;
me->SetFacingTo(5.63741350f);
}
if (!UpdateVictim())
{
return;
}
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BASH:
DoCastVictim(SPELL_BASH);
events.ScheduleEvent(EVENT_BASH, urand(12, 15) * IN_MILLISECONDS);
break;
case EVENT_COMMAND_AURA:
DoCastSelf(SPELL_AURA_OF_COMMAND, true);
events.ScheduleEvent(EVENT_COMMAND_AURA, urand(10, 20) * IN_MILLISECONDS);
break;
case EVENT_STRIKE:
DoCastVictim(SPELL_STRIKE);
events.ScheduleEvent(EVENT_STRIKE, urand(4, 6) * IN_MILLISECONDS);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
InstanceScript* instance;
EventMap events;
SummonList _summons;
uint32 _initialAttackTimer;
bool Endwaypoint;
bool _paused;
};
void AddSC_boss_rajaxx() void AddSC_boss_rajaxx()
{ {
RegisterRuinsOfAhnQirajCreatureAI(boss_rajaxx); RegisterRuinsOfAhnQirajCreatureAI(boss_rajaxx);
RegisterSpellScript(spell_rajaxx_thundercrash); RegisterSpellScript(spell_rajaxx_thundercrash);
RegisterRuinsOfAhnQirajCreatureAI(npc_general_andorov);
} }
@@ -17,6 +17,7 @@
#include "CreatureGroups.h" #include "CreatureGroups.h"
#include "InstanceScript.h" #include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "TaskScheduler.h" #include "TaskScheduler.h"
#include "ruins_of_ahnqiraj.h" #include "ruins_of_ahnqiraj.h"
@@ -76,6 +77,17 @@ public:
_rajaxWaveCounter = 0; _rajaxWaveCounter = 0;
} }
void OnPlayerEnter(Player* player) override
{
if (GetBossState(DATA_KURINNAXX) == DONE && GetBossState(DATA_RAJAXX) != DONE)
{
if (!_andorovGUID)
{
player->SummonCreature(NPC_ANDOROV, -8538.177f, 1486.0956f, 32.39054f, 3.7638654f, TEMPSUMMON_CORPSE_DESPAWN, 600000000);
}
}
}
void OnCreatureCreate(Creature* creature) override void OnCreatureCreate(Creature* creature) override
{ {
InstanceScript::OnCreatureCreate(creature); InstanceScript::OnCreatureCreate(creature);
@@ -101,6 +113,9 @@ public:
_sandVortexes.push_back(creature->GetGUID()); _sandVortexes.push_back(creature->GetGUID());
creature->SetVisible(false); creature->SetVisible(false);
break; break;
case NPC_ANDOROV:
_andorovGUID = creature->GetGUID();
break;
} }
} }
@@ -167,7 +182,8 @@ public:
case NPC_PAKKON: case NPC_PAKKON:
case NPC_ZERRAN: case NPC_ZERRAN:
_scheduler.CancelAll(); _scheduler.CancelAll();
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) { _scheduler.Schedule(1s, [this, formation](TaskContext /*context*/)
{
if (!formation->IsAnyMemberAlive()) if (!formation->IsAnyMemberAlive())
{ {
CallNextRajaxxLeader(true); CallNextRajaxxLeader(true);
@@ -234,6 +250,8 @@ public:
return _ossirianGUID; return _ossirianGUID;
case DATA_PARALYZED: case DATA_PARALYZED:
return _paralyzedGUID; return _paralyzedGUID;
case DATA_ANDOROV:
return _andorovGUID;
} }
return ObjectGuid::Empty; return ObjectGuid::Empty;
@@ -301,7 +319,15 @@ public:
if (nextLeader->IsAlive()) if (nextLeader->IsAlive())
{ {
nextLeader->SetInCombatWithZone(); Creature* generalAndorov = instance->GetCreature(_andorovGUID);
if (generalAndorov && generalAndorov->IsAlive() && generalAndorov->AI()->GetData(DATA_ANDOROV))
{
nextLeader->AI()->AttackStart(generalAndorov);
}
else
{
nextLeader->SetInCombatWithZone();
}
} }
else else
{ {
@@ -333,6 +359,7 @@ public:
ObjectGuid _buruGUID; ObjectGuid _buruGUID;
ObjectGuid _ossirianGUID; ObjectGuid _ossirianGUID;
ObjectGuid _paralyzedGUID; ObjectGuid _paralyzedGUID;
ObjectGuid _andorovGUID;
GuidVector _sandVortexes; GuidVector _sandVortexes;
uint32 _rajaxWaveCounter; uint32 _rajaxWaveCounter;
TaskScheduler _scheduler; TaskScheduler _scheduler;
@@ -41,6 +41,7 @@ enum DataTypes
DATA_YEGGETH = 12, DATA_YEGGETH = 12,
DATA_PAKKON = 13, DATA_PAKKON = 13,
DATA_ZERRAN = 14, DATA_ZERRAN = 14,
DATA_ANDOROV = 15,
DATA_ENGAGED_FORMATION = 1 DATA_ENGAGED_FORMATION = 1
}; };
@@ -68,7 +69,9 @@ enum Creatures
NPC_XURREM = 15390, NPC_XURREM = 15390,
NPC_YEGGETH = 15386, NPC_YEGGETH = 15386,
NPC_PAKKON = 15388, NPC_PAKKON = 15388,
NPC_ZERRAN = 15385 NPC_ZERRAN = 15385,
NPC_ANDOROV = 15471,
NPC_KALDOREI_ELITE = 15473
}; };
enum GameObjects enum GameObjects