#keep level 2 treasure #2

from APIUtils import *

rtkeep2treas2 = 0
rtmelvinFlag = 0

def fireEvent(e):
   global rtkeep2treas2
   global rtmelvinFlag
   rtmelvinFlag = getTag(e, "rtmelvinFlag")
   rtkeep2treas2 = getTag(e, "rtkeep2treas2")
   if ((rtkeep2treas2 == 1) or (rtmelvinFlag > 2)):
      return 1
   else:
      showMessage(e, ["There is a rotted chest here."])
      chest(e, 3, 9, 0, [], dice(1, 3, 1), "Treasure")
      rtkeep2treas2 = 1
      setTag(e, "rtkeep2treas2", rtkeep2treas2)
      return 1
