//:://////////////////////////////////////////////
//:: Created By: Rich Dersheimer
//:: Created On: July 5, 2002
//:://////////////////////////////////////////////
#include "nw_i0_tool"

void main()
{
object oDoor = GetObjectByTag("STUCKDOOR"); // assign oDoor the stuck door
object oPC = GetLastUsedBy(); // assign oPC to the player who pulls the lever
int nLeverUnstuck = GetLocalInt(OBJECT_SELF, "UNSTUCK"); // get the status of the lever

if (nLeverUnstuck == FALSE) // is the lever stuck?
{
    if (HasItem(oPC,"JAROFOIL")) //does the party have some oil?
    {
    SetLocked(oDoor, FALSE); // unlock the door
    ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE); // move the lever
    PlaySound("as_sw_lever1");
    AssignCommand(oDoor, PlaySound("gui_picklockopen"));
     object oItemToTake;
    oItemToTake = GetItemPossessedBy(oPC, "JAROFOIL");
    if(GetIsObjectValid(oItemToTake) != 0)
        DestroyObject(oItemToTake);

    SendMessageToPC(oPC, "After pouring some of the oil on it, you are able to tug the lever forward.");
    SetLocalInt(OBJECT_SELF, "UNSTUCK", FALSE); // set the lever status to unstuck
    }
    else
    {
    SendMessageToPC(oPC, "The lever appears to be rusted in place, and will not move.");
    }
}
else
{
SendMessageToPC(oPC, "The lever is rusted and refuses to budge.");
SetLocalInt(OBJECT_SELF, "UNSTUCK", FALSE);
}
}