Beispiel #1
0
bool DISMEMBER(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
 if( !target || ( target->GetEntry() != 23657 && target->GetEntry() != 23661 && target->GetEntry() != 23662 && target->GetEntry() != 23663 && target->GetEntry() != 23664 && target->GetEntry() != 23665 && target->GetEntry() != 23666 && target->GetEntry() != 23667 && target->GetEntry() != 23668  && target->GetEntry() != 23669 && target->GetEntry() != 23670)  || !target->IsDead())
  return true;
 
((Creature*)target)->Despawn(500,300000);
  
 Player * pPlayer = pSpell->p_caster;
 int entry;

 if ( pPlayer->GetTeam() == 1)
	{
	 entry = 11257;
	}
 else
	{
	 entry = 11246;
	}
	QuestLogEntry * en = pPlayer->GetQuestLogForEntry( entry );
	if( en == NULL)
	return true;
	else
		{
		if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0])
		en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
		en->SendUpdateAddKill( 0 );
		en->UpdatePlayerFields();
		}
			return true;
};
Beispiel #2
0
 SpellCastResult CheckTarget()
 {
     Unit* target = GetTargetUnit();
     if(!target)
         return SPELL_FAILED_BAD_TARGETS;
     if(target->GetEntry() == NPC_OZZIE_TOGGLEVOLT || target->GetEntry() == NPC_MILLI_FEATHERWHISTLE || target->GetEntry() == NPC_TOG_RUSTSPROCKET)
         return SPELL_CAST_OK;
     return SPELL_FAILED_BAD_TARGETS;
 }
