Advertisement
Emulation

Untitled

Sep 25th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.45 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. #define DISTANCE 4.0f
  4.  
  5. #define RANDOM_1 "Think it's brave to get beaten up do you? This is the last time I'll heal you, I swear"
  6. #define RANDOM_2 "Next time all you're getting is my used bandages"
  7. #define RANDOM_3 "There we go, all patched up"
  8. #define RANDOM_4 "Since I just healed you for free, take a look at my bandages, I have the best prices"
  9. #define RANDOM_5 "Yeah, how about we stop deliberately putting ourselves in danger? I don't have infinite mana you know"
  10.  
  11.  
  12. class nurse_areatrigger : public CreatureScript
  13. {
  14.   public:
  15.           nurse_areatrigger() : CreatureScript("nurse_areatrigger") { }
  16.  
  17.           struct nurse_areatriggerAI : public ScriptedAI
  18.           {
  19.                   nurse_areatriggerAI(Creature * pCreature) : ScriptedAI(pCreature){}
  20.  
  21.                   void MoveInLineOfSight(Unit * player)
  22.                   {
  23.                           if(!player || !player->IsAlive() || player->GetHealth() == player->GetMaxHealth()) // NEW!, if the npc isnt facing the player then it won't cast
  24.                                   return; // If the entity detected is not a player, has a gamemaster tag, or already has full health the npc will not heal it
  25.  
  26.                           if(me->IsWithinDistInMap(player, DISTANCE))
  27.                           {
  28.                               if(me->GetDistance(player) <= DISTANCE)
  29.                               {
  30.                                         switch (urand(1, 5))
  31.                                         {
  32.                                         case 1:
  33.                                             me->MonsterSay(RANDOM_1, LANG_UNIVERSAL, player->GetGUID());
  34.                                             player->CastSpell(player, 68024, true);
  35.                                             break;
  36.                                         case 2:
  37.                                             me->MonsterSay(RANDOM_2, LANG_UNIVERSAL, player->GetGUID());
  38.                                             player->CastSpell(player, 68024, true);
  39.                                             break;
  40.                                         case 3:
  41.                                             player->CastSpell(player, 68024, true);
  42.                                             me->MonsterSay(RANDOM_3, LANG_UNIVERSAL, NULL);
  43.                                             break;
  44.                                         case 4:
  45.                                             me->MonsterSay(RANDOM_4, LANG_UNIVERSAL, NULL);
  46.                                             player->CastSpell(player, 68024, true);
  47.                                             break;
  48.                                         case 5:
  49.                                             me->MonsterSay(RANDOM_5, LANG_UNIVERSAL, NULL);
  50.                                             player->CastSpell(player, 68024, true);
  51.                                             break;
  52.                                   }
  53.                               }
  54.                           }
  55.                   }
  56.           };
  57.  
  58.           CreatureAI * GetAI(Creature * c) const
  59.           {
  60.                   return new nurse_areatriggerAI(c);
  61.           }
  62. };
  63.  
  64. void AddSC_nurse_areatrigger()
  65. {
  66.    new nurse_areatrigger();
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement