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); if (lAssistList.empty()) return; 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) error_log("SSC: npc_anubisath_sentinel found too few/too many buddies, expected %u.", MAX_BUDDY); }
// TODO: Should this be moved into another file? GUIDList GetChannelGUIDs() { HKEY hkUpdateChannel = NULL; GUIDList retval; LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, CHANNEL_PATH, 0, KEY_READ, &hkUpdateChannel); if (ERROR_SUCCESS == error) { // Technically, the buffer can be smaller -- GUIDs are fixed length. DWORD bufSize = MAX_PATH; TCHAR szChannelGUID[MAX_PATH] = {0,}; DWORD dwIndex = 0; while (ERROR_SUCCESS == RegEnumKeyEx(hkUpdateChannel, dwIndex, szChannelGUID, &bufSize, NULL, NULL, NULL, NULL)) { retval.push_back(wstring(CT2CW(szChannelGUID))); *szChannelGUID = 0; bufSize = MAX_PATH; ++dwIndex; } } RegCloseKey(hkUpdateChannel); return retval; }
void JustSummoned(Creature* pSummoned) { // Add the Darkness and Singularity into the list m_lSummonedCreaturesList.push_back(pSummoned->GetObjectGuid()); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) return; if (m_uiMark_Count >= 100) if (m_uiEnrage_Timer < uiDiff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_BERSERK, true); m_uiEnrage_Timer = 300000; } else m_uiEnrage_Timer -= uiDiff; // Mark of Blaumeux if (m_uiMark_Timer < uiDiff) { DoCastSpellIfCan(m_creature,SPELL_MARK_OF_BLAUMEUX,CAST_TRIGGERED); m_uiMark_Timer = 15000; m_uiMark_Count++; } else m_uiMark_Timer -= uiDiff; // Shield Wall - All 4 horsemen will shield wall at 50% hp and 20% hp for 20 seconds if (m_bShieldWall1 && m_creature->GetHealthPercent() < 50.0f) { if (m_bShieldWall1) { DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL); m_bShieldWall1 = false; } } else if (m_bShieldWall2 && m_creature->GetHealthPercent() < 20.0f) { if (m_bShieldWall2) { DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL); m_bShieldWall2 = false; } } // Void Zone if (m_uiVoidZone_Timer < uiDiff) { // get random player in 45yard range (maybe this can be done easier?) ThreatList const& tList = m_creature->getThreatManager().getThreatList(); if(!tList.empty()) { GUIDList lClosePlayerList; lClosePlayerList.clear(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) if(Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) if (m_creature->GetDistance2d(pUnit) < 45.f) lClosePlayerList.push_back(pUnit->GetGUID()); if(!lClosePlayerList.empty()) { GUIDList::iterator i = lClosePlayerList.begin(); advance(i, (rand() % lClosePlayerList.size())); if(Player* pTarget = m_creature->GetMap()->GetPlayer(*i)) DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_VOIDZONE : H_SPELL_VOIDZONE, CAST_TRIGGERED); } } m_uiVoidZone_Timer = 12000; } else m_uiVoidZone_Timer -= uiDiff; if (m_uiShadowBolt_Timer < uiDiff) { // cast on closest player ThreatList const& tList = m_creature->getThreatManager().getThreatList(); if (!tList.empty()) { Unit* pTarget = m_creature->GetMap()->GetUnit((*tList.begin())->getUnitGuid()); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) if (pTarget && m_creature->GetDistance2d(pUnit) < m_creature->GetDistance2d(pTarget)) pTarget = pUnit; if (pTarget && m_creature->GetDistance2d(pTarget)< 45.0f) DoCast(pTarget, m_bIsRegularMode ? SPELL_SHADOW_BOLT : H_SPELL_SHADOW_BOLT, true); else DoCast(m_creature, SPELL_UNYIELDING_PAIN, true); } m_uiShadowBolt_Timer = 2000; } else m_uiShadowBolt_Timer -= uiDiff; DoMeleeAttackIfReady(); }
void JustSummoned(Creature* pSummoned) { m_luiDwarfGUIDs.push_back(pSummoned->GetObjectGuid()); pSummoned->AI()->AttackStart(m_creature); }