Beispiel #3
0
bool MasterDemonologist5(uint32 i, Spell* s)
{
    Player* p_caster = s->p_caster;
    Unit* unitTarget = s->GetUnitTarget();

    if(!p_caster || !unitTarget)
        return false; //can't imagine how this talent got to anybody else then a player casting on pet

    uint32 casted_spell_id = 0 ;
    uint32 inc_resist_by_level = 0 ;
    uint32 inc_resist_by_level_spell = 0 ;

    if(unitTarget->GetEntry()  == 416)    //in case it is imp
        casted_spell_id = 23829 ;
    else if(unitTarget->GetEntry()  == 1860)    //VoidWalker
        casted_spell_id = 23844 ;
    else if(unitTarget->GetEntry()  == 1863)    //Succubus
        casted_spell_id = 23836 ;
    else if(unitTarget->GetEntry()  == 417)    //Felhunter
    {
        casted_spell_id = 0 ;
        inc_resist_by_level_spell = 23840 ;
        inc_resist_by_level = 100 ;
    }
    else if(unitTarget->GetEntry()  == 17252)    //Felguard
    {
        casted_spell_id = 35706 ;
        inc_resist_by_level_spell = 23840 ;
        inc_resist_by_level = 50 ;
    }
    if(casted_spell_id)
    {
        //for self
        Spell* sp = sSpellFactoryMgr.NewSpell(p_caster, dbcSpell.LookupEntry(casted_spell_id), true, NULL);
        SpellCastTargets tgt(p_caster->GetGUID());
        sp->prepare(&tgt);
        //for pet
        sp = sSpellFactoryMgr.NewSpell(unitTarget, dbcSpell.LookupEntry(casted_spell_id), true, NULL);
        SpellCastTargets tgt1(unitTarget->GetGUID());
        sp->prepare(&tgt1);
    }

    if(inc_resist_by_level_spell)
    {
        //for self
        Spell* sp = sSpellFactoryMgr.NewSpell(p_caster, dbcSpell.LookupEntry(inc_resist_by_level_spell), true, NULL);
        SpellCastTargets tgt(p_caster->GetGUID());
        sp->prepare(&tgt);
        //for pet
        sp = sSpellFactoryMgr.NewSpell(unitTarget, dbcSpell.LookupEntry(inc_resist_by_level_spell), true, NULL);
        SpellCastTargets tgt1(unitTarget->GetGUID());
        sp->prepare(&tgt1);
    }

    return true;
}
Beispiel #4
0
bool ItemUse_item_muiseks_vessel(Player *player, Item* _Item, SpellCastTargets const& targets)
{
    Unit* uTarget = targets.getUnitTarget();
    uint32 itemSpell = _Item->GetProto()->Spells[0].SpellId;
    uint32 cEntry = 0;
    uint32 cEntry2 = 0;
    uint32 cEntry3 = 0;
    uint32 cEntry4 = 0;

    if(itemSpell)
    {
        switch(itemSpell)
        {
            case 11885:                                     //Wandering Forest Walker
                cEntry =  7584;
                break;
            case 11886:                                     //Owlbeasts
                cEntry =  2927;
                cEntry2 = 2928;
                cEntry3 = 2929;
                cEntry4 = 7808;
                break;
            case 11887:                                     //Freyfeather Hippogryphs
                cEntry =  5300;
                cEntry2 = 5304;
                cEntry3 = 5305;
                cEntry4 = 5306;
                break;
            case 11888:                                     //Sprite Dragon Sprite Darters
                cEntry =  5276;
                cEntry2 = 5278;
                break;
            case 11889:                                     //Zapped Land Walker Land Walker Zapped Cliff Giant Cliff Giant
                cEntry =  5357;
                cEntry2 = 5358;
                cEntry3 = 14640;
                cEntry4 = 14604;
                break;
        }
        if( uTarget && uTarget->GetTypeId()==TYPEID_UNIT && uTarget->isDead() &&
            (uTarget->GetEntry()==cEntry || uTarget->GetEntry()==cEntry2 || uTarget->GetEntry()==cEntry3 || uTarget->GetEntry()==cEntry4) )
        {
            ((Creature*)uTarget)->RemoveCorpse();
            return false;
        }
    }

    WorldPacket data(SMSG_CAST_FAILED, (4+2));              // prepare packet error message
    data << uint32(_Item->GetEntry());                      // itemId
    data << uint8(SPELL_FAILED_BAD_TARGETS);                // reason
    player->GetSession()->SendPacket(&data);                // send message: Invalid target

    player->SendEquipError(EQUIP_ERR_NONE,_Item,NULL);      // break spell
    return true;
}
Beispiel #5
0
 void HandlePeriodic(AuraEffect const* /*aurEff*/)
 {
     Unit* target = GetTarget();
     if (target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL || target->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
         if (Creature* trigger = target->ToCreature())
         {
             uint32 spell = target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL ? crystalSpikeSummon[0] : crystalSpikeSummon[urand(0, 2)];
             if (trigger->AI()->GetData(DATA_COUNT) < MAX_COUNT)
                 trigger->CastSpell(trigger, spell, true);
         }
 }
    void KilledUnit(Unit* victim)
    {
        Unit* pLeftHead  = Unit::GetUnit(*m_creature,LeftHeadGUID);
        Unit* pRightHead = Unit::GetUnit(*m_creature,RightHeadGUID);

        if (!pLeftHead || !pRightHead)
            return;

        ikilling = rand()%2;

        Unit *source = (pLeftHead->GetEntry() == Killing[ikilling].creature ? pLeftHead : pRightHead);

        switch (ikilling)
        {
            case 0:
                DoScriptText(Killing[ikilling].id, source);
                Delay_Timer = 3500;
                KillingYell = true;
                break;
            case 1:
                DoScriptText(Killing[ikilling].id, source);
                KillingYell = false;
                break;
        }
    }
Beispiel #7
0
bool ChatHandler::HandleKillCommand(const char *args, WorldSession *m_session)
{
    Unit* unit = getSelectedUnit(m_session);
    if(!unit)
        return true;

    sWorld.LogGM(m_session, "used kill command on %s %s", unit->IsPlayer() ? "Player" : "Creature", unit->GetName());

    if(unit->IsPlayer())
    {
        // If we're killing a player, send a message indicating a gm killed them.
        BlueSystemMessageToPlr(TO_PLAYER(unit), "%s killed you with a GM command.", m_session->GetPlayer()->GetName());
        TO_PLAYER(unit)->SetUInt32Value(UNIT_FIELD_HEALTH, 0); // Die, insect
        TO_PLAYER(unit)->KillPlayer();
        GreenSystemMessage(m_session, "Killed player %s.", unit->GetName());
    }
    else if(isTargetDummy(unit->GetEntry()))
        RedSystemMessage(m_session, "Target cannot be killed.");
    else
    {
        m_session->GetPlayer()->DealDamage(unit, 0xFFFFFFFF, 0, 0, 0);
        GreenSystemMessage(m_session, "Killed unit %s.", unit->GetName());
    }
    return true;
}
Beispiel #8
0
Unit* MoonScriptCreatureAI::ForceCreatureFind(uint32 pCreatureId, float pX, float pY, float pZ, bool pCurrentPosition)
{
	Unit *pUnit = NULL;
	MapMgr *pMapMgr = _unit->GetMapMgr();
	if (pMapMgr == NULL)
		return pUnit;

	if (pCurrentPosition)
		pUnit = pMapMgr->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), pCreatureId);
	else
		pUnit = pMapMgr->GetInterface()->GetCreatureNearestCoords(pX, pY, pZ, pCreatureId);

	if (pUnit == NULL)
	{
		for (int i = 0; i != pMapMgr->m_CreatureHighGuid; ++i)
		{
			if (pMapMgr->m_CreatureStorage[i] != NULL)
			{ 
				pUnit = pMapMgr->m_CreatureStorage[i];
				if (pUnit->GetEntry() == pCreatureId)
					return pUnit;

				pUnit = NULL;
			}
		}
	}

	return pUnit;
}
Beispiel #9
0
        void IsSummonedBy(Unit* summoner)
        {
            Summoner = summoner;

            Intialized = true;

            switch(Summoner->GetEntry())
            {
            case BOSS_MAGMAW:
                events.ScheduleEvent(EVENT_BLAZING_INFERNO, 5000);
                me->SetFlying(true);
                break;

            case BOSS_OMNOTRON:
                events.ScheduleEvent(EVENT_GRIP_ZONE, 40000);
                events.ScheduleEvent(EVENT_ENCASING_SHADOWS, 100000);
                events.ScheduleEvent(EVENT_OVERCHARGED, 40000);
                me->SetDisplayId(32440);
                break;

            case BOSS_ATRAMEDES:
                break;

            case BOSS_MALORIAK:
                break;

            case BOSS_CHIMAERON:
                me->SetDisplayId(32440);
                DoCast(me, SPELL_MOCKING_SHADOWS, true);
                break;

            default:
                break;
            }
        }
