bool OnDummyApply(const Aura* pAura, bool bApply) override { if (pAura->GetId() != SPELL_TAG_MURLOC || pAura->GetEffIndex() != EFFECT_INDEX_0) { return true; } Creature* pCreature = (Creature*)pAura->GetTarget(); if (bApply) { if (pCreature->GetEntry() == NPC_BLACKSILT_MURLOC) { if (Unit* pCaster = pAura->GetCaster()) { pCaster->CastSpell(pCreature, SPELL_TAG_MURLOC_PROC, true); } } } else { if (pCreature->GetEntry() == NPC_TAGGED_MURLOC) { pCreature->ForcedDespawn(); } } return true; }
bool EffectAuraDummy_npc_beryl_sorcerer(const Aura* pAura, bool bApply) { if (pAura->GetId() == SPELL_ARCANE_CHAINS) { if (pAura->GetEffIndex() != EFFECT_INDEX_0 || !bApply) return false; Creature* pCreature = (Creature*)pAura->GetTarget(); Unit* pCaster = pAura->GetCaster(); if (!pCreature || !pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || pCreature->GetEntry() != NPC_BERYL_SORCERER) return false; // only for wounded creatures if (pCreature->GetHealthPercent() > 30.0f) return false; // spawn the captured sorcerer, apply dummy aura on the summoned and despawn pCaster->CastSpell(pCreature, SPELL_SUMMON_CHAINS_CHARACTER, true); pCaster->CastSpell(pCaster, SPELL_ARCANE_CHAINS_CHANNEL, true); pCreature->ForcedDespawn(); return true; } return false; }
void WorldSession::HandleDismissControlledVehicle(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Received CMSG_DISMISS_CONTROLLED_VEHICLE"); recv_data.hexlike(); MovementInfo movementInfo; recv_data >> movementInfo; if (!GetPlayer()->GetVehicle()) return; bool dismiss = true; Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(movementInfo.GetGuid()); if (!vehicle || !vehicle->IsVehicle() || !vehicle->GetVehicleKit() || !vehicle->GetEntry()) return; if (vehicle->GetVehicleKit()->GetEntry()->m_flags & (VEHICLE_FLAG_NOT_DISMISS | VEHICLE_FLAG_ACCESSORY)) dismiss = false; // Client freezes... if (vehicle->GetEntry() == 34812 || vehicle->GetEntry() == 34819 || vehicle->GetEntry() == 34822 || vehicle->GetEntry() == 34823 || vehicle->GetEntry() == 34824) dismiss = false; GetPlayer()->m_movementInfo = movementInfo; GetPlayer()->ExitVehicle(); if (dismiss) vehicle->ForcedDespawn(); }
void instance_pit_of_saron::OnCreatureDeath(Creature* pCreature) { switch (pCreature->GetEntry()) { case NPC_YMIRJAR_DEATHBRINGER: case NPC_YMIRJAR_WRATHBRINGER: case NPC_YMIRJAR_FLAMEBEARER: case NPC_FALLEN_WARRIOR: case NPC_COLDWRAITH: // Check for tunnel event end - these mobs are not summoned if (pCreature->IsTemporarySummon()) { m_lAmbushNpcsGuidList.remove(pCreature->GetObjectGuid()); // If empty start tunnel event if (m_lAmbushNpcsGuidList.empty()) { Creature* pTyrannus = GetSingleCreatureFromStorage(NPC_TYRANNUS_INTRO); if (!pTyrannus) return; DoScriptText(SAY_GAUNTLET, pTyrannus); pTyrannus->SetWalk(false); pTyrannus->GetMotionMaster()->MovePoint(0, afTyrannusMovePos[0][0], afTyrannusMovePos[0][1], afTyrannusMovePos[0][2]); pTyrannus->ForcedDespawn(20000); m_uiIciclesTimer = urand(3000, 5000); SetSpecialAchievementCriteria(TYPE_ACHIEV_DONT_LOOK_UP, true); } } break; } }
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) { DEBUG_LOG("WORLD: Received CMSG_DISMISS_CONTROLLED_VEHICLE"); recv_data.hexlike(); ObjectGuid guid; MovementInfo mi; recv_data >> guid.ReadAsPacked(); recv_data >> mi; if(!GetPlayer()->GetVehicle()) return; bool dismiss = true; Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(guid); if (!vehicle || !vehicle->GetVehicleInfo()) return; if (vehicle->GetVehicleInfo()->GetEntry()->m_flags & (VEHICLE_FLAG_NOT_DISMISS | VEHICLE_FLAG_ACCESSORY)) dismiss = false; GetPlayer()->m_movementInfo = mi; if (!vehicle->RemoveSpellsCausingAuraByCaster(SPELL_AURA_CONTROL_VEHICLE, GetPlayer()->GetObjectGuid())) GetPlayer()->ExitVehicle(); if (dismiss) vehicle->ForcedDespawn(); }
void instance_zulfarrak::OnPlayerDeath(Player * /*pPlayer*/) { //Wipe during pyramide event: reset! if (GetData(TYPE_PYRAMIDE) != IN_PROGRESS && GetData(TYPE_PYRAMIDE) != SPECIAL) return; Map::PlayerList const& L = instance->GetPlayers(); uint32 i = 0; for (Map::PlayerList::const_iterator itr = L.begin(); itr != L.end(); ++itr) { Player* P = itr->getSource(); if (!P || P->isDead() || !P->isAlive()) i++; } if (i < L.getSize()-1) return; //Reset Event SetData(TYPE_PYRAMIDE, NOT_STARTED); //despawn summons if (!m_uiPyramideTrash.empty()) { for(GUIDList::iterator itr = m_uiPyramideTrash.begin(); itr != m_uiPyramideTrash.end(); ++itr) { if (Creature* pTroll = instance->GetCreature(*itr)) { pTroll->ForcedDespawn(); pTroll->RemoveFromWorld(); } } } m_uiPyramideTrash.clear(); m_uiPyramideTrashTemp.clear(); m_uiWave = 0; m_uiCheckPyramideTrash_Timer = 15000; //Reset troll cages and prisoners so event can be restarted for (int i = 0; i < 5; i++) { m_uiPyramideNPCs[i].clear(); DoUseDoorOrButton(m_mGoEntryGuidStore[GO_TROLL_CAGE1+i],0,false); Creature* C = GetSingleCreatureFromStorage(NPC_SERGEANT_BLY+i); C->SetDeathState(JUST_DIED); C->Respawn(); C->setFaction(FACTION_FRIENDLY); } //Set respawn time of executioner Creature* C = GetSingleCreatureFromStorage(NPC_SANDFURY_EXECUTIONER); if (C && C->IsInWorld() && !C->isAlive()) { C->RemoveCorpse(); C->SetRespawnTime(35); C->SaveRespawnTime(); C->SetRespawnDelay(10 * 24 * 3600); } //Despawn Nekrum aswell C = GetSingleCreatureFromStorage(NPC_NEKRUM_GUTCHEWER); if (C && C->IsInWorld()) { C->ForcedDespawn(); C->RemoveFromWorld(); } }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { Creature* pCreatureTarget = pTarget->ToCreature(); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_COMPLETE_IMMOLATION, true); pCreatureTarget->SetStandState(UNIT_STAND_STATE_DEAD); pCreatureTarget->ForcedDespawn(10000); return true; }
void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); if (m_pInstance) { m_pInstance->SetData(TYPE_THADDIUS, DONE); // Force Despawn of Adds Creature* pFeugen = m_pInstance->GetSingleCreatureFromStorage(NPC_FEUGEN); Creature* pStalagg = m_pInstance->GetSingleCreatureFromStorage(NPC_STALAGG); if (pFeugen) pFeugen->ForcedDespawn(); if (pStalagg) pStalagg->ForcedDespawn(); } }
void instance_uldaman::SetData(uint32 uiType, uint32 uiData) { switch (uiType) { case TYPE_ALTAR_EVENT: if (uiData == DONE) { DoUseDoorOrButton(GO_TEMPLE_DOOR_UPPER); DoUseDoorOrButton(GO_TEMPLE_DOOR_LOWER); m_auiEncounter[0] = uiData; } break; case TYPE_ARCHAEDAS: if (uiData == FAIL) { for (GuidList::const_iterator itr = m_lWardens.begin(); itr != m_lWardens.end(); ++itr) { if (Creature* pWarden = instance->GetCreature(*itr)) { pWarden->SetDeathState(JUST_DIED); pWarden->Respawn(); pWarden->SetNoCallAssistance(true); } } } else if (uiData == DONE) { for (GuidList::const_iterator itr = m_lWardens.begin(); itr != m_lWardens.end(); ++itr) { Creature* pWarden = instance->GetCreature(*itr); if (pWarden && pWarden->isAlive()) pWarden->ForcedDespawn(); } DoUseDoorOrButton(GO_ANCIENT_VAULT); } m_auiEncounter[1] = uiData; break; } if (uiData == DONE) { OUT_SAVE_INST_DATA; std::ostringstream saveStream; saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1]; m_strInstData = saveStream.str(); SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } }
void PhaseChange() { if (m_uiPhase == PHASE_SINGLE) { if (m_creature->GetHealthPercent() <= float(25*m_uiPhaseCounter)) { if (!m_uiPhaseCounter) { // final phase m_uiPhase = PHASE_FINAL; m_uiFrenzyTimer = 16*IN_MILLISECONDS; m_uiSaberLashTimer = 20*IN_MILLISECONDS; } else { m_uiPhase = PHASE_TOTEM; m_uiShockTimer = 10*IN_MILLISECONDS; m_uiTotemTimer = 12*IN_MILLISECONDS; DoScriptText(SAY_SPLIT, m_creature); m_creature->CastSpell(m_creature, SPELL_TRANSFIGURE_TO_TROLL, false); } } } else { Creature* pSpiritLynx = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SPIRIT_LYNX)); if (m_creature->GetHealthPercent() < 10.0f || (pSpiritLynx && pSpiritLynx->GetHealthPercent() < 10.0f)) { m_uiPhase = PHASE_SINGLE; DoScriptText(SAY_MERGE, m_creature); uint32 uiSpellId; switch(m_uiPhaseCounter) { case 3: uiSpellId = SPELL_TRANSFORM_TO_LYNX_75; break; case 2: uiSpellId = SPELL_TRANSFORM_TO_LYNX_50; break; case 1: uiSpellId = SPELL_TRANSFORM_TO_LYNX_25; break; } m_creature->CastSpell(m_creature, uiSpellId, false); if (pSpiritLynx) pSpiritLynx->ForcedDespawn(); m_uiFrenzyTimer = 16*IN_MILLISECONDS; m_uiSaberLashTimer = 20*IN_MILLISECONDS; } } }
void DespawnAdds() { if (m_pInstance->lGothikDeathAdds.empty()) return; for(std::list<uint64>::iterator itr = m_pInstance->lGothikDeathAdds.begin(); itr != m_pInstance->lGothikDeathAdds.end(); ++itr) { Creature* pDeathAdds = m_pInstance->instance->GetCreature((*itr)); if (pDeathAdds && pDeathAdds->isAlive()) pDeathAdds->ForcedDespawn(20000); } m_pInstance->lGothikDeathAdds.clear(); for(std::list<uint64>::iterator itr = m_pInstance->lGothikLiveAdds.begin(); itr != m_pInstance->lGothikLiveAdds.end(); ++itr) { Creature* pLiveAdds = m_pInstance->instance->GetCreature((*itr)); if (pLiveAdds && pLiveAdds->isAlive()) pLiveAdds->ForcedDespawn(20000); } m_pInstance->lGothikLiveAdds.clear(); }
void JustReachedHome() { if (m_pInstance) { m_pInstance->SetData(TYPE_THADDIUS, FAIL); // Respawn Adds: Creature* pFeugen = m_pInstance->GetSingleCreatureFromStorage(NPC_FEUGEN); Creature* pStalagg = m_pInstance->GetSingleCreatureFromStorage(NPC_STALAGG); if (pFeugen) { pFeugen->ForcedDespawn(); pFeugen->Respawn(); } if (pStalagg) { pStalagg->ForcedDespawn(); pStalagg->Respawn(); } } }
void DespawnDwarf() { if (lDwarfGUIDList.empty()) return; for (std::list<uint64>::iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) { Creature* pTemp = Unit::GetCreature(*m_creature, pInstance ? (*itr) : 0); if (pTemp && pTemp->isAlive()) pTemp->ForcedDespawn(); } lDwarfGUIDList.clear(); }
int32 NextStep(uint32 Steps) { if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) { Creature* Taretha = (Unit::GetCreature(*me, TarethaGUID)); Creature* Image = me->GetMap()->GetCreature(ImageGUID); switch (Steps) { case 1: return 15000; case 2: DoScriptText(SAY_TR_GLAD_SAFE, me); return 10000; case 3: DoScriptText(SAY_TA_NEVER_MET, Taretha); return 10000; case 4: DoScriptText(SAY_TR_THEN_WHO, me); return 5000; case 5: me->SummonCreature(NPC_EROZION, 2648.47f, 684.43f, 55.713f, 3.86f, TEMPSUMMON_TIMED_DESPAWN, 300000); return 5000; case 6: Image->CastSpell(Image, SPELL_MEMORY_WIPE, false); return 5000; case 7: DoScriptText(SAY_WIPE_MEMORY, Image); return 10000; case 8: DoScriptText(SAY_ABOUT_TARETHA, Image); return 5000; case 9: Image->CastSpell(Image, SPELL_MEMORY_WP_RESUME, false); DoScriptText(SAY_TH_EVENT_COMPLETE, me); return 6000; case 10: Taretha->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); DoScriptText(SAY_TA_FAREWELL, Taretha); SetEscortPaused(false); QuestCredit(); return 3000; case 11: Taretha->SetWalk(true); Taretha->GetMotionMaster()->MovePoint(0, 2639.96f, 703.66f, 56.056f); Taretha->ForcedDespawn(11000); default: return 0; } } return true; }
void DespawnZombies() { if (lZombies.empty()) return; for (GUIDList::iterator itr = lZombies.begin(); itr != lZombies.end(); ++itr) { Creature* pZombie = m_creature->GetMap()->GetCreature(*itr); if (pZombie && pZombie->isAlive()) pZombie->ForcedDespawn(); } lZombies.clear(); }
void DespawnAllMinions() { if(!MinionList.empty()) { for(std::list<uint64>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) { Creature *Minion = Unit::GetCreature(*m_creature, *itr); if(Minion && Minion->isAlive()) Minion->ForcedDespawn(); } } MinionList.clear(); }
void UnsummonNPC() { if (summoned) { Creature* ChampionRosSlai = Unit::GetCreature((*me), ChampionRosSlaiGUID); if (ChampionRosSlai) { ChampionRosSlai->ForcedDespawn(); ChampionRosSlaiGUID = 0; } summoned = false; } }
void UnsummonNPC() { if (summoned) { Creature* MarshalMagruder = Unit::GetCreature((*me), MarshalMagruderGUID); if (MarshalMagruder) { MarshalMagruder->ForcedDespawn(); MarshalMagruderGUID = 0; } summoned = false; } }
void EnterEvadeMode() { if (m_pInstance) { m_pInstance->SetData(TYPE_THADDIUS, FAIL); // Respawn Adds: Creature* pFeugen = m_pInstance->GetSingleCreatureFromStorage(NPC_FEUGEN); Creature* pStalagg = m_pInstance->GetSingleCreatureFromStorage(NPC_STALAGG); if (pFeugen) { pFeugen->ForcedDespawn(); pFeugen->Respawn(); } if (pStalagg) { pStalagg->ForcedDespawn(); pStalagg->Respawn(); } } // Reset m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Delay reloading of CreatureAddon until Reached home for proper handling // Also note that m_creature->LoadCreatureAddon(); must _not_ be called before m_creature->GetMotionMaster()->MoveTargetedHome(); // Done this way, because MoveTargetHome ensures proper positioning (orientation) m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->SetLootRecipient(NULL); Reset(); }
void DespawnEssences() { Creature* pEssence = NULL; if (SufferingGUID) pEssence = (Creature*)Unit::GetUnit((*m_creature), SufferingGUID); else if (DesireGUID) pEssence = (Creature*)Unit::GetUnit((*m_creature), DesireGUID); else if (AngerGUID) pEssence = (Creature*)Unit::GetUnit((*m_creature), AngerGUID); if (pEssence && pEssence->isAlive()) pEssence->ForcedDespawn(); }
void JustReachedHome() { if (m_pInstance) m_pInstance->SetData(TYPE_SAPPHIRON, FAIL); DoCastSpellIfCan(m_creature, SPELL_DEACTIVATE_BLIZZARD, CAST_TRIGGERED); Creature* pWingBuffet = m_creature->GetMap()->GetCreature(m_uiWingBuffetGuid); if (pWingBuffet && pWingBuffet->isAlive()) pWingBuffet->ForcedDespawn(); // after server crash m_creature->RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)); m_creature->SetVisibility(VISIBILITY_ON); }
bool OnGossipHello(Player* pPlayer, GameObject* pGO) { Creature* pTyralius = pGO->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f); if(pTyralius) { pGO->UseDoorOrButton(); if(pPlayer) pPlayer->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0); pTyralius->AI()->Talk(SAY_FREE); pTyralius->ForcedDespawn(8000); } return true; }
void EnterCombat(Unit* pWho) { if (!pInstance) return; if (pWho->GetTypeId() != TYPEID_PLAYER) return; if (pDummyTarget) pDummyTarget->ForcedDespawn(); SetEquipmentSlots(false, EQUIP_MAIN, EQUIP_OFFHAND, EQUIP_RANGED); inCombat = true; me->InterruptNonMeleeSpells(true); SetCombatMovement(true); pInstance->SetData(TYPE_BALTHARUS, IN_PROGRESS); DoScriptText(-1666300,me); }
void MoveInLineOfSight(Unit* pWho) { // Despawn Time Keeper if (pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_TIME_KEEPER) { if (m_creature->IsWithinDistInMap(pWho,20.0f)) { Creature* pTimeKeeper = (Creature*)pWho; pTimeKeeper->ForcedDespawn(); DoScriptText(SAY_BANISH, m_creature); } } ScriptedAI::MoveInLineOfSight(pWho); }
//Despawn all Inner Demon summoned void DespawnDemon() { for (uint8 i = 0; i < 5; ++i) { if (InnderDemon[i]) { //delete creature Creature* pCreature = Unit::GetCreature((*me), InnderDemon[i]); if (pCreature && pCreature->IsAlive()) pCreature->ForcedDespawn(); InnderDemon[i] = 0; } } InnerDemon_Count = 0; }
void instance_onyxias_lair::OnCreatureDeath(Creature* pCreature) { switch (pCreature->GetEntry()) { case NPC_ONYXIA: if(!m_uiOnyxianWarderGuids.empty()) { for (std::list<ObjectGuid>::iterator itr = m_uiOnyxianWarderGuids.begin(); itr != m_uiOnyxianWarderGuids.end(); ++itr) { Creature* pWarder = instance->GetCreature(*itr); if (pWarder) pWarder->ForcedDespawn(); } } break; } }
void EnterCombat(Unit* pWho) { if (!pInstance) return; if (pWho->GetTypeId() != TYPEID_PLAYER) return; if (pDummyTarget) pDummyTarget->ForcedDespawn(); inCombat = true; DoCast(SPELL_LLAMAR); me->Attack(me, LISA); me->FindNearestCreature(LISA, 7.0f, true); DoCast(SPELL_LLAMAR); m_uiLlamarTimer = 1*IN_MILLISECONDS; me->InterruptNonMeleeSpells(true); SetCombatMovement(true); pInstance->SetData(DATA_BRUTALLUS_EVENT2, IN_PROGRESS); DoScriptText(-1580022,me); }
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/) { Creature* target = player->FindNearestCreature(NPC_RAVENOUS_JAWS_KILL_CREDIT, 10.0f, true); Creature* shark = player->FindNearestCreature(NPC_RAVENOUS_JAWS,10.0f,false); if(target && target->isAlive()) { player->Kill(target); player->KilledMonsterCredit(target->GetEntry(),target->GetGUID()); } else return false; if(shark) { shark->ForcedDespawn(0); } else return false; return true; }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { if (uiEffIndex == EFFECT_INDEX_0) { Creature *pCreatureTarget = pTarget->ToCreature(); if (!pCreatureTarget || pCreatureTarget->GetEntry() != NPC_SMOLDERING_SCRAP_BUNNY) return true; if (GameObject* pScrap = GetClosestGameObjectWithEntry(pCreatureTarget, GO_SMOLDERING_SCRAP, 5.0f)) { if (pScrap->GetRespawnTime() != 0) return true; pCreatureTarget->CastSpell(pCreatureTarget, SPELL_FROZEN_IRON_SCRAP, true); pScrap->SetLootState(GO_JUST_DEACTIVATED); pCreatureTarget->ForcedDespawn(1000); } } return true; }
bool OnDummyApply(const Aura* pAura, bool bApply) override { if (pAura->GetId() != SPELL_HEALING_SALVE_DUMMY || pAura->GetEffIndex() != EFFECT_INDEX_0) { return true; } if (!bApply) { Creature* pCreature = (Creature*)pAura->GetTarget(); pCreature->UpdateEntry(NPC_MAGHAR_GRUNT); if (pCreature->getStandState() == UNIT_STAND_STATE_KNEEL) { pCreature->SetStandState(UNIT_STAND_STATE_STAND); } pCreature->ForcedDespawn(60 * IN_MILLISECONDS); } return true; }