void instance_stratholme::SetData(uint32 uiType, uint32 uiData) { // TODO: Remove the hard-coded indexes from array accessing switch (uiType) { case TYPE_BARON_RUN: switch (uiData) { case IN_PROGRESS: if (m_auiEncounter[uiType] == IN_PROGRESS || m_auiEncounter[uiType] == FAIL) break; DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_START, NPC_BARON); m_uiBaronRunTimer = 45 * MINUTE * IN_MILLISECONDS; debug_log("SD2: Instance Stratholme: Baron run in progress."); break; case FAIL: // may add code to remove aura from players, but in theory the time should be up already and removed. break; case DONE: m_uiBaronRunTimer = 0; break; } m_auiEncounter[uiType] = uiData; break; case TYPE_BARONESS: case TYPE_NERUB: case TYPE_PALLID: m_auiEncounter[uiType] = uiData; if (uiData == DONE) { DoSortZiggurats(); DoUseDoorOrButton(m_zigguratStorage[uiType - TYPE_BARONESS].m_doorGuid); } if (uiData == SPECIAL) StartSlaugtherSquare(); break; case TYPE_RAMSTEIN: if (uiData == SPECIAL) { if (m_auiEncounter[uiType] != SPECIAL && m_auiEncounter[uiType] != DONE) { m_uiSlaugtherSquareTimer = 20000; // TODO - unknown, also possible that this is not the very correct place.. DoUseDoorOrButton(GO_PORT_GAUNTLET); } uint32 uiCount = m_sAbomnationGUID.size(); for (GuidSet::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end();) { if (Creature* pAbom = instance->GetCreature(*itr)) { ++itr; if (!pAbom->IsAlive()) --uiCount; } else { // Remove obsolete guid from set and decrement count m_sAbomnationGUID.erase(itr++); --uiCount; } } if (!uiCount) { // Old Comment: a bit itchy, it should close GO_ZIGGURAT_DOOR_4 door after 10 secs, but it doesn't. skipping it for now. // However looks like that this door is no more closed DoUseDoorOrButton(GO_ZIGGURAT_DOOR_4); // No more handlng of Abomnations m_uiSlaugtherSquareTimer = 0; if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) { DoScriptText(SAY_ANNOUNCE_RAMSTEIN, pBaron); if (Creature* pRamstein = pBaron->SummonCreature(NPC_RAMSTEIN, aStratholmeLocation[2].m_fX, aStratholmeLocation[2].m_fY, aStratholmeLocation[2].m_fZ, aStratholmeLocation[2].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0)) pRamstein->GetMotionMaster()->MovePoint(0, aStratholmeLocation[3].m_fX, aStratholmeLocation[3].m_fY, aStratholmeLocation[3].m_fZ); debug_log("SD2: Instance Stratholme - Slaugther event: Ramstein spawned."); } } else debug_log("SD2: Instance Stratholme - Slaugther event: %u Abomnation left to kill.", uiCount); } // After fail aggroing Ramstein means wipe on Ramstein, so close door again if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); if (uiData == DONE) { // Open side gate and start summoning skeletons DoUseDoorOrButton(GO_PORT_SLAUGHTER_GATE); // use this timer as a bool just to start summoning m_uiMindlessSummonTimer = 500; m_uiMindlessCount = 0; m_luiUndeadGUIDs.clear(); // Summon 5 guards if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) { for (uint8 i = 0; i < 5; ++i) { float fX, fY, fZ; pBaron->GetRandomPoint(aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, 5.0f, fX, fY, fZ); if (Creature* pTemp = pBaron->SummonCreature(NPC_BLACK_GUARD, aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, aStratholmeLocation[6].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0)) m_luiGuardGUIDs.push_back(pTemp->GetObjectGuid()); } debug_log("SD2: Instance Stratholme - Slaugther event: Summoned 5 guards."); } } // Open Door again and stop Abomnation if (uiData == FAIL && m_auiEncounter[uiType] != FAIL) { DoUseDoorOrButton(GO_PORT_GAUNTLET); m_uiSlaugtherSquareTimer = 0; // Let already moving Abomnations stop for (GuidSet::const_iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end(); ++itr) { Creature* pAbom = instance->GetCreature(*itr); if (pAbom && pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) pAbom->GetMotionMaster()->MovementExpired(); } } m_auiEncounter[uiType] = uiData; break; case TYPE_BARON: if (uiData == IN_PROGRESS) { // Reached the Baron within time-limit if (m_auiEncounter[TYPE_BARON_RUN] == IN_PROGRESS) SetData(TYPE_BARON_RUN, DONE); // Close Slaughterhouse door if needed if (m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); } if (uiData == DONE) { if (m_auiEncounter[TYPE_BARON_RUN] == DONE) { Map::PlayerList const& players = instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); } } // Open cage and finish rescue event if (Creature* pYsidaT = GetSingleCreatureFromStorage(NPC_YSIDA_TRIGGER)) { if (Creature* pYsida = pYsidaT->SummonCreature(NPC_YSIDA, pYsidaT->GetPositionX(), pYsidaT->GetPositionY(), pYsidaT->GetPositionZ(), pYsidaT->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1800000)) { DoScriptText(SAY_EPILOGUE, pYsida); pYsida->GetMotionMaster()->MovePoint(0, aStratholmeLocation[7].m_fX, aStratholmeLocation[7].m_fY, aStratholmeLocation[7].m_fZ); } DoUseDoorOrButton(GO_YSIDA_CAGE); } } // Open Slaughterhouse door again DoUseDoorOrButton(GO_PORT_GAUNTLET); } if (uiData == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); m_auiEncounter[uiType] = uiData; break; case TYPE_BARTHILAS_RUN: if (uiData == IN_PROGRESS) { Creature* pBarthilas = GetSingleCreatureFromStorage(NPC_BARTHILAS); if (pBarthilas && pBarthilas->IsAlive() && !pBarthilas->IsInCombat()) { DoScriptText(SAY_WARN_BARON, pBarthilas); pBarthilas->SetWalk(false); pBarthilas->GetMotionMaster()->MovePoint(0, aStratholmeLocation[0].m_fX, aStratholmeLocation[0].m_fY, aStratholmeLocation[0].m_fZ); m_uiBarthilasRunTimer = 8000; } } m_auiEncounter[uiType] = uiData; break; case TYPE_BLACK_GUARDS: // Prevent double action if (m_auiEncounter[uiType] == uiData) return; // Restart after failure, close Gauntlet if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); // Wipe case - open gauntlet if (uiData == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); if (uiData == DONE) { if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) DoScriptText(SAY_UNDEAD_DEFEAT, pBaron); DoUseDoorOrButton(GO_ZIGGURAT_DOOR_5); } m_auiEncounter[uiType] = uiData; // No need to save anything here, so return return; case TYPE_POSTMASTER: m_auiEncounter[uiType] = uiData; if (uiData == IN_PROGRESS) { ++m_uiPostboxesUsed; // After the second post box prepare to spawn the Post Master if (m_uiPostboxesUsed == 2) SetData(TYPE_POSTMASTER, SPECIAL); } // No need to save anything here, so return return; case TYPE_TRUE_MASTERS: m_auiEncounter[uiType] = uiData; if (uiData == SPECIAL) { ++m_uiSilverHandKilled; // When the 5th paladin is killed set data to DONE in order to give the quest credit for the last paladin if (m_uiSilverHandKilled == MAX_SILVERHAND) SetData(TYPE_TRUE_MASTERS, DONE); } // No need to save anything here, so return return; } if (uiData == DONE) { OUT_SAVE_INST_DATA; std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6]; m_strInstData = saveStream.str(); SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } }
void instance_stratholme::SetData(uint32 uiType, uint32 uiData) { // TODO: Remove the hard-coded indexes from array accessing switch(uiType) { case TYPE_BARON_RUN: switch(uiData) { case IN_PROGRESS: if (m_auiEncounter[uiType] == IN_PROGRESS || m_auiEncounter[uiType] == FAIL) break; if (Creature* pBaron = instance->GetCreature(m_uiBaronGUID)) DoScriptText(SAY_ANNOUNCE_RUN_START, pBaron); m_uiBaronRunTimer = 45*MINUTE*IN_MILLISECONDS; debug_log("SD2: Instance Stratholme: Baron run in progress."); break; case FAIL: //may add code to remove aura from players, but in theory the time should be up already and removed. break; case DONE: m_uiBaronRunTimer = 0; break; } m_auiEncounter[uiType] = uiData; break; case TYPE_BARONESS: case TYPE_NERUB: case TYPE_PALLID: m_auiEncounter[uiType] = uiData; if (uiData == DONE) { DoSortZiggurats(); DoUseDoorOrButton(m_auiZigguratGUID[uiType - TYPE_BARONESS]); } if (uiData == SPECIAL) StartSlaugtherSquare(); break; case TYPE_RAMSTEIN: if (uiData == SPECIAL) { if (m_auiEncounter[uiType] != SPECIAL && m_auiEncounter[uiType] != DONE) { m_uiSlaugtherSquareTimer = 20000; // TODO - unknown, also possible that this is not the very correct place.. DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = false; } uint32 uiCount = m_sAbomnationGUID.size(); for(std::set<uint64>::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end();) { if (Creature* pAbom = instance->GetCreature(*itr)) { ++itr; if (!pAbom->isAlive()) --uiCount; } else { // Remove obsolete guid from set and decrement count m_sAbomnationGUID.erase(itr++); --uiCount; } } if (!uiCount) { // Old Comment: a bit itchy, it should close m_auiRamsteinDoorGUID door after 10 secs, but it doesn't. skipping it for now. // However looks like that this door is no more closed DoUseDoorOrButton(m_auiRamsteinDoorGUID); // No more handlng of Abomnations m_uiSlaugtherSquareTimer = 0; if (Creature* pBaron = instance->GetCreature(m_uiBaronGUID)) { DoScriptText(SAY_ANNOUNCE_RAMSTEIN, pBaron); if (Creature* pRamstein = pBaron->SummonCreature(NPC_RAMSTEIN, sStratholmeLocation[2].m_fX, sStratholmeLocation[2].m_fY, sStratholmeLocation[2].m_fZ, sStratholmeLocation[2].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0)) pRamstein->GetMotionMaster()->MovePoint(0, sStratholmeLocation[3].m_fX, sStratholmeLocation[3].m_fY, sStratholmeLocation[3].m_fZ); debug_log("SD2: Instance Stratholme - Slaugther event: Ramstein spawned."); } } else debug_log("SD2: Instance Stratholme - Slaugther event: %u Abomnation left to kill.", uiCount); } // After fail aggroing Ramstein means wipe on Ramstein, so close door again if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL) { DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = false; } if (uiData == DONE) { // Open side gate and start summoning skeletons DoUseDoorOrButton(m_uiPortSlaughterGateGUID); // use this timer as a bool just to start summoning m_uiMindlessSummonTimer = 500; m_uiMindlessCount = 0; m_luiUndeadGUIDs.clear(); // Summon 5 guards if (Creature* pBaron = instance->GetCreature(m_uiBaronGUID)) { for(uint8 i = 0; i < 5; ++i) { float fX, fY, fZ; pBaron->GetRandomPoint(sStratholmeLocation[6].m_fX, sStratholmeLocation[6].m_fY, sStratholmeLocation[6].m_fZ, 5.0f, fX, fY, fZ); if (Creature* pTemp = pBaron->SummonCreature(NPC_BLACK_GUARD, sStratholmeLocation[6].m_fX, sStratholmeLocation[6].m_fY, sStratholmeLocation[6].m_fZ, sStratholmeLocation[6].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0)) m_luiGuardGUIDs.push_back(pTemp->GetGUID()); } debug_log("SD2: Instance Stratholme - Slaugther event: Summoned 5 guards."); } } // Open Door again and stop Abomnation if (uiData == FAIL && m_auiEncounter[uiType] != FAIL) { DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = true; m_uiSlaugtherSquareTimer = 0; // Let already moving Abomnations stop for (std::set<uint64>::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end(); ++itr) { Creature* pAbom = instance->GetCreature(*itr); if (pAbom && pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) pAbom->GetMotionMaster()->MovementExpired(); } } m_auiEncounter[uiType] = uiData; break; case TYPE_BARON: if (uiData == IN_PROGRESS) { // Reached the Baron within time-limit if (m_auiEncounter[TYPE_BARON_RUN] == IN_PROGRESS) SetData(TYPE_BARON_RUN, DONE); // Close Slaughterhouse door if needed if (m_bIsSlaughterhouseGateOpened) { DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = false; } } if (uiData == DONE) { if (m_auiEncounter[TYPE_BARON_RUN] == DONE) { Map::PlayerList const& players = instance->GetPlayers(); for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); } } // Open cage and finish rescue event if (Creature* pYsidaT = instance->GetCreature(m_uiYsidaTriggerGUID)) { if (Creature* pYsida = pYsidaT->SummonCreature(NPC_YSIDA, pYsidaT->GetPositionX(), pYsidaT->GetPositionY(), pYsidaT->GetPositionZ(), pYsidaT->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1800000)) { DoScriptText(SAY_EPILOGUE, pYsida); pYsida->GetMotionMaster()->MovePoint(0, sStratholmeLocation[7].m_fX, sStratholmeLocation[7].m_fY, sStratholmeLocation[7].m_fZ); } DoUseDoorOrButton(m_uiYsidaCageGUID); } } // Open Slaughterhouse door again DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = true; } if (uiData == FAIL) { DoUseDoorOrButton(m_uiPortGauntletGUID); m_bIsSlaughterhouseGateOpened = true; } // combat door DoUseDoorOrButton(m_auiRivendareDoorGUID); m_auiEncounter[5] = uiData; // TODO break; case TYPE_BARTHILAS_RUN: if (uiData == IN_PROGRESS) { Creature* pBarthilas = instance->GetCreature(m_uiBarthilasGUID); if (pBarthilas && pBarthilas->isAlive() && !pBarthilas->isInCombat()) { DoScriptText(SAY_WARN_BARON, pBarthilas); pBarthilas->RemoveSplineFlag(SPLINEFLAG_WALKMODE); pBarthilas->GetMotionMaster()->MovePoint(0, sStratholmeLocation[0].m_fX, sStratholmeLocation[0].m_fY, sStratholmeLocation[0].m_fZ); m_uiBarthilasRunTimer = 8000; } } m_auiEncounter[6] = uiData; // TODO break; case TYPE_SH_AELMAR: m_bIsSilverHandDead[0] = (uiData) ? true : false; break; case TYPE_SH_CATHELA: m_bIsSilverHandDead[1] = (uiData) ? true : false; break; case TYPE_SH_GREGOR: m_bIsSilverHandDead[2] = (uiData) ? true : false; break; case TYPE_SH_NEMAS: m_bIsSilverHandDead[3] = (uiData) ? true : false; break; case TYPE_SH_VICAR: m_bIsSilverHandDead[4] = (uiData) ? true : false; break; } if (uiData == DONE) { OUT_SAVE_INST_DATA; std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6]; strInstData = saveStream.str(); SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } }
void instance_stratholme::SetData(uint32 uiType, uint32 uiData) { // TODO: Remove the hard-coded indexes from array accessing switch (uiType) { case TYPE_BARON_RUN: switch (uiData) { case IN_PROGRESS: if (m_auiEncounter[uiType] == IN_PROGRESS || m_auiEncounter[uiType] == FAIL) break; // Baron ultimatum starts: summon Ysida in the cage if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) { DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_START, NPC_BARON); if (Creature* pYsida = pBaron->SummonCreature(NPC_YSIDA, aStratholmeLocation[7].m_fX, aStratholmeLocation[7].m_fY, aStratholmeLocation[7].m_fZ, aStratholmeLocation[7].m_fO, TEMPSPAWN_DEAD_DESPAWN, 0)) pYsida->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); } m_uiBaronRunTimer = 45 * MINUTE * IN_MILLISECONDS; debug_log("SD2: Instance Stratholme: Baron run in progress."); break; case FAIL: // may add code to remove aura from players, but in theory the time should be up already and removed. break; case DONE: m_uiBaronRunTimer = 0; break; } m_auiEncounter[uiType] = uiData; break; case TYPE_BARONESS: case TYPE_NERUB: case TYPE_PALLID: m_auiEncounter[uiType] = uiData; if (uiData == DONE) { DoSortZiggurats(); DoUseDoorOrButton(m_zigguratStorage[uiType - TYPE_BARONESS].m_doorGuid); } if (uiData == SPECIAL) StartSlaugtherSquare(); break; case TYPE_RAMSTEIN: if (uiData == SPECIAL) { if (m_auiEncounter[uiType] != SPECIAL && m_auiEncounter[uiType] != DONE) { m_uiSlaugtherSquareTimer = 20000; // TODO - unknown, also possible that this is not the very correct place.. DoUseDoorOrButton(GO_PORT_GAUNTLET); } uint32 uiCount = m_sAbomnationGUID.size(); for (GuidSet::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end();) { if (Creature* pAbom = instance->GetCreature(*itr)) { ++itr; if (!pAbom->isAlive()) --uiCount; } else { // Remove obsolete guid from set and decrement count m_sAbomnationGUID.erase(itr++); --uiCount; } } if (!uiCount) { // Open the Slaughterhouse door and set a timer to close it after 10 sec to let some time to Ramstein to move out DoOpenSlaughterhouseDoor(true); m_uiSlaughterDoorTimer = 10000; // No more handlng of Abomnations m_uiSlaugtherSquareTimer = 0; if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) { DoScriptText(SAY_ANNOUNCE_RAMSTEIN, pBaron); if (Creature* pRamstein = pBaron->SummonCreature(NPC_RAMSTEIN, aStratholmeLocation[2].m_fX, aStratholmeLocation[2].m_fY, aStratholmeLocation[2].m_fZ, aStratholmeLocation[2].m_fO, TEMPSPAWN_DEAD_DESPAWN, 0)) pRamstein->GetMotionMaster()->MovePoint(0, aStratholmeLocation[5].m_fX, aStratholmeLocation[5].m_fY, aStratholmeLocation[5].m_fZ); debug_log("SD2: Instance Stratholme - Slaugther event: Ramstein spawned."); } } else debug_log("SD2: Instance Stratholme - Slaugther event: %u Abomnation left to kill.", uiCount); } // After fail aggroing Ramstein means wipe on Ramstein, so close door again if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); if (uiData == DONE) { // Open side gate and start summoning skeletons DoUseDoorOrButton(GO_PORT_SLAUGHTER_GATE); // Close the Slaughterhouse door in case it was open again after a wipe on Ramstein DoOpenSlaughterhouseDoor(false); // use this timer as a bool just to start summoning m_uiMindlessSummonTimer = 500; m_uiMindlessCount = 0; m_luiUndeadGUIDs.clear(); // Summon 5 guards if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) { for (uint8 i = 0; i < 5; ++i) { float fX, fY, fZ; pBaron->GetRandomPoint(aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, 5.0f, fX, fY, fZ); if (Creature* pTemp = pBaron->SummonCreature(NPC_BLACK_GUARD, aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, aStratholmeLocation[6].m_fO, TEMPSPAWN_DEAD_DESPAWN, 0)) m_luiGuardGUIDs.push_back(pTemp->GetObjectGuid()); } debug_log("SD2: Instance Stratholme - Slaugther event: Summoned 5 guards."); } } // Open Door again and stop Abomnation if (uiData == FAIL && m_auiEncounter[uiType] != FAIL) { DoUseDoorOrButton(GO_PORT_GAUNTLET); m_uiSlaugtherSquareTimer = 0; // Let already moving Abomnations stop for (auto itr : m_sAbomnationGUID) { Creature* pAbom = instance->GetCreature(itr); if (pAbom && pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) pAbom->GetMotionMaster()->MovementExpired(); } } m_auiEncounter[uiType] = uiData; break; case TYPE_BARON: if (uiData == IN_PROGRESS) { // Close Slaughterhouse door if needed if (m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); // If Aurius was given the medaillon wait 5s before summoning him if (GetData(TYPE_AURIUS) == DONE) m_uiAuriusSummonTimer = 5000; } else if (uiData == DONE) { // Players successfully engaged Baron within the time-limit of his ultimatum // Note: UpdateAI() prevents TYPE_BARON_RUN to be marked as FAILED if the // Baron is already engaged (in progress) when the ultimatum timer expires if (m_auiEncounter[TYPE_BARON_RUN] == IN_PROGRESS) { SetData(TYPE_BARON_RUN, DONE); Map::PlayerList const& players = instance->GetPlayers(); for (const auto& player : players) { if (Player* pPlayer = player.getSource()) { if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) pPlayer->KilledMonsterCredit(NPC_YSIDA); // Argent Dawn reputation reward pPlayer->CastSpell(pPlayer, SPELL_YSIDA_FREED, TRIGGERED_OLD_TRIGGERED); } } // Open cage, finish rescue event if (Creature* pYsida = GetSingleCreatureFromStorage(NPC_YSIDA)) { DoScriptText(SAY_EPILOGUE, pYsida); DoUseDoorOrButton(GO_YSIDA_CAGE); pYsida->GetMotionMaster()->MovePoint(0, aStratholmeLocation[8].m_fX, aStratholmeLocation[8].m_fY, aStratholmeLocation[8].m_fZ); pYsida->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); } } // If Aurius was spawned to help fight the Baron if (GetData(TYPE_AURIUS) == DONE) { // Baron killed and Aurius is alive: give him his NPC Flags back, so players can complete the quest and fake his death if (Creature* pAurius = GetSingleCreatureFromStorage(NPC_AURIUS)) { if (pAurius->isAlive()) { DoScriptText(SAY_AURIUS_DEATH, pAurius); pAurius->StopMoving(); pAurius->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); pAurius->InterruptNonMeleeSpells(true); pAurius->SetHealth(1); pAurius->GetMotionMaster()->MovementExpired(); pAurius->GetMotionMaster()->MoveIdle(); pAurius->RemoveAllAurasOnDeath(); pAurius->SetStandState(UNIT_STAND_STATE_DEAD); } } } // Open Slaughterhouse door again DoUseDoorOrButton(GO_PORT_GAUNTLET); } else if (uiData == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); m_auiEncounter[uiType] = uiData; break; case TYPE_BARTHILAS_RUN: if (uiData == IN_PROGRESS) { Creature* pBarthilas = GetSingleCreatureFromStorage(NPC_BARTHILAS); if (pBarthilas && pBarthilas->isAlive() && !pBarthilas->isInCombat()) { DoScriptText(SAY_WARN_BARON, pBarthilas); pBarthilas->SetWalk(false); pBarthilas->GetMotionMaster()->MovePoint(0, aStratholmeLocation[0].m_fX, aStratholmeLocation[0].m_fY, aStratholmeLocation[0].m_fZ); m_uiBarthilasRunTimer = 8000; } } m_auiEncounter[uiType] = uiData; break; case TYPE_BLACK_GUARDS: // Prevent double action if (m_auiEncounter[uiType] == uiData) return; // Restart after failure, close Gauntlet if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); // Wipe case - open gauntlet if (uiData == FAIL) DoUseDoorOrButton(GO_PORT_GAUNTLET); if (uiData == DONE) { if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON)) DoScriptText(SAY_UNDEAD_DEFEAT, pBaron); DoOpenSlaughterhouseDoor(true); DoUseDoorOrButton(GO_ZIGGURAT_DOOR_5); } m_auiEncounter[uiType] = uiData; // No need to save anything here, so return return; case TYPE_POSTMASTER: m_auiEncounter[uiType] = uiData; if (uiData == IN_PROGRESS) { ++m_uiPostboxesUsed; // After the second post box prepare to spawn the Post Master if (m_uiPostboxesUsed == 2) SetData(TYPE_POSTMASTER, SPECIAL); } // No need to save anything here, so return return; case TYPE_TRUE_MASTERS: m_auiEncounter[uiType] = uiData; if (uiData == SPECIAL) { ++m_uiSilverHandKilled; // When the 5th paladin is killed set data to DONE in order to give the quest credit for the last paladin if (m_uiSilverHandKilled == MAX_SILVERHAND) SetData(TYPE_TRUE_MASTERS, DONE); } // No need to save anything here, so return return; case TYPE_AURIUS: // Prevent further players to complete the quest in that instance or autocomplete the follow-up quest. the flag will be set back if event is succeed if (uiData == DONE) { if (Creature* pAurius = GetSingleCreatureFromStorage(NPC_AURIUS)) pAurius->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } m_auiEncounter[uiType] = uiData; break; } if (uiData == DONE) { OUT_SAVE_INST_DATA; std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7]; m_strInstData = saveStream.str(); SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } }