fix(DB/CreatureSAI): Ruul-Snowhoof (#4786)

This commit is contained in:
Stifler82
2021-03-11 17:37:37 +00:00
committed by GitHub
parent a323107724
commit 30b3d74f01
2 changed files with 898 additions and 100 deletions

View File

@@ -11,113 +11,15 @@ SDComment: Quest support: 6544, 6482
SDCategory: Ashenvale Forest
EndScriptData */
/* ContentData
npc_ruul_snowhoof
EndContentData */
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptMgr.h"
/*####
# npc_ruul_snowhoof
####*/
enum RuulSnowhoof
{
NPC_THISTLEFUR_URSA = 3921,
NPC_THISTLEFUR_TOTEMIC = 3922,
NPC_THISTLEFUR_PATHFINDER = 3926,
QUEST_FREEDOM_TO_RUUL = 6482,
FACTION_QUEST = 113,
GO_CAGE = 178147
};
Position const RuulSnowhoofSummonsCoord[6] =
{
{ 3449.218018f, -587.825073f, 174.978867f, 4.714445f },
{ 3446.384521f, -587.830872f, 175.186279f, 4.714445f },
{ 3444.218994f, -587.835327f, 175.380600f, 4.714445f },
{ 3508.344482f, -492.024261f, 186.929031f, 4.145029f },
{ 3506.265625f, -490.531006f, 186.740128f, 4.239277f },
{ 3503.682373f, -489.393799f, 186.629684f, 4.349232f }
};
class npc_ruul_snowhoof : public CreatureScript
{
public:
npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
struct npc_ruul_snowhoofAI : public npc_escortAI
{
npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) { }
void Reset() override
{
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_READY);
}
void EnterCombat(Unit* /*who*/) override { }
void JustSummoned(Creature* summoned) override
{
summoned->AI()->AttackStart(me);
}
void sQuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
{
me->setFaction(FACTION_QUEST);
npc_escortAI::Start(true, false, player->GetGUID());
}
}
void WaypointReached(uint32 waypointId) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 0:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_ACTIVE);
break;
case 13:
me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 19:
me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 21:
player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me);
break;
}
}
void UpdateAI(uint32 diff) override
{
npc_escortAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_ruul_snowhoofAI(creature);
}
};
enum Muglash
{
FACTION_QUEST = 113,
SAY_MUG_START1 = 0,
SAY_MUG_START2 = 1,
SAY_MUG_BRAZIER = 2,
@@ -325,7 +227,6 @@ public:
void AddSC_ashenvale()
{
new npc_ruul_snowhoof();
new npc_muglash();
new go_naga_brazier();
}