Advertisement
EmuDevs

EmuDevs: TrinityCore - Boss Fight Timer

Aug 2nd, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. class npc_fight_example : public CreatureScript
  2. {
  3. public:
  4.     npc_fight_example() : CreatureScript("npc_fight_example") { }
  5.    
  6.     struct npc_fight_exampleAI : public ScriptedAI
  7.     {
  8.     npc_fight_example(Creature* creature) : ScriptedAI(creature) { }
  9.  
  10.     uint32 getTimeStart;
  11.     uint32 getTimeDifference;
  12.        
  13.     void Reset()
  14.     {
  15.         getTimeStart = 0;
  16.         getTimeEnd = 0;
  17.     }
  18.        
  19.     void EnterCombat(Unit* /* target */)
  20.     {
  21.             getTimeStart = getMSTime();
  22.     }
  23.        
  24.         void JustDied(Unit* /* killer */)
  25.     {
  26.         getTimeEnd = getMSTime();
  27.     }
  28.     }
  29.    
  30.     CreatureAI* GetAI(Creature* creature) const
  31.     {
  32.         return new npc_fight_exampleAI(creature);
  33.     }
  34. };
  35.  
  36. void AddSC_example_boss_timer()
  37. {
  38.     new npc_fight_example;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement