diff --git a/data/sql/updates/pending_db_world/rev_1662287136008855900.sql b/data/sql/updates/pending_db_world/rev_1662287136008855900.sql new file mode 100644 index 000000000..64572c26b --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1662287136008855900.sql @@ -0,0 +1,15 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid` = 15252 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 +(15252,0,0,0,11,0,100,256,0,0,0,0,211,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - On Respawn - Set not phase reset"), +(15252,0,1,0,0,0,100,0,500,500,6000,15000,11,40504,0,0,0,0,0,2,0,0,0,0,0,0,0,"Qiraji Champion - In Combat - Cast 'Cleave'"), +(15252,0,2,0,0,0,100,0,20000,40000,20000,40000,11,19134,0,0,0,0,0,2,0,0,0,0,0,0,0,"Qiraji Champion - In Combat - Cast 'Frightening Shout'"), +(15252,0,3,0,0,0,100,0,7500,12500,10000,20000,11,11130,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - In Combat - Cast 'Knock Away'"), +(15252,0,4,5,38,0,100,0,0,1,0,0,11,25164,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - On Data Set 0 1 - Cast 'Vengeance'"), +(15252,0,5,6,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - On Link - Say Line 0"), +(15252,0,6,0,61,0,100,256,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - On Link - Set Phase 1"), +(15252,0,7,0,0,1,100,0,60000,60000,60000,60000,11,25164,0,0,0,0,0,1,0,0,0,0,0,0,0,"Qiraji Champion - IC - Cast 'Vengeance' (Phase 1)"); + +DELETE FROM `creature_text` WHERE `CreatureID`=15252; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(15252,0,0,'%s becomes enraged!',16,0,100,0,0,0,24144,0,'Qiraji Champion'); diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index a181c571a..f7fa675de 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -406,13 +406,16 @@ bool CreatureGroup::IsFormationInCombat() return false; } -bool CreatureGroup::IsAnyMemberAlive() +bool CreatureGroup::IsAnyMemberAlive(bool ignoreLeader /*= false*/) { for (auto const& itr : m_members) { if (itr.first && itr.first->IsAlive()) { - return true; + if (!ignoreLeader || itr.first != m_leader) + { + return true; + } } } diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index 9fe3398f5..c3a9fc13a 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -111,7 +111,7 @@ public: void MemberEvaded(Creature* member); void RespawnFormation(bool force = false); [[nodiscard]] bool IsFormationInCombat(); - [[nodiscard]] bool IsAnyMemberAlive(); + [[nodiscard]] bool IsAnyMemberAlive(bool ignoreLeader = false); private: Creature* m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 350c489d5..2d9bc3cc1 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -15,9 +15,11 @@ * with this program. If not, see . */ +#include "CreatureGroups.h" #include "InstanceScript.h" #include "Player.h" #include "ScriptMgr.h" +#include "TaskScheduler.h" #include "temple_of_ahnqiraj.h" ObjectData const creatureData[] = @@ -69,6 +71,8 @@ public: uint32 BugTrioDeathCount; uint32 CthunPhase; + TaskScheduler scheduler; + void Initialize() override { BugTrioDeathCount = 0; @@ -140,6 +144,37 @@ public: InstanceScript::OnGameObjectCreate(go); } + void OnUnitDeath(Unit* unit) override + { + switch (unit->GetEntry()) + { + case NPC_QIRAJI_SLAYER: + case NPC_QIRAJI_MINDSLAYER: + if (Creature* creature = unit->ToCreature()) + { + if (CreatureGroup* formation = creature->GetFormation()) + { + scheduler.Schedule(100ms, [formation](TaskContext /*context*/) + { + if (!formation->IsAnyMemberAlive(true)) + { + if (Creature* leader = formation->GetLeader()) + { + if (leader->IsAlive()) + { + leader->AI()->SetData(0, 1); + } + } + } + }); + } + } + break; + default: + break; + } + } + uint32 GetData(uint32 type) const override { switch (type) @@ -217,6 +252,11 @@ public: return true; } + + void Update(uint32 diff) override + { + scheduler.Update(diff); + } }; }; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h index 6d0ae143a..2527a960b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h @@ -75,7 +75,10 @@ enum Creatures NPC_VEKNILASH = 15275, NPC_OURO = 15517, NPC_OURO_SPAWNER = 15957, - NPC_SARTURA = 15516 + NPC_SARTURA = 15516, + + NPC_QIRAJI_SLAYER = 15250, + NPC_QIRAJI_MINDSLAYER = 15246 }; enum ObjectsAQ40