Advertisement
Guest User

Untitled

a guest
May 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. // 58220, 58243, 58244
  2. struct npc_windward_hatchling : public ScriptedAI
  3. {
  4.     npc_windward_hatchling(Creature* creature) : ScriptedAI(creature) { }
  5.  
  6.     void Reset() override { }
  7.  
  8.     void SpellHit(Unit* caster, SpellInfo const* spell) override
  9.     {
  10.         auto player = caster->ToPlayer();
  11.         if (spell->Id == SPELL_SILKEN_ROPE && player && player->GetQuestStatus(QUEST_EMPTY_NESTS) == QUEST_STATUS_INCOMPLETE)
  12.         {
  13.             if (auto summon = player->SummonCreature(NPC_WINDWARD_HATCHLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000))
  14.             {
  15.                 summon->SetOwnerGUID(player->GetGUID());
  16.                 summon->SetDisplayId(me->GetDisplayId());
  17.                 summon->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, M_PI);
  18.                 summon->CastSpell(player, SPELL_ROPE_BEAM, true);
  19.                 summon->ClearUnitState(UNIT_STATE_CASTING); // Allows move
  20.                 me->DespawnOrUnsummon();
  21.             }
  22.         }
  23.     }
  24. };
  25.  
  26. // 58275
  27. struct npc_windward_nest_trigger : public ScriptedAI
  28. {
  29.     npc_windward_nest_trigger(Creature* creature) : ScriptedAI(creature) { me->SetReactState(REACT_AGGRESSIVE); }
  30.  
  31.     void Reset() override { }
  32.  
  33.     void MoveInLineOfSight(Unit* who) override
  34.     {
  35.         if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_WINDWARD_HATCHLING)
  36.         {
  37.             if (who->GetDistance(me) > 5.0f)
  38.                 return;
  39.  
  40.             if (auto owner = who->GetCharmerOrOwnerPlayerOrPlayerItself())
  41.             {
  42.                 owner->KilledMonsterCredit(58246);
  43.                 who->RemoveAurasDueToSpell(SPELL_ROPE_BEAM);
  44.                 who->GetMotionMaster()->MoveFollow(me, 0, 0);
  45.                 who->ToCreature()->SetOwnerGUID(0);
  46.                 who->ToCreature()->DespawnOrUnsummon(1000);
  47.             }
  48.         }
  49.     }
  50. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement