void Cleanup(Creature *infernal, InfernalPoint *point) { for(GUIDVector::iterator itr = m_vInfernalGuids.begin(); itr!= m_vInfernalGuids.end(); ++itr) if (*itr == infernal->GetObjectGuid()) { m_vInfernalGuids.erase(itr); break; } m_positions.push_back(point); }
// players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... void CastGravityLapseFly() { GUIDVector vGuids; m_creature->FillGuidsListFromThreatList(vGuids.getSource()); for (GUIDVector::const_iterator i = vGuids.begin();i != vGuids.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit(*i); // Also needs an exception in spell system. if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, m_creature->GetObjectGuid()); } }
void TeleportPlayersToSelf() { DoCastSpellIfCan(m_creature, SPELL_TELEPORT_CENTER, CAST_TRIGGERED); GUIDVector vGuids; m_creature->FillGuidsListFromThreatList(vGuids.getSource()); for (GUIDVector::const_iterator i = vGuids.begin();i != vGuids.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit(*i); if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); } }
void InfernalCleanup() { // Infernal Cleanup for(GUIDVector::const_iterator itr = m_vInfernalGuids.begin(); itr!= m_vInfernalGuids.end(); ++itr) { Creature *pInfernal = m_creature->GetMap()->GetCreature(*itr); if (pInfernal && pInfernal->isAlive()) { pInfernal->SetVisibility(VISIBILITY_OFF); pInfernal->SetDeathState(JUST_DIED); } } m_vInfernalGuids.clear(); }
void RemoveGravityLapse() { GUIDVector vGuids; m_creature->FillGuidsListFromThreatList(vGuids.getSource()); for (GUIDVector::const_iterator i = vGuids.begin();i != vGuids.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit(*i); if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) { pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); } } }
void JustSummoned(Creature* pSummoned) { 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 SummonInfernal() { InfernalPoint *point = NULL; float posX,posY,posZ; if ((m_creature->GetMapId() != 532) || m_positions.empty()) { m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 60, posX, posY, posZ); } else { std::vector<InfernalPoint*>::iterator itr = m_positions.begin()+rand()%m_positions.size(); point = *itr; m_positions.erase(itr); posX = point->x; posY = point->y; posZ = INFERNAL_Z; } Creature *Infernal = m_creature->SummonCreature(NETHERSPITE_INFERNAL, posX, posY, posZ, 0, TEMPSUMMON_TIMED_DESPAWN, 180000); if (Infernal) { Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); Infernal->setFaction(m_creature->getFaction()); netherspite_infernalAI* pInfernalAI = dynamic_cast<netherspite_infernalAI*>(Infernal->AI()); if (pInfernalAI) { if (point) pInfernalAI->pPoint = point; pInfernalAI->m_malchezaarGuid = m_creature->GetObjectGuid(); } m_vInfernalGuids.push_back(Infernal->GetObjectGuid()); DoCastSpellIfCan(Infernal, SPELL_INFERNAL_RELAY); } DoScriptText(urand(0, 1) ? SAY_SUMMON1 : SAY_SUMMON2, m_creature); }
// Note: this should be done by creature linkin in core void DoDespawnAdds() { for (GUIDVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr) { if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) pTemp->ForcedDespawn(); } m_vAddGuids.clear(); for (GUIDVector::const_iterator itr = m_vAssassinGuids.begin(); itr != m_vAssassinGuids.end(); ++itr) { if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) pTemp->ForcedDespawn(); } m_vAssassinGuids.clear(); }