Beispiel #10
0
bool PurifiedAshes(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
 if( !target || target->GetEntry() != 26633 || !target->IsDead())
  return true;

 Player * pPlayer = pSpell->p_caster;
 int entry;
 
 if ( pPlayer->GetTeam() == 1)
 {
	 entry = 12236;
 }
 else
 {
	 entry = 12249;
 }
 QuestLogEntry * en = pPlayer->GetQuestLogForEntry( entry );
 if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0] )
 {
  en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
  en->SendUpdateAddKill( 0 );
  en->UpdatePlayerFields();
   }
 return true;
 }
Beispiel #11
0
bool ChatHandler::HandleListAIAgentCommand(const char* args, WorldSession *m_session)
{
	Unit* target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
	if(!target)
	{
		RedSystemMessage(m_session, "You have to select a Creature!");
		return false;
	}

	std::stringstream sstext;
	sstext << "agentlist of creature: " << target->GetGUID() << '\n';

	std::stringstream ss;
	ss << "SELECT * FROM ai_agents where entry=" << target->GetEntry();
	QueryResult *result = WorldDatabase.Query( ss.str().c_str() );

	if( !result )
		return false;

	do
	{
		Field *fields = result->Fetch();
		sstext << "agent: "   << fields[1].GetUInt16()
			<< " | spellId: " << fields[5].GetUInt32()
			<< " | Event: "   << fields[2].GetUInt32()
			<< " | chance: "  << fields[3].GetUInt32()
			<< " | count: "   << fields[4].GetUInt32() << '\n';
	} while( result->NextRow() );

	delete result;

	SendMultilineMessage(m_session, sstext.str().c_str());

	return true;
}
    void KilledUnit(Unit* victim)
    {
        if (LeftHead && RightHead)
        {
            Unit *Left  = Unit::GetUnit(*me,LeftHead);
            Unit *Right = Unit::GetUnit(*me,RightHead);

            if (!Left || !Right)
                return;

            ikilling = rand()%2;

            Unit *source = (Left->GetEntry() == Killing[ikilling].creature ? Left : Right);

            switch(ikilling)
            {
                case 0:
                    DoScriptText(Killing[ikilling].id, source);
                    Delay_Timer = 3500;
                    KillingYell = true;
                    break;
                case 1:
                    DoScriptText(Killing[ikilling].id, source);
                    KillingYell = false;
                    break;
            }
        }
    }
        void IsSummonedBy(Unit* summoner)
        {
            Summoner = summoner;

            Intialized = true;

            switch(Summoner->GetEntry())
            {
            case NPC_MAGMAW:
                events.ScheduleEvent(EVENT_BLAZING_INFERNO, 5000);
                break;

            case NPC_ATRAMEDES:
                break;

            case NPC_MALORIAK:
                break;

            case NPC_CHIMAERON:
                break;

            default:
                break;
            }
        }
    void KilledUnit(Unit* pVictim)
    {
        Unit* pLeftHead  = Unit::GetUnit(*m_creature,m_uiLeftHeadGUID);
        Unit* pRightHead = Unit::GetUnit(*m_creature,m_uiRightHeadGUID);

        if (!pLeftHead || !pRightHead)
            return;

        m_iKilling = irand(0, 1);

        Unit* pSource = (pLeftHead->GetEntry() == Killing[m_iKilling].creature ? pLeftHead : pRightHead);

        switch(m_iKilling)
        {
            case 0:
                DoScriptText(Killing[m_iKilling].id, pSource);
                m_uiDelay_Timer = 3500;
                m_bKillingYell = true;
                break;
            case 1:
                DoScriptText(Killing[m_iKilling].id, pSource);
                m_bKillingYell = false;
                break;
        }
    }
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     Unit* caster = GetCaster();
     if (caster && caster->GetEntry() == NPC_ACIDMAW)
         if (Creature* acidmaw = caster->ToCreature())
             acidmaw->AI()->Talk(SAY_SPECIAL, GetTarget());
 }
