Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ObjectMgr.h"
- #include "ScriptMgr.h"
- #include "SpellScript.h"
- #include "SpellAuraEffects.h"
- #include "icecrown_citadel.h"
- enum Spells
- {
- // Frost Freeze Trap
- SPELL_COLDFLAME_JETS = 70460,
- };
- enum Events
- {
- // Frost Freeze Trap
- EVENT_ACTIVATE_TRAP = 1,
- };
- class npc_frost_freeze_trap : public CreatureScript
- {
- public:
- npc_frost_freeze_trap() : CreatureScript("npc_frost_freeze_trap") { }
- struct npc_frost_freeze_trapAI: public Scripted_NoMovementAI
- {
- npc_frost_freeze_trapAI(Creature* creature) : Scripted_NoMovementAI(creature)
- {
- }
- void DoAction(const int32 action)
- {
- switch (action)
- {
- case 1000:
- case 11000:
- events.ScheduleEvent(EVENT_ACTIVATE_TRAP, uint32(action));
- break;
- case ACTION_STOP_TRAPS:
- me->RemoveAurasDueToSpell(SPELL_COLDFLAME_JETS);
- events.CancelEvent(EVENT_ACTIVATE_TRAP);
- break;
- default:
- break;
- }
- }
- void UpdateAI(const uint32 diff)
- {
- events.Update(diff);
- if (events.ExecuteEvent() == EVENT_ACTIVATE_TRAP)
- {
- DoCast(me, SPELL_COLDFLAME_JETS);
- events.ScheduleEvent(EVENT_ACTIVATE_TRAP, 22000);
- }
- }
- private:
- EventMap events;
- };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_frost_freeze_trapAI(creature);
- }
- };
- class at_icc_saurfang_portal : public AreaTriggerScript
- {
- public:
- at_icc_saurfang_portal() : AreaTriggerScript("at_icc_saurfang_portal") { }
- bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
- {
- InstanceScript* instance = player->GetInstanceScript();
- if (!instance || instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE)
- return true;
- player->TeleportTo(631, 4126.35f, 2769.23f, 350.963f, 0.0f);
- if (instance->GetData(DATA_COLDFLAME_JETS) == NOT_STARTED)
- {
- // Process relocation now, to preload the grid and initialize traps
- player->GetMap()->PlayerRelocation(player, 4126.35f, 2769.23f, 350.963f, 0.0f);
- instance->SetData(DATA_COLDFLAME_JETS, IN_PROGRESS);
- std::list<Creature*> traps;
- GetCreatureListWithEntryInGrid(traps, player, NPC_FROST_FREEZE_TRAP, 120.0f);
- traps.sort(Trinity::ObjectDistanceOrderPred(player));
- bool instant = false;
- for (std::list<Creature*>::iterator itr = traps.begin(); itr != traps.end(); ++itr)
- {
- (*itr)->AI()->DoAction(instant ? 1000 : 11000);
- instant = !instant;
- }
- }
- return true;
- }
- };
- class at_icc_shutdown_traps : public AreaTriggerScript
- {
- public:
- at_icc_shutdown_traps() : AreaTriggerScript("at_icc_shutdown_traps") { }
- bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
- {
- if (InstanceScript* instance = player->GetInstanceScript())
- if (instance->GetData(DATA_COLDFLAME_JETS) == IN_PROGRESS)
- instance->SetData(DATA_COLDFLAME_JETS, DONE);
- return true;
- }
- };
- void AddSC_icecrown_citadel()
- {
- new npc_frost_freeze_trap();
- new at_icc_saurfang_portal();
- new at_icc_shutdown_traps();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement