diff options
-rw-r--r-- | sql/updates/world/2013_07_13_00_world_misc.sql | 5 | ||||
-rw-r--r-- | src/server/scripts/Outland/BlackTemple/black_temple.cpp | 164 |
2 files changed, 160 insertions, 9 deletions
diff --git a/sql/updates/world/2013_07_13_00_world_misc.sql b/sql/updates/world/2013_07_13_00_world_misc.sql new file mode 100644 index 00000000000..b34e96a0811 --- /dev/null +++ b/sql/updates/world/2013_07_13_00_world_misc.sql @@ -0,0 +1,5 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=40094; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,40094,0,0,31,0,3,22953,0,0,'','Spell summom channel targets Wrathbone Flayer'); +UPDATE `creature_template` SET `AIName`= '', `ScriptName` = 'npc_wrathbone_flayer' WHERE `entry`=22953; +DELETE FROM smart_scripts WHERE entryorguid=22953; diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 3d4e7290238..a44c5f58dc4 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -21,25 +21,41 @@ Complete: 100% Comment: Spirit of Olum: Player Teleporter to Seer Kanai Teleport after defeating Naj'entus and Supremus. */ -/* Content -npc_spirit_of_olum -*/ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "black_temple.h" #include "Player.h" -/*### -# npc_spirit_of_olum -####*/ - enum Spells { - SPELL_TELEPORT = 41566 + // Spirit of Olum + SPELL_TELEPORT = 41566, + // Wrathbone Flayer + SPELL_CLEAVE = 15496, + SPELL_IGNORED = 39544, + SPELL_SUMMON_CHANNEL = 40094 }; +enum Creatures +{ + NPC_BLOOD_MAGE = 22945, + NPC_DEATHSHAPER = 22882 +}; + +enum Events +{ + // Wrathbone Flayer + EVENT_GET_CHANNELERS = 1, + EVENT_SET_CHANNELERS = 2, + EVENT_CLEAVE = 3, + EVENT_IGNORED = 4, +}; + +// ######################################################## +// Spirit of Olum +// ######################################################## + class npc_spirit_of_olum : public CreatureScript { public: @@ -66,7 +82,137 @@ public: } }; +// ######################################################## +// Wrathbone Flayer +// ######################################################## + +class npc_wrathbone_flayer : public CreatureScript +{ +public: + npc_wrathbone_flayer() : CreatureScript("npc_wrathbone_flayer") { } + + struct npc_wrathbone_flayerAI : public ScriptedAI + { + npc_wrathbone_flayerAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + events.ScheduleEvent(EVENT_GET_CHANNELERS, 3000); + enteredCombat = false; + } + + void JustDied(Unit* /*killer*/) OVERRIDE { } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + events.ScheduleEvent(EVENT_CLEAVE, 5000); + events.ScheduleEvent(EVENT_IGNORED, 7000); + enteredCombat = true; + } + + void UpdateAI(uint32 diff) OVERRIDE + { + + if (!enteredCombat) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GET_CHANNELERS: + { + std::list<Creature*> BloodMageList; + me->GetCreatureListWithEntryInGrid(BloodMageList, NPC_BLOOD_MAGE, 15.0f); + + if (!BloodMageList.empty()) + for (std::list<Creature*>::const_iterator itr = BloodMageList.begin(); itr != BloodMageList.end(); ++itr) + { + bloodmage.push_back((*itr)->GetGUID()); + if ((*itr)->isDead()) + (*itr)->Respawn(); + } + + std::list<Creature*> DeathShaperList; + me->GetCreatureListWithEntryInGrid(DeathShaperList, NPC_DEATHSHAPER, 15.0f); + + if (!DeathShaperList.empty()) + for (std::list<Creature*>::const_iterator itr = DeathShaperList.begin(); itr != DeathShaperList.end(); ++itr) + { + deathshaper.push_back((*itr)->GetGUID()); + if ((*itr)->isDead()) + (*itr)->Respawn(); + } + + events.ScheduleEvent(EVENT_SET_CHANNELERS, 3000); + + break; + } + case EVENT_SET_CHANNELERS: + { + for (std::list<uint64>::const_iterator itr = bloodmage.begin(); itr != bloodmage.end(); ++itr) + if (Creature* bloodmage = (Unit::GetCreature(*me, *itr))) + bloodmage->AI()->DoCast(SPELL_SUMMON_CHANNEL); + + for (std::list<uint64>::const_iterator itr = deathshaper.begin(); itr != deathshaper.end(); ++itr) + if (Creature* deathshaper = (Unit::GetCreature(*me, *itr))) + deathshaper->AI()->DoCast(SPELL_SUMMON_CHANNEL); + + events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000); + + break; + } + default: + break; + } + } + } + + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, urand (1000, 2000)); + break; + case EVENT_IGNORED: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_IGNORED); + events.ScheduleEvent(EVENT_IGNORED, 10000); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + EventMap events; + std::list<uint64> bloodmage; + std::list<uint64> deathshaper; + bool enteredCombat; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_wrathbone_flayerAI(creature); + } +}; + void AddSC_black_temple() { new npc_spirit_of_olum(); + new npc_wrathbone_flayer(); } |