Beispiel #16
0
            void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                if (Unit* caster = GetCaster())
                {
                    Unit* target = GetTarget();
                    // Already in fire
                    if (target->HasAura(SPELL_ABLAZE))
                        return;

                    if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
                    {
                        switch (target->GetEntry())
                        {
                            case NPC_FROSTWORG:
                                target->CastSpell(player, SPELL_FROSTWORG_CREDIT, true);
                                target->CastSpell(target, SPELL_IMMOLATION, true);
                                target->CastSpell(target, SPELL_ABLAZE, true);
                                break;
                            case NPC_FROSTGIANT:
                                target->CastSpell(player, SPELL_FROSTGIANT_CREDIT, true);
                                target->CastSpell(target, SPELL_IMMOLATION, true);
                                target->CastSpell(target, SPELL_ABLAZE, true);
                                break;
                        }
                    }
                }
            }
Beispiel #17
0
void WorldSession::HandlePetAction(WorldPacket& recvData)
{
    ObjectGuid guid1;
    uint32 data;
    ObjectGuid guid2;
    float x, y, z;
    recvData >> guid1;                                     //pet guid
    recvData >> data;
    recvData >> guid2;                                     //tag guid
    // Position
    recvData >> x;
    recvData >> y;
    recvData >> z;

    uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
    uint8 flag = UNIT_ACTION_BUTTON_TYPE(data);             //delete = 0x07 CastSpell = C1

    // used also for charmed creature
    Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
    TC_LOG_DEBUG("network", "HandlePetAction: %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str());

    if (!pet)
    {
        TC_LOG_DEBUG("network", "HandlePetAction: %s doesn't exist for %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
        return;
    }

    if (pet != GetPlayer()->GetFirstControlled())
    {
        TC_LOG_DEBUG("network", "HandlePetAction: %s does not belong to %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
        return;
    }

    if (!pet->IsAlive())
    {
        SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : NULL;
        if (!spell)
            return;
        if (!spell->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD))
            return;
    }

    /// @todo allow control charmed player?
    if (pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
        return;

    if (GetPlayer()->m_Controlled.size() == 1)
        HandlePetActionHelper(pet, guid1, spellid, flag, guid2, x, y, z);
    else
    {
        //If a pet is dismissed, m_Controlled will change
        std::vector<Unit*> controlled;
        for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
            if ((*itr)->GetEntry() == pet->GetEntry() && (*itr)->IsAlive())
                controlled.push_back(*itr);
        for (std::vector<Unit*>::iterator itr = controlled.begin(); itr != controlled.end(); ++itr)
            HandlePetActionHelper(*itr, guid1, spellid, flag, guid2, x, y, z);
    }
}
Beispiel #18
0
        void UpdateAI(const uint32 diff)
        {
            if(!Intialized)
                return;

            events.Update(diff);

            // Magmaw fight
            if(Summoner->GetEntry() == BOSS_MAGMAW && Summoner->HealthBelowPct(30) && !SpecialPhaseSwitchActive)
            {
                events.Reset();

                events.ScheduleEvent(EVENT_SHADOWFLAME_BARRAGE, 3000);
                SpecialPhaseSwitchActive = true;
            }

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                // Magmaw fight
                case EVENT_BLAZING_INFERNO:
                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 500, true))
                        DoCast(target, SPELL_BLAZING_INFERNO, true);

                    events.ScheduleEvent(EVENT_BLAZING_INFERNO, 35000);
                    break;
                case EVENT_SHADOWFLAME_BARRAGE:
                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 500, true))
                        DoCast(target, SPELL_SHADOWFLAME_BARRAGE, true);

                    events.ScheduleEvent(EVENT_SHADOWFLAME_BARRAGE, 7000);
                    break;

                // Omnotron Fight
                case EVENT_GRIP_ZONE :
                    if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true))
                        DoCast(target, SPELL_GRIP_OF_DEATH);
                    events.ScheduleEvent(EVENT_GRIP_ZONE, 40000);
                    return;
                case EVENT_ENCASING_SHADOWS :
                    if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))
                        DoCast(target, SPELL_ENCASING_SHADOWS);
                    events.ScheduleEvent(EVENT_ENCASING_SHADOWS, 100000);
                    return;

                case EVENT_OVERCHARGED :
                    if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_OVERCHARGED_POWER_GENERATOR);
                    events.ScheduleEvent(EVENT_OVERCHARGED, 40000);
                    return;

                default:
                    break;
                }
            }
        }
