void EnterCombat(Unit* u) { if (!pInstance) return; me->CastSpell(me, SPELL_GATHERING_DOUBT, false); events.ScheduleEvent(EVENT_GATHERING_DOUBT, 1000); events.ScheduleEvent(EVENT_SIPHON_ESSENCE, 8000); switch (_class) { case CLASS_DPS: events.ScheduleEvent(EVENT_SPELL_FURY, 5000); events.ScheduleEvent(EVENT_BLADE_SONG, 13000); events.ScheduleEvent(EVENT_GLIMPSE_OF_MADNESS, 8000); break; case CLASS_HEAL: events.ScheduleEvent(EVENT_SPELL_PHANTOM_STRIKE, 20000); events.ScheduleEvent(EVENT_STUN, 7000); break; case CLASS_TANK: events.ScheduleEvent(EVENT_SPELL_ARMOR_BUFF, 10000); events.ScheduleEvent(EVENT_SANCTUARY, 10000); events.ScheduleEvent(EVENT_STUN, 7000); break; } Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT))); if(sha && sha->GetAI()) sha->GetAI()->DoAction(ACTION_FIGMENT_POP); }
void JustDied(Unit* killer) { if (!pInstance) return; me->CastSpell(me, SPELL_DROWNED_STATE, false); me->RemoveAura(SPELL_GATHERING_DOUBT); me->DespawnOrUnsummon(5000); Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT))); if(sha && sha->GetAI()) sha->GetAI()->DoAction(ACTION_FIGMENT_DIED); }
void MovementInform(uint32 type, uint32 id) { if (type == POINT_MOTION_TYPE) { switch (id) { case POINT_DRAHGA_GO_TO_THE_LAVA: me->MonsterYell(SAY_JUMP_DOWN, LANG_UNIVERSAL, NULL); pValiona->GetAI()->DoAction(ACTION_DRAGAH_CALLS_VALIONA_FOR_HELP); me->SetSpeed(MOVE_RUN, 1.0f); me->GetMotionMaster()->Clear(); me->JumpTo(pValiona,2); events.ScheduleEvent(EVENT_DRAGAH_ENTER_VEHICLE,2000); break; default: break; } } }
void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHello& packet) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO %s", packet.QuestGiverGUID.ToString().c_str()); Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.QuestGiverGUID, UNIT_NPC_FLAG_QUESTGIVER); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.", packet.QuestGiverGUID.ToString().c_str()); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving creature->StopMoving(); if (sScriptMgr->OnGossipHello(_player, creature)) return; _player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true); _player->SendPreparedGossip(creature); creature->GetAI()->sGossipHello(_player); }
void JustDied(Unit* /*killer*/) { if (jules) { jules->GetAI()->DoAction(ACTION_JULES_MOVE_HOME); jules->RemoveAllAuras(); } }
void UpdateAI(uint32 /*diff*/) override { if (!bInChase) { Player* target = ObjectAccessor::GetPlayer(*me, kologarn->GetAI()->GetGUID(DATA_EYEBEAM_TARGET)); me->Attack(target, false); me->GetMotionMaster()->MoveChase(target); bInChase = true; } }
void Reset() { if (!pInstance) return; me->CastSpell(me, SPELL_GROW, false); Player* owner = NULL; if (TempSummon* tempMe = me->ToTempSummon()) if (Unit* summoner = tempMe->GetSummoner()) owner = summoner->ToPlayer(); if (!owner) return; me->SetDisplayId(owner->GetDisplayId()); // A check au cas où ça crasherait uint8 role = lfg::PLAYER_ROLE_DAMAGE; if(owner && owner->GetGroup()) // role = owner->GetGroup()->GetMemberRole(GetGUID(owner->GetGUID())); role = owner->GetGroup()->GetLfgRoles(owner->GetGUID()); if (role & lfg::PLAYER_ROLE_DAMAGE) _class = CLASS_DPS; else if (role & lfg::PLAYER_ROLE_HEALER) _class = CLASS_HEAL; else if (role & lfg::PLAYER_ROLE_TANK) _class = CLASS_TANK; owner->CastSpell(me, SPELL_FIGMENT_OF_DOUBT_2, true); Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT))); if(sha && sha->GetAI()) sha->GetAI()->DoAction(ACTION_FIGMENT_POP); }
void EnterCombat(Unit* who) { if (!slatedrake->HasAura(SPELL_UNRESPONSIVE_DRAKE)) slatedrake->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!stormrider->HasAura(SPELL_UNRESPONSIVE_DRAKE)) stormrider->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!netherscion->HasAura(SPELL_UNRESPONSIVE_DRAKE)) netherscion->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!timewarden->HasAura(SPELL_UNRESPONSIVE_DRAKE)) timewarden->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (bWhelps) if (GameObject* pGo = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_WHELP_CAGE))) pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); if (me->HasAura(SPELL_SHADOW_WARPED)) events.ScheduleEvent(EVENT_SHADOW_NOVA, 7000); events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS); proto->AddThreat(who, 10.0f); proto->SetInCombatWith(who); Talk(SAY_AGGRO); DoZoneInCombat(); instance->SetBossState(DATA_HALFUS,IN_PROGRESS); }
void DamageTaken(Unit* who, uint32 &damage) {// every hit that originally should have hit for more than 15k will cause rhyolith to steer if (!me || !me->isAlive()) return; uint32 treshold = 15000; //threshold of damage that will cause rhyolith to steer uint32 stacks =0; if (me->GetAura(SPELL_OBSIDIAN_ARMOR)) stacks = me->GetAura(SPELL_OBSIDIAN_ARMOR)->GetStackAmount(); treshold -= treshold /100 * stacks; if (!rhyolith) rhyolith = me->FindNearestCreature(BOSS_RHYOLITH, 100, true); if (damage >= treshold && rhyolith) { me->MonsterSay("steer left", LANG_UNIVERSAL, 0); rhyolith->GetAI()->DoAction(ACTION_STEER_LEFT); //steer that direction } }
void SetData_trial_of_the_king(uint32 type, uint32 data) { switch (type) { case TYPE_OUTRO_05: { if (Creature* haiyan = instance->GetCreature(haiyan_guid)) if (haiyan->GetAI()) haiyan->GetAI()->DoAction(1); //ACTION_OUTRO_02 } break; case TYPE_OUTRO_04: { if (Creature* kuai = instance->GetCreature(kuai_guid)) if (kuai->GetAI()) kuai->GetAI()->DoAction(3); //ACTION_OUTRO_02 } break; case TYPE_OUTRO_03: { if (Creature* ming = instance->GetCreature(ming_guid)) if (ming->GetAI()) ming->GetAI()->DoAction(2); //ACTION_OUTRO_02 } break; case TYPE_OUTRO_02: { if (Creature* haiyan = instance->GetCreature(haiyan_guid)) if (haiyan->GetAI()) haiyan->GetAI()->DoAction(0); //ACTION_OUTRO_01 } break; case TYPE_OUTRO_01: { if (Creature* ming = instance->GetCreature(ming_guid)) if (ming->GetAI()) ming->GetAI()->DoAction(1); //ACTION_OUTRO_01 } break; case TYPE_MING_INTRO: { if (Creature* ming = instance->GetCreature(ming_guid)) if (ming->GetAI()) ming->GetAI()->DoAction(0); //ACTION_INTRO } break; case TYPE_WIPE_FIRST_BOSS: { Creature* xin = instance->GetCreature(xin_guid); if (!xin) return; xin->SetVisible(true); if (xin->GetAI()) xin->GetAI()->Reset(); switch (data) { case 0: for (auto guid : adepts) { Creature* creature = instance->GetCreature(guid); if (!creature) continue; if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE creature->RemoveAura(121569); } break; case 1: for (auto guid : scrappers) { Creature* creature = instance->GetCreature(guid); if (!creature) continue; if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE creature->RemoveAura(121569); } break; case 2: for (auto guid : grunts) { Creature* creature = instance->GetCreature(guid); if (!creature) continue; if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE creature->RemoveAura(121569); } break; } } break; case TYPE_MING_ATTACK: { //Move the adepts for (auto guid : adepts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(0); //EVENT_ENCOURAGE } Creature* ming = instance->GetCreature(ming_guid); if (!ming) return; ming->GetMotionMaster()->MovePoint(0, -4237.658f, -2613.860f, 16.48f); ming->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); ming->SetReactState(REACT_AGGRESSIVE); } break; case TYPE_KUAI_ATTACK: { //Move the scrappers for (auto guid : scrappers) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(0); //EVENT_ENCOURAGE } Creature* kuai = instance->GetCreature(kuai_guid); if (!kuai) return; kuai->GetMotionMaster()->MovePoint(0, -4215.359f, -2601.283f, 16.48f); kuai->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); kuai->SetReactState(REACT_AGGRESSIVE); } break; case TYPE_HAIYAN_ATTACK: { //Move the scrappers for (auto guid : grunts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(0); //EVENT_ENCOURAGE } Creature* haiyan = instance->GetCreature(haiyan_guid); if (!haiyan) return; haiyan->GetMotionMaster()->MovePoint(0, -4215.772f, -2627.216f, 16.48f); haiyan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); haiyan->SetReactState(REACT_AGGRESSIVE); } break; case TYPE_ALL_ATTACK: { for (auto guid : adepts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(2); //ACTION_ATTACK std::list<uint64>::iterator itr = grunts.begin(); std::advance(itr, urand(0, grunts.size() - 1)); Creature* grunt = instance->GetCreature(*itr); if (creature && grunt) creature->Attack(grunt, true); } for (auto guid : grunts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(2); //ACTION_ATTACK std::list<uint64>::iterator itr = scrappers.begin(); std::advance(itr, urand(0, scrappers.size() - 1)); Creature* scrapper = instance->GetCreature(*itr); if (creature && scrapper) creature->Attack(scrapper, true); } for (auto guid : scrappers) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(2); //ACTION_ATTACK std::list<uint64>::iterator itr = adepts.begin(); std::advance(itr, urand(0, adepts.size() - 1)); Creature* adept = instance->GetCreature(*itr); if (creature && adept) creature->Attack(adept, true); } SetBossState(DATA_TRIAL_OF_THE_KING, DONE); } break; case TYPE_MING_RETIRED: //Retire the adepts for (auto guid : adepts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE } break; case TYPE_KUAI_RETIRED: //Retire the adepts for (auto guid : scrappers) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE } break; case TYPE_HAIYAN_RETIRED: //Retire the adepts for (auto guid : grunts) { Creature* creature = instance->GetCreature(guid); if (creature && creature->GetAI()) creature->GetAI()->DoAction(1); //EVENT_RETIRE } break; } }
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::QuestGiverChooseReward& packet) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", packet.QuestGiverGUID.ToString().c_str(), packet.QuestID, packet.ItemChoiceID); Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID); if (!quest) return; // This is Real Item Entry, not slot id as pre 5.x if (packet.ItemChoiceID) { ItemTemplate const* rewardProto = sObjectMgr->GetItemTemplate(packet.ItemChoiceID); if (!rewardProto) { TC_LOG_ERROR("entities.player.cheat", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (%s) tried to get invalid reward item (Item Entry: %u) for quest %u (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), packet.ItemChoiceID, packet.QuestID); return; } bool itemValid = false; for (uint32 i = 0; i < quest->GetRewChoiceItemsCount(); ++i) { if (quest->RewardChoiceItemId[i] && quest->RewardChoiceItemId[i] == uint32(packet.ItemChoiceID)) { itemValid = true; break; } } if (!itemValid && quest->GetQuestPackageID()) { if (std::vector<QuestPackageItemEntry const*> const* questPackageItems = sDB2Manager.GetQuestPackageItems(quest->GetQuestPackageID())) { for (QuestPackageItemEntry const* questPackageItem : *questPackageItems) { if (questPackageItem->ItemID != packet.ItemChoiceID) continue; if (_player->CanSelectQuestPackageItem(questPackageItem)) { itemValid = true; break; } } } if (!itemValid) { if (std::vector<QuestPackageItemEntry const*> const* questPackageItems = sDB2Manager.GetQuestPackageItemsFallback(quest->GetQuestPackageID())) { for (QuestPackageItemEntry const* questPackageItem : *questPackageItems) { if (questPackageItem->ItemID != packet.ItemChoiceID) continue; itemValid = true; break; } } } } if (!itemValid) { TC_LOG_ERROR("entities.player.cheat", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (%s) tried to get reward item (Item Entry: %u) wich is not a reward for quest %u (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), packet.ItemChoiceID, packet.QuestID); return; } } Object* object = _player; if (!quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) { object = ObjectAccessor::GetObjectByTypeMask(*_player, packet.QuestGiverGUID, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(packet.QuestID)) return; // some kind of WPE protection if (!_player->CanInteractWithQuestGiver(object)) return; } if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(packet.QuestID) == QUEST_STATUS_NONE) || (_player->GetQuestStatus(packet.QuestID) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete())) { TC_LOG_ERROR("network", "Error in QUEST_STATUS_COMPLETE: player %s (%s) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), packet.QuestID); return; } if (_player->CanRewardQuest(quest, packet.ItemChoiceID, true)) { _player->RewardQuest(quest, packet.ItemChoiceID, object); switch (object->GetTypeId()) { case TYPEID_UNIT: case TYPEID_PLAYER: { //For AutoSubmition was added plr case there as it almost same exclute AI script cases. Creature* creatureQGiver = object->ToCreature(); if (!creatureQGiver || !sScriptMgr->OnQuestReward(_player, creatureQGiver, quest, packet.ItemChoiceID)) { // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest)) { // Only send the quest to the player if the conditions are met if (_player->CanTakeQuest(nextQuest, false)) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) _player->AddQuestAndCheckCompletion(nextQuest, object); _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); } } if (creatureQGiver) creatureQGiver->GetAI()->sQuestReward(_player, quest, packet.ItemChoiceID); } break; } case TYPEID_GAMEOBJECT: { GameObject* questGiver = object->ToGameObject(); if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID)) { // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest)) { // Only send the quest to the player if the conditions are met if (_player->CanTakeQuest(nextQuest, false)) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) _player->AddQuestAndCheckCompletion(nextQuest, object); _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); } } questGiver->AI()->QuestReward(_player, quest, packet.ItemChoiceID); } break; } default: break; } } else _player->PlayerTalkClass->SendQuestGiverOfferReward(quest, packet.QuestGiverGUID, true); }
void UpdateAI(uint32 const diff) { events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BARADAS_TALK: switch (step) { case 0: me->SetFacingTo(1.513286f); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); events.ScheduleEvent(EVENT_BARADAS_TALK, 3000); step++; break; case 1: DoCast(SPELL_BARADAS_COMMAND); events.ScheduleEvent(EVENT_BARADAS_TALK, 5000); step++; break; case 2: Talk(SAY_BARADA_3); events.ScheduleEvent(EVENT_BARADAS_TALK, 7000); step++; break; case 3: if (jules) jules->AI()->Talk(SAY_JULES_2); events.ScheduleEvent(EVENT_BARADAS_TALK, 18000); step++; break; case 4: DoCast(SPELL_BARADA_FALTERS); me->HandleEmoteCommand(EMOTE_STAND_STATE_NONE); if (jules) jules->GetAI()->DoAction(ACTION_JULES_HOVER); events.ScheduleEvent(EVENT_BARADAS_TALK, 11000); step++; break; case 5: if (jules) jules->AI()->Talk(SAY_JULES_3); events.ScheduleEvent(EVENT_BARADAS_TALK, 13000); step++; break; case 6: Talk(SAY_BARADA_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 5000); step++; break; case 7: if (jules) jules->AI()->Talk(SAY_JULES_3); events.ScheduleEvent(EVENT_BARADAS_TALK, 13000); step++; break; case 8: Talk(SAY_BARADA_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 12000); step++; break; case 9: if (jules) jules->AI()->Talk(SAY_JULES_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 12000); step++; break; case 10: Talk(SAY_BARADA_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 5000); step++; break; case 11: if (jules) jules->GetAI()->DoAction(ACTION_JULES_FLIGH); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 12: if (jules) jules->AI()->Talk(SAY_JULES_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 8000); step++; break; case 13: Talk(SAY_BARADA_5); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 14: if (jules) jules->AI()->Talk(SAY_JULES_4); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 15: Talk(SAY_BARADA_6); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 16: if (jules) jules->AI()->Talk(SAY_JULES_5); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 17: Talk(SAY_BARADA_7); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 18: if (jules) jules->AI()->Talk(SAY_JULES_3); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 19: Talk(SAY_BARADA_7); events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 20: if (jules) { jules->GetAI()->DoAction(ACTION_JULES_MOVE_HOME); jules->RemoveAura(SPELL_JULES_VOMITS_AURA); } events.ScheduleEvent(EVENT_BARADAS_TALK, 10000); step++; break; case 21: //Ende if (playerGUID) { if (Player* player = ObjectAccessor::FindPlayer(playerGUID)) player->KilledMonsterCredit(NPC_COLONEL_JULES, 0); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } if (jules) jules->RemoveAllAuras(); me->RemoveAura(SPELL_BARADAS_COMMAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); Talk(SAY_BARADA_8); me->GetMotionMaster()->MoveTargetedHome(); EnterEvadeMode(); break; } break; } } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING)) return; if(phase == PHASE_CASTER_PHASE && !HealthAbovePct(30)) { phase = PHASE_DRAGON_PHASE; me->SetSpeed(MOVE_RUN, 1.5f); me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveAllAuras(); // He should not die when he is jumping down... DoCast(me, SPELL_TWILIGHT_PROTECTION, true); events.Reset(); // He Should not cast while he is flying me->GetMotionMaster()->MovePoint(POINT_DRAHGA_GO_TO_THE_LAVA, position[0]); pValiona = me->SummonCreature(NPC_VALIONA,-375.33f,-667.291f,270.0f,3.29545f, TEMPSUMMON_CORPSE_DESPAWN); } if(phase == PHASE_DRAGON_PHASE && !HealthAbovePct(10)) { phase = PHASE_FINAL_PHASE; me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); pValiona->GetAI()->DoAction(ACTION_VALIONA_SHOULD_FLY_AWAY); pValiona = NULL; } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BURNING_SHADOWBOLT: if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, RAID_MODE(SPELL_BURNING_SHADOWBOLT,SPELL_BURNING_SHADOWBOLT_H)); events.ScheduleEvent(EVENT_BURNING_SHADOWBOLT,4000); break; case EVENT_SUMMON_INVOKED_FLAME_SPIRIT: me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, NULL); DoCast(SPELL_INVOCATION_OF_FLAME); events.ScheduleEvent(EVENT_SUMMON_INVOKED_FLAME_SPIRIT,20000); break; case EVENT_DRAGAH_ENTER_VEHICLE: me->GetMotionMaster()->Clear(); // me->EnterVehicle(pValiona, 1); break; default: break; } } DoMeleeAttackIfReady(); }
// Wipe has been detected. Perform cleanup and reset. void DoWipe() { if (GetData(DATA_WAVES_STATE) == IN_PROGRESS) // are the waves already done ? { HandleGameObject(uiFrontDoor, true); HandleGameObject(uiFrostwornDoor, false); // Reset - set down to the last uiEncounter that was fulfilled if (GetData(DATA_FALRIC_EVENT) != DONE) { SetData(DATA_WAVES_STATE, FAIL); uiWaveCount = 0; events.Reset(); DoUpdateWorldState(WORLD_STATE_HOR, 1); DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); if (GetData(DATA_INTRO_EVENT) == DONE) { if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) pMarwyn->SetVisible(true); if (Creature* pFalric = instance->GetCreature(uiFalric)) pFalric->SetVisible(true); } } else if (GetData(DATA_MARWYN_EVENT) != DONE) { SetData(DATA_WAVES_STATE, FAIL); uiWaveCount = 5; events.Reset(); DoUpdateWorldState(WORLD_STATE_HOR, 1); DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); if (GetData(DATA_INTRO_EVENT) == DONE) { if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) pMarwyn->SetVisible(true); } } } else { // Falric and Marwyn have been finished by the group if (GetData(DATA_LICHKING_EVENT) == NOT_STARTED) { // Lichking-Event was not started yet, i.e. the group has wiped on the Frostworn General HandleGameObject(uiFrontDoor, true); if (GetData(DATA_MARWYN_EVENT) == DONE) HandleGameObject(uiFrostwornDoor, true); } else { // Group has wiped on escape SetData(DATA_LICHKING_EVENT, NOT_STARTED); SetData(DATA_WIPE, 1); Creature* pSylvanasOrJaina = instance->GetCreature(GetData64(DATA_ESCAPE_LEADER)); if (pSylvanasOrJaina && pSylvanasOrJaina->GetAI()) { pSylvanasOrJaina->Respawn(true); pSylvanasOrJaina->GetAI()->Reset(); } Creature* pLichKing = instance->GetCreature(GetData64(DATA_LICHKING)); if (pLichKing && pLichKing->GetAI()) { pLichKing->Respawn(true); pLichKing->GetAI()->Reset(); } // TODO: maybe something is missing here } } }