//::///////////////////////////////////////////////
//:: Identify
//:: jx_sp_identify.nss
//:://////////////////////////////////////////////
/*
	Discover all the magical properties of an item.
*/
//:://////////////////////////////////////////////
//:: Created By: jallaix
//:: Created On: July 17, 2007
//:://////////////////////////////////////////////


#include "jx_inc_magic_ident"
#include "x2_inc_spellhook" 


void main()
{
    if (!X2PreSpellCastCode())
    {
        JXPostSpellCastCode();
		return;
    }

    object oTarget = JXGetSpellTargetObject();

	// Apply a visual effect
	effect eDur = EffectVisualEffect(VFX_DUR_SPELL_IDENTIFY);
	JXApplyEffectToObject( DURATION_TYPE_TEMPORARY, eDur, OBJECT_SELF, RoundsToSeconds(1));
    
    if (GetObjectType( oTarget ) == OBJECT_TYPE_ITEM)
    {
        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_IDENTIFY, FALSE));
		// Identify the item
		JXIdentifyItem(oTarget);
    }

	JXPostSpellCastCode();
}