Beispiel #19
0
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
    ;//sLog->outDetail("CMSG_PET_SPELL_AUTOCAST");
    uint64 guid;
    uint32 spellid;
    uint8  state;                                           //1 for on, 0 for off
    recvPacket >> guid >> spellid >> state;

    if (!_player->GetGuardianPet() && !_player->GetCharm())
        return;

    if (IS_PLAYER_GUID(guid))
        return;

	SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
	if (!spellInfo)
		return;

    Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
    if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm()))
    {
        sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
        return;
    }

	Unit::ControlSet petsSet;
	if (checkPet->GetEntry() != GUID_ENPART(guid))
		petsSet.insert(checkPet);
	else
		petsSet = _player->m_Controlled;

	// Xinef: loop all pets with same entry (fixes partial state change for feral spirits)
	for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr)
	{
		Unit* pet = *itr;
		if (checkPet->GetEntry() == GUID_ENPART(guid) && pet->GetEntry() != GUID_ENPART(guid))
			continue;

		// do not add not learned spells/ passive spells
		if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable())
			continue;

		CharmInfo* charmInfo = pet->GetCharmInfo();
		if (!charmInfo)
		{
			sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
			continue;
		}

		if (pet->IsPet())
			((Pet*)pet)->ToggleAutocast(spellInfo, state);
		else
			pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state);

		charmInfo->SetSpellAutocast(spellInfo, state);
	}
}
Beispiel #20
0
bool CraftyBlaster(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
 if (!target || ( target->GetEntry() != 25432 && target->GetEntry() != 25434 ) || !target->isAlive())
  return true;
  
 Player * pPlayer = pSpell->p_caster;
 QuestLogEntry * en = pPlayer->GetQuestLogForEntry( 11653 );
 if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0] )
 {
  en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
  en->SendUpdateAddKill( 0 );
  en->UpdatePlayerFields();
   }
 return true;
}
bool ItemUse_item_complimentary_brewfest_sampler(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
	Unit* pTarget = Unit::GetUnit(*pPlayer, pPlayer->GetTargetGUID());
	if (pTarget)
	{
		if ((pTarget->GetEntry() == NPC_SCOUT) && ((pPlayer->GetQuestStatus(QUEST_CHUG_AND_CHUCK_A) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(QUEST_CHUG_AND_CHUCK_H) == QUEST_STATUS_INCOMPLETE)))
			pPlayer->KilledMonsterCredit(NPC_SCOUT,0);
	}
	pPlayer->CastSpell(pPlayer, 42436, false);
	return true;
}
Beispiel #22
0
bool PlagueSpray(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
 if( !target || target->GetEntry() != 23652 || !target->isAlive())
  return true;
 else if(!target || target->GetEntry() != 23652 || !target->HasAura(40467)) 
  return false;
 
 Player * pPlayer = pSpell->p_caster;
 QuestLogEntry * en = pPlayer->GetQuestLogForEntry( 11307 );
 if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0] )
 {
  en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
  en->SendUpdateAddKill( 0 );
 en->UpdatePlayerFields();
   }
 return true;
}
Beispiel #23
0
bool HodirsHorn(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
  if( !target || ( target->GetEntry() != 29974 && target->GetEntry() != 30144 && target->GetEntry() != 30135)  || !target->IsDead())
  return true;

 ((Creature*)target)->Despawn(500, 360000);

 Player * pPlayer = pSpell->p_caster;
 QuestLogEntry * en = pPlayer->GetQuestLogForEntry( 12977 );
 if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0] )
 {
  en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
  en->SendUpdateAddKill( 0 );
  en->UpdatePlayerFields();
   }
 return true;
}
Beispiel #24
0
bool RagefistTorch(uint32 i, Spell * pSpell)
{
 if( !pSpell->p_caster )
  return true;

 Unit * target = pSpell->GetUnitTarget();
 if( !target || ( target->GetEntry() != 25342 && target->GetEntry() != 25343))
  return true;

 ((Creature*)target)->Despawn(500, 360000);

 Player * pPlayer = pSpell->p_caster;
 QuestLogEntry * en = pPlayer->GetQuestLogForEntry( 11593 );
 if( en && en->GetMobCount( 0 ) < en->GetQuest()->required_mobcount[0] )
 {
  en->SetMobCount( 0, en->GetMobCount( 0 ) + 1 );
  en->SendUpdateAddKill( 0 );
  en->UpdatePlayerFields();
   }
 return true;
 }
