fix(Core/Quest): For The Horde! (#10330)

* Fix(Core/Quest): Fix For The Horde! quest

* fix build

* Change the methods
This commit is contained in:
Nefertumm
2022-02-10 17:40:20 -03:00
committed by GitHub
parent 9d166722c4
commit bffe838163
2 changed files with 88 additions and 3 deletions

View File

@@ -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;
};
};