void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
        {
            if (spellInfo->Id != SPELL_OFFER)
                return;

            Player* player = caster->ToPlayer();
            if (!player)
                return;

            Quest const* quest = sObjectMgr->GetQuestTemplate(QUEST_TASTE_TEST);
            if (!quest)
                return;

            QuestStatusMap::const_iterator itr = player->getQuestStatusMap().find(QUEST_TASTE_TEST);
            if (itr->second.Status != QUEST_STATUS_INCOMPLETE)
                return;

            for (uint8 i = 0; i < 3; ++i)
            {
                if (uint32(quest->RequiredNpcOrGo[i]) != me->GetEntry())
                    continue;

                if (itr->second.CreatureOrGOCount[i] != 0)
                    continue;

                player->KilledMonsterCredit(me->GetEntry());
                player->Say(SAY_OFFER, LANG_UNIVERSAL);
                sayStep = 1;
                break;
            }
        }
Example #2
0
    void UpdateAI(const uint32 diff)
    {
        if (Event_Timer <= diff)
        {
            switch(Phase)
            {
                case 1:
                    if (someplayer)
                    {
                        Unit* u = Unit::GetUnit((*me), someplayer);
                        if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u);
                    }
                    Event_Timer = 60000;
                    Wave = true;
                    ++Phase;
                    break;
                case 2:
                    DoScriptText(EMOTE_60, me);
                    Event_Timer = 30000;
                    ++Phase;
                    break;
                case 3:
                    DoScriptText(EMOTE_30, me);
                    Event_Timer = 20000;
                    DoFinalSpawnForCreature(me);
                    ++Phase;
                    break;
                case 4:
                    DoScriptText(EMOTE_10, me);
                    Event_Timer = 10000;
                    Wave = false;
                    ++Phase;
                    break;
                case 5:
                    DoScriptText(EMOTE_COMPLETE, me);
                    if (someplayer)
                    {
                        Player* player = Unit::GetPlayer(*me, someplayer);
                        if (player)
                           player->KilledMonsterCredit(me->GetEntry(),me->GetGUID());
                        DoCast(me,SPELL_DISABLE_VISUAL);
                    }
                    if (goConsole)
                    {
                        if (GameObject* go = GameObject::GetGameObject((*me),goConsole))
                            go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                    }
                    ++Phase;
                    break;
            }
        } else Event_Timer -= diff;

        if (Wave)
        {
            if (Wave_Timer <= diff)
            {
                DoWaveSpawnForCreature(me);
            } else Wave_Timer -= diff;
        }
    }
        void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
        {
            if (spellInfo->Id != SPELL_OFFER)
                return;

            Player* player = caster->ToPlayer();
            if (!player)
                return;

            Quest const* quest = sObjectMgr->GetQuestTemplate(QUEST_TASTE_TEST);
            if (!quest)
                return;

            if (player->GetQuestStatus(QUEST_TASTE_TEST) != QUEST_STATUS_INCOMPLETE)
                return;

            for (uint32 i = 0; i < quest->Objectives.size(); ++i)
            {
                if (uint32(quest->Objectives[i].ObjectID) != me->GetEntry())
                    continue;

                if (player->GetQuestObjectiveData(quest, i) != 0)
                    continue;

                player->KilledMonsterCredit(me->GetEntry());
                player->Say(SAY_OFFER, LANG_UNIVERSAL);
                sayStep = 1;
                break;
            }
        }
Example #4
0
		void UpdateAI(const uint32 diff)
		{
			if (!me->IsVisible())
			{
				if (RespawnTimer <= diff)
					Reset();
				else
					RespawnTimer -= diff;
			}
			else
			{
				if (me->GetHealth() <= 1)
				{
					if (DespawnTimer <= diff)
					{
						me->setFaction(35);
						me->SetVisible(false);
						me->CombatStop(true);
						me->AttackStop();
						me->ClearAllReactives();
						me->DeleteThreatList();
						me->SetHealth(me->GetMaxHealth());

						Player* player = me->GetPlayer(*me, PlayerGUID);
						if (player->IsInWorld())
						{
							player->KilledMonsterCredit(me->GetEntry(), 0);
						}
					}
					else
						DespawnTimer -= diff;
				}
			}
			DoMeleeAttackIfReady();
		}
        void DoWork()
        {
            switch (m_phase)
            {
            case 1:
                Talk(1);
                m_timer = 2000;
                m_phase = 2;
                break;
            case 2:
                if (m_player)
                    m_player->KilledMonsterCredit(49231);

                m_timer = 4000;
                m_phase = 3;
                break;
            case 3:
                me->GetMotionMaster()->MovePath(4923101, false);
                m_timer = 10000;
                m_phase = 4;
                break;
            case 4:
                me->DespawnOrUnsummon();
                m_timer = 0;
                m_phase = 0;
                break;
            }
        }
Example #6
0
    void OnUpdate(GameObject* go, uint32 diff)
    {
        if (opened == 1)
        {
            if (tQuestCredit <= ((float)diff/8))
            {
                opened = 0;
                aPlayer->KilledMonsterCredit(35830, 0);
                if (spawnKind == 3)
                {
                    if (Creature* spawnedCreature = go->SummonCreature(NPC_RAMPAGING_WORGEN_2, wx, wy, z, angle, TEMPSUMMON_TIMED_DESPAWN, SUMMON1_TTL))
                    {
                        spawnedCreature->SetPhaseMask(6, 1);
                        spawnedCreature->Respawn(1);
                        spawnedCreature->getThreatManager().resetAllAggro();
                        aPlayer->AddThreat(spawnedCreature, 1.0f);
                        spawnedCreature->AddThreat(aPlayer, 1.0f);
                    }
                }
            }
            else tQuestCredit -= ((float)diff/8);
        }
        if (DoorTimer <= diff)
            {
                if (go->GetGoState() == GO_STATE_ACTIVE)
                    go->SetGoState(GO_STATE_READY);

                DoorTimer = DOOR_TIMER;
            }
        else
            DoorTimer -= diff;
    }
Example #7
0
        void UpdateAI(uint32 const diff)
        {
            if(!QuestInProgress)
                return;

            Player* player = Unit::GetPlayer(*me, playerGUID);

            if(!player)
                return;

            if (sayTimer <= diff)
            {
                switch (RAND(0, 1, 2, 3, 4))
                {
                    case 0:
                        me->MonsterSay(CREW_SAY_1, LANG_UNIVERSAL, NULL);
                        player->KilledMonsterCredit(42758, 0);
                        QuestInProgress = false;
                        break;
                    case 1:
                        me->MonsterSay(CREW_SAY_2, LANG_UNIVERSAL, NULL);
                        player->KilledMonsterCredit(42758, 0);
                        QuestInProgress = false;
                        break;
                    case 2:
                        me->MonsterSay(CREW_SAY_3, LANG_UNIVERSAL, NULL);
                        player->KilledMonsterCredit(42758, 0);
                        QuestInProgress = false;
                        break;
                    case 3:
                        me->MonsterSay(CREW_SAY_4, LANG_UNIVERSAL, NULL);
                        player->KilledMonsterCredit(42758, 0);
                        QuestInProgress = false;
                        break;
                    case 4:
                        me->MonsterSay(CREW_SAY_5, LANG_UNIVERSAL, NULL);
                        me->setFaction(14);
                        me->AddThreat(player, 53.0f);
                        me->AI()->AttackStart(player);
                        QuestInProgress = false;
                        break;
                }
            }
            else sayTimer -= diff;
        }
Example #8
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Creature* target = GetHitCreature())
     {
         target->DespawnOrUnsummon();
         caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0);
     }
 }
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (TalkSequenceIsStarted)
                {
                    if (!player)
                    {
                        timer = 0; phase = 0; TalkSequenceIsStarted = false;
                        return;
                    }
                    if (timer <= diff)
                    {
                        switch (phase)
                        {
                        case 1:
                        {
                            Talk(0); timer = 5000; phase++;
                            break;
                        }
                        case 2:
                        {
                            Talk(1); timer = 5000; phase++;
                            break;
                        }
                        case 3:
                        {
                            Talk(2); timer = 5000; phase++;
                            break;
                        }
                        case 4:
                        {
                            player->KilledMonsterCredit(NPC_TROLLING_FOR_INFORMATION_KILL_CREDIT_BUNNY_W, 0);
                            timer = 120000; phase++; // cooldown                                                                                      
                            break;
                        }
                        case 5:
                        {
                            timer = 0; phase = 0; TalkSequenceIsStarted = false;
                            break;
                        }
                        }
                    }
                    else
                        timer -= diff;

                    if (!me->IsInRange(player, 0.0f, 15.0F))
                    {
                        timer = 0; phase = 0; TalkSequenceIsStarted = false; // if player gone away, delete cooldown
                    }
                }

            }
            else
                DoMeleeAttackIfReady();

        }
Example #10
0
 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Creature* target = GetHitCreature())
     {
         caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0);
         target->CastSpell(target, uint32(GetEffectValue()), true);
         target->DespawnOrUnsummon(2000);
     }
 }
Example #11
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Creature* target = GetHitCreature())
     {
         caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
         caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
         target->DespawnOrUnsummon();
     }
 }
Example #12
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Creature* target = GetHitCreature())
         if (target && target->HasAura(SPELL_FLAMES))
         {
             caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0);
             target->CastSpell(target, SPELL_FLAMES, true);
             target->DespawnOrUnsummon(60000);
         }
 }
Example #13
0
        void WaypointReached(uint32 i)
        {
            Player* pPlayer = GetPlayerForEscort();

            switch(i)
            {
                case 7:
                    pPlayer->KilledMonsterCredit(35753, 0);
                    break;
            }
        }
Example #14
0
    void DoChallengeQuestCredit()
    {
        Map::PlayerList const& PlayerList = m_creature->GetMap()->GetPlayers();

        for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
        {
            Player* pPlayer = itr->getSource();
            if (pPlayer && pPlayer->GetQuestStatus(QUEST_THE_CHALLENGE) == QUEST_STATUS_INCOMPLETE)
                pPlayer->KilledMonsterCredit(NPC_THELDREN_QUEST_CREDIT);
        }
    }
Example #15
0
 void SpellHit(Unit* pHitter, const SpellEntry* pSpell)
 {
     if (pSpell->Id == 1243 || pSpell->Id == 1244 || pSpell->Id == 1245)
     {
         if (pHitter->GetTypeId() == TYPEID_PLAYER)
         {
             Player* pPlayer = pHitter->ToPlayer();
             if (pPlayer && pPlayer->GetQuestStatus(9489) == QUEST_STATUS_INCOMPLETE)
                 pPlayer->KilledMonsterCredit(15938, 0);
         }
     }
 }
Example #16
0
 void SpellHit(Unit* caster, SpellInfo const* spell) 
 { 
     if (spell->Id == SPELL_BLOODTALON_WHISTLE && m_phase == 0)
         if (m_player = caster->ToPlayer())
             if (m_player->GetQuestStatus(QUEST_SAVING_THE_YOUNG) == QUEST_STATUS_INCOMPLETE)
                 if (me->GetDistance2d(m_player) < 15.0f)
                 {
                     me->GetMotionMaster()->MoveFollow(m_player, 2.0f, frand(0.0f, 6.28f));
                     m_player->KilledMonsterCredit(NPC_BLOODTALON_HATCHLING);
                     m_timer = 1000;
                     m_phase = 1;
                 }
 }
Example #17
0
        void SpellHit(Unit* caster, const SpellInfo* spell)
        {
            if (spell->Id != SPELL_AWAKEN_PEON)
                return;

            Player* player = caster->ToPlayer();
            if (player && player->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
            {
                player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
                Talk(SAY_SPELL_HIT, caster->GetGUID());
                me->RemoveAllAuras();
                if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))
                    me->GetMotionMaster()->MovePoint(1, Lumberpile->GetPositionX()-1, Lumberpile->GetPositionY(), Lumberpile->GetPositionZ());
            }
        }
        void JustDied(Unit* killer) override
        {
            if (!killer || killer->GetTypeId() != TYPEID_PLAYER)
                return;

            Player* player = killer->ToPlayer();

            if (roll_chance_i(20))
            {
                player->CastSpell(me, SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT, true);
                player->KilledMonsterCredit(NPC_MIST_WHISPER_SCOUT);
            }
            else
                player->CastSpell(me, rivenWidowCocoonVictims[urand(0, 10)], true);
        }
            void SpellHit(Unit * Hitter, SpellInfo const* spell)
            {
                Player* player = Hitter->ToPlayer();

                if (!player)
                    return;

                if (spell->Id == SPELL_INOCULATE_NESTLEWOOD_OWLKIN)
                {
                    if (player->GetQuestStatus(QUEST_INOCULATION) == QUEST_STATUS_INCOMPLETE)
                    {
                        player->KilledMonsterCredit(NPC_NESTLEWOOD_OWLKIN);
                        me->DespawnOrUnsummon(0);
                    }
                }
            }
Example #20
0
 void SpellHit(Unit* caster, const SpellEntry* spell)
 {
     Player* questTarget = caster->ToPlayer();
     if (questTarget && questTarget->getClass() == CLASS_PRIEST)
         switch (spell->Id)
         {
             case SPELL_GIFT_OF_THE_NARUU:
             case SPELL_LESSER_HEAL_R1:
             case SPELL_LESSER_HEAL_R2:
             case SPELL_RENEW_R1:
                 {
                     me->HandleEmoteCommand(ANIM_RISE);
                     questTarget->KilledMonsterCredit(NPC_TAVARA, me->GetGUID());
                 }
         }
 }
        void JustSummoned(Creature* summon)
        {
            Player* wrangler = me->GetPlayer(*summon,wranglerGUID);
            if(wrangler)
            {
                //summon->CastSpell(wrangler,40926,true);

                //summon->SetOwnerGUID(wrangler->GetGUID());
                wrangler->KilledMonsterCredit(summon->GetEntry(),summon->GetGUID());
                me->DealDamage(me,me->GetHealth());
                me->RemoveCorpse();

                //summon->CastSpell(wrangler,40926,true);
                //wrangler->CastSpell(summon,40926,true);
            }
        }
Example #22
0
        void MoveInLineOfSight(Unit* who)
        {
            if (!who)
                return;

            Player* player = who->ToPlayer();
            if (player && player->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE)
            {
                uint32 creditMarkerId = me->GetEntry();
                if (creditMarkerId >= 18840 && creditMarkerId <= 18843)
                {
                    // 18840: Sunspring, 18841: Laughing, 18842: Garadar, 18843: Bleeding
                    if (!player->GetReqKillOrCastCurrentCount(10085, creditMarkerId))
                        player->KilledMonsterCredit(creditMarkerId, me->GetGUID());
                }
            }
        }
Example #23
0
void WorldPvPNA::HandleObjectiveComplete(GuidSet m_sPlayersSet, uint32 uiEventId)
{
    if (uiEventId == EVENT_HALAA_BANNER_WIN_ALLIANCE || uiEventId == EVENT_HALAA_BANNER_WIN_HORDE)
    {
        for (GuidSet::iterator itr = m_sPlayersSet.begin(); itr != m_sPlayersSet.end(); ++itr)
        {
            if (!(*itr))
                continue;

            Player* pPlayer = sObjectMgr.GetPlayer(*itr);

            if (!pPlayer)
                continue;

            pPlayer->KilledMonsterCredit(NPC_HALAA_COMBATANT);
        }
    }
}
Example #24
0
/**
  Function that rewards the given team players

  @param   kill credit
  @param   team
  @param   source object
*/
void Battlefield::QuestCreditTeam(uint32 credit, Team team, WorldObject* source)
{
    for (auto& m_zonePlayer : m_zonePlayers)
    {
        if (!m_zonePlayer.first || !HasPlayer(m_zonePlayer.first))
            continue;

        Player* player = sObjectMgr.GetPlayer(m_zonePlayer.first);
        if (!player)
            continue;

        // check if player is eligible for kill credit
        if (!source || !credit || player->GetTeam() != team || !player->IsAtGroupRewardDistance(source))
            continue;

        player->KilledMonsterCredit(credit);
    }
}
        void MoveInLineOfSight(Unit* who)
        {
            if(!who || (!who->isAlive()))
                return;

            if(me->IsWithinDistInMap(who, 50.0f))
            {
                Creature* pCreature = me->FindNearestCreature(NPC_QUEST_CREDIT, 50);

                if(who->GetTypeId() == TYPEID_PLAYER && pCreature)
                {
                    Player* player = who->ToPlayer();
                    if(player->GetQuestStatus(QUEST_GETTING_THE_BLADESPIRE_TANKED) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_BLADESPIRE_KEGGER) == QUEST_STATUS_INCOMPLETE)
                        player->KilledMonsterCredit(NPC_QUEST_CREDIT, 0);

                    pCreature->DespawnOrUnsummon();
                }
            }
        }
Example #26
0
        void MoveInLineOfSight(Unit* pWho) override
        {
            FollowerAI::MoveInLineOfSight(pWho);

            if (!m_creature->HasAura(SPELL_SUBDUED) || m_creature->getVictim())
                return;

            if (pWho->GetEntry() == NPC_COLDARRA_DRAKE_HUNT_INVISMAN && m_creature->IsWithinDistInMap(pWho, 20.0f))
            {
                Player* pPlayer = GetLeaderForFollower();
                if (!pPlayer || !pPlayer->HasAura(SPELL_DRAKE_HATCHLING_SUBDUED))
                    return;

                pWho->CastSpell(pPlayer, SPELL_STRIP_AURAS, true);
                // give kill credit, mark the follow as completed and start the final event
                pPlayer->KilledMonsterCredit(NPC_COLDARRA_DRAKE_HUNT_INVISMAN);
                pPlayer->CastSpell(m_creature, SPELL_DRAKE_TURN_IN, true);
                SetFollowComplete(true);
            }
        }
Example #27
0
 void UpdateAI(uint32 const diff)
 {
     if(uiExplosionTimer < diff)
     {
         DoCast(SPELL);
         for(uint8 i = 0; i < 4; ++i)
         {
             if(Creature* cCredit = me->FindNearestCreature(27436 + i, 10.0f))
             {
                 if(Unit* uOwner = me->GetOwner())
                 {
                     Player* pOwner = uOwner->ToPlayer();
                     if(pOwner && pOwner->GetQuestStatus(QUEST) == QUEST_STATUS_INCOMPLETE)
                         pOwner->KilledMonsterCredit(cCredit->GetEntry(), cCredit->GetGUID());
                 }
             }
         }
         me->Kill(me);
         return;
     } else uiExplosionTimer -= diff;
 }
        void JustDied(Unit* killer)
        {
            Player* player = killer->ToPlayer();
            if (!player)
                return;

            if (player->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE)
            {
                if (rand()%100 < 25)
                {
                    me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
                    player->KilledMonsterCredit(QUEST_TARGET, 0);
                }
                else
                    me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);

                if (rand()%100 < 75)
                    me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);

                me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
            }
        }
    void SpellHit(Unit* caster, const SpellEntry* spell)
    {
        if (!caster)
            return;

        if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE, 0))
        {
            PlayerGUID = caster->GetGUID();
            if (PlayerGUID)
            {
                Player* plr = Unit::GetPlayer(*me, PlayerGUID);
                if (plr && plr->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
                    plr->KilledMonsterCredit(25086, me->GetGUID());
            }
            DoCast(me, ENRAGE);
            Unit* Myrmidon = me->FindNearestCreature(DM, 70);
            if (Myrmidon)
            {
                me->AddThreat(Myrmidon, 100000.0f);
                AttackStart(Myrmidon);
            }
        }
    }
Example #30
0
void OutdoorPvPObjective::SendObjectiveComplete(uint32 id,uint64 guid)
{
    uint32 controlling_faction;
    switch(m_State)
    {
        case OBJECTIVESTATE_ALLIANCE:
            controlling_faction = ALLIANCE;
            break;
        case OBJECTIVESTATE_HORDE:
            controlling_faction = HORDE;
            break;
        default:
            return;
            break;
    }

    // send to all players present in the area
    for(std::set<uint64>::iterator itr = m_ActivePlayerGuids.begin(); itr != m_ActivePlayerGuids.end(); ++itr)
    {
        Player * plr = sObjectMgr.GetPlayer(*itr);
        if(plr && plr->GetTeam() == controlling_faction)
            plr->KilledMonsterCredit(id,guid);
    }
}