class npc_ogre_brute : public CreatureScript { public: npc_ogre_brute() : CreatureScript("npc_ogre_brute") { } CreatureAI* GetAI(Creature* creature) const { return new npc_ogre_bruteAI(creature); } struct npc_ogre_bruteAI : public ScriptedAI { npc_ogre_bruteAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; void Reset() { PlayerGUID = 0; } void MoveInLineOfSight(Unit* who) { if (!who || (!who->isAlive())) return; if (me->IsWithinDistInMap(who, 50.0f)) { if (who->GetTypeId() == TYPEID_PLAYER) if (who->ToPlayer()->GetQuestStatus(QUEST_GETTING_THE_BLADESPIRE_TANKED) == QUEST_STATUS_INCOMPLETE || who->ToPlayer()->GetQuestStatus(QUEST_BLADESPIRE_KEGGER) == QUEST_STATUS_INCOMPLETE ) PlayerGUID = who->GetGUID(); } } void MovementInform(uint32 /*type*/, uint32 id) { Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); if (id == 1) { GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); if (Keg) Keg->Delete(); me->HandleEmoteCommand(7); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->MoveTargetedHome(); Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); if (pPlayer && Credit) pPlayer->KilledMonster(Credit->GetCreatureInfo(), Credit->GetGUID()); } } void UpdateAI(const uint32 /*diff*/) { if (!UpdateVictim()) return; DoMeleeAttackIfReady(); } }; };