#Script for Hughter's Owl tavern
#Provides intro to quest for the Cloak of the True Hero
from eventAPI import getTag, showPicture, setTag, callEvent
from APIUtils import isclearall, showMessage

def fireEvent(e):
    lFlagU = getTag(e, "lFlagU")
    RingPlt1 = getTag(e, "RingPlt1")
    if (lFlagU == 0xFFFFFFFF):
        leave(e)
        return 0
    if (not isclearall(RingPlt1, 0x01000000)):
        leave(e)
        # do something at some point?
    else:
        showPicture(e, "Aldorik")
        showMessage(e,
            ["As you walk towards the tavern, and old man leaning against the building waves you over.",
             "As you approach him, he introduces himself...",
             "\"My name is Aldorik.",
             "\"I have been living in Rennibister for many years, and for many years have kept secret the location of a great treasure.",
             "\"I am interested in obtaining that treasure, but I'm too old, and so am willing to pay richly for someone else to get it for me.",
             "\"If you are interested, find me in my home - I live in the South-Easternmost dwelling in town.\"",
             "The old man then walks off briskly, leaving you no time to ask questions."])
        setTag(e, "RingPlt1", RingPlt1 | 0x01000000)
        leave(e)
    return 0

def leave(e):
    callEvent(e, 1008, ["-1", "-1", "-1"])
