void WaypointReached(uint32 uiPointId) override { switch (uiPointId) { case 0: if (!m_pScriptedMap) break; // Prepare Jonathan for the first event if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) { // Summon 3 guards on each side and move Jonathan in the middle for (uint8 i = 0; i < MAX_ROYAL_GUARDS; ++i) { if (Creature* pTemp = m_creature->SummonCreature(NPC_GUARD_ROYAL, aGuardLocations[i][0], aGuardLocations[i][1], aGuardLocations[i][2], aGuardLocations[i][3], TEMPSUMMON_TIMED_DESPAWN, 180000)) m_guardsGuid[i] = pTemp->GetObjectGuid(); } pJonathan->SetWalk(false); pJonathan->Unmount(); pJonathan->GetMotionMaster()->MovePoint(0, aMoveLocations[0][0], aMoveLocations[0][1], aMoveLocations[0][2]); } break; case 1: StartNextDialogueText(SAY_JON_DIALOGUE_1); SetEscortPaused(true); break; case 3: m_bCanGuardSalute = true; break; case 11: if (!m_pScriptedMap) break; // We can reset Jonathan now if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) { pJonathan->SetWalk(true); pJonathan->SetStandState(UNIT_STAND_STATE_STAND); pJonathan->GetMotionMaster()->MoveTargetedHome(); } break; case 22: SetEscortPaused(true); m_creature->SetFacingTo(5.41f); StartNextDialogueText(NPC_GUARD_ROYAL); break; case 24: m_bCanGuardSalute = false; break; case 25: StartNextDialogueText(NPC_WRYNN); SetEscortPaused(true); m_bCanGuardSalute = false; break; } }
bool AreaTrigger_at_murkdeep(Player* pPlayer, AreaTriggerEntry const* /*pAt*/) { // Handle Murkdeep event start // The area trigger summons 3 Greymist Coastrunners; The rest of the event is handled by world map scripts if (pPlayer->isAlive() && !pPlayer->isGameMaster() && pPlayer->GetQuestStatus(QUEST_WANTED_MURKDEEP) == QUEST_STATUS_INCOMPLETE) { ScriptedMap* pScriptedMap = (ScriptedMap*)pPlayer->GetInstanceData(); if (!pScriptedMap) return false; // If Murkdeep is already spawned, skip the rest if (pScriptedMap->GetSingleCreatureFromStorage(NPC_MURKDEEP, true)) return true; // Check if there are already coastrunners (dead or alive) around the area if (GetClosestCreatureWithEntry(pPlayer, NPC_GREYMIST_COASTRUNNNER, 60.0f, false, false)) return true; float fX, fY, fZ; for (uint8 i = 0; i < 3; ++i) { // Spawn locations are defined in World Maps Scripts.h pPlayer->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][0], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][1], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][2], 5.0f, fX, fY, fZ); if (Creature* pTemp = pPlayer->SummonCreature(NPC_GREYMIST_COASTRUNNNER, fX, fY, fZ, aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][3], TEMPSUMMON_DEAD_DESPAWN, 0)) { pTemp->SetWalk(false); pTemp->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_MOVE][0], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][1], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][2], 5.0f, fX, fY, fZ); pTemp->GetMotionMaster()->MovePoint(0, fX, fY, fZ); } } } return false; }
void JustDidDialogueStep(int32 iEntry) override { if (!m_pScriptedMap) return; switch (iEntry) { // Set orientation and prepare the npcs for the next event case SAY_WINDSOR_GET_READY: m_creature->SetFacingTo(0.6f); break; case SAY_PRESTOR_SIEZE: if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) Start(false, pPlayer); break; case SAY_JON_DIALOGUE_8: // Turn left and move the guards if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) pJonathan->SetFacingTo(5.375f); if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[5])) { pGuard->SetFacingTo(2.234f); pGuard->SetStandState(UNIT_STAND_STATE_KNEEL); } if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[4])) pGuard->GetMotionMaster()->MovePoint(1, aMoveLocations[1][0], aMoveLocations[1][1], aMoveLocations[1][2]); if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[3])) pGuard->GetMotionMaster()->MovePoint(2, aMoveLocations[2][0], aMoveLocations[2][1], aMoveLocations[2][2]); break; case SAY_JON_DIALOGUE_9: // Turn right and move the guards if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) pJonathan->SetFacingTo(2.234f); if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[2])) { pGuard->SetFacingTo(5.375f); pGuard->SetStandState(UNIT_STAND_STATE_KNEEL); } if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[1])) pGuard->GetMotionMaster()->MovePoint(3, aMoveLocations[3][0], aMoveLocations[3][1], aMoveLocations[3][2]); if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardsGuid[0])) pGuard->GetMotionMaster()->MovePoint(4, aMoveLocations[4][0], aMoveLocations[4][1], aMoveLocations[4][2]); break; case SAY_JON_DIALOGUE_10: if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) pJonathan->SetFacingToObject(m_creature); break; case EMOTE_ONESHOT_SALUTE: if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) pJonathan->HandleEmote(EMOTE_ONESHOT_SALUTE); break; case NPC_JONATHAN: if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) { pJonathan->SetWalk(true); pJonathan->GetMotionMaster()->MovePoint(0, aMoveLocations[5][0], aMoveLocations[5][1], aMoveLocations[5][2]); } break; case EMOTE_ONESHOT_KNEEL: if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) { pJonathan->SetFacingToObject(m_creature); pJonathan->SetStandState(UNIT_STAND_STATE_KNEEL); } break; case SAY_WINDSOR_DIALOGUE_12: if (Creature* pJonathan = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_JONATHAN)) m_creature->SetFacingToObject(pJonathan); break; case SAY_WINDSOR_DIALOGUE_13: m_creature->SetFacingTo(0.6f); break; case EMOTE_ONESHOT_POINT: m_creature->HandleEmote(EMOTE_ONESHOT_POINT); break; case NPC_WINDSOR: SetEscortPaused(false); break; case SAY_WINDSOR_BEFORE_KEEP: m_bIsKeepReady = true; m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; case NPC_GUARD_CITY: SetEscortPaused(false); break; case NPC_WRYNN: // Remove npc flags during the event if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) pOnyxia->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); if (Creature* pWrynn = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_WRYNN)) pWrynn->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) pBolvar->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); break; case SAY_BOLVAR_KEEP_2: if (Creature* pWrynn = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_WRYNN)) { pWrynn->SetWalk(false); pWrynn->ForcedDespawn(15000); pWrynn->GetMotionMaster()->MovePoint(0, aMoveLocations[6][0], aMoveLocations[6][1], aMoveLocations[6][2]); // Store all the nearby guards, in order to transform them into Onyxia guards std::list<Creature*> lGuardsList; GetCreatureListWithEntryInGrid(lGuardsList, pWrynn, NPC_GUARD_ROYAL, 25.0f); for (std::list<Creature*>::const_iterator itr = lGuardsList.begin(); itr != lGuardsList.end(); ++itr) m_lRoyalGuardsGuidList.push_back((*itr)->GetObjectGuid()); } break; case SPELL_WINDSOR_READ: DoCastSpellIfCan(m_creature, SPELL_WINDSOR_READ); break; case EMOTE_BOLVAR_GASP: if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) { pOnyxia->UpdateEntry(NPC_LADY_ONYXIA); if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) pBolvar->SetFacingToObject(pOnyxia); } break; case SAY_PRESTOR_KEEP_9: if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) { pBolvar->SetWalk(false); pBolvar->GetMotionMaster()->MovePoint(0, aMoveLocations[7][0], aMoveLocations[7][1], aMoveLocations[7][2]); } break; case SAY_BOLVAR_KEEP_10: if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) { if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) { pBolvar->SetFacingToObject(pOnyxia); DoScriptText(EMOTE_PRESTOR_LAUGH, pOnyxia); } } break; case SAY_PRESTOR_KEEP_11: for (GuidList::const_iterator itr = m_lRoyalGuardsGuidList.begin(); itr != m_lRoyalGuardsGuidList.end(); ++itr) { if (Creature* pGuard = m_creature->GetMap()->GetCreature(*itr)) { if (!pGuard->isAlive()) continue; pGuard->UpdateEntry(NPC_GUARD_ONYXIA); DoScriptText(EMOTE_GUARD_TRANSFORM, pGuard); if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) pGuard->AI()->AttackStart(pBolvar); } } m_uiGuardCheckTimer = 1000; break; case SPELL_WINDSOR_DEATH: if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) pOnyxia->CastSpell(m_creature, SPELL_WINDSOR_DEATH, false); break; case SAY_WINDSOR_KEEP_12: if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) DoScriptText(SAY_PRESTOR_KEEP_13, pOnyxia); // Fake death m_creature->InterruptNonMeleeSpells(true); m_creature->SetHealth(0); m_creature->StopMoving(); m_creature->ClearComboPointHolders(); m_creature->RemoveAllAurasOnDeath(); m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->ClearAllReactives(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); break; case SAY_PRESTOR_KEEP_14: if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) { pOnyxia->ForcedDespawn(1000); pOnyxia->HandleEmote(EMOTE_ONESHOT_LIFTOFF); pOnyxia->CastSpell(pOnyxia, SPELL_ONYXIA_DESPAWN, false); } break; case NPC_GUARD_ONYXIA: if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) pBolvar->GetMotionMaster()->MovePoint(0, aMoveLocations[7][0], aMoveLocations[7][1], aMoveLocations[7][2]); break; case NPC_BOLVAR: if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) { pBolvar->SetWalk(true); pBolvar->GetMotionMaster()->MovePoint(0, aMoveLocations[8][0], aMoveLocations[8][1], aMoveLocations[8][2]); } break; case SAY_BOLVAR_KEEP_15: if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) pBolvar->SetStandState(UNIT_STAND_STATE_KNEEL); DoScriptText(SAY_WINDSOR_KEEP_16, m_creature); DoScriptText(EMOTE_WINDSOR_DIE, m_creature); if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) pPlayer->GroupEventHappens(QUEST_THE_GREAT_MASQUERADE, m_creature); break; case NPC_GUARD_PATROLLER: // Reset Bolvar and Wrynn if (Creature* pBolvar = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_BOLVAR)) { pBolvar->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); pBolvar->SetStandState(UNIT_STAND_STATE_STAND); pBolvar->GetMotionMaster()->MoveTargetedHome(); } if (Creature* pWrynn = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_WRYNN)) { pWrynn->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); pWrynn->Respawn(); pWrynn->SetWalk(true); pWrynn->GetMotionMaster()->MoveTargetedHome(); } // Onyxia will respawn by herself in about 30 min, so just reset flags if (Creature* pOnyxia = m_pScriptedMap->GetSingleCreatureFromStorage(NPC_PRESTOR)) pOnyxia->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); // Allow creature to despawn SetEscortPaused(false); break; } }