#keep level 4 treasure 1
from eventAPI import *
from APIUtils import *

rtKeep1TowerFlag=0

def fireEvent(e):
   global rtKeep1TowerFlag
   rtKeep1TowerFlag = getTag(e, "rtKeep1TowerFlag")
   if (rtKeep1TowerFlag != 8):
      return 1
   else:
      towerReward(e)
   return 1

def towerReward(e):
   global rtKeep1TowerFlag
   showMessage(e, ["A sprite appears from nowhere and buzzes excitedly around your head."])
   showPicture(e, "Ubu")
   showMessage(e, ["\"Finally!  Someone to take over the watch!  My shift was up decades ago!\""])
   clearPicture(e)
   showMessage(e, ["The sprite then flies off for a well-deserved break.  You notice a few items scattered about the top of the tower."])
   chest(e, -1, 0, 0, ["Travel Journal", "Dragonhide Leather Gloves"], dice(2, 4, 1), "Treasure")
   rtKeep1TowerFlag += 1
   setTag(e, "rtKeep1TowerFlag", rtKeep1TowerFlag)