Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #define DISTANCE 4.0f
- #define RANDOM_1 "Think it's brave to get beaten up do you? This is the last time I'll heal you, I swear"
- #define RANDOM_2 "Next time all you're getting is my used bandages"
- #define RANDOM_3 "There we go, all patched up"
- #define RANDOM_4 "Since I just healed you for free, take a look at my bandages, I have the best prices"
- #define RANDOM_5 "Yeah, how about we stop deliberately putting ourselves in danger? I don't have infinite mana you know"
- class nurse_areatrigger : public CreatureScript
- {
- public:
- nurse_areatrigger() : CreatureScript("nurse_areatrigger") { }
- struct nurse_areatriggerAI : public ScriptedAI
- {
- nurse_areatriggerAI(Creature * pCreature) : ScriptedAI(pCreature){}
- void MoveInLineOfSight(Unit * player)
- {
- if(!player || !player->IsAlive() || player->GetHealth() == player->GetMaxHealth()) // NEW!, if the npc isnt facing the player then it won't cast
- return; // If the entity detected is not a player, has a gamemaster tag, or already has full health the npc will not heal it
- if(me->IsWithinDistInMap(player, DISTANCE))
- {
- if(me->GetDistance(player) <= DISTANCE)
- {
- switch (urand(1, 5))
- {
- case 1:
- me->MonsterSay(RANDOM_1, LANG_UNIVERSAL, player->GetGUID());
- player->CastSpell(player, 68024, true);
- break;
- case 2:
- me->MonsterSay(RANDOM_2, LANG_UNIVERSAL, player->GetGUID());
- player->CastSpell(player, 68024, true);
- break;
- case 3:
- player->CastSpell(player, 68024, true);
- me->MonsterSay(RANDOM_3, LANG_UNIVERSAL, NULL);
- break;
- case 4:
- me->MonsterSay(RANDOM_4, LANG_UNIVERSAL, NULL);
- player->CastSpell(player, 68024, true);
- break;
- case 5:
- me->MonsterSay(RANDOM_5, LANG_UNIVERSAL, NULL);
- player->CastSpell(player, 68024, true);
- break;
- }
- }
- }
- }
- };
- CreatureAI * GetAI(Creature * c) const
- {
- return new nurse_areatriggerAI(c);
- }
- };
- void AddSC_nurse_areatrigger()
- {
- new nurse_areatrigger();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement