From c65d4bbe56a0860569f1ba57488a188eea971915 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sun, 21 Aug 2022 06:34:34 +0200 Subject: [PATCH] fix(Scripts/AhnQiraj): Implemented General Andorov event. (#12645) --- .../rev_1659801375917048100.sql | 47 ++++ .../RuinsOfAhnQiraj/boss_kurinnaxx.cpp | 7 + .../Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp | 243 +++++++++++++++++- .../instance_ruins_of_ahnqiraj.cpp | 31 ++- .../RuinsOfAhnQiraj/ruins_of_ahnqiraj.h | 5 +- 5 files changed, 326 insertions(+), 7 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1659801375917048100.sql diff --git a/data/sql/updates/pending_db_world/rev_1659801375917048100.sql b/data/sql/updates/pending_db_world/rev_1659801375917048100.sql new file mode 100644 index 000000000..db5775296 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1659801375917048100.sql @@ -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'"); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index b0cf0c878..ddd1628b8 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -77,8 +77,15 @@ struct boss_kurinnaxx : public BossAI void JustDied(Unit* killer) override { if (killer) + { 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)) { ossirian->setActive(true); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index 6b543c55b..4fbe00e82 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -15,21 +15,22 @@ * with this program. If not, see . */ +#include "SmartAI.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "SpellScript.h" #include "ruins_of_ahnqiraj.h" enum Yells { - SAY_UNK1 = 6, - SAY_UNK2 = 7, - SAY_UNK3 = 8, + // The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! Sound: 8645 Emote: 35 SAY_DEATH = 9, SAY_CHANGEAGGRO = 10, SAY_KILLS_ANDOROV = 11, 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 @@ -60,6 +61,12 @@ struct boss_rajaxx : public BossAI { Talk(SAY_DEATH); _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 @@ -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() { RegisterRuinsOfAhnQirajCreatureAI(boss_rajaxx); RegisterSpellScript(spell_rajaxx_thundercrash); + RegisterRuinsOfAhnQirajCreatureAI(npc_general_andorov); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index c5ac1d205..9299a6123 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -17,6 +17,7 @@ #include "CreatureGroups.h" #include "InstanceScript.h" +#include "Player.h" #include "ScriptMgr.h" #include "TaskScheduler.h" #include "ruins_of_ahnqiraj.h" @@ -76,6 +77,17 @@ public: _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 { InstanceScript::OnCreatureCreate(creature); @@ -101,6 +113,9 @@ public: _sandVortexes.push_back(creature->GetGUID()); creature->SetVisible(false); break; + case NPC_ANDOROV: + _andorovGUID = creature->GetGUID(); + break; } } @@ -167,7 +182,8 @@ public: case NPC_PAKKON: case NPC_ZERRAN: _scheduler.CancelAll(); - _scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) { + _scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) + { if (!formation->IsAnyMemberAlive()) { CallNextRajaxxLeader(true); @@ -234,6 +250,8 @@ public: return _ossirianGUID; case DATA_PARALYZED: return _paralyzedGUID; + case DATA_ANDOROV: + return _andorovGUID; } return ObjectGuid::Empty; @@ -301,7 +319,15 @@ public: 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 { @@ -333,6 +359,7 @@ public: ObjectGuid _buruGUID; ObjectGuid _ossirianGUID; ObjectGuid _paralyzedGUID; + ObjectGuid _andorovGUID; GuidVector _sandVortexes; uint32 _rajaxWaveCounter; TaskScheduler _scheduler; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h index 418c9edbe..3c4746388 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h @@ -41,6 +41,7 @@ enum DataTypes DATA_YEGGETH = 12, DATA_PAKKON = 13, DATA_ZERRAN = 14, + DATA_ANDOROV = 15, DATA_ENGAGED_FORMATION = 1 }; @@ -68,7 +69,9 @@ enum Creatures NPC_XURREM = 15390, NPC_YEGGETH = 15386, NPC_PAKKON = 15388, - NPC_ZERRAN = 15385 + NPC_ZERRAN = 15385, + NPC_ANDOROV = 15471, + NPC_KALDOREI_ELITE = 15473 }; enum GameObjects