Advertisement
Guest User

Untitled

a guest
Sep 16th, 2011
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.47 KB | None | 0 0
  1. enum keristraszaData
  2. {
  3. QUEST_SPRINGING_TRAP = 11969,
  4.  
  5. NPC_KERISTRASZA = 26237,
  6. NPC_SARAGOSA = 26299,
  7. NPC_MALYGOS = 26310,
  8. GO_SIGNAL_FIRE = 194151,
  9.  
  10. SPELL_RAELORASZ_SPARK = 62272,
  11. SPELL_FIRE_CORPSE = 39199,
  12. SPELL_FIRE_BREATH = 31962,
  13. SPELL_MALYGOS_EARTHQ = 46853,
  14. SPELL_TAXI_KERISTASZA = 46814,
  15. SPELL_ICE_BLOCK = 56644,
  16. SPELL_FROSTBOLT = 61461,
  17.  
  18. SAY_KERISTRASZA_1 = -1002030,
  19. YELL_KERISTRASZA_1 = -1002031,
  20. YELL_KERISTRASZA_2 = -1002032,
  21. YELL_KERISTRASZA_3 = -1002033,
  22. SAY_KERISTRASZA_2 = -1002034,
  23.  
  24. //After Fligth
  25. YELL_MALYGOS_1 = -1002035,
  26. SAY_KERISTRASZA_3 = -1002036,
  27. YELL_MALYGOS_2 = -1002037,
  28. YELL_KERISTRASZA_4 = -1002038,
  29. };
  30. const Position posKeristrasza[6] =
  31. {
  32. {4157.00f, 7035.00f, 215.87f, 0.00f}, // Summon position
  33. {4063.72f, 7084.12f, 174.86f, 0.00f}, // Land position
  34. {4054.51f, 7084.29f, 168.12f, 0.00f}, // Burn Corpse positon
  35. {4048.90f, 7083.94f, 168.21f, 0.00f}, // Saragosa Corpse Spawn
  36. {3800.47f, 6557.50f, 170.98f, 1.55f}, // Keristrasza 2ş Spawn
  37. {3791.76f, 6603.61f, 179.91f, 0.00f}, // Malygos Spawn
  38. };
  39. class npc_signal_fire : public CreatureScript
  40. {
  41. public:
  42. npc_signal_fire() : CreatureScript("npc_signal_fire") { }
  43.  
  44. struct npc_signal_fireAI : public ScriptedAI
  45. {
  46. npc_signal_fireAI(Creature* creature) : ScriptedAI(creature) { }
  47.  
  48. EventMap events;
  49. Creature* pKeristrasza;
  50. Creature* pSaragosa;
  51. Player* player;
  52. bool eventRunning;
  53.  
  54. void Reset()
  55. {
  56. // Reset al variables
  57. events.Reset();
  58. pKeristrasza, pSaragosa, player = NULL;
  59. eventRunning = false;
  60. // Unlit signal
  61. if(GameObject* pGo = me->FindNearestGameObject(GO_SIGNAL_FIRE, 2.0f))
  62. pGo->SetGoState(GO_STATE_READY);
  63. }
  64.  
  65. void SpellHit(Unit* caster, SpellEntry const* spell)
  66. {
  67. if (eventRunning)
  68. return;
  69.  
  70. // The invisible trigger handles the event until the Fly of Keristrasza
  71. if(spell->Id == SPELL_RAELORASZ_SPARK)
  72. {
  73. player = caster->ToPlayer();
  74. // Lit the fire signal
  75. if(GameObject* pGo = me->FindNearestGameObject(GO_SIGNAL_FIRE, 2.0f))
  76. pGo->SetGoState(GO_STATE_ACTIVE);
  77. // Summon Keristrasza
  78. if(Creature* pFind = me->SummonCreature(NPC_KERISTRASZA, posKeristrasza[0]))
  79. {
  80. pKeristrasza = pFind;
  81. pFind->SetFlying(true);
  82. pFind->GetMotionMaster()->MovePoint(1, posKeristrasza[1]);
  83. }
  84. eventRunning = true;
  85. events.ScheduleEvent(1, 6000);
  86. }
  87. }
  88.  
  89. void UpdateAI(const uint32 diff)
  90. {
  91. events.Update(diff);
  92.  
  93. switch(events.ExecuteEvent())
  94. {
  95. case 1:
  96. pKeristrasza->SetFlying(false);
  97. DoScriptText(SAY_KERISTRASZA_1, pKeristrasza, player);
  98. events.ScheduleEvent(2, 3000);
  99. break;
  100. case 2:
  101. DoScriptText(YELL_KERISTRASZA_1, pKeristrasza);
  102. pKeristrasza->GetMotionMaster()->MovePoint(1, posKeristrasza[2]);
  103. events.ScheduleEvent(3, 5000);
  104. break;
  105. case 3:
  106. DoScriptText(YELL_KERISTRASZA_2, pKeristrasza);
  107. // Summon Saragosa and make her die
  108. if(Creature* pCorpse = me->SummonCreature(NPC_SARAGOSA, posKeristrasza[3]))
  109. pSaragosa = pCorpse;
  110. events.ScheduleEvent(4, 3000);
  111. break;
  112. case 4:
  113. DoScriptText(YELL_KERISTRASZA_3, pKeristrasza);
  114. pKeristrasza->CastSpell(pSaragosa, SPELL_FIRE_BREATH, true);
  115. events.ScheduleEvent(5, 1000);
  116. break;
  117. case 5:
  118. me->AddAura(SPELL_FIRE_CORPSE, pSaragosa);
  119. events.ScheduleEvent(6, 1000);
  120. break;
  121. case 6:
  122. player->CastSpell(player, SPELL_MALYGOS_EARTHQ, true);
  123. events.ScheduleEvent(7, 3000);
  124. break;
  125. case 7:
  126. DoScriptText(SAY_KERISTRASZA_2, pKeristrasza, player);
  127. events.ScheduleEvent(8, 3000);
  128. break;
  129. case 8:
  130. // Passes the control to Keristrasza
  131. player->CastSpell(player, SPELL_TAXI_KERISTASZA, true);
  132. pKeristrasza->AI()->SetGUID(player->GetGUID());
  133. pSaragosa->DespawnOrUnsummon(10000);
  134. events.ScheduleEvent(9, 20000);
  135. break;
  136. case 9:
  137. Reset();
  138. break;
  139. }
  140. }
  141.  
  142. };
  143.  
  144. CreatureAI* GetAI(Creature* creature) const
  145. {
  146. return new npc_signal_fireAI(creature);
  147. }
  148. };
  149.  
  150. class npc_keristrasza_coldarra : public CreatureScript
  151. {
  152. public:
  153. npc_keristrasza_coldarra() : CreatureScript("npc_keristrasza_coldarra") { }
  154.  
  155. struct npc_keristrasza_coldarraAI : public ScriptedAI
  156. {
  157. npc_keristrasza_coldarraAI(Creature* creature) : ScriptedAI(creature) { }
  158.  
  159. EventMap events;
  160. uint64 uiPlayer;
  161. bool waiting;
  162. bool finishedWay;
  163. Creature* pMalygos;
  164.  
  165. void SetGUID(const uint64 &guid, int32 /*iId*/)
  166. {
  167. me->NearTeleportTo(posKeristrasza[4].GetPositionX(), posKeristrasza[4].GetPositionY(), posKeristrasza[4].GetPositionZ(), posKeristrasza[4].GetOrientation());
  168. me->SetVisible(false);
  169. uiPlayer = guid;
  170. waiting = true;
  171. }
  172. void Reset()
  173. {
  174. events.Reset();
  175. me->SetSpeed(MOVE_FLIGHT, 3.2f, true);
  176. pMalygos = NULL;
  177. uiPlayer = 0;
  178. waiting = false;
  179. finishedWay = false;
  180. me->SetReactState(REACT_PASSIVE);
  181. }
  182.  
  183.  
  184. void UpdateAI(const uint32 diff)
  185. {
  186. if(!waiting)
  187. return;
  188.  
  189. if(!finishedWay)
  190. {
  191. if(Player* player = me->GetPlayer(*me, uiPlayer))
  192. {
  193. if (!player->isInFlight())
  194. {
  195. if(me->IsWithinDist(player, 10.0f))
  196. {
  197. finishedWay = true;
  198. me->SetVisible(true);
  199. player->ToPlayer()->KilledMonsterCredit(NPC_KERISTRASZA, 0);
  200. events.ScheduleEvent(1, 0);
  201. }else
  202. me->DespawnOrUnsummon(0);
  203. }
  204. else
  205. return;
  206. }
  207. }
  208.  
  209. events.Update(diff);
  210.  
  211. switch(events.ExecuteEvent())
  212. {
  213. case 1:
  214. me->SetFlying(false);
  215. if(Player* player = me->GetPlayer(*me, uiPlayer))
  216. DoScriptText(SAY_KERISTRASZA_3, me, player);
  217. events.ScheduleEvent(2, 5000);
  218. break;
  219. case 2:
  220. if(Creature* pSumm = me->SummonCreature(NPC_MALYGOS, posKeristrasza[5]))
  221. {
  222. pMalygos = pSumm;
  223. pSumm->SetFlying(true);
  224. pSumm->SetReactState(REACT_PASSIVE);
  225. pSumm->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE);
  226. pSumm->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.4f);
  227. DoScriptText(YELL_MALYGOS_2, pMalygos);
  228. pMalygos->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID());
  229. me->SetUInt64Value(UNIT_FIELD_TARGET, pMalygos->GetGUID());
  230. }
  231. events.ScheduleEvent(3, 6000);
  232. break;
  233. case 3:
  234. DoScriptText(YELL_KERISTRASZA_4, me);
  235. me->AddAura(SPELL_ICE_BLOCK, me);
  236.  
  237. if(pMalygos)
  238. pMalygos->DespawnOrUnsummon(7000);
  239. me->DespawnOrUnsummon(7000);
  240. break;
  241. }
  242.  
  243. }
  244. };
  245.  
  246. CreatureAI* GetAI(Creature* creature) const
  247. {
  248. return new npc_keristrasza_coldarraAI(creature);
  249. }
  250. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement