Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. #include "ObjectMgr.h"
  2. #include "ScriptMgr.h"
  3. #include "SpellScript.h"
  4. #include "SpellAuraEffects.h"
  5. #include "icecrown_citadel.h"
  6.  
  7. enum Spells
  8. {
  9. // Frost Freeze Trap
  10. SPELL_COLDFLAME_JETS = 70460,
  11. };
  12.  
  13. enum Events
  14. {
  15. // Frost Freeze Trap
  16. EVENT_ACTIVATE_TRAP = 1,
  17. };
  18.  
  19. class npc_frost_freeze_trap : public CreatureScript
  20. {
  21. public:
  22. npc_frost_freeze_trap() : CreatureScript("npc_frost_freeze_trap") { }
  23.  
  24. struct npc_frost_freeze_trapAI: public Scripted_NoMovementAI
  25. {
  26. npc_frost_freeze_trapAI(Creature* creature) : Scripted_NoMovementAI(creature)
  27. {
  28. }
  29.  
  30. void DoAction(const int32 action)
  31. {
  32. switch (action)
  33. {
  34. case 1000:
  35. case 11000:
  36. events.ScheduleEvent(EVENT_ACTIVATE_TRAP, uint32(action));
  37. break;
  38. case ACTION_STOP_TRAPS:
  39. me->RemoveAurasDueToSpell(SPELL_COLDFLAME_JETS);
  40. events.CancelEvent(EVENT_ACTIVATE_TRAP);
  41. break;
  42. default:
  43. break;
  44. }
  45. }
  46.  
  47. void UpdateAI(const uint32 diff)
  48. {
  49. events.Update(diff);
  50.  
  51. if (events.ExecuteEvent() == EVENT_ACTIVATE_TRAP)
  52. {
  53. DoCast(me, SPELL_COLDFLAME_JETS);
  54. events.ScheduleEvent(EVENT_ACTIVATE_TRAP, 22000);
  55. }
  56. }
  57.  
  58. private:
  59. EventMap events;
  60. };
  61.  
  62. CreatureAI* GetAI(Creature* creature) const
  63. {
  64. return new npc_frost_freeze_trapAI(creature);
  65. }
  66. };
  67.  
  68. class at_icc_saurfang_portal : public AreaTriggerScript
  69. {
  70. public:
  71. at_icc_saurfang_portal() : AreaTriggerScript("at_icc_saurfang_portal") { }
  72.  
  73. bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
  74. {
  75. InstanceScript* instance = player->GetInstanceScript();
  76. if (!instance || instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE)
  77. return true;
  78.  
  79. player->TeleportTo(631, 4126.35f, 2769.23f, 350.963f, 0.0f);
  80.  
  81. if (instance->GetData(DATA_COLDFLAME_JETS) == NOT_STARTED)
  82. {
  83. // Process relocation now, to preload the grid and initialize traps
  84. player->GetMap()->PlayerRelocation(player, 4126.35f, 2769.23f, 350.963f, 0.0f);
  85.  
  86. instance->SetData(DATA_COLDFLAME_JETS, IN_PROGRESS);
  87. std::list<Creature*> traps;
  88. GetCreatureListWithEntryInGrid(traps, player, NPC_FROST_FREEZE_TRAP, 120.0f);
  89. traps.sort(Trinity::ObjectDistanceOrderPred(player));
  90. bool instant = false;
  91. for (std::list<Creature*>::iterator itr = traps.begin(); itr != traps.end(); ++itr)
  92. {
  93. (*itr)->AI()->DoAction(instant ? 1000 : 11000);
  94. instant = !instant;
  95. }
  96. }
  97. return true;
  98. }
  99. };
  100.  
  101. class at_icc_shutdown_traps : public AreaTriggerScript
  102. {
  103. public:
  104. at_icc_shutdown_traps() : AreaTriggerScript("at_icc_shutdown_traps") { }
  105.  
  106. bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
  107. {
  108. if (InstanceScript* instance = player->GetInstanceScript())
  109. if (instance->GetData(DATA_COLDFLAME_JETS) == IN_PROGRESS)
  110. instance->SetData(DATA_COLDFLAME_JETS, DONE);
  111. return true;
  112. }
  113. };
  114.  
  115. void AddSC_icecrown_citadel()
  116. {
  117. new npc_frost_freeze_trap();
  118. new at_icc_saurfang_portal();
  119. new at_icc_shutdown_traps();
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement