#keep level 2 treasure #3

from APIUtils import *

rtkeep2treas3 = 0
rtmelvinFlag = 0

def fireEvent(e):
   global rtkeep2treas3
   global rtmelvinFlag
   rtmelvinFlag = getTag(e, "rtmelvinFlag")
   rtkeep2treas3 = getTag(e, "rtkeep2treas3")
   if ((rtkeep2treas3 == 1) or (rtmelvinFlag > 2)):
      return 1
   else:
      showMessage(e, ["The chest here falls apart from your slightest touch."])
      chest(e, -1, 0, 4722, [], dice(1, 3, 1), "Treasure")
      rtkeep2treas3 = 1
      setTag(e, "rtkeep2treas3", rtkeep2treas3)
      return 1
