void DemonDespawn(bool triggered = true) { if (Creature* pSimone = m_creature->GetMap()->GetCreature(m_simoneGuid)) { pSimone->SetRespawnDelay(15 * MINUTE); pSimone->SetRespawnTime(15 * MINUTE); pSimone->SaveRespawnTime(); } if (triggered) { Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSPAWN_DEAD_DESPAWN, 20 * MINUTE*IN_MILLISECONDS); if (pCleaner) { ThreatList const& SimonetList = m_creature->getThreatManager().getThreatList(); for (auto itr : SimonetList) { if (Unit* pUnit = m_creature->GetMap()->GetUnit(itr->getUnitGuid())) { if (pUnit->isAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); pCleaner->AI()->AttackStart(pUnit); } } } if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { ThreatList const& PrecioustList = pPrecious->getThreatManager().getThreatList(); for (auto itr : PrecioustList) { if (Unit* pUnit = m_creature->GetMap()->GetUnit(itr->getUnitGuid())) { if (pUnit->isAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); pCleaner->AI()->AttackStart(pUnit); } } } } } } if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { pPrecious->SetVisibility(VISIBILITY_OFF); pPrecious->ForcedDespawn(); pPrecious->RemoveFromWorld(); } m_creature->SetVisibility(VISIBILITY_OFF); m_creature->ForcedDespawn(); m_creature->RemoveFromWorld(); }
void AggroAllPlayers(Creature* pTemp) { Map::PlayerList const &PlList = pTemp->GetMap()->GetPlayers(); if(PlList.isEmpty()) return; for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if(Player* pPlayer = i->getSource()) { if(pPlayer->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !pPlayer->isGameMaster()) { Creature* pCreature = pPlayer->GetVehicleBase()->ToCreature(); if(pCreature) { pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); pTemp->SetReactState(REACT_AGGRESSIVE); pTemp->SetInCombatWith(pCreature); pPlayer->SetInCombatWith(pTemp); pCreature->SetInCombatWith(pTemp); pTemp->AddThreat(pCreature, 0.0f); } } else if(pPlayer->isAlive() && !pPlayer->isGameMaster()) { pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); pTemp->SetReactState(REACT_AGGRESSIVE); pTemp->SetInCombatWith(pPlayer); pPlayer->SetInCombatWith(pTemp); pTemp->AddThreat(pPlayer, 0.0f); } } } }
void AggroAllPlayers(Creature* temp) { Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); if (PlList.isEmpty()) return; for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if (Player* player = i->getSource()) { if (player->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !player->isGameMaster()) { Creature* creature = player->GetVehicleBase()->ToCreature(); if (creature) { temp->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); temp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); temp->SetInCombatWith(creature); player->SetInCombatWith(temp); creature->SetInCombatWith(temp); temp->AddThreat(creature, 0.0f); } } else if (player->isAlive() && !player->isGameMaster() ) { temp->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); temp->SetInCombatWith(player); player->SetInCombatWith(temp); temp->AddThreat(player, 0.0f); } if (player->isGameMaster()) continue; } } }
void EnterCombat(Unit* who) { if (!slatedrake->HasAura(SPELL_UNRESPONSIVE_DRAKE)) slatedrake->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!stormrider->HasAura(SPELL_UNRESPONSIVE_DRAKE)) stormrider->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!netherscion->HasAura(SPELL_UNRESPONSIVE_DRAKE)) netherscion->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!timewarden->HasAura(SPELL_UNRESPONSIVE_DRAKE)) timewarden->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (bWhelps) if (GameObject* pGo = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_WHELP_CAGE))) pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); if (me->HasAura(SPELL_SHADOW_WARPED)) events.ScheduleEvent(EVENT_SHADOW_NOVA, 7000); events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS); proto->AddThreat(who, 10.0f); proto->SetInCombatWith(who); Talk(SAY_AGGRO); DoZoneInCombat(); instance->SetBossState(DATA_HALFUS,IN_PROGRESS); }
void UpdateAI(const uint32 uiDiff) { if (!pInstance) return; if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; switch (getStage()) { case 0: //PHASE 1 PHYSICAL REALM timedCast(SPELL_FLAME_BREATH, uiDiff); timedCast(SPELL_FIERY_COMBUSTION, uiDiff); timedCast(SPELL_METEOR, uiDiff); if (m_creature->GetHealthPercent() < 75.0f) setStage(1); break; case 1: // Switch to phase 2 m_creature->AttackStop(); m_creature->InterruptNonMeleeSpells(true); DoScriptText(-1666108,m_creature); pInstance->SetData(TYPE_HALION_EVENT, NOT_STARTED); SetCombatMovement(false); StartMovement(0); { Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL)); if (!pControl) pControl = m_creature->SummonCreature(NPC_HALION_CONTROL, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000); else if (!pControl->isAlive()) pControl->Respawn(); pControl->SetActiveObjectState(true); pControl->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetInCombatWith(pControl); pControl->SetInCombatWith(m_creature); } setStage(2); break; case 2: if (MovementStarted) return; doCast(SPELL_SUMMON_TWILIGHT_PORTAL); setStage(3); if (GameObject* pGoPortal = pInstance->instance->GetGameObject(pInstance->GetData64(GO_HALION_PORTAL_1))) pGoPortal->SetPhaseMask(31,true); if (GameObject* pGoRing = pInstance->instance->GetGameObject(pInstance->GetData64(GO_FLAME_RING))) pGoRing->SetPhaseMask(65535,true); break; case 3: if (m_creature->IsNonMeleeSpellCasted(false)) return; m_creature->SetActiveObjectState(true); doCast(SPELL_START_PHASE2); setStage(4); break; case 4: if (!m_creature->IsNonMeleeSpellCasted(false)) { if (Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL))) { m_creature->SetInCombatWith(pControl); pControl->SetInCombatWith(m_creature); } Creature* pTwilight = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_TWILIGHT)); if (!pTwilight) pTwilight = m_creature->SummonCreature(NPC_HALION_TWILIGHT, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000); else if (!pTwilight->isAlive()) pTwilight->Respawn(); pTwilight->SetCreatorGUID(0); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); setStage(5); } break; case 5: // HALION awaiting end battle in TWILIGHT REALM if (pInstance->GetData(TYPE_HALION_EVENT) == IN_PROGRESS) { // pInstance->SetData(TYPE_HALION_EVENT, SPECIAL); doRemove(SPELL_START_PHASE2); if (Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL))) { m_creature->SetInCombatWith(pControl); pControl->SetInCombatWith(m_creature); } m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetHealth(m_creature->GetMaxHealth()/2); m_creature->SetInCombatWithZone(); setStage(6); } return; case 6: // Switch to phase 3 // doCast(SPELL_TWILIGHT_DIVISION); DoScriptText(-1666109,m_creature); pInstance->SetData(TYPE_HALION_EVENT, SPECIAL); setStage(7); break; case 7: if (m_creature->IsNonMeleeSpellCasted(false)) return; if (m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return; SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); setStage(8); break; case 8: //PHASE 3 BOTH REALMS timedCast(SPELL_FLAME_BREATH, uiDiff); timedCast(SPELL_FIERY_COMBUSTION, uiDiff); timedCast(SPELL_METEOR, uiDiff); break; default: break; } timedCast(SPELL_BERSERK, uiDiff); DoMeleeAttackIfReady(); }
// Function to process actions for linked NPCs void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventType, Creature* pSource, Unit* pEnemy /* = NULL*/) { // This check will be needed in reload case if (!sCreatureLinkingMgr.IsLinkedEventTrigger(pSource)) return; // Ignore atypic behaviour if (pSource->IsControlledByPlayer()) return; if (eventType == LINKING_EVENT_AGGRO && !pEnemy) return; uint32 eventFlagFilter = 0; uint32 reverseEventFlagFilter = 0; switch (eventType) { case LINKING_EVENT_AGGRO: eventFlagFilter = EVENT_MASK_ON_AGGRO; reverseEventFlagFilter = FLAG_TO_AGGRO_ON_AGGRO; break; case LINKING_EVENT_EVADE: eventFlagFilter = EVENT_MASK_ON_EVADE; reverseEventFlagFilter = FLAG_TO_RESPAWN_ON_EVADE; break; case LINKING_EVENT_DIE: eventFlagFilter = EVENT_MASK_ON_DIE; reverseEventFlagFilter = 0; break; case LINKING_EVENT_RESPAWN: eventFlagFilter = EVENT_MASK_ON_RESPAWN; reverseEventFlagFilter = FLAG_FOLLOW; break; } // Process Slaves (by entry) HolderMapBounds bounds = m_holderMap.equal_range(pSource->GetEntry()); for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr) ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy); // Process Slaves (by guid) bounds = m_holderGuidMap.equal_range(pSource->GetGUIDLow()); for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr) ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy); // Process Master if (CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pSource)) { if (pInfo->linkingFlag & reverseEventFlagFilter) { Creature* pMaster = NULL; if (pInfo->mapId != INVALID_MAP_ID) // entry case { BossGuidMapBounds finds = m_masterGuid.equal_range(pInfo->masterId); for (BossGuidMap::iterator itr = finds.first; itr != finds.second; ++itr) { pMaster = pSource->GetMap()->GetCreature(itr->second); if (pMaster && IsSlaveInRangeOfBoss(pSource, pMaster, pInfo->searchRange)) break; } } else // guid case { CreatureData const* masterData = sObjectMgr.GetCreatureData(pInfo->masterDBGuid); CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(masterData->id); pMaster = pSource->GetMap()->GetCreature(ObjectGuid(cInfo->GetHighGuid(), cInfo->Entry, pInfo->masterDBGuid)); } if (pMaster) { switch (eventType) { case LINKING_EVENT_AGGRO: if (pMaster->IsControlledByPlayer()) return; if (pMaster->isInCombat()) pMaster->SetInCombatWith(pEnemy); else pMaster->AI()->AttackStart(pEnemy); break; case LINKING_EVENT_EVADE: if (!pMaster->isAlive()) pMaster->Respawn(); break; case LINKING_EVENT_RESPAWN: if (pMaster->isAlive()) SetFollowing(pSource, pMaster); } } } } }
void npc_reginald_windsorAI::UpdateAI(const uint32 uiDiff) { // in case of idle / afk players if (m_uiDespawnTimer < uiDiff) { PokeRowe(); m_creature->ForcedDespawn(); } else m_uiDespawnTimer -= uiDiff; for (int i = 0; i < 6; i++) { if (GardeNeed[i] == true) { if (GardeTimer[i] < uiDiff) { if (Creature* pGarde = GetGuard(i)) { int Var = i + 7; pGarde->SetFacingTo(WindsorEventMove[Var].o); pGarde->SetStandState(UNIT_STAND_STATE_KNEEL); GardeNeed[i] = false; } } else GardeTimer[i] -= uiDiff; } } if (Begin) { if (m_creature->GetDistance2d(WindsorDeplacement[0].x, WindsorDeplacement[0].y) < 2.0f) { Begin = false; m_creature->Unmount(); m_creature->CastSpell(m_creature, SPELL_WINDSOR_DISMISS_HORSE, true); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); if (Creature* pMercutio = m_creature->FindNearestCreature(NPC_MERCUTIO, 10.0f)) { pMercutio->SetSpeedRate(MOVE_WALK, 2.5f, true); pMercutio->setFaction(m_creature->getFaction()); pMercutio->GetMotionMaster()->MovePoint(0, -9148.395508f, 371.322174f, 90.543655f); pMercutio->ForcedDespawn(12000); m_creature->SetFacingToObject(pMercutio); m_creature->MonsterSay("Yawww!"); m_creature->HandleEmote(EMOTE_ONESHOT_ATTACKUNARMED); } m_creature->SetWalk(true); m_creature->SetSpeedRate(MOVE_WALK, 1.0f, true); GreetPlayer = true; } } if (!BeginQuest) { if (GreetPlayer) { if (Timer <= uiDiff) { Player* pPlayer = GetPlayer(); if (pPlayer) { m_creature->SetFacingToObject(pPlayer); char sMessage[200]; sprintf(sMessage, "I knew you would come, %s. It is good to see you again, friend.", pPlayer->GetName()); m_creature->MonsterSay(sMessage); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 5000; GreetPlayer = false; } else Timer -= uiDiff; } return; } if (Timer < uiDiff) { std::list<Creature*> DragListe; float X = 0.0f; float Y = 0.0f; uint32 eventGardId = 6; switch (Tick) { case 0: m_uiDespawnTimer = 20 * MINUTE*IN_MILLISECONDS; m_creature->SetFacingTo(0.659f); m_creature->MonsterYellToZone(NOST_TEXT(235)); m_creature->HandleEmote(EMOTE_ONESHOT_SHOUT); Timer = 5000; break; case 1: for (int i = 0; i < 6; i++) { int Var = i + 1; Creature* pSummon = m_creature->SummonCreature(NPC_STORMWIND_CITY_GUARD, WindsorEventMove[Var].x, WindsorEventMove[Var].y, WindsorEventMove[Var].z, WindsorEventMove[Var].o, TEMPSUMMON_TIMED_DESPAWN, 240 * IN_MILLISECONDS); if (pSummon) { GardesGUIDs[i] = pSummon->GetGUID(); pSummon->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } if (Creature* Onyxia = m_creature->SummonCreature(NPC_KATRANA_PRESTOR, -9075.6f, 466.11f, 120.383f, 6.27f, TEMPSUMMON_TIMED_DESPAWN, 10 * IN_MILLISECONDS)) { Onyxia->SetDisplayId(11686); Onyxia->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Onyxia->MonsterYellToZone(NOST_TEXT(WindsorTalk[IDSpeech])); IDSpeech++; } if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->GetMotionMaster()->MovePoint(0, WindsorEventMove[0].x, WindsorEventMove[0].y, WindsorEventMove[0].z); General->Unmount(); } m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[1].x, WindsorDeplacement[1].y, WindsorDeplacement[1].z); X = m_creature->GetPositionX() - WindsorDeplacement[1].x; Y = m_creature->GetPositionY() - WindsorDeplacement[1].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); break; case 2: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 3: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 4: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 5: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); General->MonsterTextEmote("General Marcus Jonathan appears lost in contemplation.", nullptr); } Timer = 10000; break; case 6: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 7: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 8: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 9: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { if (Creature* pGarde = GetGuard(0)) General->SetFacingToObject(pGarde); General->HandleEmote(EMOTE_ONESHOT_EXCLAMATION); DoTalk(General, false); } Timer = 4000; break; case 10: eventGardId = 0; break; case 11: eventGardId = 1; break; case 12: eventGardId = 2; break; case 13: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { if (Creature* pGarde = GetGuard(3)) General->SetFacingToObject(pGarde); General->HandleEmote(EMOTE_ONESHOT_EXCLAMATION); DoTalk(General, false); } Timer = 4000; break; case 14: eventGardId = 3; break; case 15: eventGardId = 4; break; case 16: eventGardId = 5; break; case 17: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->SetFacingToObject(m_creature); DoTalk(General, true); General->HandleEmote(EMOTE_ONESHOT_SHOUT); } Timer = 5000; break; case 18: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) General->HandleEmote(EMOTE_ONESHOT_SALUTE); Timer = 5000; break; case 19: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) DoTalk(General, false); Timer = 10000; break; case 20: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->GetMotionMaster()->MovePoint(0, WindsorEventMove[13].x, WindsorEventMove[13].y, WindsorEventMove[13].z); X = General->GetPositionX() - WindsorEventMove[13].x; Y = General->GetPositionY() - WindsorEventMove[13].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else Timer = 1000; break; case 21: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->HandleEmote(EMOTE_STATE_KNEEL); General->SetFacingTo(WindsorEventMove[13].o); m_creature->SetFacingToObject(General); DoTalk(m_creature, false); } Timer = 10000; break; case 22: if (Creature* pGarde = GetGuard(0)) m_creature->SetFacingToObject(pGarde); DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_POINT); Timer = 5000; break; case 25: NeedCheck = true; break; case 26: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->ForcedDespawn(); General->Respawn(); } break; case 40: m_uiDespawnTimer = 10 * MINUTE*IN_MILLISECONDS; BeginQuest = false; m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 1); DoTalk(m_creature, false); break; case 47: DoTalk(m_creature, false); if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); Timer = 10000; break; case 48: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) DoTalk(Bolvar, false); Timer = 500; break; case 49: if (Creature* Anduin = m_creature->FindNearestCreature(NPC_ANDUIN_WRYNN, 150.0f)) Anduin->GetMotionMaster()->MovePoint(0, WindsorEventMove[14].x, WindsorEventMove[14].y, WindsorEventMove[14].z); Timer = 5000; break; case 50: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { m_creature->SetFacingToObject(Onyxia); DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_POINT); } Timer = 10000; break; case 51: case 52: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { DoTalk(Onyxia, false); Onyxia->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 53: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 7000; break; case 54: m_creature->MonsterTextEmote("Reginald Windsor reaches into his pack and pulls out the encoded tablets."); Timer = 4000; break; case 55: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 6000; break; case 56: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 4000; break; case 57: m_creature->MonsterTextEmote("Reginald Windsor reads from the tablets. Unknown, unheard sounds flow through your consciousness."); Timer = 2000; break; case 58: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) m_creature->CastSpell(Onyxia, SPELL_WINSOR_READ_TABLETS, false); Timer = 10000; break; case 59: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->CastSpell(Onyxia, SPELL_ONYXIA_TRANS, true); Onyxia->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); } if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->MonsterTextEmote("Highlord Bolvar Fordragon gasps."); Timer = 2000; break; case 60: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { Bolvar->GetMotionMaster()->MovePoint(0, WindsorEventMove[15].x, WindsorEventMove[15].y, WindsorEventMove[15].z); X = Bolvar->GetPositionX() - WindsorEventMove[15].x; Y = Bolvar->GetPositionY() - WindsorEventMove[15].y; Timer = 1000 + sqrt((X * X) + (Y * Y)) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { DoTalk(Onyxia, false); Onyxia->HandleEmote(EMOTE_ONESHOT_TALK); } else Timer = 5000; break; case 61: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Bolvar->SetFacingToObject(Onyxia); DoTalk(Bolvar, true); } Timer = 1000; break; case 62: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->MonsterTextEmote("Lady Onyxia laughs."); Timer = 2000; break; case 63: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterSay("Yesss... Guards, come to your lord's aid!"); int Var = 0; GetCreatureListWithEntryInGrid(DragListe, Onyxia, NPC_STORMWIND_ROYAL_GUARD, 25.0f); for (auto itr = DragListe.begin(); itr != DragListe.end(); ++itr) { DragsGUIDs[Var] = (*itr)->GetGUID(); (*itr)->UpdateEntry(NPC_ONYXIA_ELITE_GUARD); (*itr)->AIM_Initialize(); (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (!urand(0, 2)) (*itr)->MonsterTextEmote("Onyxia's Elite Guard hisses."); Var++; } } Timer = 4000; break; case 64: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->CastSpell(m_creature, SPELL_WINDSOR_DEATH, false); Timer = 1500; break; case 65: DoTalk(m_creature, false); if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterSay("Was this fated, Windsor? If it was death that you came for then the prophecy has been fulfilled. May your consciousness rot in the Twisting Nether. Finish the rest of these meddlesome insects, children. Bolvar, you have been a pleasurable puppet."); Onyxia->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE); if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { int Var = 0; while (DragsGUIDs[Var] && Var < 9) { Creature* crea = me->GetMap()->GetCreature(DragsGUIDs[Var]); crea->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); crea->getThreatManager().addThreatDirectly(Bolvar, 5000.0f); crea->SetTargetGuid(Bolvar->GetGUID()); Bolvar->AddThreat(crea); Bolvar->SetInCombatWith(crea); crea->SetInCombatWith(Bolvar); Var++; } } } Timer = 5000; break; case 66: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterYell("You have failed him, mortalsss... Farewell!"); Onyxia->CastSpell(Onyxia, SPELL_PRESTOR_DESPAWNS, true); } if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->MonsterTextEmote("Highlord Bolvar Fordragon's medallion shatters."); Timer = 1000; PhaseFinale = true; break; case 67: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); Onyxia->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); Onyxia->ForcedDespawn(); Onyxia->SetRespawnDelay(7 * MINUTE); Onyxia->SetRespawnTime(7 * MINUTE); } Tick = 100; // come back when combat is done break; case 68: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { DoTalk(Bolvar, false); DoTalk(m_creature, false); Bolvar->HandleEmote(EMOTE_ONESHOT_KNEEL); } Timer = 4500; break; case 69: SituationFinale(); BeginQuest = false; m_creature->MonsterTextEmote("Reginald Windsor dies."); m_creature->CastSpell(m_creature, 5, true); break; } if (eventGardId < 6) { if (Creature* pGarde = GetGuard(eventGardId)) { int Var = eventGardId + 7; pGarde->GetMotionMaster()->MovePoint(0, WindsorEventMove[Var].x, WindsorEventMove[Var].y, WindsorEventMove[Var].z); X = pGarde->GetPositionX() - WindsorEventMove[Var].x; Y = pGarde->GetPositionY() - WindsorEventMove[Var].y; } GardeTimer[eventGardId] = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); GardeNeed[eventGardId] = true; Timer = 1000; } if (Tick > 23 && Tick < 40) { int Var = Tick - 21; m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[Var].x, WindsorDeplacement[Var].y, WindsorDeplacement[Var].z); X = m_creature->GetPositionX() - WindsorDeplacement[Var].x; Y = m_creature->GetPositionY() - WindsorDeplacement[Var].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else if (Tick > 41 && Tick < 46) { int Var = Tick - 22; m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[Var].x, WindsorDeplacement[Var].y, WindsorDeplacement[Var].z); X = m_creature->GetPositionX() - WindsorDeplacement[Var].x; Y = m_creature->GetPositionY() - WindsorDeplacement[Var].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else if (PhaseFinale == true) { if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { if (!Bolvar->isInCombat()) { if (!CombatJustEnded) { Bolvar->SetWalk(true); Bolvar->GetMotionMaster()->MovePoint(0, -8447.39f, 335.35f, 121.747f, 1.29f); CombatJustEnded = true; Timer = 5000; Tick = 68; return; } } } } Tick++; } else Timer -= uiDiff; }
//Called at World update tick void UpdateAI(uint32 const diff) { if (!me->getVictim()) { if (!Unit::GetCreature(*me, m_uiJalootGuid)) { if (TempSummon* jaloot = me->SummonCreature(NPC_JALOOT, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS)) { m_uiJalootGuid = jaloot->GetGUID(); jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } else { if (Creature * jaloot = Unit::GetCreature(*me, m_uiJalootGuid)) if (jaloot->isAlive() && me->isAlive()) { jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } if (!Unit::GetCreature(*me, m_uiZepikGuid)) { if (TempSummon* zepik = me->SummonCreature(NPC_ZEPIK, SpawnLocations[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS)) { m_uiZepikGuid = zepik->GetGUID(); zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } else { if (Creature * zepik = Unit::GetCreature(*me, m_uiZepikGuid)) if (zepik->isAlive() && me->isAlive()) { zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } } //Return since we have no target if (!UpdateVictim()) return; if (HealthBelowPct(30) && m_uiArtriusPhase == 0) { m_uiArtriusPhase = 1; if (Creature* jaloot = Unit::GetCreature(*me, m_uiJalootGuid)) { jaloot->RemoveAllAuras(); jaloot->setFaction(FACTION_MONSTER); jaloot->SetInCombatWith(me->getVictim()); jaloot->AddThreat(me->getVictim(), 0.0f); me->CastSpell(jaloot, SPELL_BINDINGS_OF_SUBMISSION); } if (Creature* zepik = Unit::GetCreature(*me, m_uiZepikGuid)) { zepik->RemoveAllAuras(); zepik->setFaction(FACTION_MONSTER); zepik->SetInCombatWith(me->getVictim()); zepik->AddThreat(me->getVictim(), 0.0f); me->CastSpell(zepik, SPELL_BINDINGS_OF_SUBMISSION); } } if ( m_uiArtriusPhase == 0 || m_uiArtriusPhase == 2 ) { if ( m_uiFrostboltTimer <= diff ) { DoCast(me->getVictim(), SPELL_FROSTBOLT); m_uiFrostboltTimer = 5 * IN_MILLISECONDS; } else m_uiFrostboltTimer -= diff; if ( m_uiFrostNovaTimer <= diff ) { if ( me->IsInRange(me->getVictim(), 5.0f, 10.0f) ) { DoCast(SPELL_FROST_NOVA); m_uiFrostNovaTimer = 5 * IN_MILLISECONDS; } } else m_uiFrostNovaTimer -= diff; if ( m_uiIceLanceTimer <= diff ) { if (me->getVictim()->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) { DoCast(me->getVictim(), SPELL_ICE_LANCE); m_uiIceLanceTimer = 5 * IN_MILLISECONDS; } } else m_uiIceLanceTimer -= diff; if ( m_uiIcyVeinsTimer <= diff ) { if (!me->HasUnitState(UNIT_STATE_CASTING)) { DoCast(SPELL_ICY_VEINS); m_uiIcyVeinsTimer = 25 * IN_MILLISECONDS; } } else m_uiIcyVeinsTimer -= diff; } else { Creature* jaloot = Unit::GetCreature(*me, m_uiJalootGuid); Creature* zepik = Unit::GetCreature(*me, m_uiZepikGuid); if (!jaloot || !zepik) return; if (jaloot->isDead()) { m_uiArtriusPhase = 2; me->RemoveAllAuras(); zepik->RestoreFaction(); zepik->SetInCombatWith(me); zepik->AddThreat(me, 0.0f); } if (zepik->isDead()) { m_uiArtriusPhase = 2; me->RemoveAllAuras(); jaloot->RestoreFaction(); jaloot->SetInCombatWith(me); jaloot->AddThreat(me, 0.0f); } } DoMeleeAttackIfReady(); }