diff options
| author | offl <11556157+offl@users.noreply.github.com> | 2021-11-21 23:18:10 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-22 23:50:20 +0100 |
| commit | d3c9c14f83078736b1500e303da5ec575aaf22dc (patch) | |
| tree | 16ee4a467002c035cb11441054228ccf2e8b00ca /src/server/scripts/Kalimdor | |
| parent | 12ae55df6c720f21b64ee2b530a6b461c20b86f7 (diff) | |
Scripts/Misc: Migrate world event scripts to separate files (#27284)
(cherry picked from commit 542c10094f8660302708e24cf3c8b2903ac25607)
Diffstat (limited to 'src/server/scripts/Kalimdor')
| -rw-r--r-- | src/server/scripts/Kalimdor/zone_moonglade.cpp | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index d664bc8a0d5..bdddccf846d 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -22,154 +22,6 @@ #include "ScriptedCreature.h" #include "SpellInfo.h" -/*#### -# 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->SetImmuneToPC(true); - me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f); - } - - EventMap events; - - void MovementInform(uint32 type, uint32 pointId) override - { - if (type != POINT_MOTION_TYPE) - return; - - if (pointId == 1) - { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->SetImmuneToPC(false); - if (Player* player = me->SelectNearestPlayer(40.0f)) - AttackStart(player); - } - } - - void JustEngagedWith(Unit* /*attacker*/) override - { - events.Reset(); - events.ScheduleEvent(EVENT_CAST_CLEAVE, 3s, 5s); - events.ScheduleEvent(EVENT_CAST_STARFALL, 8s, 10s); - } - - void JustDied(Unit* /*killer*/) override - { - DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT); - } - - void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override - { - if (spellInfo->Id == SPELL_ELUNE_CANDLE) - { - if (me->HasAura(SPELL_OMEN_STARFALL)) - me->RemoveAurasDueToSpell(SPELL_OMEN_STARFALL); - - events.RescheduleEvent(EVENT_CAST_STARFALL, 14s, 16s); - } - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - switch (events.ExecuteEvent()) - { - case EVENT_CAST_CLEAVE: - DoCastVictim(SPELL_OMEN_CLEAVE); - events.ScheduleEvent(EVENT_CAST_CLEAVE, 8s, 10s); - break; - case EVENT_CAST_STARFALL: - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - DoCast(target, SPELL_OMEN_STARFALL); - events.ScheduleEvent(EVENT_CAST_STARFALL, 14s, 16s); - break; - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - 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() override - { - events.Reset(); - events.ScheduleEvent(EVENT_DESPAWN, 5min); - } - - void UpdateAI(uint32 diff) override - { - 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 override - { - return new npc_giant_spotlightAI(creature); - } -}; - void AddSC_moonglade() { - new npc_omen(); - new npc_giant_spotlight(); } |
