void Update(uint32 diff) { if (!instance->HavePlayers()) return; if (bActive) { if (uiActivationTimer < diff) { AddWave(); bActive = false; uiActivationTimer = 5000; } else uiActivationTimer -= diff; } if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) if (pMainDoor->GetGoState() != GO_STATE_ACTIVE && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); bWiped = true; if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { pSinclari->DisappearAndDie(); pSinclari->Respawn(true); } if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); } }
void AddWave() { DoUpdateWorldState(WORLD_STATE_VH, 1); DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount); DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); // TODO switch (uiWaveCount) { case 6: if (uiFirstBoss == 0) uiFirstBoss = urand(1,6); StartBossEncounter(uiFirstBoss); break; case 12: if (uiSecondBoss == 0) do { uiSecondBoss = urand(1,6); } while (uiSecondBoss == uiFirstBoss); StartBossEncounter(uiSecondBoss); break; case 18: { Creature *pSinclari = instance->GetCreature(uiSinclari); if (pSinclari) pSinclari->SummonCreature(CREATURE_CYANIGOSA,PortalLocation[0],TEMPSUMMON_DEAD_DESPAWN); break; } case 1: { if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_READY); } default: if (!bWiped) SpawnPortal(); bWiped = false; break; } }
void Update(uint32 diff) { if (!instance->HavePlayers()) return; // portals should spawn if other portal is dead and doors are closed if (bActive && uiMainEventPhase == IN_PROGRESS) { if (uiActivationTimer < diff) { AddWave(); bActive = false; uiActivationTimer = 5000; } else uiActivationTimer -= diff; } // if main event is in progress and players have wiped then reset instance if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); uiMainEventPhase = NOT_STARTED; if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { pSinclari->SetVisibility(VISIBILITY_ON); std::list<Creature*> GuardList; pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); if (!GuardList.empty()) { for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { if (Creature* pGuard = *itr) { pGuard->SetVisibility(VISIBILITY_ON); pGuard->SetReactState(REACT_AGGRESSIVE); pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); } } } pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } } // Cyanigosa is spawned but not tranformed, prefight event Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) { if (uiCyanigosaEventTimer <= diff) { switch(uiCyanigosaEventPhase) { case 1: pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); uiCyanigosaEventTimer = 7*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 2: pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); uiCyanigosaEventTimer = 7*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 3: pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); pCyanigosa->SetReactState(REACT_AGGRESSIVE); uiCyanigosaEventTimer = 2*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 4: uiCyanigosaEventPhase = 0; break; } } else uiCyanigosaEventTimer -= diff; } // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) { // if door integrity is > 0 then decrase it's integrity state if(GetData(DATA_DOOR_INTEGRITY)) { if(uiDoorSpellTimer < diff) { SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); uiDoorSpellTimer =2000; } else uiDoorSpellTimer -= diff; } // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) else { SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); uiMainEventPhase = FAIL; } } }
void SetData(uint32 type, uint32 data) { switch(type) { case DATA_1ST_BOSS_EVENT: m_auiEncounter[0] = data; if (data == DONE) SaveToDB(); break; case DATA_2ND_BOSS_EVENT: m_auiEncounter[1] = data; if (data == DONE) SaveToDB(); break; case DATA_CYANIGOSA_EVENT: m_auiEncounter[2] = data; if (data == DONE) { SaveToDB(); uiMainEventPhase = DONE; if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_ACTIVE); if (!bCrystalActivated && uiDoorIntegrity == 100) DoCompleteAchievement(ACHIEV_DEFENSELESS); } break; case DATA_WAVE_COUNT: uiWaveCount = data; bActive = true; break; case DATA_REMOVE_NPC: uiRemoveNpc = data; break; case DATA_PORTAL_LOCATION: uiLocation = (uint8)data; break; case DATA_DOOR_INTEGRITY: uiDoorIntegrity = data; DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity); break; case DATA_NPC_PRESENCE_AT_DOOR_ADD: NpcAtDoorCastingList.push_back(data); break; case DATA_NPC_PRESENCE_AT_DOOR_REMOVE: if(!NpcAtDoorCastingList.empty()) NpcAtDoorCastingList.pop_back(); break; case DATA_MAIN_DOOR: if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) { switch(data) { case GO_STATE_ACTIVE: pMainDoor->SetGoState(GO_STATE_ACTIVE); break; case GO_STATE_READY: pMainDoor->SetGoState(GO_STATE_READY); break; case GO_STATE_ACTIVE_ALTERNATIVE: pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); break; } } break; case DATA_START_BOSS_ENCOUNTER: switch(uiWaveCount) { case 6: StartBossEncounter(uiFirstBoss); break; case 12: StartBossEncounter(uiSecondBoss); break; } break; case DATA_ACTIVATE_CRYSTAL: ActivateCrystal(); break; case DATA_MAIN_EVENT_PHASE: uiMainEventPhase = data; if (data == IN_PROGRESS) // Start event { if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_READY); uiWaveCount = 1; bActive = true; uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. } break; } }
void Update(uint32 diff) override { if (!instance->HavePlayers()) return; // portals should spawn if other portal is dead and doors are closed if (bActive && uiMainEventPhase == IN_PROGRESS) { if (uiActivationTimer < diff) { AddWave(); bActive = false; // 1 minute waiting time after each boss fight uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000; } else uiActivationTimer -= diff; } // if main event is in progress and players have wiped then reset instance if (uiMainEventPhase == IN_PROGRESS && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); uiMainEventPhase = NOT_STARTED; for (int i = 0; i < 4; ++i) if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i])) crystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (Creature* sinclari = GetCreature(DATA_SINCLARI)) { sinclari->SetVisible(true); std::list<Creature*> GuardList; sinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); if (!GuardList.empty()) { for (Creature* guard : GuardList) { guard->SetVisible(true); guard->SetReactState(REACT_AGGRESSIVE); guard->GetMotionMaster()->MovePoint(1, guard->GetHomePosition()); } } sinclari->GetMotionMaster()->MovePoint(1, sinclari->GetHomePosition()); sinclari->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } // Cyanigosa is spawned but not tranformed, prefight event Creature* cyanigosa = GetCreature(DATA_CYANIGOSA); if (cyanigosa && !cyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) { if (uiCyanigosaEventTimer <= diff) { switch (uiCyanigosaEventPhase) { case 1: cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false); cyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN); uiCyanigosaEventTimer = 7*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 2: cyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false); uiCyanigosaEventTimer = 7*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 3: cyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); cyanigosa->CastSpell(cyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); cyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); cyanigosa->SetReactState(REACT_AGGRESSIVE); uiCyanigosaEventTimer = 2*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 4: uiCyanigosaEventPhase = 0; break; } } else uiCyanigosaEventTimer -= diff; } // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) { // if door integrity is > 0 then decrase it's integrity state if (GetData(DATA_DOOR_INTEGRITY)) { if (uiDoorSpellTimer < diff) { SetData(DATA_DOOR_INTEGRITY, GetData(DATA_DOOR_INTEGRITY)-1); uiDoorSpellTimer =2000; } else uiDoorSpellTimer -= diff; } // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) else { SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE); uiMainEventPhase = FAIL; } } }
void Update(uint32 diff) { if (!instance->HavePlayers()) return; if ((uiWaveCount == 0) && (GetData(DATA_MAIN_DOOR) != GO_STATE_READY) && uiOnlyonce == 0) { uiOnlyonce=1; if (Creature *pSinclari = instance->GetCreature(uiSinclari)) { if(Creature *portal1 = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, PreEventPortal1Location, TEMPSUMMON_CORPSE_DESPAWN)) uiPreEventPortal1 = portal1->GetGUID(); if(Creature *portal2 = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, PreEventPortal2Location, TEMPSUMMON_CORPSE_DESPAWN)) uiPreEventPortal2 = portal2->GetGUID(); } return; } // portals should spawn if other portal is dead and doors are closed if (bActive && GetData(DATA_MAIN_DOOR) == GO_STATE_READY) { if (uiActivationTimer < diff) { AddWave(); bActive = false; uiActivationTimer = 5000; } else uiActivationTimer -= diff; } if (uiStartBossEncounter == 1) { switch(uiWaveCount) { case 6: StartBossEncounter(uiFirstBoss); uiStartBossEncounter = -1; break; case 12: StartBossEncounter(uiSecondBoss); uiStartBossEncounter = -1; break; } } if (uiTimer <= diff) { switch(uiWaveCount) { case 18: if (Creature *pCyanigosa = instance->GetCreature(uiCyanigosa)) if (!pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) switch(uiPhase) { case 1: pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); uiTimer = 7000; ++uiPhase; break; case 2: pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); uiTimer = 7000; ++uiPhase; break; case 3: pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); pCyanigosa->SetReactState(REACT_AGGRESSIVE); uiTimer = 2000; ++uiPhase; break; case 4: uiPhase = 0; break; } break; } } else uiTimer -= diff; // if doors are closed (means event is in progres) and players have wiped then reset instance if (GetData(DATA_MAIN_DOOR) != GO_STATE_ACTIVE && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { pSinclari->SetVisibility(VISIBILITY_ON); std::list<Creature*> GuardList; pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); if (!GuardList.empty()) { for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { if (Creature* pGuard = *itr) { pGuard->SetVisibility(VISIBILITY_ON); pGuard->SetReactState(REACT_AGGRESSIVE); pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); } } } pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } } // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active if(GetData(DATA_NPC_PRESENCE_AT_DOOR) && (GetData(DATA_MAIN_DOOR) == GO_STATE_READY)) { // if door integrity is > 0 then decrase it's integrity state if(GetData(DATA_DOOR_INTEGRITY)) { if(uiDoorSpellTimer < diff) { SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); uiDoorSpellTimer =2000; } else uiDoorSpellTimer -= diff; } // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) else SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); } }