// Wrapper to handle the drakkari invaders summon void DoSummonDrakkariInvaders() { if (!m_pInstance) return; // check if there are there are at least 2 triggers in the vector if (m_vTriggers.size() < 2) return; if (roll_chance_i(30)) { // Summon a troll in the corner and 2 trolls in the air if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetTrollgoreCornerTrigger())) pTrigger->CastSpell(pTrigger, roll_chance_i(20) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid()); // get two random outside triggers uint8 uiMaxTriggers = m_vTriggers.size(); uint8 uiPos1 = urand(0, uiMaxTriggers - 1); uint8 uiPos2 = (uiPos1 + urand(1, uiMaxTriggers - 1)) % uiMaxTriggers; if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos1])) pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid()); if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos2])) pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid()); } else { // Summon 3 trolls in the air for (auto m_vTrigger : m_vTriggers) { if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTrigger)) pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid()); } } }
void JustDied(Unit* /*killer*/) override { LiveTriggerGUID.clear(); DeadTriggerGUID.clear(); _JustDied(); Talk(SAY_DEATH); instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); }
void AddJustAggroed(Unit* pWho) { // Let all adds attack for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr) { Creature* pAdd = m_creature->GetMap()->GetCreature(*itr); if (pAdd && !pAdd->getVictim()) pAdd->AI()->AttackStart(pWho); } }
void Reset() override { LiveTriggerGUID.clear(); DeadTriggerGUID.clear(); me->SetReactState(REACT_PASSIVE); instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); _Reset(); Initialize(); }
void Reset() override { m_Phase = PHASE_GROUND; m_PhaseSwitchTimer = 80000; m_uiFreezingSlashTimer = 20000; m_uiPenetratingColdTimer = urand(15000, 25000); m_uiBurrowerSummonTimer = 10000; m_uiBerserkTimer = 10 * MINUTE * IN_MILLISECONDS; m_vSpheresGuidVector.clear(); m_vSpheresGuidVector.resize(MAX_FROSTSPHERES, ObjectGuid()); }
void Cleanup(Creature* infernal, InfernalPoint *point) { for (GuidVector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) { if (*itr == infernal->GetGUID()) { infernals.erase(itr); break; } } positions.push_back(point); }
void CastBunnySpell(Creature* pTarget, uint32 uSpell) { if (!uSpell) return; std::list<Creature*> creatureList; GetCreatureListWithEntryInGrid(creatureList, m_creature, NPC_VIMGOL_VISUAL_BUNNY, 200.0f); for (auto& bunny : creatureList) for (auto it = m_uiBunnyGuids.begin(); it != m_uiBunnyGuids.end(); ++it) if ((*it) == bunny->GetObjectGuid()) if (m_uiActiveCircles[std::distance(m_uiBunnyGuids.begin(), it)]) bunny->CastSpell(pTarget ? pTarget : bunny, uSpell, TRIGGERED_OLD_TRIGGERED); }
void InfernalCleanup() { //Infernal Cleanup for (GuidVector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr)) if (pInfernal->IsAlive()) { pInfernal->SetVisible(false); pInfernal->setDeathState(JUST_DIED); } infernals.clear(); }
void CallFallSoldier() { for (uint8 i = 0; i < 4 && m_uiSummonGUID.size(); i++) { if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID.back())) { Summon->setFaction(14); Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Summon->SetInCombatWithZone(); } m_uiSummonGUID.pop_back(); } }
void JustDied(Unit* /*pKiller*/) override { for (GuidVector::const_iterator itr = m_vSnoboldGuidsVector.begin(); itr != m_vSnoboldGuidsVector.end(); ++itr) { if (Creature* pSnobold = m_creature->GetMap()->GetCreature(*itr)) { if (!pSnobold->isAlive()) continue; // ToDo: check if there is any player vehicle mounting involved SendAIEvent(AI_EVENT_CUSTOM_EVENTAI_A, m_creature, pSnobold); } } }
void DoSetupAdds() { m_uiSetupAddsTimer = 0; if (!m_pInstance) return; GuidList lAddGuids; m_pInstance->GetKelidanAddList(lAddGuids); // Sort Adds to vector if not already done if (!lAddGuids.empty()) { m_vAddGuids.reserve(lAddGuids.size()); std::list<Creature*> lAdds; for (GuidList::const_iterator itr = lAddGuids.begin(); itr != lAddGuids.end(); ++itr) { if (Creature* pAdd = m_pInstance->instance->GetCreature(*itr)) lAdds.push_back(pAdd); } // Sort them by angle lAdds.sort(SortByAngle(m_creature)); for (std::list<Creature*>::const_iterator itr = lAdds.begin(); itr != lAdds.end(); ++itr) m_vAddGuids.push_back((*itr)->GetObjectGuid()); } // Respawn killed adds and reset counter m_uiKilledAdds = 0; for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr) { Creature* pAdd = m_pInstance->instance->GetCreature(*itr); if (pAdd && !pAdd->isAlive()) pAdd->Respawn(); } // Cast pentagram uint8 s = m_vAddGuids.size(); for (uint8 i = 0; i < s; ++i) { Creature* pCaster = m_pInstance->instance->GetCreature(m_vAddGuids[i]); Creature* pTarget = m_pInstance->instance->GetCreature(m_vAddGuids[(i + 2) % s]); if (pCaster && pTarget) pCaster->CastSpell(pTarget, SPELL_CHANNELING, TRIGGERED_NONE); } m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); }
void JustSummoned(Creature* summoned) override { m_skeletons.push_back(summoned->GetObjectGuid()); if (m_creature->getVictim()) summoned->AI()->AttackStart(m_creature->getVictim()); }
void SetChallengers() { m_vAffrayChallengerGuidsVector.reserve(MAX_CHALLENGERS); for (uint8 i = 0; i < MAX_CHALLENGERS; ++i) m_creature->SummonCreature(NPC_AFFRAY_CHALLENGER, aAffrayChallengerLoc[i][0], aAffrayChallengerLoc[i][1], aAffrayChallengerLoc[i][2], aAffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 600000); }
void SummonInfernal(const uint32 /*diff*/) { InfernalPoint *point = NULL; Position pos; if ((me->GetMapId() != 532) || positions.empty()) pos = me->GetRandomNearPosition(60); else { point = Trinity::Containers::SelectRandomContainerElement(positions); pos.Relocate(point->x, point->y, INFERNAL_Z, frand(0.0f, float(M_PI * 2))); } Creature* infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); if (infernal) { infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); infernal->setFaction(me->getFaction()); if (point) ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->point = point; ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->malchezaar = me->GetGUID(); infernals.push_back(infernal->GetGUID()); DoCast(infernal, SPELL_INFERNAL_RELAY); } Talk(SAY_SUMMON); }
void ScriptedAI::DespawnGuids(GuidVector& spawns) { for (ObjectGuid& guid : spawns) if (Creature* spawn = m_creature->GetMap()->GetCreature(guid)) spawn->ForcedDespawn(); spawns.clear(); }
// Wrapper to remove Gravity Lapse - this should be removed on aura 44251 expires void RemoveGravityLapse() { GuidVector vGuids; m_creature->FillGuidsListFromThreatList(vGuids); for (GuidVector::const_iterator itr = vGuids.begin(); itr != vGuids.end(); ++itr) { Unit* pUnit = m_creature->GetMap()->GetUnit(*itr); if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) { pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); } } }
npc_vimgol_visual_bunnyAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pMap = (ScriptedMap*)pCreature->GetInstanceData(); GuidVector bunnyGuids; if (m_pMap) { m_pMap->GetCreatureGuidVectorFromStorage(m_creature->GetEntry(), bunnyGuids); for (auto it = bunnyGuids.begin(); it != bunnyGuids.end(); ++it) if ((*it) == m_creature->GetObjectGuid()) m_uiBunnyId = std::distance(bunnyGuids.begin(), it); } Reset(); }
uint8 playersInsideCircles() { uint32 tmpAuras[5] = { SPELL_VIMGOL_POP_TEST_A, SPELL_VIMGOL_POP_TEST_B, SPELL_VIMGOL_POP_TEST_C, SPELL_VIMGOL_POP_TEST_D, SPELL_VIMGOL_POP_TEST_E }; uint8 tmpCounter = 0; if (m_uiBunnyGuids.size() < 5 && m_pMap) { m_uiBunnyGuids.clear(); m_pMap->GetCreatureGuidVectorFromStorage(NPC_VIMGOL_VISUAL_BUNNY, m_uiBunnyGuids); } for (int i = 0; i < 5; i++) m_uiActiveCircles[i] = false; std::list<Player*> playerList; GetPlayerListWithEntryInWorld(playerList, m_creature, 30); for (auto itr = playerList.begin(); itr != playerList.end(); ++itr) { if (!(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_A) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_B) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_C) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_D) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_E)) continue; for (auto it = m_uiBunnyGuids.begin(); it != m_uiBunnyGuids.end(); ++it) { for (int i = 0; i < 5; ++i) { if (!(*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0))) continue; if ((*it) != (*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0))->GetCasterGuid()) continue; m_uiActiveCircles[std::distance(m_uiBunnyGuids.begin(), it)] = true; } } } for (int i = 0; i < 5; i++) if (m_uiActiveCircles[i]) ++tmpCounter; return tmpCounter; }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_SNOBOLD_VASSAL) { m_vSnoboldGuidsVector.push_back(pSummoned->GetObjectGuid()); ++m_uiSnoboldsBoarded; } }
// Wrapper to teleport all players to the platform - Workaround for missing spell void DoTeleportToPlatform() { m_creature->NearTeleportTo(aVorpilTeleportLoc[0], aVorpilTeleportLoc[1], aVorpilTeleportLoc[2], 0.0f); float fX, fY, fZ; GuidVector vGuids; m_creature->FillGuidsListFromThreatList(vGuids); for (GuidVector::const_iterator itr = vGuids.begin(); itr != vGuids.end(); ++itr) { Unit* pTarget = m_creature->GetMap()->GetUnit(*itr); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { pTarget->GetRandomPoint(aVorpilTeleportLoc[0], aVorpilTeleportLoc[1], aVorpilTeleportLoc[2], 4.0f, fX, fY, fZ); DoTeleportPlayer(pTarget, fX, fY, fZ, m_creature->GetAngle(fX, fY)); } } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_HEARTHEN_GUARD: case NPC_SHARPSHOOTER_GUARD: case NPC_REAVER_GUARD: if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { pSummoned->AI()->AttackStart(pTarget); } m_vAddGuids.push_back(pSummoned->GetObjectGuid()); break; case NPC_SHATTERED_ASSASSIN: m_vAssassinGuids.push_back(pSummoned->GetObjectGuid()); break; } }
void Reset() override { m_bIsEventInProgress = false; m_uiEventTimer = 1000; m_uiChallengerCount = 0; m_uiStep = 0; m_playerGuid.Clear(); m_bigWillGuid.Clear(); m_vAffrayChallengerGuidsVector.clear(); }
void Reset() override { // get the list of summoned stalkers and move to a randome one if (m_pInstance) m_pInstance->GetStalkersGUIDVector(m_vStalkersGuids); if (m_vStalkersGuids.empty()) return; m_creature->SetWalk(false); if (Creature* pStalker = m_creature->GetMap()->GetCreature(m_vStalkersGuids[urand(0, m_vStalkersGuids.size() - 1)])) m_creature->GetMotionMaster()->MovePoint(1, pStalker->GetPositionX(), pStalker->GetPositionY(), pStalker->GetPositionZ()); }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_PLANAR_ANOMALY) { pSummoned->CastSpell(pSummoned, SPELL_PLANAR_ANOMALY_AGGRO, true); // If this happens then something is really wrong if (m_vAnomalyTargets.empty()) return; if (Unit* pTarget = m_creature->GetMap()->GetUnit(m_vAnomalyTargets[m_uiAnomalyTargetIndex])) pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0, 0); if (m_uiAnomalyTargetIndex < m_vAnomalyTargets.size() - 1) ++m_uiAnomalyTargetIndex; } else if (pSummoned->GetEntry() == NPC_GREATER_LEY_WHELP) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } }
void Summon() { m_uiLocNo = 0; for(uint8 i = 0; i < 16; i++) { switch(urand(0,3)) { case 0: switch(urand(1, 3)) { case 1: pSummon = NPC_DARK_1; break; case 2: pSummon = NPC_DARK_3; break; case 3: pSummon = NPC_DARK_6; break; } break; case 1: switch(urand(1, 3)) { case 1: pSummon = NPC_DARK_2; break; case 2: pSummon = NPC_DARK_3; break; case 3: pSummon = NPC_DARK_4; break; } break; case 2: switch(urand(1, 3)) { case 1: pSummon = NPC_DARK_2; break; case 2: pSummon = NPC_DARK_5; break; case 3: pSummon = NPC_DARK_6; break; } break; case 3: switch(urand(1, 3)) { case 1: pSummon = NPC_DARK_1; break; case 2: pSummon = NPC_DARK_5; break; case 3: pSummon = NPC_DARK_4; break; } break; } if(Creature* Summon = m_creature->SummonCreature(pSummon, SpawnLoc[m_uiLocNo].x, SpawnLoc[m_uiLocNo].y, SpawnLoc[m_uiLocNo].z, SpawnLoc[m_uiLocNo].o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { m_uiSummonGUID.push_back(Summon->GetObjectGuid()); Summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Summon->setFaction(974); } m_uiLocNo++; } }
void EnterCombat(Unit* /*who*/) override { for (uint32 i = 0; i < POS_LIVE; ++i) if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) LiveTriggerGUID.push_back(trigger->GetGUID()); for (uint32 i = 0; i < POS_DEAD; ++i) if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) DeadTriggerGUID.push_back(trigger->GetGUID()); if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) { TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!"); EnterEvadeMode(); return; } _EnterCombat(); waveCount = 0; events.ScheduleEvent(EVENT_SUMMON, 30000); DoTeleportTo(PosPlatform); Talk(SAY_SPEECH); instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY); }
// Wrapper to summon the npcs for the epilogue void DoSummonBrokenAshtongue() { if (!m_pInstance) return; float fX, fY, fZ; // Spawn 4 Broken in the center and behind the column for (uint8 i = 0; i < countof(afBrokenSpawnLoc); ++i) { for (uint8 j = 0; j < 4; ++j) { fX = afBrokenSpawnLoc[i].m_fX; fY = afBrokenSpawnLoc[i].m_fY + (j * 7); fZ = afBrokenSpawnLoc[i].m_fZ; m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS); } } GuidVector vGeneratorsVect; m_pInstance->GetGeneratorGuidVector(vGeneratorsVect); // Spawn 4 Broken at each generator for (uint8 i = 0; i < vGeneratorsVect.size(); ++i) { if (Creature* pGenerator = m_creature->GetMap()->GetCreature(vGeneratorsVect[i])) { for (uint8 j = 0; j < 4; ++j) { pGenerator->GetRandomPoint(pGenerator->GetPositionX(), pGenerator->GetPositionY(), pGenerator->GetPositionZ(), 10.0f, fX, fY, fZ); m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS); } } } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_BIG_WILL) { m_bigWillGuid = pSummoned->GetObjectGuid(); pSummoned->setFaction(FACTION_FRIENDLY); pSummoned->SetWalk(false); pSummoned->GetMotionMaster()->MovePoint(1, aAffrayChallengerLoc[7][0], aAffrayChallengerLoc[7][1], aAffrayChallengerLoc[7][2]); } else { pSummoned->setFaction(FACTION_FRIENDLY); pSummoned->HandleEmote(EMOTE_ONESHOT_ROAR); m_vAffrayChallengerGuidsVector.push_back(pSummoned->GetObjectGuid()); } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT: // Note: this should be moved to database pSummoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pSummoned->CastSpell(pSummoned, SPELL_SPOTLIGHT, TRIGGERED_NONE); m_vSpotLightsGuidVector.push_back(pSummoned->GetObjectGuid()); break; case NPC_SOLARIUM_AGENT: case NPC_SOLARIUM_PRIEST: if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER)) { pSummoned->AI()->AttackStart(pTarget); pSummoned->AddThreat(pTarget, 100000.f); // explicitly used in script without spell } break; } }
void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 /*uiMiscValue*/) override { // start XT phase switch and start recharging robots if (eventType == AI_EVENT_CUSTOM_A && pInvoker->GetEntry() == NPC_XT002) { // remove flags and previous vehicle aura before applying the new one m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pInvoker->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE); DoCastSpellIfCan(pInvoker, SPELL_RIDE_VEHICLE, CAST_TRIGGERED); DoCastSpellIfCan(pInvoker, SPELL_LIGHTNING_TETHER, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_HEART_OVERLOAD, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_EXPOSED_HEART, CAST_TRIGGERED); m_uiRobotTimer = 1000; // load the toy piles guids if (m_pInstance && m_vToyPileGuids.empty()) m_pInstance->GetToyPileGuids(m_vToyPileGuids); } }