#Passage, back to level 0
from eventAPI import *
from APIUtils import *

lairUpOpen = 0

def fireEvent(e):
    global lairUpOpen
    lairKey = getTag(e, "lairKey")
    lairUpOpen = getTag(e, "lairUpOpen")

    if(lairKey and (not lairUpOpen)):
        if( poseYesNo(e,
            ["There is a large iron door here, it looks like the key you found will most likely fit in it",
             "Do you use the key?"])):
            showMessage(e, 
                 ["With a bit of force, the lock tumblers open, but unfortunately the rusty key breaks",
                  "looks like there won't be any way to shut this door"], optionInput)
            lairUpOpen = 1
            setTag(e, "lairUpOpen", lairUpOpen)
        else:
            showMessage(e,["You walk away from the door"], optionInput)
            return 1

    if(lairUpOpen):
        showPicture(e, "Cave")
        if (poseYesNo(e, ["There is a passage here, leading out of bottom levels of the lair.", "Do you continue upwards?"])):
            tickGame(e, 60)
            setExit(e, "maps/lair0.cfg", 20, 0, 90)
        return 0

    return 1
