void SpawnAdds(GuidList& List, uint32 uiEntry) { if (Creature* pSummon = m_creature->SummonCreature(uiEntry, SpawnNode[7][0], SpawnNode[7][1], SpawnNode[7][2], 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0)) { uint8 uiPoint = urand(0, 2); float x,y,z; x = SpawnNode[uiPoint][0] -5 + urand(0, 10); y = SpawnNode[uiPoint][1] -5 + urand(0, 10); z = SpawnNode[uiPoint][2]; pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pSummon->GetMotionMaster()->MovePoint(uiPoint, x, y, z); List.push_back(pSummon->GetObjectGuid()); } if (Creature* pSummon = m_creature->SummonCreature(uiEntry, SpawnNode[6][0], SpawnNode[6][1], SpawnNode[6][2], 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0)) { uint8 uiPoint = urand(3, 5); float x,y,z; x = SpawnNode[uiPoint][0] -5 + urand(0, 10); y = SpawnNode[uiPoint][1] -5 + urand(0, 10); z = SpawnNode[uiPoint][2]; pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pSummon->GetMotionMaster()->MovePoint(uiPoint, x, y, z); List.push_back(pSummon->GetObjectGuid()); } }
void DoSummonGuards() { // 4 adds if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[3][0], fPositions[3][1], fPositions[3][2], fPositions[3][3], TEMPSUMMON_MANUAL_DESPAWN, 0)) m_lGuards.push_back(pTmp->GetObjectGuid()); if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[4][0], fPositions[4][1], fPositions[4][2], fPositions[4][3], TEMPSUMMON_MANUAL_DESPAWN, 0)) m_lGuards.push_back(pTmp->GetObjectGuid()); if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[5][0], fPositions[5][1], fPositions[5][2], fPositions[5][3], TEMPSUMMON_MANUAL_DESPAWN, 0)) m_lGuards.push_back(pTmp->GetObjectGuid()); if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[6][0], fPositions[6][1], fPositions[6][2], fPositions[6][3], TEMPSUMMON_MANUAL_DESPAWN, 0)) m_lGuards.push_back(pTmp->GetObjectGuid()); }
void JustSummoned(Creature* pSummoned) override { pSummoned->CastSpell(pSummoned, SPELL_FLAME_SPHERE_SPAWN_EFFECT, true); pSummoned->CastSpell(pSummoned, SPELL_FLAME_SPHERE_VISUAL, true); m_lFlameOrbsGuidList.push_back(pSummoned->GetObjectGuid()); }
void Reset() override { DoCastSpellIfCan(m_creature, SPELL_SNEAK); // Do only once, and only for those summoned by Arlokk if (m_bMoveToAid) { // Add to GUID list to despawn later m_lProwlerGUIDList.push_back(m_creature->GetObjectGuid()); // Count the number of prowlers alive uint32 count = 0; for (GuidList::const_iterator itr = m_lProwlerGUIDList.begin(); itr != m_lProwlerGUIDList.end(); ++itr) { if (Unit* pProwler = m_creature->GetMap()->GetUnit(*itr)) if (pProwler->isAlive()) count++; } // Check if more than 40 are alive, if so, despawn if (count > 40) { m_creature->ForcedDespawn(); return; } m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MovePoint(1, aArlokkWallShieldPos[0], aArlokkWallShieldPos[1], aArlokkWallShieldPos[2]); m_bMoveToAid = false; } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_HIGH_EXECUTIONER_NUZARK: m_nuzarkGuid = pSummoned->GetObjectGuid(); break; case NPC_SHADOW_OF_LEXLORT: m_lexlortGuid = pSummoned->GetObjectGuid(); break; case NPC_SEARSCALE_DRAKE: // If it's the flying drake allow him to move in circles if (m_bIsFirstSearScale) { m_bIsFirstSearScale = false; pSummoned->SetLevitate(true); // ToDo: this guy should fly in circles above the creature } m_lSearscaleGuidList.push_back(pSummoned->GetObjectGuid()); break; default: // The hostile mobs should attack the player only if (Player* pPlayer = GetPlayerForEscort()) pSummoned->AI()->AttackStart(pPlayer); break; } }
void JustSummoned(Creature* pSummoned) override { // Also remove npc flags where needed switch (pSummoned->GetEntry()) { case NPC_FANDRAL_STAGHELM: m_fandralGuid = pSummoned->GetObjectGuid(); break; case NPC_MERITHRA_OF_THE_DREAM: m_merithraGuid = pSummoned->GetObjectGuid(); pSummoned->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); break; case NPC_CAELESTRASZ: m_CaelestraszGuid = pSummoned->GetObjectGuid(); pSummoned->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); break; case NPC_ARYGOS: m_arygosGuid = pSummoned->GetObjectGuid(); pSummoned->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); break; case NPC_ANUBISATH_CONQUEROR: case NPC_QIRAJI_WASP: case NPC_QIRAJI_DRONE: case NPC_QIRAJI_TANK: case NPC_KALDOREI_INFANTRY: m_lQirajiWarriorsList.push_back(pSummoned->GetObjectGuid()); break; } }
/** Checks que main queue to try to form a Lfg group. Returns first match found (if any) @param[in] check List of guids trying to match with other groups @param[in] all List of all other guids in main queue to match against @return LfgCompatibility type of compatibility between groups */ LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all) { std::string strGuids = ConcatenateGuids(check); LfgCompatibility compatibles = GetCompatibles(strGuids); TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str()); if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate compatibles = CheckCompatibility(check); if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check)) { TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH); return LFG_COMPATIBLES_MATCH; } if (compatibles != LFG_COMPATIBLES_WITH_LESS_PLAYERS) return compatibles; // Try to match with queued groups while (!all.empty()) { check.push_back(all.front()); all.pop_front(); LfgCompatibility subcompatibility = FindNewGroups(check, all); if (subcompatibility == LFG_COMPATIBLES_MATCH) return LFG_COMPATIBLES_MATCH; check.pop_back(); } return compatibles; }
Unit* SelectTargetWithinDist() { ThreatList const& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return NULL; GuidList distPositive; for (ThreatList::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) { if (Unit* pTemp = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { //player within 80 yards if ((pTemp->GetTypeId() == TYPEID_PLAYER && !m_creature->IsWithinDist(pTemp, 10.0f) && m_creature->IsWithinDist(pTemp, 80.0f))) distPositive.push_back(pTemp->GetObjectGuid()); } } if (!distPositive.empty()) { GuidList::iterator m_uiPlayerGUID = distPositive.begin(); advance(m_uiPlayerGUID, (rand()%distPositive.size())); if (Player* pTemp = m_creature->GetMap()->GetPlayer(*m_uiPlayerGUID)) return pTemp; } return NULL; }
void InitSentinelsNear(Unit* pTarget) { if (!m_lAssistList.empty()) { for (GuidList::const_iterator itr = m_lAssistList.begin(); itr != m_lAssistList.end(); ++itr) { if (*itr == m_creature->GetObjectGuid()) continue; if (Creature* pBuddy = m_creature->GetMap()->GetCreature(*itr)) { if (pBuddy->isAlive()) pBuddy->AI()->AttackStart(pTarget); } } return; } std::list<Creature*> lAssistList; GetCreatureListWithEntryInGrid(lAssistList, m_creature, m_creature->GetEntry(), 80.0f); for (std::list<Creature*>::iterator iter = lAssistList.begin(); iter != lAssistList.end(); ++iter) { m_lAssistList.push_back((*iter)->GetObjectGuid()); if ((*iter)->GetObjectGuid() == m_creature->GetObjectGuid()) continue; (*iter)->AI()->AttackStart(pTarget); } if (m_lAssistList.size() != MAX_BUDDY) script_error_log("npc_anubisath_sentinel for %s found too few/too many buddies, expected %u.", m_creature->GetGuidStr().c_str(), MAX_BUDDY); }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_TWILIGHT_VOLUNTEER) { pSummoned->SetWalk(false); pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_6); m_lVolunteerGuidList.push_back(pSummoned->GetObjectGuid()); } }
void PrepareSummonPlaces() { CreatureList lSummonList; m_pInstance->GetGothSummonPointCreatures(lSummonList, true); if (lSummonList.empty()) return; // Trainees and Rider uint8 index = 0; uint8 uiTraineeCount = 3; lSummonList.sort(ObjectDistanceOrder(m_creature)); for (auto& itr : lSummonList) { if (itr) { if (uiTraineeCount == 0) break; if (index == 1) m_lRiderSummonPosGuids.push_back(itr->GetObjectGuid()); else { m_lTraineeSummonPosGuids.push_back(itr->GetObjectGuid()); --uiTraineeCount; } index++; } } // DeathKnights uint8 uiDeathKnightCount = 2; lSummonList.sort(ObjectDistanceOrderReversed(m_creature)); for (auto& itr : lSummonList) { if (itr) { if (uiDeathKnightCount == 0) break; m_lDeathKnightSummonPosGuids.push_back(itr->GetObjectGuid()); --uiDeathKnightCount; } } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) { m_lGolemGUIDList.push_back(pSummoned->GetObjectGuid()); if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_WALKING_BOMB) { m_lSummonedBombGUIDs.push_back(pSummoned->GetObjectGuid()); // calculate point for falling down float fX, fY; fX = 0.2 * m_afSpawnPos[0] + 0.8 * pSummoned->GetPositionX(); fY = 0.2 * m_afSpawnPos[1] + 0.8 * pSummoned->GetPositionY(); pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, m_afSpawnPos[2] - 2.0f); } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_GLOB_OF_VISCIDUS) { float fX, fY, fZ; m_creature->GetRespawnCoord(fX, fY, fZ); pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ); m_lGlobesGuidList.push_back(pSummoned->GetObjectGuid()); } else if (pSummoned->GetEntry() == NPC_VISCIDUS_TRIGGER) pSummoned->CastSpell(pSummoned, SPELL_TOXIN, TRIGGERED_OLD_TRIGGERED); }
void JustSummoned(Creature* pCreature) override { m_lSummonedAddsGuids.push_back(pCreature->GetObjectGuid()); if (pCreature->GetEntry() == NPC_SUPPRESSER) pCreature->FixateTarget(m_creature); else { pCreature->AddThreat(m_creature, 5000); pCreature->AI()->AttackStart(m_creature); } pCreature->SetInCombatWithZone(); }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) { pSummoned->CastSpell(pSummoned, m_bIsRegularMode ? SPELL_SPARK_VISUAL_TRIGGER_N : SPELL_SPARK_VISUAL_TRIGGER_H, true); if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); m_lSparkGUIDList.push_back(pSummoned->GetObjectGuid()); } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_IRONTREE_STOMPER: DoScriptText(SAY_EXIT_WOODS, m_creature, pSummoned); // no break; case NPC_IRONTREE_WANDERER: pSummoned->AI()->AttackStart(m_creature); m_lSummonsGuids.push_back(pSummoned->GetObjectGuid()); break; } }
void JustSummoned(Creature* summoned) override { if (summoned->GetEntry() == NPC_MOLTEN_GOLEM) { m_lGolemGUIDList.push_back(summoned->GetGUID()); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) summoned->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); // Why healing when just summoned? summoned->CastSpell(summoned, SPELL_HEAT, false, NULL, NULL, me->GetGUID()); } }
void SendAddsUpStairs(uint32 count) { //pop a add from list, send him up the stairs... for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++) { if (Creature* add = instance->GetCreature(*addsAtBase.begin())) { add->GetMotionMaster()->MovePath(PATH_ADDS, false); movedadds.push_back(add->GetGUID()); } addsAtBase.erase(addsAtBase.begin()); } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_BROOD_OF_ANZU) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } else { DoScriptText(EMOTE_BIRD_STONE, pSummoned); m_lBirdsGuidList.push_back(pSummoned->GetObjectGuid()); } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_FLAMEWAKER_HEALER || pSummoned->GetEntry() == NPC_FLAMEWAKER_ELITE) { m_luiMajordomoAddsGUIDs.push_back(pSummoned->GetObjectGuid()); pSummoned->SetRespawnDelay(2 * HOUR); } else if (pSummoned->GetEntry() == NPC_RAGNAROS) { m_ragnarosGuid = pSummoned->GetObjectGuid(); pSummoned->CastSpell(pSummoned, SPELL_RAGNA_EMERGE, TRIGGERED_NONE); } }
void SpawnPyramidWave(uint32 wave) { for (int i = 0; i < pyramidSpawnTotal; i++) { if (pyramidSpawns[i][0] == (float)wave) { Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87f, 0}; TempSummon* ts = instance->SummonCreature(uint32(pyramidSpawns[i][1]), pos); ts->GetMotionMaster()->MoveRandom(10); addsAtBase.push_back(ts->GetGUID()); } } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_INJURED_PEASANT: case NPC_PLAGUED_PEASANT: float fX, fY, fZ; pSummoned->GetRandomPoint(aPeasantMoveLoc[0], aPeasantMoveLoc[1], aPeasantMoveLoc[2], 10.0f, fX, fY, fZ); pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ); m_lSummonedGuidList.push_back(pSummoned->GetObjectGuid()); break; case NPC_SCOURGE_FOOTSOLDIER: case NPC_THE_CLEANER: if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) pSummoned->AI()->AttackStart(pPlayer); break; case NPC_SCOURGE_ARCHER: // ToDo: make these ones attack the peasants break; } m_lSummonedGuidList.push_back(pSummoned->GetObjectGuid()); }
void JustSummoned(Creature* pSummoned) override { if (!m_pInstance) return; // Ring mob or boss summoned float fX, fY, fZ; float fcX, fcY, fcZ; m_pInstance->GetArenaCenterCoords(fX, fY, fZ); m_creature->GetRandomPoint(fX, fY, fZ, 10.0f, fcX, fcY, fcZ); pSummoned->GetMotionMaster()->MovePoint(1, fcX, fcY, fcZ); m_lSummonedGUIDList.push_back(pSummoned->GetObjectGuid()); }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_ASH_SORCERER: { pSummoned->SetWalk(false); m_lSorcerersGUIDList.push_back(pSummoned->GetObjectGuid()); float fX, fY, fZ; if (m_pInstance) { if (Creature* pShade = m_pInstance->GetSingleCreatureFromStorage(NPC_SHADE_OF_AKAMA)) { pShade->GetNearPoint(pShade, fX, fY, fZ, 0, 20.0f, pShade->GetAngle(pSummoned)); pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ); } } break; } case NPC_ASH_BROKEN: { float fX, fY, fZ; m_lBrokenGUIDList.push_back(pSummoned->GetObjectGuid()); m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, 30.0f, m_creature->GetAngle(pSummoned)); pSummoned->GetMotionMaster()->MovePoint(0, fX, fY, fZ); break; } case NPC_ASH_DEFENDER: pSummoned->AI()->AttackStart(m_creature); break; default: pSummoned->SetInCombatWithZone(); break; } }
void npc_doctorAI::UpdateAI(const uint32 uiDiff) { if (m_bIsEventInProgress && m_uiSummonPatientCount >= 20) { Reset(); return; } if (m_bIsEventInProgress && !m_vPatientSummonCoordinates.empty()) { if (m_uiSummonPatientTimer < uiDiff) { std::vector<Location*>::iterator itr = m_vPatientSummonCoordinates.begin() + urand(0, m_vPatientSummonCoordinates.size() - 1); uint32 patientEntry = 0; switch (m_creature->GetEntry()) { case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[urand(0, 2)]; break; case DOCTOR_HORDE: patientEntry = HordeSoldierId[urand(0, 2)]; break; default: script_error_log("Invalid entry for Triage doctor. Please check your database"); return; } if (Creature* Patient = m_creature->SummonCreature(patientEntry, (*itr)->x, (*itr)->y, (*itr)->z, (*itr)->o, TEMPSUMMON_TIMED_OOC_DESPAWN, 5000)) { // 2.4.3, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); m_lPatientGuids.push_back(Patient->GetObjectGuid()); if (npc_injured_patientAI* pPatientAI = dynamic_cast<npc_injured_patientAI*>(Patient->AI())) { pPatientAI->m_doctorGuid = m_creature->GetObjectGuid(); pPatientAI->m_pCoord = *itr; m_vPatientSummonCoordinates.erase(itr); } } m_uiSummonPatientTimer = 10000; ++m_uiSummonPatientCount; } else m_uiSummonPatientTimer -= uiDiff; } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_EYE_TENTACLE: m_lEyeTentaclesList.push_back(pSummoned->GetObjectGuid()); // no break; case NPC_CLAW_TENTACLE: if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); pSummoned->SummonCreature(NPC_TENTACLE_PORTAL, pSummoned->GetPositionX(), pSummoned->GetPositionY(), pSummoned->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 0); break; } }
void JustSummoned(Creature* pSummoned) override { if (pSummoned->GetEntry() == NPC_FRENZIED_BAT) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } else if (pSummoned->GetEntry() == NPC_BAT_RIDER) { pSummoned->CastSpell(pSummoned, SPELL_LIQUID_FIRE, TRIGGERED_OLD_TRIGGERED); m_lBombRiderGuidsList.push_back(pSummoned->GetObjectGuid()); } pSummoned->SetLevitate(true); }
void JustSummoned(Creature* pSummoned) override { // store the swarmers for a future attack if (pSummoned->GetEntry() == NPC_SWARMER) m_lSwarmersGuidList.push_back(pSummoned->GetObjectGuid()); // move the larva to paralyze target position else if (pSummoned->GetEntry() == NPC_LARVA) { pSummoned->SetWalk(false); pSummoned->GetMotionMaster()->MovePoint(1, aAyamissSpawnLocs[3].m_fX, aAyamissSpawnLocs[3].m_fY, aAyamissSpawnLocs[3].m_fZ); } else if (pSummoned->GetEntry() == NPC_HORNET) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) pSummoned->AI()->AttackStart(pTarget); } }
void JustSummoned(Creature* pSummoned) override { switch (pSummoned->GetEntry()) { case NPC_TYRANDE_WHISPERWIND: m_tyrandeGuid = pSummoned->GetObjectGuid(); pSummoned->SetWalk(false); pSummoned->GetMotionMaster()->MovePoint(POINT_ID_TYRANDE_HEAL, aTyrandeLocations[1].m_fX, aTyrandeLocations[1].m_fY, aTyrandeLocations[1].m_fZ); break; case NPC_ELUNE_PRIESTESS: m_lPriestessList.push_back(pSummoned->GetObjectGuid()); float fX, fY, fZ; pSummoned->SetWalk(false); m_creature->GetRandomPoint(aTyrandeLocations[1].m_fX, aTyrandeLocations[1].m_fY, aTyrandeLocations[1].m_fZ, 10.0f, fX, fY, fZ); pSummoned->GetMotionMaster()->MovePoint(POINT_ID_TYRANDE_HEAL, fX, fY, fZ); break; } }