1. /*
  2. *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
  3. *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
  4. *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
  5. *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
  6. * www.emudevs.com
  7. */
  8. enum NpcIds
  9. {
  10. NPC_DEFIAS_COMMANDER = 80000,
  11. NPC_DEFIAS_VICTIM = 80001
  12. };
  13. enum EventIds
  14. {
  15. EVENT_NONE,
  16. EVENT_START_CINEMATIC,
  17. EVENT_CINEMATIC_TALK,
  18. EVENT_CINEMATIC_TALK2,
  19. EVENT_CINEMATIC_TALK3,
  20. EVENT_CINEMATIC_TALK4
  21. };
  22. class defias_cinematic : public CreatureScript
  23. {
  24. public:
  25. defias_cinematic() : CreatureScript("defias_cinematic") { }
  26. bool OnGossipHello(Player* player, Creature* creature)
  27. {
  28. if (defias_cinematicAI* defiasAI = CAST_AI(defias_cinematicAI, creature->GetAI()))
  29. {
  30. if (!defiasAI->start)
  31. defiasAI->start = true;
  32. else
  33. player->GetSession()->SendNotification("Event already started!");
  34. }
  35. return true;
  36. }
  37. struct defias_cinematicAI : public ScriptedAI
  38. {
  39. defias_cinematicAI(Creature* creature) : ScriptedAI(creature) { }
  40. bool start;
  41. bool canContinue;
  42. void Reset()
  43. {
  44. start = false;
  45. canContinue = true;
  46. if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
  47. me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  48. events.Reset();
  49. }
  50. void UpdateAI(uint32 diff)
  51. {
  52. events.Update(diff);
  53. if (start && canContinue)
  54. {
  55. events.ScheduleEvent(EVENT_START_CINEMATIC, 1000);
  56. me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
  57. canContinue = false;
  58. }
  59. while (uint32 eventId = events.ExecuteEvent())
  60. {
  61. switch(eventId)
  62. {
  63. case EVENT_START_CINEMATIC:
  64. defiasVictim = me->SummonCreature(NPC_DEFIAS_VICTIM, me->GetPositionX() - 2, me->GetPositionY(), me->GetPositionZ() + 1, me->GetOrientation() + me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  65. me->MonsterSay("Welcome scum!", LANG_UNIVERSAL, 0);
  66. me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
  67. events.ScheduleEvent(EVENT_CINEMATIC_TALK, 2500);
  68. break;
  69. case EVENT_CINEMATIC_TALK:
  70. defiasVictim->MonsterSay("Please.. what have I done to you?", LANG_UNIVERSAL, 0);
  71. events.ScheduleEvent(EVENT_CINEMATIC_TALK2, 4000);
  72. break;
  73. case EVENT_CINEMATIC_TALK2:
  74. me->MonsterSay("SILENCE! It is not what you've done, it is what your buddy, Hogger, has done..", LANG_UNIVERSAL, 0);
  75. me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
  76. events.ScheduleEvent(EVENT_CINEMATIC_TALK3, 4500);
  77. break;
  78. case EVENT_CINEMATIC_TALK3:
  79. defiasVictim->MonsterYell("So be it! I'd rather die than see your ugly face!", LANG_UNIVERSAL, 0);
  80. events.ScheduleEvent(EVENT_CINEMATIC_TALK4, 3500);
  81. break;
  82. case EVENT_CINEMATIC_TALK4:
  83. me->MonsterYell("Be gone!", LANG_UNIVERSAL, 0);
  84. defiasVictim->DespawnOrUnsummon(1000);
  85. me->DespawnOrUnsummon(1000);
  86. break;
  87. }
  88. }
  89. }
  90. private:
  91. EventMap events;
  92. Creature* defiasVictim;
  93. };
  94. CreatureAI* GetAI(Creature* creature) const
  95. {
  96. return new defias_cinematicAI(creature);
  97. }
  98. };
  99. void AddSC_cinematic()
  100. {
  101. new defias_cinematic();
  102. }

EmuDevs : TrinityCore Cinematic