Advertisement
Rochet2

Untitled

Jun 23rd, 2013
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.19 KB | None | 0 0
  1.  
  2. class Wolves : public CreatureScript
  3. {
  4. public:
  5.     Wolves() : CreatureScript("Wolves") { }
  6.  
  7.     bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
  8.     {
  9.         //if(quest->GetQuestId() != 19005)
  10.         //return false;
  11.         Creature* Tevelvka = Unit::GetCreature(*creature, MAKE_NEW_GUID(280753, 11115, HIGHGUID_UNIT));
  12.         Creature* Axchorak = Unit::GetCreature(*creature, MAKE_NEW_GUID(277762, 54676, HIGHGUID_UNIT));
  13.         Creature* Dimka = Unit::GetCreature(*creature, MAKE_NEW_GUID(280752, 111162, HIGHGUID_UNIT));
  14.  
  15.         Creature* E = Unit::GetCreature(*creature, MAKE_NEW_GUID(277764, 87787, HIGHGUID_UNIT));
  16.         std::list<Creature*> list;
  17.         creature->GetCreatureListWithEntryInGrid(list, 46457, 500); // get all creatures with entry within 500 yards
  18.         if(E)
  19.             list.push_back(E);
  20.         /*
  21.         Creature* D = Unit::GetCreature(*creature, MAKE_NEW_GUID(280771, 46457, HIGHGUID_UNIT));
  22.         Creature* C = Unit::GetCreature(*creature, MAKE_NEW_GUID(280763, 46457, HIGHGUID_UNIT));
  23.         Creature* B = Unit::GetCreature(*creature, MAKE_NEW_GUID(280761, 46457, HIGHGUID_UNIT));
  24.         Creature* A = Unit::GetCreature(*creature, MAKE_NEW_GUID(280775, 46457, HIGHGUID_UNIT));
  25.         */
  26.  
  27.         if (!Tevelvka)  return false;
  28.         if (!Axchorak)  return false;
  29.         if (!Dimka)     return false;
  30.         /*
  31.         if (!E) return false;
  32.         if (!D) return false;
  33.         if (!C) return false;
  34.         if (!B) return false;
  35.         if (!A) return false;
  36.         */
  37.  
  38.         // add timed events to the creatures:
  39.         new TimedMessage(Axchorak, "Theyre coming..", CHAT_TYPE_SAY, 1000);
  40.         new TimedAction(Axchorak, 12166, 1000);
  41.         new TimedMessage(Axchorak, "Their forces has crossed the road of Bronze, time is up the essence Captains", CHAT_TYPE_SAY, 4000);
  42.         new TimedMessage(Tevelvka, "Well then SLUGS!... are you ready to chop some human's head?", CHAT_TYPE_SAY, 7000);
  43.         new TimedAction(Tevelvka, 8574, 7000);
  44.         new TimedMessage(Dimka , "Ready boys! we ride for glory and honour... LOKTAR OGAR!", CHAT_TYPE_SAY, 9000);
  45.         new TimedAction(Dimka, 6943, 9000);
  46.         new TimedAction(Dimka, 8574, 9000);
  47.         for (std::list<Creature*>::const_iterator it = list.begin(); it != list.end(); ++it)
  48.             new TimedMessage(*it, "LOKTAR OGAR", CHAT_TYPE_SAY, 10000);
  49.         new TimedMessage(Dimka, "RIDE WITH ME, RIDE TO OUR DEATH, FOR THE HORDE!", CHAT_TYPE_SAY, 14000);
  50.         return true;
  51.     }
  52.  
  53.     bool OnQuestSelect(Player* player, Creature* creature, Quest const* quest)
  54.     {
  55.         //if (quest->GetQuestId() != 19005)
  56.         //  return false;
  57.         return true;
  58.     }
  59.  
  60.     bool OnQuestComplete(Player* player, Creature* creature, Quest const* quest)
  61.     {
  62.         //if (quest->GetQuestId() != 19005)
  63.         //return false;
  64.         player->SetPhaseMask(16, true);
  65.         return true;
  66.     }
  67.  
  68.     struct TimedMessage : public BasicEvent
  69.     {
  70.         TimedMessage(Creature* creature, const char* text, ChatType type, uint32 delay) : _creature(creature), _text(text), _type(type)
  71.         {
  72.             creature->m_Events.AddEvent(this, creature->m_Events.CalculateTime(delay));
  73.         }
  74.  
  75.         bool Execute(uint64 time, uint32 diff)
  76.         {
  77.             switch (_type)
  78.             {
  79.             case CHAT_TYPE_SAY:
  80.                 _creature->MonsterSay(_text, LANG_UNIVERSAL, 0);
  81.                 break;
  82.             case CHAT_TYPE_YELL:
  83.                 _creature->MonsterYell(_text, LANG_UNIVERSAL, 0);
  84.                 break;
  85.             }
  86.             return true;
  87.         }
  88.  
  89.         Creature* _creature;
  90.         const char* _text;
  91.         ChatType _type;
  92.     };
  93.  
  94.     struct TimedAction : public BasicEvent
  95.     {
  96.         TimedAction(Creature* creature, uint32 sound_id, uint32 delay) : _creature(creature), _sound_id(sound_id)
  97.         {
  98.             creature->m_Events.AddEvent(this, creature->m_Events.CalculateTime(delay));
  99.         }
  100.  
  101.         bool Execute(uint64 time, uint32 diff)
  102.         {
  103.             _creature->PlayDirectSound(_sound_id);
  104.             return true;
  105.         }
  106.  
  107.         Creature* _creature;
  108.         uint32 _sound_id;
  109.     };
  110. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement