Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class mob_attacker_dimwind : public CreatureScript
- {
- public:
- mob_attacker_dimwind() : CreatureScript("mob_attacker_dimwind") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_attacker_dimwindAI(creature);
- }
- struct mob_attacker_dimwindAI : public ScriptedAI
- {
- mob_attacker_dimwindAI(Creature* creature) : ScriptedAI(creature) {}
- void DamageTaken(Unit* pDoneBy, uint32 &uiDamage, DamageEffectType dmgType)
- {
- if(me->GetHealthPct() < 90 && pDoneBy && pDoneBy->ToCreature() && pDoneBy->ToCreature()->GetEntry() == 54785)
- uiDamage = 0;
- }
- void JustDied(Unit* killer)
- {
- if (killer->GetTypeId() != TYPEID_PLAYER || !me->ToTempSummon())
- return;
- if (Creature* owner = me->GetMap()->GetCreature(me->ToTempSummon()->GetSummonerGUID()))
- owner->AI()->SetGUID(killer->GetGUID(), 0);
- }
- };
- };
- class mob_min_dimwind : public CreatureScript
- {
- public:
- mob_min_dimwind() : CreatureScript("mob_min_dimwind") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_min_dimwindAI(creature);
- }
- struct mob_min_dimwindAI : public ScriptedAI
- {
- EventMap events;
- GuidSet guidMob;
- ObjectGuid plrGUID;
- GuidSet m_player_for_event;
- bool mt;
- mob_min_dimwindAI(Creature* creature) : ScriptedAI(creature)
- {
- mt = false;
- }
- void Reset()
- {
- me->setActive(true);
- me->HandleEmoteCommand(EMOTE_STATE_READY2H);
- }
- void MoveInLineOfSight(Unit* who)
- {
- if (who->GetTypeId() != TYPEID_PLAYER || who->ToPlayer()->GetQuestStatus(QUEST_MISSING_DRIVER) != QUEST_STATUS_INCOMPLETE)
- return;
- GuidSet::iterator itr = m_player_for_event.find(who->GetGUID());
- if (itr != m_player_for_event.end())
- return;
- m_player_for_event.insert(who->GetGUID());
- if (!mt)
- {
- mt = true;
- InitMobs(who);
- }
- }
- void DamageTaken(Unit* pDoneBy, uint32 &uiDamage, DamageEffectType dmgType)
- {
- if(me->GetHealthPct() < 25 && pDoneBy && pDoneBy->ToCreature() && pDoneBy->ToCreature()->GetEntry() == NPC_AMBERLEAF_SCAMP)
- uiDamage = 0;
- }
- void SetGUID(ObjectGuid const& guid, int32 /*id*/ = 0)
- {
- plrGUID = guid;
- }
- void SummonedCreatureDespawn(Creature* summon)
- {
- guidMob.erase(summon->GetGUID());
- if (guidMob.empty())
- {
- mt = false;
- me->HandleEmoteCommand(EMOTE_STATE_STAND);
- if (Player* target = sObjectAccessor->FindPlayer(plrGUID))
- {
- target->KilledMonsterCredit(54855, ObjectGuid::Empty);
- // by spell 106205
- if(TempSummon* mind = target->SummonCreature(NPC_MIN_DIMWIND_OUTRO, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000))
- {
- mind->AI()->SetGUID(plrGUID, 0);
- mind->setFaction(35);
- }
- }
- me->DespawnOrUnsummon(1000);
- }
- }
- void InitMobs(Unit* who)
- {
- me->HandleEmoteCommand(EMOTE_STATE_READY2H);
- for(GuidSet::iterator itr = guidMob.begin(); itr != guidMob.end(); ++itr)
- if (Creature* c = me->GetMap()->GetCreature(*itr))
- c->DespawnOrUnsummon(1000);
- guidMob.clear();
- for(int i = 0; i < 4; i++)
- {
- if(TempSummon* temp = me->SummonCreature(NPC_AMBERLEAF_SCAMP, me->GetPositionX()-3+rand()%6, me->GetPositionY() + 4 + rand()%4, me->GetPositionZ()+2, 3.3f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000))
- {
- guidMob.insert(temp->GetGUID());
- if (i == 0)
- sCreatureTextMgr->SendChat(temp->ToCreature(), TEXT_GENERIC_0, who->GetGUID());
- temp->SetFacingToObject(me);
- temp->HandleEmoteCommand(EMOTE_STATE_READY2H);
- temp->Attack(me, true);
- //temp->getThreatManager().addThreat(me, 250.0f);
- }
- }
- }
- };
- };
- class npc_min_dimwind_outro : public CreatureScript
- {
- public:
- npc_min_dimwind_outro() : CreatureScript("npc_min_dimwind_outro") {}
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_min_dimwind_outroAI (creature);
- }
- struct npc_min_dimwind_outroAI : public npc_escortAI
- {
- npc_min_dimwind_outroAI(Creature* creature) : npc_escortAI(creature) {}
- EventMap events;
- ObjectGuid playerGUID;
- enum eEvents
- {
- EVENT_1 = 1,
- EVENT_2 = 2,
- };
- void Reset()
- {
- playerGUID.Clear();
- }
- void SetGUID(ObjectGuid const& guid, int32 id)
- {
- playerGUID = guid;
- events.RescheduleEvent(EVENT_1, 1000);
- }
- void WaypointReached(uint32 pointId)
- {
- switch(pointId)
- {
- case 3:
- case 4:
- sCreatureTextMgr->SendChat(me, TEXT_GENERIC_2, playerGUID);
- break;
- case 12:
- sCreatureTextMgr->SendChat(me, TEXT_GENERIC_3, playerGUID);
- me->DespawnOrUnsummon(30000);
- break;
- default:
- break;
- }
- }
- void UpdateAI(uint32 diff)
- {
- npc_escortAI::UpdateAI(diff);
- events.Update(diff);
- if (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- // emotes only when in vehicle.
- case EVENT_1:
- sCreatureTextMgr->SendChat(me, TEXT_GENERIC_0, playerGUID);
- events.RescheduleEvent(EVENT_2, 1000);
- break;
- case EVENT_2:
- sCreatureTextMgr->SendChat(me, TEXT_GENERIC_1, playerGUID);
- Start(true, true);
- break;
- default:
- break;
- }
- }
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement