Guest User

Untitled

a guest
May 16th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1. class npc_throw_quel_delar : public CreatureScript // Frostmourne Altar Bunny (Quel'Delar) entry 37704
  2. {
  3. public:
  4.  
  5.         npc_throw_quel_delar()
  6.                 : CreatureScript("npc_throw_quel_delar")
  7.         {
  8.         }
  9.  
  10.         struct npc_throw_quel_delarAI : public ScriptedAI
  11.         {
  12.                 npc_throw_quel_delarAI(Creature* c) : ScriptedAI(c)
  13.                 {
  14.                         m_pInstance = (InstanceScript*)c->GetInstanceScript();
  15.                 }
  16.  
  17.                 InstanceScript* m_pInstance;
  18.  
  19.  
  20.                 // Called when hit by a spell
  21.                 void SpellHit(Unit* caster, SpellInfo const* spell)
  22.                 {
  23.                         if ( caster->GetTypeId() == TYPEID_PLAYER && spell->Id == 70698 )
  24.                             DoCast(SPELL_BOESES_QUELDELAR_SUMMON);
  25.                 }
  26.  
  27.                 //Called at World update tick
  28.                 void UpdateAI (uint32 const diff)
  29.                 {
  30.                         Map::PlayerList const &players = m_pInstance->instance->GetPlayers();
  31.                         for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  32.                         {
  33.                                 Player* player = itr->getSource();
  34.  
  35.                                 if ( player->isAlive() && me->IsWithinDistInMap(player, 10.0) )
  36.                                         if ( player->HasAura(70013) && ( player->ToPlayer()->IsActiveQuest(24480) || player->ToPlayer()->IsActiveQuest(24561) ) )
  37.                                         {
  38.                                                 player->RemoveAura(70013);
  39.                                                 player->CastSpell(me, 70698, false);
  40.                                         }
  41.  
  42.                         }
  43.  
  44.                 }
  45.  
  46.         };
Add Comment
Please, Sign In to add comment