void UpdateAI(const uint32 diff) { if (!pInstance) return; if (MobDeath_Timer) { if (MobDeath_Timer <= diff) { MobDeath_Timer = 2500; if (RingBossGUID) { Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID); if (boss && !boss->isAlive() && boss->isDead()) { RingBossGUID = 0; Event_Timer = 5000; MobDeath_Timer = 0; return; } return; } for(uint8 i = 0; i < MOB_AMOUNT; i++) { Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]); if (mob && !mob->isAlive() && mob->isDead()) { RingMobGUID[i] = 0; --MobCount; //seems all are gone, so set timer to continue and discontinue this if (!MobCount) { Event_Timer = 5000; MobDeath_Timer = 0; } } } }else MobDeath_Timer -= diff; } if (Event_Timer) { if (Event_Timer <= diff) { switch(EventPhase) { case 0: DoScriptText(-1000000, m_creature);//1 HandleGameObject(DATA_ARENA4, false); Start(false, false, false); CanWalk = true; Event_Timer = 0; break; case 1: CanWalk = true; Event_Timer = 0; break; case 2: Event_Timer = 2000; break; case 3: HandleGameObject(DATA_ARENA1, true); Event_Timer = 3000; break; case 4: CanWalk = true; m_creature->SetVisibility(VISIBILITY_OFF); SummonRingMob(); Event_Timer = 8000; break; case 5: SummonRingMob(); SummonRingMob(); Event_Timer = 8000; break; case 6: SummonRingMob(); Event_Timer = 0; break; case 7: m_creature->SetVisibility(VISIBILITY_ON); HandleGameObject(DATA_ARENA1, false); DoScriptText(-1000000, m_creature);//4 CanWalk = true; Event_Timer = 0; break; case 8: HandleGameObject(DATA_ARENA2, true); Event_Timer = 5000; break; case 9: m_creature->SetVisibility(VISIBILITY_OFF); SummonRingBoss(); Event_Timer = 0; break; case 10: //if quest, complete HandleGameObject(DATA_ARENA2, false); HandleGameObject(DATA_ARENA3, true); HandleGameObject(DATA_ARENA4, true); CanWalk = true; Event_Timer = 0; break; } ++EventPhase; }else Event_Timer -= diff; } if (CanWalk) npc_escortAI::UpdateAI(diff); }
void UpdateAI(uint32 diff) override { if (MobDeath_Timer) { if (MobDeath_Timer <= diff) { MobDeath_Timer = 2500; if (RingBossGUID) { Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID); if (boss && !boss->IsAlive() && boss->isDead()) { RingBossGUID.Clear(); Event_Timer = 5000; MobDeath_Timer = 0; return; } return; } for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i) { Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]); if (mob && !mob->IsAlive() && mob->isDead()) { RingMobGUID[i].Clear(); --MobCount; //seems all are gone, so set timer to continue and discontinue this if (!MobCount) { Event_Timer = 5000; MobDeath_Timer = 0; } } } } else MobDeath_Timer -= diff; } if (Event_Timer) { if (Event_Timer <= diff) { switch (EventPhase) { case 0: Talk(SAY_TEXT5); HandleGameObject(DATA_ARENA4, false); Start(false, false); CanWalk = true; Event_Timer = 0; break; case 1: CanWalk = true; Event_Timer = 0; break; case 2: Event_Timer = 2000; break; case 3: HandleGameObject(DATA_ARENA1, true); Event_Timer = 3000; break; case 4: CanWalk = true; me->SetVisible(false); SummonRingMob(); Event_Timer = 8000; break; case 5: SummonRingMob(); SummonRingMob(); Event_Timer = 8000; break; case 6: SummonRingMob(); Event_Timer = 0; break; case 7: me->SetVisible(true); HandleGameObject(DATA_ARENA1, false); Talk(SAY_TEXT6); CanWalk = true; Event_Timer = 0; break; case 8: HandleGameObject(DATA_ARENA2, true); Event_Timer = 5000; break; case 9: me->SetVisible(false); SummonRingBoss(); Event_Timer = 0; break; case 10: //if quest, complete HandleGameObject(DATA_ARENA2, false); HandleGameObject(DATA_ARENA3, true); HandleGameObject(DATA_ARENA4, true); CanWalk = true; Event_Timer = 0; break; } ++EventPhase; } else Event_Timer -= diff; } if (CanWalk) npc_escortAI::UpdateAI(diff); }
void UpdateAI(const uint32 uiDiff) { if (!m_pInstance) return; if (m_uiMobDeathTimer) { if (m_uiMobDeathTimer <= uiDiff) { m_uiMobDeathTimer = 2500; if (m_uiRingBossGUID) { Creature* pBoss = m_creature->GetMap()->GetCreature(m_uiRingBossGUID); if (pBoss && !pBoss->isAlive() && pBoss->isDead()) { m_uiRingBossGUID = 0; m_uiEventTimer = 5000; m_uiMobDeathTimer = 0; return; } return; } for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { Creature* pMob = m_creature->GetMap()->GetCreature(m_auiRingMobGUID[i]); if (pMob && !pMob->isAlive() && pMob->isDead()) { m_auiRingMobGUID[i] = 0; --m_uiMobCount; //seems all are gone, so set timer to continue and discontinue this if (!m_uiMobCount) { m_uiEventTimer = 5000; m_uiMobDeathTimer = 0; } } } } else m_uiMobDeathTimer -= uiDiff; } if (m_uiEventTimer) { if (m_uiEventTimer <= uiDiff) { switch(m_uiEventPhase) { case 0: // Shortly after spawn, start walking //DoScriptText(-1000000, m_creature); // no more text on spawn DoGate(DATA_ARENA4, GO_STATE_READY); Start(false); m_bCanWalk = true; m_uiEventTimer = 0; break; case 1: // Start walking towards wall m_bCanWalk = true; m_uiEventTimer = 0; break; case 2: m_uiEventTimer = 2000; break; case 3: // Open East Gate DoGate(DATA_ARENA1, GO_STATE_ACTIVE); m_uiEventTimer = 3000; break; case 4: m_bCanWalk = true; m_creature->SetVisibility(VISIBILITY_OFF); SummonRingMob(); m_uiEventTimer = 8000; break; case 5: SummonRingMob(); SummonRingMob(); m_uiEventTimer = 8000; break; case 6: SummonRingMob(); m_uiEventTimer = 0; break; case 7: // Summoned Mobs are dead, continue event m_creature->SetVisibility(VISIBILITY_ON); DoGate(DATA_ARENA1, GO_STATE_READY); //DoScriptText(-1000000, m_creature); // after killed the mobs, no say here m_bCanWalk = true; m_uiEventTimer = 0; break; case 8: // Open North Gate DoGate(DATA_ARENA2, GO_STATE_ACTIVE); m_uiEventTimer = 5000; break; case 9: // Summon Boss m_creature->SetVisibility(VISIBILITY_OFF); SummonRingBoss(); m_uiEventTimer = 0; break; case 10: // Boss dead //if quest, complete DoGate(DATA_ARENA2, GO_STATE_READY); DoGate(DATA_ARENA3, GO_STATE_ACTIVE); DoGate(DATA_ARENA4, GO_STATE_ACTIVE); m_bCanWalk = true; m_uiEventTimer = 0; break; } ++m_uiEventPhase; } else m_uiEventTimer -= uiDiff; } if (m_bCanWalk) npc_escortAI::UpdateAI(uiDiff); }
void UpdateEscortAI(const uint32 uiDiff) override { if (!m_pInstance) return; if (m_pInstance->GetData(TYPE_RING_OF_LAW) == FAIL) { // Reset Doors if (m_uiEventPhase >= 9) // North Gate is opened { m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); } else if (m_uiEventPhase >= 4) // East Gate is opened { m_pInstance->DoUseDoorOrButton(GO_ARENA_1); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); } // Despawn Summoned Mobs for (GuidList::const_iterator itr = m_lSummonedGUIDList.begin(); itr != m_lSummonedGUIDList.end(); ++itr) { if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr)) pSummoned->ForcedDespawn(); } m_lSummonedGUIDList.clear(); // Despawn NPC m_creature->ForcedDespawn(); return; } if (m_uiEventTimer) { if (m_uiEventTimer <= uiDiff) { switch (m_uiEventPhase) { case 0: // Shortly after spawn, start walking // DoScriptText(-1000000, m_creature); // no more text on spawn m_pInstance->DoUseDoorOrButton(GO_ARENA_4); Start(false); SetEscortPaused(false); m_uiEventTimer = 0; break; case 1: // Start walking towards wall SetEscortPaused(false); m_uiEventTimer = 0; break; case 2: m_uiEventTimer = 2000; break; case 3: // Open East Gate m_pInstance->DoUseDoorOrButton(GO_ARENA_1); m_uiEventTimer = 3000; break; case 4: SetEscortPaused(false); m_creature->SetVisibility(VISIBILITY_OFF); // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 8000; break; case 5: // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 8000; break; case 6: // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 0; break; case 7: // Summoned Mobs are dead, continue event m_creature->SetVisibility(VISIBILITY_ON); m_pInstance->DoUseDoorOrButton(GO_ARENA_1); // DoScriptText(-1000000, m_creature); // after killed the mobs, no say here SetEscortPaused(false); m_uiEventTimer = 0; break; case 8: // Open North Gate m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_uiEventTimer = 5000; break; case 9: // Summon Boss m_creature->SetVisibility(VISIBILITY_OFF); // If banner summoned after start, then summon Thelden after the creatures are dead if (m_pInstance->GetData(TYPE_RING_OF_LAW) == SPECIAL && m_uiPhase == PHASE_MOBS) { m_uiPhase = PHASE_GLADIATORS; SummonRingMob(NPC_THELDREN, POS_NORTH); for (uint8 i = 0; i < MAX_THELDREN_ADDS; ++i) SummonRingMob(m_uiGladiatorId[i], POS_NORTH); } else { m_uiPhase = PHASE_BOSS; SummonRingMob(aRingBoss[urand(0, 5)], POS_NORTH); } m_uiEventTimer = 0; break; case 10: // Boss dead m_lSummonedGUIDList.clear(); m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_pInstance->DoUseDoorOrButton(GO_ARENA_3); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); SetEscortPaused(false); m_uiEventTimer = 0; break; } ++m_uiEventPhase; } else m_uiEventTimer -= uiDiff; } }
void UpdateAI(const uint32 uiDiff) { if (!m_pInstance) return; if (m_uiMobDeathTimer) { if (m_uiMobDeathTimer <= uiDiff) { m_uiMobDeathTimer = 2500; if (m_uiRingBossGUID) { Creature* pBoss = (Creature*)Unit::GetUnit(*m_creature, m_uiRingBossGUID); if (pBoss && !pBoss->isAlive() && pBoss->isDead()) { m_uiRingBossGUID = 0; m_uiEventTimer = 5000; m_uiMobDeathTimer = 0; return; } return; } for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { Creature* pMob = (Creature*)Unit::GetUnit(*m_creature, m_auiRingMobGUID[i]); if (pMob && !pMob->isAlive() && pMob->isDead()) { m_auiRingMobGUID[i] = 0; --m_uiMobCount; //seems all are gone, so set timer to continue and discontinue this if (!m_uiMobCount) { m_uiEventTimer = 5000; m_uiMobDeathTimer = 0; } } } } else m_uiMobDeathTimer -= uiDiff; } if (m_uiEventTimer) { if (m_uiEventTimer <= uiDiff) { switch(m_uiEventPhase) { case 0: DoScriptText(-1000000, m_creature); DoGate(DATA_ARENA4, GO_STATE_READY); Start(false, false); m_bCanWalk = true; m_uiEventTimer = 0; break; case 1: m_bCanWalk = true; m_uiEventTimer = 0; break; case 2: m_uiEventTimer = 2000; break; case 3: DoGate(DATA_ARENA1,GO_STATE_ACTIVE); m_uiEventTimer = 3000; break; case 4: m_bCanWalk = true; m_creature->SetVisibility(VISIBILITY_OFF); SummonRingMob(); m_uiEventTimer = 8000; break; case 5: SummonRingMob(); SummonRingMob(); m_uiEventTimer = 8000; break; case 6: SummonRingMob(); m_uiEventTimer = 0; break; case 7: m_creature->SetVisibility(VISIBILITY_ON); DoGate(DATA_ARENA1,GO_STATE_READY); DoScriptText(-1000000, m_creature); m_bCanWalk = true; m_uiEventTimer = 0; break; case 8: DoGate(DATA_ARENA2,GO_STATE_ACTIVE); m_uiEventTimer = 5000; break; case 9: m_creature->SetVisibility(VISIBILITY_OFF); SummonRingBoss(); m_uiEventTimer = 0; break; case 10: //if quest, complete DoGate(DATA_ARENA2,GO_STATE_READY); DoGate(DATA_ARENA3,GO_STATE_ACTIVE); DoGate(DATA_ARENA4,GO_STATE_ACTIVE); m_bCanWalk = true; m_uiEventTimer = 0; break; } ++m_uiEventPhase; } else m_uiEventTimer -= uiDiff; } if (m_bCanWalk) npc_escortAI::UpdateAI(uiDiff); }
void UpdateEscortAI(const uint32 uiDiff) override { if (!m_pInstance) return; if (m_pInstance->GetData(TYPE_RING_OF_LAW) == FAIL) { // Reset Doors if (m_uiEventPhase >= 10) // North Gate is opened { m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); } else if (m_uiEventPhase >= 4) // East Gate is opened { m_pInstance->DoUseDoorOrButton(GO_ARENA_1); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); } // Despawn Summoned Mobs for (GuidList::const_iterator itr = m_lSummonedGUIDList.begin(); itr != m_lSummonedGUIDList.end(); ++itr) { if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr)) pSummoned->ForcedDespawn(); } m_lSummonedGUIDList.clear(); // Despawn NPC m_creature->ForcedDespawn(); return; } if (m_uiEventTimer) { if (m_uiEventTimer <= uiDiff) { switch (m_uiEventPhase) { case 0: // Shortly after spawn, start walking m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_A, true); DoScriptText(SAY_START_2, m_creature); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); // Some of the NPCs in the crowd do cheer emote at event start // we randomly select 25% of the NPCs to do this m_pInstance->GetArenaCrowdGuid(m_lArenaCrowd); for (GuidSet::const_iterator itr = m_lArenaCrowd.begin(); itr != m_lArenaCrowd.end(); ++itr) { if (Creature* pSpectator = m_creature->GetMap()->GetCreature(*itr)) { if (urand(0, 1) < 0.25) pSpectator->HandleEmote(EMOTE_ONESHOT_CHEER); } } Start(false); SetEscortPaused(false); m_uiEventTimer = 0; break; case 1: // Start walking towards wall SetEscortPaused(false); m_uiEventTimer = 0; break; case 2: m_uiEventTimer = 2000; break; case 3: // Open East Gate m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_A, true); m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_B, true); m_pInstance->DoUseDoorOrButton(GO_ARENA_1); m_uiEventTimer = 3000; break; case 4: // timer for teleport out spell which has 2000 ms cast time m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_B, true); m_uiEventTimer = 2500; break; case 5: m_creature->SetVisibility(VISIBILITY_OFF); SetEscortPaused(false); // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 8000; break; case 6: // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 8000; break; case 7: // Summon Ring Mob(s) SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST); m_uiEventTimer = 0; break; case 8: // Summoned Mobs are dead, continue event DoScriptText(SAY_SUMMON_BOSS_2, m_creature); m_creature->SetVisibility(VISIBILITY_ON); m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_A, true); m_pInstance->DoUseDoorOrButton(GO_ARENA_1); SetEscortPaused(false); m_uiEventTimer = 0; break; case 9: // Open North Gate m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_C, true); m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_D, true); m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_uiEventTimer = 5000; break; case 10: // timer for teleport out spell which has 2000 ms cast time m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_B, true); m_uiEventTimer = 2500; break; case 11: // Summon Boss m_creature->SetVisibility(VISIBILITY_OFF); // If banner summoned after start, then summon Thelden after the creatures are dead if (m_pInstance->GetData(TYPE_RING_OF_LAW) == SPECIAL && m_uiPhase == PHASE_MOBS) { m_uiPhase = PHASE_GLADIATORS; SummonRingMob(NPC_THELDREN, POS_NORTH); for (uint8 i = 0; i < MAX_THELDREN_ADDS; ++i) SummonRingMob(m_uiGladiatorId[i], POS_NORTH); } else { m_uiPhase = PHASE_BOSS; SummonRingMob(aRingBoss[urand(0, 5)], POS_NORTH); } m_uiEventTimer = 0; break; case 12: // Boss dead m_lSummonedGUIDList.clear(); m_pInstance->DoUseDoorOrButton(GO_ARENA_2); m_pInstance->DoUseDoorOrButton(GO_ARENA_3); m_pInstance->DoUseDoorOrButton(GO_ARENA_4); SetEscortPaused(false); m_uiEventTimer = 0; break; } ++m_uiEventPhase; } else m_uiEventTimer -= uiDiff; } }