Permalink
Browse files

Merge pull request #4981 from Souler/fix_omen

Events/Lunar Festival: Fixed behaviour of Elune's Candle, Rockets and Rocket Clusters. Implemented AI for Omen and his summoning ritual.

Closes #4939
  • Loading branch information...
Shocker committed Jan 29, 2012
2 parents ad4cf93 + 50a6ec0 commit ff1964906b5d43ca7a748282f460807523ca9092
@@ -0,0 +1,102 @@
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (26374);
+INSERT INTO `spell_script_names`(`spell_id`,`ScriptName`) VALUES
+(26374,'spell_gen_elune_candle');
+
+-- Set Gigant Spotlight as not selectable
+UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=15902;
+
+DELETE FROM `creature_template_addon` WHERE (`entry`IN(15902,15466));
+INSERT INTO `creature_template_addon`(`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(15466,0,0,0,0,0,17327), -- Add spirit particles to Omen minions
+(15902,0,0,0,0,0,50236); -- Add Spotlight aura to Gigant Spotlight (ummoned by 26392 on Omen's death)
+
+UPDATE `creature_template` SET `ScriptName`='npc_giant_spotlight' WHERE `entry`=15902;
+UPDATE `creature_template` SET `RegenHealth`=0,`ScriptName`='npc_omen' WHERE `entry`=15467;
+UPDATE `creature_template` SET `ScriptName`='npc_firework',`AIName`='',`faction_A`=35,`faction_H`=35,`unit_flags`=33555200 WHERE `entry` IN (15879,15880,15881,15882,15883,15884,15885,15886,15887,15888,15889,15890,15872,15873,15874,15875,15876,15877,15911,15912,15913,15914,15915,15916,15918);
+-- Cleanup EventAI and SmartAI
+DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (15879,15880,15881,15882,15883,15884,15885,15886,15887,15888,15889,15890,15872,15873,15874,15875,15876,15877,15911,15912,15913,15914,15915,15916,15918);
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (15879,15880,15881,15882,15883,15884,15885,15886,15887,15888,15889,15890,15872,15873,15874,15875,15876,15877,15911,15912,15913,15914,15915,15916,15918);
+
+-- Update al targeting stuff for Fireworks and Rocket clusters
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (26294,26295,26333,26334,26336,26337,26338,26488,26490,26517,26521,26344,26347,26345,26348,26349,26351,26352,26354,26355,26356);
+INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+-- Targeting Firework Launcher
+(13,0,26294,0,18,0,180771,0,0,'',"Small White Rocket target Firework Launcher"),
+(13,0,26294,0,18,0,180850,0,0,'',"Small White Rocket target Firework Launcher"),
+(13,0,26294,0,18,0,180868,0,0,'',"Small White Rocket target Firework Launcher"),
+(13,0,26295,0,18,0,180771,0,0,'',"Small Yellow Rocket target Firework Launcher"),
+(13,0,26295,0,18,0,180850,0,0,'',"Small Yellow Rocket target Firework Launcher"),
+(13,0,26295,0,18,0,180868,0,0,'',"Small Yellow Rocket target Firework Launcher"),
+(13,0,26333,0,18,0,180771,0,0,'',"Large Blue Rocket target Firework Launcher"),
+(13,0,26333,0,18,0,180850,0,0,'',"Large Blue Rocket target Firework Launcher"),
+(13,0,26333,0,18,0,180868,0,0,'',"Large Blue Rocket target Firework Launcher"),
+(13,0,26334,0,18,0,180771,0,0,'',"Large Green Rocket target Firework Launcher"),
+(13,0,26334,0,18,0,180850,0,0,'',"Large Green Rocket target Firework Launcher"),
+(13,0,26334,0,18,0,180868,0,0,'',"Large Green Rocket target Firework Launcher"),
+(13,0,26336,0,18,0,180771,0,0,'',"Large Red Rocket target Firework Launcher"),
+(13,0,26336,0,18,0,180850,0,0,'',"Large Red Rocket target Firework Launcher"),
+(13,0,26336,0,18,0,180868,0,0,'',"Large Red Rocket target Firework Launcher"),
+(13,0,26337,0,18,0,180771,0,0,'',"Large White Rocket target Firework Launcher"),
+(13,0,26337,0,18,0,180850,0,0,'',"Large White Rocket target Firework Launcher"),
+(13,0,26337,0,18,0,180868,0,0,'',"Large White Rocket target Firework Launcher"),
+(13,0,26338,0,18,0,180771,0,0,'',"Large Yellow Rocket target Firework Launcher"),
+(13,0,26338,0,18,0,180850,0,0,'',"Large Yellow Rocket target Firework Launcher"),
+(13,0,26338,0,18,0,180868,0,0,'',"Large Yellow Rocket target Firework Launcher"),
+-- Targeting Cluster Launcher
+(13,0,26488,0,18,0,180772,0,0,'',"Large Blue Rocket Cluster target Cluster Launcher"),
+(13,0,26488,0,18,0,180859,0,0,'',"Large Blue Rocket Cluster target Cluster Launcher"),
+(13,0,26488,0,18,0,180869,0,0,'',"Large Blue Rocket Cluster target Cluster Launcher"),
+(13,0,26488,0,18,0,180874,0,0,'',"Large Blue Rocket Cluster target Cluster Launcher"),
+(13,0,26490,0,18,0,180772,0,0,'',"Large Green Rocket Cluster target Cluster Launcher"),
+(13,0,26490,0,18,0,180859,0,0,'',"Large Green Rocket Cluster target Cluster Launcher"),
+(13,0,26490,0,18,0,180869,0,0,'',"Large Green Rocket Cluster target Cluster Launcher"),
+(13,0,26490,0,18,0,180874,0,0,'',"Large Green Rocket Cluster target Cluster Launcher"),
+(13,0,26517,0,18,0,180772,0,0,'',"Large Red Rocket Cluster target Cluster Launcher"),
+(13,0,26517,0,18,0,180859,0,0,'',"Large Red Rocket Cluster target Cluster Launcher"),
+(13,0,26517,0,18,0,180869,0,0,'',"Large Red Rocket Cluster target Cluster Launcher"),
+(13,0,26517,0,18,0,180874,0,0,'',"Large Red Rocket Cluster target Cluster Launcher"),
+(13,0,26521,0,18,0,180772,0,0,'',"Lucky Lunar rocket Cluster target Cluster Launcher"),
+(13,0,26521,0,18,0,180859,0,0,'',"Lucky Lunar rocket Cluster target Cluster Launcher"),
+(13,0,26521,0,18,0,180869,0,0,'',"Lucky Lunar rocket Cluster target Cluster Launcher"),
+(13,0,26521,0,18,0,180874,0,0,'',"Lucky Lunar rocket Cluster target Cluster Launcher"),
+-- Targeting Firework Launcher (Again)
+(13,0,26347,0,18,0,180771,0,0,'',"Rocket, RED target Firework Launcher"),
+(13,0,26347,0,18,0,180850,0,0,'',"Rocket, RED target Firework Launcher"),
+(13,0,26347,0,18,0,180868,0,0,'',"Rocket, RED target Firework Launcher"),
+(13,0,26344,0,18,0,180771,0,0,'',"Rocket, BLUE target Firework Launcher"),
+(13,0,26344,0,18,0,180850,0,0,'',"Rocket, BLUE target Firework Launcher"),
+(13,0,26344,0,18,0,180868,0,0,'',"Rocket, BLUE target Firework Launcher"),
+(13,0,26345,0,18,0,180771,0,0,'',"Rocket, GREEEN target Firework Launcher"),
+(13,0,26345,0,18,0,180850,0,0,'',"Rocket, GREEEN target Firework Launcher"),
+(13,0,26345,0,18,0,180868,0,0,'',"Rocket, GREEEN target Firework Launcher"),
+(13,0,26348,0,18,0,180771,0,0,'',"Rocket, WHITE target Firework Launcher"),
+(13,0,26348,0,18,0,180850,0,0,'',"Rocket, WHITE target Firework Launcher"),
+(13,0,26348,0,18,0,180868,0,0,'',"Rocket, WHITE target Firework Launcher"),
+(13,0,26349,0,18,0,180771,0,0,'',"Rocket, YELLOW target Firework Launcher"),
+(13,0,26349,0,18,0,180850,0,0,'',"Rocket, YELLOW target Firework Launcher"),
+(13,0,26349,0,18,0,180868,0,0,'',"Rocket, YELLOW target Firework Launcher"),
+(13,0,26351,0,18,0,180771,0,0,'',"Rocket, BLUE BIG target Firework Launcher"),
+(13,0,26351,0,18,0,180850,0,0,'',"Rocket, BLUE BIG target Firework Launcher"),
+(13,0,26351,0,18,0,180868,0,0,'',"Rocket, BLUE BIG target Firework Launcher"),
+(13,0,26352,0,18,0,180771,0,0,'',"Rocket, GREEN BIG target Firework Launcher"),
+(13,0,26352,0,18,0,180850,0,0,'',"Rocket, GREEN BIG target Firework Launcher"),
+(13,0,26352,0,18,0,180868,0,0,'',"Rocket, GREEN BIG target Firework Launcher"),
+(13,0,26354,0,18,0,180771,0,0,'',"Rocket, RED BIG target Firework Launcher"),
+(13,0,26354,0,18,0,180850,0,0,'',"Rocket, RED BIG target Firework Launcher"),
+(13,0,26354,0,18,0,180868,0,0,'',"Rocket, RED BIG target Firework Launcher"),
+(13,0,26355,0,18,0,180771,0,0,'',"Rocket, WHITE BIG target Firework Launcher"),
+(13,0,26355,0,18,0,180850,0,0,'',"Rocket, WHITE BIG target Firework Launcher"),
+(13,0,26355,0,18,0,180868,0,0,'',"Rocket, WHITE BIG target Firework Launcher"),
+(13,0,26356,0,18,0,180771,0,0,'',"Rocket, YELLOW BIG target Firework Launcher"),
+(13,0,26356,0,18,0,180850,0,0,'',"Rocket, YELLOW BIG target Firework Launcher"),
+(13,0,26356,0,18,0,180868,0,0,'',"Rocket, YELLOW BIG target Firework Launcher");
+
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=15466;
+DELETE FROM `smart_scripts` WHERE (`entryorguid`=15466 AND `source_type`=0);
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(15466,0,0,0,8,0,100,0,26636,0,8000,9000,11,25495,0,0,0,0,0,1,0,0,0,0,0,0,0,"Minion of Omen - Cast Firework Dazzled when hitted by Elune's Candle firework");
+
+-- Cast quest credit spell when getting Elune's Blessing buff
+DELETE FROM `spell_scripts` WHERE `id`=26393;
+INSERT INTO `spell_scripts`(`id`,`effIndex`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(26393,1,0,15,26394,2,0,0,0,0,0);
@@ -573,14 +573,158 @@ class npc_clintar_dreamwalker : public CreatureScript
};
/*####
-#
+# npc_omen
####*/
+enum Omen
+{
+ NPC_OMEN = 15467,
+
+ SPELL_OMEN_CLEAVE = 15284,
+ SPELL_OMEN_STARFALL = 26540,
+ SPELL_OMEN_SUMMON_SPOTLIGHT = 26392,
+ SPELL_ELUNE_CANDLE = 26374,
+
+ GO_ELUNE_TRAP_1 = 180876,
+ GO_ELUNE_TRAP_2 = 180877,
+
+ EVENT_CAST_CLEAVE = 1,
+ EVENT_CAST_STARFALL = 2,
+ EVENT_DESPAWN = 3,
+};
+
+class npc_omen : public CreatureScript
+{
+public:
+ npc_omen() : CreatureScript("npc_omen") { }
+
+ struct npc_omenAI : public ScriptedAI
+ {
+ npc_omenAI(Creature* creature) : ScriptedAI(creature)
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
+ me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f);
+ }
+
+ EventMap events;
+
+ void MovementInform(uint32 type, uint32 pointId)
+ {
+ if (type != POINT_MOTION_TYPE)
+ return;
+
+ if (pointId == 1)
+ {
+ me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
+ if (Player* player = me->SelectNearestPlayer(40.0f))
+ AttackStart(player);
+ }
+ }
+
+ void EnterCombat(Unit* /*attacker*/)
+ {
+ events.Reset();
+ events.ScheduleEvent(EVENT_CAST_CLEAVE, urand(3000, 5000));
+ events.ScheduleEvent(EVENT_CAST_STARFALL, urand(8000, 10000));
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT);
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
+ {
+ if (spell->Id == SPELL_ELUNE_CANDLE)
+ {
+ if (me->HasAura(SPELL_OMEN_STARFALL))
+ me->RemoveAurasDueToSpell(SPELL_OMEN_STARFALL);
+
+ events.RescheduleEvent(EVENT_CAST_STARFALL, urand(14000, 16000));
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ switch (events.ExecuteEvent())
+ {
+ case EVENT_CAST_CLEAVE:
+ DoCastVictim(SPELL_OMEN_CLEAVE);
+ events.ScheduleEvent(EVENT_CAST_CLEAVE, urand(8000, 10000));
+ break;
+ case EVENT_CAST_STARFALL:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_OMEN_STARFALL);
+ events.ScheduleEvent(EVENT_CAST_STARFALL, urand(14000, 16000));
+ break;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_omenAI(creature);
+ }
+};
+
+class npc_giant_spotlight : public CreatureScript
+{
+public:
+ npc_giant_spotlight() : CreatureScript("npc_giant_spotlight") { }
+
+ struct npc_giant_spotlightAI : public ScriptedAI
+ {
+ npc_giant_spotlightAI(Creature* creature) : ScriptedAI(creature) {}
+
+ EventMap events;
+
+ void Reset()
+ {
+ events.Reset();
+ events.ScheduleEvent(EVENT_DESPAWN, 5*MINUTE*IN_MILLISECONDS);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ events.Update(diff);
+
+ if (events.ExecuteEvent() == EVENT_DESPAWN)
+ {
+ if (GameObject* trap = me->FindNearestGameObject(GO_ELUNE_TRAP_1, 5.0f))
+ trap->RemoveFromWorld();
+
+ if (GameObject* trap = me->FindNearestGameObject(GO_ELUNE_TRAP_2, 5.0f))
+ trap->RemoveFromWorld();
+
+ if (Creature* omen = me->FindNearestCreature(NPC_OMEN, 5.0f, false))
+ omen->DespawnOrUnsummon();
+
+ me->DespawnOrUnsummon();
+ }
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_giant_spotlightAI(creature);
+ }
+};
+
void AddSC_moonglade()
{
new npc_bunthen_plainswind();
new npc_great_bear_spirit();
new npc_silva_filnaveth();
new npc_clintar_dreamwalker();
new npc_clintar_spirit();
+ new npc_omen();
+ new npc_giant_spotlight();
}
@@ -412,6 +412,75 @@ class spell_gen_leeching_swarm : public SpellScriptLoader
}
};
+enum EluneCandle
+{
+ NPC_OMEN = 15467,
+
+ SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622,
+ SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624,
+ SPELL_ELUNE_CANDLE_OMEN_HAND_R = 26625,
+ SPELL_ELUNE_CANDLE_OMEN_HAND_L = 26649,
+ SPELL_ELUNE_CANDLE_NORMAL = 26636,
+};
+
+class spell_gen_elune_candle : public SpellScriptLoader
+{
+ public:
+ spell_gen_elune_candle() : SpellScriptLoader("spell_gen_elune_candle") {}
+
+ class spell_gen_elune_candle_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_elune_candle_SpellScript);
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_CHEST))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_R))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_L))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_NORMAL))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ uint32 spellId = 0;
+
+ if (target->GetEntry() == NPC_OMEN)
+ {
+ switch (urand(0, 3))
+ {
+ case 0: spellId = SPELL_ELUNE_CANDLE_OMEN_HEAD; break;
+ case 1: spellId = SPELL_ELUNE_CANDLE_OMEN_CHEST; break;
+ case 2: spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_R; break;
+ case 3: spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_L; break;
+ }
+ }
+ else
+ spellId = SPELL_ELUNE_CANDLE_NORMAL;
+
+ GetCaster()->CastSpell(target, spellId, true, NULL);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_elune_candle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_elune_candle_SpellScript();
+ }
+};
+
// 24750 Trick
enum eTrickSpells
{
@@ -1592,4 +1661,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_luck_of_the_draw();
new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise");
new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise");
+ new spell_gen_elune_candle();
}
Oops, something went wrong.

0 comments on commit ff19649

Please sign in to comment.