stoneharry

Untitled

Jun 29th, 2014
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1.  
  2. #include "ScriptMgr.h"
  3. #include "ScriptedCreature.h"
  4. #include "CreatureTextMgr.h"
  5.  
  6. class generalAI : public CreatureScript
  7. {
  8. public:
  9.     generalAI() : CreatureScript("generalAI") { }
  10.  
  11.     CreatureAI* GetAI(Creature* creature) const OVERRIDE
  12.     {
  13.         return new generalAI_(creature);
  14.     }
  15.  
  16.     struct generalAI_ : public ScriptedAI
  17.     {
  18.         generalAI_(Creature* creature) : ScriptedAI(creature) { }
  19.  
  20.         void EnterCombat(Unit* aggro) OVERRIDE
  21.         {
  22.             Creature me = ((Creature)this);
  23.             int entry = me.GetEntry();
  24.             switch (entry)
  25.             {
  26.                 case 50000:
  27.                     int option = urand(0, 7);
  28.                     std::stringstream msg;
  29.                     switch (option)
  30.                     {
  31.                         case 0:
  32.                             msg << "I be killin' " << getRaceString(aggro->getRace()) << "!";
  33.                             break;
  34.                         case 1:
  35.                             msg << "Time to feast on " << getRaceString(aggro->getRace()) << "!";
  36.                             break;
  37.                         case 2:
  38.                             msg << "You die now!";
  39.                     }
  40.                     if (msg.str().length() != 0)
  41.                         me.MonsterSay(msg.str().c_str(), LANG_UNIVERSAL, NULL);
  42.                     break;
  43.             }
  44.         }
  45.  
  46.         void JustDied(Unit* killer) OVERRIDE
  47.         {
  48.             Creature me = ((Creature)this);
  49.             int entry = me.GetEntry();
  50.             switch (entry)
  51.             {
  52.             case 50000:
  53.                 int option = urand(0, 5);
  54.                 std::stringstream msg;
  55.                 switch (option)
  56.                 {
  57.                 case 0:
  58.                     msg << "Curse 'mon...";
  59.                     break;
  60.                 case 1:
  61.                     msg << "Hakkar I beg ye'...";
  62.                 }
  63.                 if (msg.str().length() != 0)
  64.                     me.MonsterSay(msg.str().c_str(), LANG_UNIVERSAL, NULL);
  65.                 break;
  66.             }
  67.         }
  68.  
  69.         /*void KilledUnit(Unit* victim) OVERRIDE
  70.         {
  71.  
  72.         }*/
  73.  
  74.         std::string getRaceString(int race)
  75.         {
  76.             switch (race)
  77.             {
  78.                 case RACE_HUMAN:
  79.                     return "Human";
  80.                 case RACE_DWARF:
  81.                     return "Dwarf";
  82.                 case RACE_NIGHTELF:
  83.                     return "Night elf";
  84.                 case RACE_GNOME:
  85.                     return "Gnome";
  86.                 case RACE_DRAENEI:
  87.                     return "Draenei";
  88.                 case RACE_ORC:
  89.                     return "Orc";
  90.                 case RACE_UNDEAD_PLAYER:
  91.                     return "Undead";
  92.                 case RACE_TAUREN:
  93.                     return "Tauren";
  94.                 case RACE_TROLL:
  95.                     return "a traitor to the tribe";
  96.                 case RACE_BLOODELF:
  97.                     return "Blood elf";
  98.             }
  99.             return "ERROR";
  100.         }
  101.     };
  102. };
  103.  
  104. void addHG_GeneralAI()
  105. {
  106.     new generalAI();
  107. }
Advertisement
Add Comment
Please, Sign In to add comment