Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 38 additions & 14 deletions src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class npc_stormwind_infantry : public CreatureScript

#define SPELL_HEAL 93072
#define SPELL_HEAL_VISUAL 93097
#define PAXTON_PRAYER_BOOK 65733

class npc_stormwind_injured_soldier : public CreatureScript
{
Expand All @@ -160,7 +161,7 @@ class npc_stormwind_injured_soldier : public CreatureScript
{
_clicker = nullptr;

me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
me->SetStandState(UNIT_STAND_STATE_DEAD);
}

Expand All @@ -170,22 +171,45 @@ class npc_stormwind_injured_soldier : public CreatureScript
return;

_clicker = Clicker;
me->CastSpell(me, SPELL_HEAL_VISUAL, true);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
me->SetStandState(UNIT_STAND_STATE_STAND);

me->GetScheduler().Schedule(Milliseconds(1000), [this](TaskContext /*task*/)
Player* player = _clicker->ToPlayer();
if (player->HasItemCount(PAXTON_PRAYER_BOOK, 1, false))
{
if (_clicker)
me->SetFacingToObject(_clicker);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
me->CastSpell(me, SPELL_HEAL_VISUAL, true);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
me->SetStandState(UNIT_STAND_STATE_STAND);

me->GetScheduler().Schedule(Milliseconds(1000), [this](TaskContext /*task*/)
{
if (_clicker)
me->SetFacingToObject(_clicker);

me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
});
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
});

me->GetScheduler().Schedule(Milliseconds(3000), [this](TaskContext /*task*/)
{
Start(false, true);
});
me->GetScheduler().Schedule(Milliseconds(3000), [this](TaskContext /*task*/)
{
Start(false, true);
});
}
}

void MoveInLineOfSight(Unit* who) override
{
npc_escortAI::MoveInLineOfSight(who);

if (!who || !who->IsPlayer())
return;

Player* player = who->ToPlayer();

if (!player)
return;

if (player->HasItemCount(PAXTON_PRAYER_BOOK, 1, false))
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
else
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
}

void WaypointReached(uint32 waypointId) override
Expand Down
Loading