diff options
author | Nay <dnpd.dd@gmail.com> | 2013-07-19 00:03:27 +0100 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2013-07-19 00:03:27 +0100 |
commit | c536ba510d523842632061c0c41d7d381d6e5a15 (patch) | |
tree | 3cdacb36c3ea0092243ec595ab06d5d2833cdeae /src | |
parent | 7dd26ce40ee92f3e8624ba2d232dbd40b6a9507c (diff) |
Scripts/Icecrown: Fix quest The Flesh Giant Champion
Closes #9040
Closes #10294
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/zone_icecrown.cpp | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index ef58138c653..35a51fb9ea0 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -966,6 +966,206 @@ class npc_frostbrood_skytalon : public CreatureScript } }; +/* +Quest: The Flesh Giant Champion +*/ +enum FleshGiant +{ + QUEST_FLESH_GIANT_CHAMPION = 13235, + NPC_MORBIDUS = 30698, + NPC_LICH_KING = 31301, + + // Factions + FACTION_HOSTILE = 14, + FACTION_BASIC = 2102, + // Events + EVENT_INTRO = 1, + EVENT_LK_SAY_1 = 2, + EVENT_LK_SAY_2 = 3, + EVENT_LK_SAY_3 = 4, + EVENT_LK_SAY_4 = 5, + EVENT_LK_SAY_5 = 6, + + EVENT_OUTRO = 7, + EVENT_START = 8, + + SPELL_SIMPLE_TELEPORT = 64195, // Visual stuff + + // Dhakar + SAY_START = 1, + // Lich King + SAY_THING_1 = 1, + SAY_THING_2 = 2, + SAY_THING_3 = 3, + SAY_THING_4 = 4, + SAY_THING_5 = 5, + // Olakin + SAY_PAY = 1 +}; +class npc_margrave_dhakar : public CreatureScript +{ + public: + npc_margrave_dhakar() : CreatureScript("npc_margrave_dhakar") { } + + struct npc_margrave_dhakarAI : public ScriptedAI + { + npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , summons(me) + { + Reset(); + } + + uint64 LKGuid; + SummonList summons; + void Reset() + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + events.Reset(); + summons.DespawnAll(); + } + void sGossipSelect(Player* player, uint32 sender, uint32 action) + { + if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->isInCombat()) + { + if (me->GetCreatureTemplate()->GossipMenuId == sender && !action) + { + events.ScheduleEvent(EVENT_INTRO, 1000); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + } + void UpdateAI(uint32 diff) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO: + Talk(SAY_START); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + Creature *LK = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); + LKGuid = LK->GetGUID(); + LK->SetFacingTo(morbidus->GetOrientation()); + LK->CastSpell(LK, SPELL_SIMPLE_TELEPORT, true); + } + events.ScheduleEvent(EVENT_LK_SAY_1, 5000); + events.CancelEvent(EVENT_INTRO); + break; + case EVENT_LK_SAY_1: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + LK->AI()->Talk(SAY_THING_1); + } + events.ScheduleEvent(EVENT_LK_SAY_2, 5000); + events.CancelEvent(EVENT_LK_SAY_1); + break; + case EVENT_LK_SAY_2: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); + LK->AI()->Talk(SAY_THING_2); + } + events.ScheduleEvent(EVENT_LK_SAY_3, 5000); + events.CancelEvent(EVENT_LK_SAY_2); + break; + + case EVENT_LK_SAY_3: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + LK->AI()->Talk(SAY_THING_3); + } + events.ScheduleEvent(EVENT_LK_SAY_4, 5000); + events.CancelEvent(EVENT_LK_SAY_3); + break; + + case EVENT_LK_SAY_4: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); + LK->AI()->Talk(SAY_THING_4); + } + events.ScheduleEvent(EVENT_OUTRO, 12000); + events.CancelEvent(EVENT_LK_SAY_4); + break; + + case EVENT_LK_SAY_5: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->AI()->Talk(SAY_THING_5); + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + } + events.ScheduleEvent(EVENT_OUTRO, 8000); + events.CancelEvent(EVENT_LK_SAY_5); + break; + case EVENT_OUTRO: + if (Creature *olakin = me->FindNearestCreature(31428, 50.0f, true)) + { + olakin->AI()->Talk(SAY_PAY); + } + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + LK->DespawnOrUnsummon(0); + events.ScheduleEvent(EVENT_START, 5000); + events.CancelEvent(EVENT_OUTRO); + break; + + case EVENT_START: + if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE); + morbidus->setFaction(FACTION_HOSTILE); + } + events.CancelEvent(EVENT_START); + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_margrave_dhakarAI(creature); + } +}; +class npc_morbidus : public CreatureScript +{ + public: + npc_morbidus() : CreatureScript("npc_morbidus") { } + + struct npc_morbidusAI : public ScriptedAI + { + npc_morbidusAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + if (Creature * dhakar = me->FindNearestCreature(31306, 50.0f, true)) + dhakar->AI()->Reset(); + // this will prevent the event to start without morbidus being alive + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + me->setFaction(FACTION_BASIC); + } + void UpdateAI(uint32 diff) + { + DoMeleeAttackIfReady(); + } + + }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_morbidusAI(creature); + } +}; + void AddSC_icecrown() { new npc_arete; @@ -976,4 +1176,7 @@ void AddSC_icecrown() new npc_tournament_training_dummy; new npc_blessed_banner(); new npc_frostbrood_skytalon(); + new npc_margrave_dhakar(); + new npc_morbidus(); + } |