from eventAPI import *
from APIUtils import *

def fireEvent(e):
    if ((getTag(e, "lFlagS") & 0x100) == 0):
        return 1
    global k
    k = getTag(e, "kssAD")
    if (k == 6):
        showMessage(e, ["Having kept track of your moves, you think you're under the Arch-Druid's house.","",
                        "You carefully check the walls, and find the faint outline of a door, along with another circular indentation.",
                        "","You can do nothing here yet, so you leave."])
        setTag(e, "kssAD", 7)
        return 1
    elif (k == 7):
        showMessage(e, ["You still have no means to open the concealed door."])
        return 1
    elif (k == 8):
        showMessage(e, ["Having kept track of your moves, you think you're under the Arch-Druid's house.","",
                        "You carefully check the walls, and find the faint outline of a door, along with another circular indentation."])
        setTag(e, "kssAD", 10)
        setExit(e, "maps/kssdruid.cfg", 28, 14, 180)
        return (poseYesNo(e,["You press the Arch-Druid's signet ring onto the marking, and the door slides open. Now you have the means to return to the Enclave.",
                             "","Do you want to?"]) == 0)
    elif (k == 9):
        setTag(e, "kssAD", 10)
        setExit(e, "maps/kssdruid.cfg", 28, 14, 180)
        return (poseYesNo(e,["With the signet ring in your possession, opening the passage is but a formality. You can finally return to the Enclave, should you wish it.",
                             "","So is it your wish?"]) == 0)

    else:
        setExit(e, "maps/kssdruid.cfg", 28, 14, 180)
        return (poseYesNo(e,["The passage provides egress to the Enclave.",
                             "","Do you want to enter it?"]) == 0)
