#castle hidden alter quest
from SDLKeys import SDLK_y, SDLK_n, SDLK_l
from eventAPI import *
from APIUtils import *

rtchapelAltar = 0
rtcBarrierFlag3 = 0

def fireEvent(e):
   global rtchapelAltar
   rtchapelAltar = getTag(e, "rtchapelAltar")
   if (rtchapelAltar > 1):
      returnVisit(e)
   else:
      returnCross(e)
   return 0

def returnCross(e):
   hasCross = 0
   if (firstHasItem(e,"Golden Cross") >= 0):
      hasCross = 1
   text = ["There is a small altar hidden away back here.  There is a place on the altar for an object."]
   if (hasCross):
      optionTexts = ["(Y)es", "(N)o"]
      optionsKeys = [SDLK_y, SDLK_n]
      text.extend(["", "Do you place the golden cross upon the altar?"])
   else:
      optionTexts = ["(L)eave the Scene"]
      optionsKeys = [SDLK_l]
   if (optionInput(e, text, optionTexts, optionsKeys) == SDLK_y):
      removeCross(e)

def removeCross(e):
   global rtchapelAltar
   holder = firstHasItem(e, "Golden Cross")
   removeItem(e, holder, "Golden Cross")
   playSpecAudio(e, "Bell_Toll")
   showMessage(e, ["As you place the cross in its resting place, you hear the sound of a bell tolling.", "", "Before your eyes, the cross appears to meld with the altar."])
   rtchapelAltar = 2
   setTag(e, "rtchapelAltar", rtchapelAltar)
   rtcBarrierFlag3 = 1
   setTag(e, "rtcBarrierFlag3", rtcBarrierFlag3)

def returnVisit(e):
   showMessage(e, ["There is a small altar here.  There is a golden cross firmly embedded within the altar."], optionInput)
