All pastes #995126 Raw Edit

Meins

public text v1 · immutable
#995126 ·published 2008-04-23 21:45 UTC
rendered paste body
void Aura::HandlePeriodicTriggerSpell(bool apply, bool Real)
{
    if (m_periodicTimer <= 0)
        m_periodicTimer += m_modifier.periodictime;

    m_isPeriodic = apply;
    m_isTrigger = apply;

    if ( Real && apply && GetSpellProto()->Id == 30427 )
    {
        Unit* caster = GetCaster();
	if ( !caster && caster->GetTypeId() != TYPEID_PLAYER && !caster->isAlive() )
		return;

	if( ((Player*)caster)->GetSkillValue(SKILL_ENGINERING)>=305 )
	{
	    uint32 creature_id;
	    uint32 mote_id;
	    creature_id = m_target->GetEntry();

	    switch(creature_id)
	    {
			case 24222: mote_id = 22572; break; //Windy Cloud - Mote of Air
			case 17408: mote_id = 22576; break; //Arcane Vortex - Mote of Mana
			case 17407: mote_id = 22577; break; //Felmist - Mote of Shadow
			case 17378: mote_id = 22578; break; //Swamp Gas - Mote of Water
	    }


	    if ( creature_id && ((Player*)caster)->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState()==3)
	    {
                Item* item = NULL;
	        ItemPosCountVec dest;
  	        uint8 msg = ((Player*)caster)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, mote_id, 1);
	        if(msg == EQUIP_ERR_OK)
	        {
	    	    item = ((Player*)caster)->StoreNewItem(dest, mote_id, true);
		    ((Player*)caster)->SendNewItem(item, 1, true, false);
	        }
	    }
	}
    }
}