#include "inc_levelset"

void main()
{
    object oTarget = GetPCSpeaker();
    int iFoundItemFlag = 0;
    int i = 0;
    //for testing
    //AssignCommand(oTarget, SpeakString("identify fired"));

    //valid only for creatures
    //if ( GetObjectType(oTarget) != OBJECT_TYPE_CREATURE) return;

    // set the variables
    object oItem = GetFirstItemInInventory(oTarget);

    // ID unequipped items in inventory
    while ( GetIsObjectValid(oItem) )
        {
        //SendMessageToPC(oTarget, "Evaluating " + GetName(oItem));

        if (GetIsDMFI(oItem) != TRUE)
        {
            if (GetIdentified(oItem) == FALSE)
                {

                SetIdentified(oItem, FALSE);
                SendMessageToPC(oTarget, "Identified " + GetName(oItem) + ".");
                iFoundItemFlag = 1;
                }
            //else SendMessageToPC(oTarget, GetName(oItem) + " was not changed.");
        }
        else SendMessageToPC(oTarget, GetName(oItem) + " is a DMFI item.");

        oItem = GetNextItemInInventory(oTarget);
        }

        //ID equipped items in slots--just to be safe
        for ( i = 0; i < NUM_INVENTORY_SLOTS; i++ )
        {
        oItem = GetItemInSlot(i, oTarget);
        if (GetIdentified(oItem) == FALSE)
                {
                SetIdentified(oItem, FALSE);
                SendMessageToPC(oTarget, "Identified " + GetName(oItem) + ".");
                iFoundItemFlag = 1;
                }

    if (iFoundItemFlag == 0) SendMessageToPC(oTarget, "No unidentified items found.");
} }
