From bffe8381636deca19f85d2ff8755b2fd95f1ef0c Mon Sep 17 00:00:00 2001 From: Nefertumm Date: Thu, 10 Feb 2022 17:40:20 -0300 Subject: [PATCH] fix(Core/Quest): For The Horde! (#10330) * Fix(Core/Quest): Fix For The Horde! quest * fix build * Change the methods --- .../rev_1642981864918755200.sql | 17 +++++ .../scripts/Kalimdor/zone_orgrimmar.cpp | 74 ++++++++++++++++++- 2 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1642981864918755200.sql diff --git a/data/sql/updates/pending_db_world/rev_1642981864918755200.sql b/data/sql/updates/pending_db_world/rev_1642981864918755200.sql new file mode 100644 index 000000000..104e6bdce --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1642981864918755200.sql @@ -0,0 +1,17 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1642981864918755200'); + +DELETE FROM `creature_text` WHERE `CreatureID` IN (4949, 10719) AND `GroupID` IN (0, 1); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(4949, 0, 0, 'Honor your heroes! On this day, they have dealt a great blow against one of our most hated enemies! The false Warchief, Rend Blackhand, has fallen!', 14, 0, 100, 22, 0, 0, 6013, 2, 'For The Horde! quest completion'), +(4949, 1, 0, 'Be bathed in my power! Drink in my might! Battle for the glory of the Horde!', 14, 0, 100, 22, 0, 0, 6014, 2, 'For The Horde! quest completion'), +(10719, 0, 0, 'Honor your heroes! On this day, they have dealt a great blow against one of our most hated enemies! The false Warchief, Rend Blackhand, has fallen!', 14, 0, 100, 22, 0, 0, 6013, 2, 'For The Horde! quest completion'), +(10719, 1, 0, 'Be bathed in the power of the Warchief! Drink in his might! Battle for the glory of the Horde!', 14, 0, 100, 22, 0, 0, 6015, 2, 'For The Horde! quest completion'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 10719; + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 10719) AND (`source_type` = 0) AND (`id` IN (0, 1, 2, 3)); +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`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(10719, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Herald of Thrall - On Just Summoned - Set Flags Not Attackable'), +(10719, 0, 1, 0, 1, 0, 100, 0, 2000, 2000, 0, 0, 0, 1, 0, 13, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Herald of Thrall - Out of Combat - Say Line 0'), +(10719, 0, 2, 0, 1, 0, 100, 0, 13000, 13000, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Herald of Thrall - Out of Combat - Say Line 1'), +(10719, 0, 3, 0, 1, 0, 100, 0, 15000, 15000, 0, 0, 0, 11, 16609, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Herald of Thrall - Out of Combat - Cast \'Warchief`s Blessing\''); diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index 98da89a9e..b73c5cc54 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "TaskScheduler.h" /*###### ## npc_shenthul @@ -135,12 +136,28 @@ public: enum ThrallWarchief { - QUEST_6566 = 6566, + QUEST_6566 = 6566, - SPELL_CHAIN_LIGHTNING = 16033, - SPELL_SHOCK = 16034 + SPELL_CHAIN_LIGHTNING = 16033, + SPELL_SHOCK = 16034, + + // For The Horde! (ID: 4974) + QUEST_FOR_THE_HORDE = 4974, + SPELL_WARCHIEF_BLESSING = 16609, + NPC_HERALD_OF_THRALL = 10719, + ACTION_START_TALKING = 0, + + SAY_THRALL_ON_QUEST_REWARD_0 = 0, + SAY_THRALL_ON_QUEST_REWARD_1 = 1, + + AREA_ORGRIMMAR = 1637, + AREA_RAZOR_HILL = 362, + AREA_CAMP_TAURAJO = 378, + AREA_CROSSROADS = 380 }; +const Position heraldOfThrallPos = { -462.404f, -2637.68f, 96.0656f, 5.8606f }; + #define GOSSIP_HTW "Please share your wisdom with me, Warchief." #define GOSSIP_STW1 "What discoveries?" #define GOSSIP_STW2 "Usurper?" @@ -204,6 +221,19 @@ public: return true; } + bool OnQuestReward(Player* /*player*/, Creature* creature, Quest const* quest, uint32 /*item*/) override + { + if (quest->GetQuestId() == QUEST_FOR_THE_HORDE) + { + if (creature && creature->AI()) + { + creature->AI()->DoAction(ACTION_START_TALKING); + } + } + + return true; + } + CreatureAI* GetAI(Creature* creature) const override { return new npc_thrall_warchiefAI(creature); @@ -224,8 +254,43 @@ public: void EnterCombat(Unit* /*who*/) override { } + void DoAction(int32 action) override + { + if (action == ACTION_START_TALKING) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->GetMap()->LoadGrid(heraldOfThrallPos.GetPositionX(), heraldOfThrallPos.GetPositionY()); + me->SummonCreature(NPC_HERALD_OF_THRALL, heraldOfThrallPos, TEMPSUMMON_TIMED_DESPAWN, 20 * IN_MILLISECONDS); + _scheduler.Schedule(2s, [this](TaskContext /*context*/) + { + Talk(SAY_THRALL_ON_QUEST_REWARD_0); + }) + .Schedule(13s, [this](TaskContext /*context*/) + { + Talk(SAY_THRALL_ON_QUEST_REWARD_1); + }) + .Schedule(15s, [this](TaskContext /*context*/) + { + DoCastAOE(SPELL_WARCHIEF_BLESSING, true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->GetMap()->DoForAllPlayers([&](Player* p) + { + if (p->IsAlive() && !p->IsGameMaster()) + { + if (p->GetAreaId() == AREA_ORGRIMMAR || p->GetAreaId() == AREA_RAZOR_HILL || p->GetAreaId() == AREA_CROSSROADS || p->GetAreaId() == AREA_CAMP_TAURAJO) + { + p->CastSpell(p, SPELL_WARCHIEF_BLESSING, true); + } + } + }); + }); + } + } + void UpdateAI(uint32 diff) override { + _scheduler.Update(diff); + if (!UpdateVictim()) return; @@ -245,6 +310,9 @@ public: DoMeleeAttackIfReady(); } + + protected: + TaskScheduler _scheduler; }; };