Skip to content

Commit

Permalink
Add 'Spy Hunter' Hodir Daily Script (#408)
Browse files Browse the repository at this point in the history
* Add 'Spy Hunter' Hodir Daily Script

* Frostwolf: Delay Timers in Combat

* Frostworg: Delay Timers but attack

* Frostworg: Remove hackfix

* Frostwolf: Enable "Emergency" despawn

* Frostworg: Consolidate Timer-removals

* Update Frostworg for OOC timers

* Frostworg: Fix bracket
  • Loading branch information
insunaa authored Dec 23, 2022
1 parent 03856cc commit bb212f3
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/northrend/storm_peaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,131 @@ struct CastNetStormforgedPursuer : public SpellScript
}
};

/*######
## npc_ethereal_frostworg
######*/

enum
{ // misc
SPELL_SUMMON_INFILTRATOR = 56325,
NPC_STORMFORGED_INFILTRATOR = 30222,

FROSTWOLF_MOVE_NORMAL = 1,
FROSTWOLF_MOVE_FINAL = 2,

};

enum FrostwolfActions
{
FROSTWOLF_CHANGE_DIRECTION,
FROSTWOLF_RESUME_SEARCH,
FROSTWOLF_FIND_INFILTRATOR,
FROSTWOLF_SUMMON_INFILTRATOR,
};

static const uint32 ethereal_frostworg_emotes[4][2] =
{
{30909, 30910},
{30911, 30912},
{30913, 30914},
{30915, 30915}
};

struct npc_ethereal_frostworgAI : public ScriptedAI
{
npc_ethereal_frostworgAI(Creature* creature) : ScriptedAI(creature)
{
AddCustomAction(FROSTWOLF_FIND_INFILTRATOR, 45s, [&]()
{
DisableTimer(FROSTWOLF_CHANGE_DIRECTION);
DisableTimer(FROSTWOLF_RESUME_SEARCH);
MoveToNewPoint(FROSTWOLF_MOVE_FINAL);
}, TIMER_COMBAT_OOC);
AddCustomAction(FROSTWOLF_CHANGE_DIRECTION, 15s, [&]()
{
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
ResetTimer(FROSTWOLF_RESUME_SEARCH, 3s);
ResetTimer(FROSTWOLF_CHANGE_DIRECTION, 15s);
}, TIMER_COMBAT_OOC);
AddCustomAction(FROSTWOLF_RESUME_SEARCH, 0s, [&]()
{
switch (m_emoteCounter)
{
case 0:
case 1:
case 2:
{
if (!m_creature->IsInCombat())
DoBroadcastText(ethereal_frostworg_emotes[m_emoteCounter][urand(0,1)], m_creature);
break;
}
case 3: break;
default: m_creature->ForcedDespawn(); break;
}
++m_emoteCounter;

MoveToNewPoint(FROSTWOLF_MOVE_NORMAL);
}, TIMER_COMBAT_OOC);
}

uint32 m_emoteCounter = 0;
bool m_summoned = false;

void MoveToNewPoint(uint32 type)
{
float dist = type == 1 ? 50.f : 20.f;
float x, y, z = 0.f;
while (abs(z - m_creature->GetPositionZ()) > 5)
m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), dist, x, y, z, 10.f);
m_creature->GetMotionMaster()->MovePoint(type, Position(x, y, z), FORCED_MOVEMENT_RUN);
}

void Reset() override
{
MoveToNewPoint(FROSTWOLF_MOVE_NORMAL);
}

void SummonedCreatureJustDied(Creature* summoned) override
{
if (summoned->GetEntry() == NPC_STORMFORGED_INFILTRATOR)
m_creature->ForcedDespawn();
}

void JustSummoned(Creature* summoned) override
{
switch (urand(0,2))
{
case 0: DoBroadcastText(30916, summoned); break;
case 1: DoBroadcastText(30917, summoned); break;
case 2: DoBroadcastText(30918, summoned); break;
}
}

void MovementInform(uint32 movementType, uint32 uiPointId) override
{
switch (uiPointId)
{
case FROSTWOLF_MOVE_NORMAL:
{
MoveToNewPoint(FROSTWOLF_MOVE_NORMAL);
break;
}
case FROSTWOLF_MOVE_FINAL:
{
if (m_summoned)
return;
m_summoned = true;
m_creature->GetMotionMaster()->Clear(true, true);
AddCustomAction(FROSTWOLF_SUMMON_INFILTRATOR, 2s, [&]() { DoCastSpellIfCan(nullptr, SPELL_SUMMON_INFILTRATOR); });
DoBroadcastText(ethereal_frostworg_emotes[3][0], m_creature);
break;
}
default: break;
}
}
};

void AddSC_storm_peaks()
{
Script* pNewScript = new Script;
Expand All @@ -256,5 +381,10 @@ void AddSC_storm_peaks()
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_injured_miner;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_ethereal_frostworg";
pNewScript->GetAI = &GetNewAIInstance<npc_ethereal_frostworgAI>;
pNewScript->RegisterSelf();

RegisterSpellScript<CastNetStormforgedPursuer>("spell_cast_net_stormforged_pursuer");
}

1 comment on commit bb212f3

@NeatElves
Copy link

@NeatElves NeatElves commented on bb212f3 Dec 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lost SQL additions.

UPDATE creature_template SET ScriptName="npc_ethereal_frostworg" WHERE entry=30219;

Please sign in to comment.