Beispiel #25
0
void WorldSession::HandlePetAction(WorldPacket& recv_data)
{
    uint64 guid1;
    uint16 spellid;
    uint16 flag;
    uint64 guid2;
    recv_data >> guid1;                                     //pet guid
    recv_data >> spellid;
    recv_data >> flag;                                      //delete = 0x0700 CastSpell = C100
    recv_data >> guid2;                                     //tag guid

    // used also for charmed creature
    Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
    sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)));
    if (!pet)
    {
        sLog.outError("Pet %u not exist.", uint32(GUID_LOPART(guid1)));
        return;
    }

    if (pet != GetPlayer()->GetFirstControlled())
    {
        sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
        return;
    }

    if (pet->GetTypeId() == TYPEID_PLAYER)
    {
        // controller player can only do melee attack
        if (!(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
            return;
    }
    else if (((Creature*)pet)->IsPet())
    {
        // pet can have action bar disabled
        if (((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
            return;
    }

    if (GetPlayer()->m_Controlled.size() == 1)
        HandlePetActionHelper(pet, guid1, spellid, flag, guid2);
    else
    {
        //If a pet is dismissed, m_Controlled will change
        std::vector<Unit*> controlled;
        for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
            if ((*itr)->GetEntry() == pet->GetEntry() && (*itr)->IsAlive())
                controlled.push_back(*itr);
        for (std::vector<Unit*>::iterator itr = controlled.begin(); itr != controlled.end(); ++itr)
            HandlePetActionHelper(*itr, guid1, spellid, flag, guid2);
    }
}
            void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                Unit* target = GetTarget();
                Unit* caster = GetCaster();

                if (!target || !caster || caster->GetEntry() != BOSS_HADRONOX_ENTRY)
                    return;

                if (!target->isAlive())
                {
                    caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true);
                }
            }
        void CalculateDamage(SpellEffIndex /*effIndex*/)
        {
            Unit* target = GetHitUnit();
            if (!target)
                return;

            float distance = GetCaster()->GetDistance2d(target);

            if (target->GetEntry() == NPC_DEVOUT_FOLLOWER)
                SetHitDamage(int32(200000 - (1000 * distance))); //need more research on this formula, damage values from sniffs: 189264, 190318, 190478, 196134, 197672, 199735
            else
                SetHitDamage(int32(4000 - (200 * distance)));
        }
    void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
    {
        Unit* caster = GetCaster();
        if (!caster || caster->GetEntry() != NPC_SNOBOLD_VASSAL)
            return;

        if (Creature* gormok = GetTarget()->ToCreature())
            if (Unit* target = gormok->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, SnobolledTargetSelector()))
            {
                gormok->AI()->Talk(EMOTE_SNOBOLLED);
                caster->GetAI()->DoAction(ACTION_ACTIVE_SNOBOLD);
                caster->CastSpell(target, SPELL_RIDE_PLAYER, true);
            }
    }
        void UpdateAI(uint32 diff)
        {
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_IMMOLATION_TRAP_TRIGGER:
                    //Riplimb and Rageface has a higher Priority than Players...

                    if(GetRiplimb() && GetRiplimb()->GetDistance(me) <= 3.0f && !GetRiplimb()->HasAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H)) && GetRiplimb()->IsAlive() && GetShannox()->AI()->GetData(DATA_PHASE) == PHASE_SHANNOX_HAS_SPEER)
                        tempTarget = GetRiplimb();
                    else if (GetRageface() && GetRageface()->GetDistance(me) <= 3.0f && !GetRageface()->HasAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H)) && GetRageface()->IsAlive())
                        tempTarget = GetRageface();
                    else 
                        tempTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 1.0f, true);

                    if (!tempTarget || tempTarget->HasAura(CRYSTAL_PRISON_EFFECT)) // If no Target exists try to get a new Target in 0,5s
                        events.ScheduleEvent(EVENT_IMMOLATION_TRAP_TRIGGER, 500);
                    else
                    {
                        DoCast(tempTarget,RAID_MODE(SPELL_IMMOLATION_TRAP_10N, SPELL_IMMOLATION_TRAP_25N,SPELL_IMMOLATION_TRAP_10H, SPELL_IMMOLATION_TRAP_25H));

                        // Cast Spell Wary on Dogs
                        if(tempTarget->GetEntry() == NPC_RIPLIMB || tempTarget->GetEntry() == NPC_RAGEFACE)
                            tempTarget->AddAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H),tempTarget);

                        me->DisappearAndDie();
                    }

                    break;
                default:
                    break;
                }
            }
        }
        void SendLavaWaves(bool start)
        {
            Unit* cr = NULL;
            for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
            {
                cr = ObjectAccessor::GetUnit(*me, *itr);
                if (!cr || cr->GetEntry() != NPC_FLAME_TSUNAMI)
                    continue;

                if (start)
                    cr->GetMotionMaster()->MovePoint(0, ((cr->GetPositionX() < 3250.0f) ? 3283.44f : 3208.44f), cr->GetPositionY(), cr->GetPositionZ());
                else
                    cr->SetObjectScale(0.1f);
            }
        }