Advertisement
Guest User

EmuDevs : TrinityCore Cinematic

a guest
May 16th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.94 KB | None | 0 0
  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.  
  14. enum EventIds
  15. {
  16.     EVENT_NONE,
  17.     EVENT_START_CINEMATIC,
  18.     EVENT_CINEMATIC_TALK,
  19.     EVENT_CINEMATIC_TALK2,
  20.     EVENT_CINEMATIC_TALK3,
  21.     EVENT_CINEMATIC_TALK4
  22. };
  23.  
  24. class defias_cinematic : public CreatureScript
  25. {
  26. public:
  27.     defias_cinematic() : CreatureScript("defias_cinematic") { }
  28.  
  29.     bool OnGossipHello(Player* player, Creature* creature)
  30.     {
  31.         if (defias_cinematicAI* defiasAI = CAST_AI(defias_cinematicAI, creature->GetAI()))
  32.         {
  33.             if (!defiasAI->start)
  34.                 defiasAI->start = true;
  35.             else
  36.                 player->GetSession()->SendNotification("Event already started!");
  37.         }
  38.         return true;
  39.     }
  40.  
  41.     struct defias_cinematicAI : public ScriptedAI
  42.     {
  43.         defias_cinematicAI(Creature* creature) : ScriptedAI(creature) { }
  44.  
  45.         bool start;
  46.         bool canContinue;
  47.  
  48.         void Reset()
  49.         {
  50.             start = false;
  51.             canContinue = true;
  52.             if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
  53.                 me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  54.             events.Reset();
  55.         }
  56.  
  57.         void UpdateAI(uint32 diff)
  58.         {
  59.             events.Update(diff);
  60.  
  61.             if (start && canContinue)
  62.             {
  63.                 events.ScheduleEvent(EVENT_START_CINEMATIC, 1000);
  64.                 me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
  65.                 canContinue = false;
  66.             }
  67.  
  68.             while (uint32 eventId = events.ExecuteEvent())
  69.             {
  70.                 switch(eventId)
  71.                 {
  72.                     case EVENT_START_CINEMATIC:
  73.                         defiasVictim = me->SummonCreature(NPC_DEFIAS_VICTIM, me->GetPositionX() - 2, me->GetPositionY(), me->GetPositionZ() + 1, me->GetOrientation() + me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  74.                         me->MonsterSay("Welcome scum!", LANG_UNIVERSAL, 0);
  75.                         me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
  76.                         events.ScheduleEvent(EVENT_CINEMATIC_TALK, 2500);
  77.                         break;
  78.  
  79.                     case EVENT_CINEMATIC_TALK:
  80.                         defiasVictim->MonsterSay("Please.. what have I done to you?", LANG_UNIVERSAL, 0);
  81.                         events.ScheduleEvent(EVENT_CINEMATIC_TALK2, 4000);
  82.                         break;
  83.  
  84.                     case EVENT_CINEMATIC_TALK2:
  85.                         me->MonsterSay("SILENCE! It is not what you've done, it is what your buddy, Hogger, has done..", LANG_UNIVERSAL, 0);
  86.                         me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
  87.                         events.ScheduleEvent(EVENT_CINEMATIC_TALK3, 4500);
  88.                         break;
  89.  
  90.                     case EVENT_CINEMATIC_TALK3:
  91.                         defiasVictim->MonsterYell("So be it! I'd rather die than see your ugly face!", LANG_UNIVERSAL, 0);
  92.                         events.ScheduleEvent(EVENT_CINEMATIC_TALK4, 3500);
  93.                         break;
  94.  
  95.                     case EVENT_CINEMATIC_TALK4:
  96.                         me->MonsterYell("Be gone!", LANG_UNIVERSAL, 0);
  97.                         defiasVictim->DespawnOrUnsummon(1000);
  98.                         me->DespawnOrUnsummon(1000);
  99.                         break;
  100.                 }
  101.             }
  102.         }
  103.  
  104.     private:
  105.         EventMap events;
  106.         Creature* defiasVictim;
  107.     };
  108.  
  109.     CreatureAI* GetAI(Creature* creature) const
  110.     {
  111.         return new defias_cinematicAI(creature);
  112.     }
  113. };
  114.  
  115. void AddSC_cinematic()
  116. {
  117.     new defias_cinematic();
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement