Skip to content

Commit

Permalink
Updates for quest 4901
Browse files Browse the repository at this point in the history
* Fix NPC Ranshalla waiting for 3 min after each spell cast
* Add missing spell visual for NPC Guardian of Elune
* Implement spell 18954, allowing the escort to auto reset in case
player leaves while Ranshalla is channeling
* Add auto reset of NPC Ranshalla after quest completion
  • Loading branch information
cala committed Jan 2, 2018
1 parent 758ff50 commit a1ea2a0
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/game/AI/ScriptDevAI/scripts/kalimdor/winterspring.cpp
Expand Up @@ -16,7 +16,7 @@

/* ScriptData
SDName: Winterspring
SD%Complete: 90
SD%Complete: 100
SDComment: Quest support: 4901.
SDCategory: Winterspring
EndScriptData */
Expand Down Expand Up @@ -73,6 +73,8 @@ enum
EMOTE_CHANT_SPELL = -1000738,

SPELL_LIGHT_TORCH = 18953, // channeled spell by Ranshalla while waiting for the torches / altar
SPELL_RANSHALLA_DESPAWN = 18954,
SPELL_BIND_WILDKIN = 18994,

NPC_RANSHALLA = 10300,
NPC_PRIESTESS_ELUNE = 12116,
Expand Down Expand Up @@ -153,6 +155,7 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
}

uint32 m_uiDelayTimer;
uint32 m_uiCurrentWaypoint;

ObjectGuid m_firstPriestessGuid;
ObjectGuid m_secondPriestessGuid;
Expand All @@ -163,6 +166,7 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
void Reset() override
{
m_uiDelayTimer = 0;
m_uiCurrentWaypoint = 0;
}

// Called when the player activates the torch / altar
Expand All @@ -182,6 +186,16 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
m_uiDelayTimer = 2000;
}

void SpellHit(Unit* pCaster, const SpellEntry* pSpell) override
{
// If Ranshalla cast the torch lightening spell for too long she will trigger SPELL_RANSHALLA_DESPAWN (quest failed and despawn)
if (pSpell->Id == SPELL_RANSHALLA_DESPAWN)
{
FailQuestForPlayerAndGroup();
m_creature->ForcedDespawn();
}
}

// Called when Ranshalla starts to channel on a torch / altar
void DoChannelTorchSpell(bool bIsAltarWaypoint = false)
{
Expand Down Expand Up @@ -251,9 +265,11 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
case 20: // Cavern 3
case 25: // Cavern 4
case 36: // Cavern 5
m_uiCurrentWaypoint = uiPointId;
DoChannelTorchSpell();
break;
case 39:
m_uiCurrentWaypoint = uiPointId;
StartNextDialogueText(SAY_REACH_ALTAR_1);
SetEscortPaused(true);
break;
Expand Down Expand Up @@ -346,6 +362,9 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
DoScriptText(SAY_PRIESTESS_ALTAR_14, pPriestess);
pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[7].m_fX, aWingThicketLocations[7].m_fY, aWingThicketLocations[7].m_fZ);
}
// make the voice of elune cast Bind Wildkin
if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardEluneGuid))
pGuard->CastSpell(pGuard, SPELL_BIND_WILDKIN, TRIGGERED_NONE);
break;
case SAY_PRIESTESS_ALTAR_19:
// make the voice of elune leave
Expand Down Expand Up @@ -386,6 +405,7 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
if (Player* pPlayer = GetPlayerForEscort())
pPlayer->GroupEventHappens(QUEST_GUARDIANS_ALTAR, m_creature);
m_creature->ForcedDespawn(1 * MINUTE * IN_MILLISECONDS);
break;
}
}
Expand Down Expand Up @@ -414,6 +434,9 @@ struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
{
m_creature->InterruptNonMeleeSpells(false);
SetEscortPaused(false);
// Spell Ranshalla Waiting applies a root aura that triggers an internal timer in the waypoint movement manager
// We need to manually set the movement manager to the next waypoint in order to reset the timer unless the NPC will wait 3 min before moving again
m_creature->GetMotionMaster()->SetNextWaypoint(m_uiCurrentWaypoint + 1);
m_uiDelayTimer = 0;
}
else
Expand Down

3 comments on commit a1ea2a0

@Grz3s
Copy link
Member

@Grz3s Grz3s commented on a1ea2a0 Jan 2, 2018

Choose a reason for hiding this comment

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

👍

@xfurry
Copy link
Member

@xfurry xfurry commented on a1ea2a0 Jan 2, 2018

Choose a reason for hiding this comment

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

Ok, but why do we need this workaround? Why doesn't the escort movement work like before?

@cala
Copy link
Contributor Author

@cala cala commented on a1ea2a0 Jan 3, 2018

Choose a reason for hiding this comment

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

Unfortunately I don't know, but this issue has been there for at least one or two years (it was already there last time I made changes on this quest).

Either this is a bug that needs to be fixed or a design change that was not documented nor advertised enough, but I can't tell.

Please sign in to comment.