#eastern keep melvin the magnificent
from eventAPI import *
from APIUtils import *
from SDLKeys import SDLK_y, SDLK_n, SDLK_l

rtmelvinFlag = 0
rtmelvinStory = 0

def fireEvent(e):
   global rtmelvinFlag
   rtmelvinFlag = getTag(e, "rtmelvinFlag")
   if (rtmelvinFlag > 0):
      return 1
   else:
      meetMelvin(e)
   return 1

def meetMelvin(e):
   global rtmelvinFlag
   showMessage(e, ["As you enter the room, a small figure stands up from emptying a treasure chest."], optionInput)
   showPicture(e, "Gnome_Male02")
   showMessage(e, ["After he sees that you do not mean to immediatly attack him, he takes a little time to straighten his cloths before introducing himself."])
   showMessage(e, ["\"Hello there!  I'm Melvin.  Melvin the Magnificent.\""])
   showMessage(e, ["He begins to vigorously shake your hands."])
   partyIdx = 0
   while (partyIdx < getPartyCount(e)):
      modifyGold(e, partyIdx, -10000)
      partyIdx += 1
   showMessage(e, ["\"It's nice to see another living soul in this horrible place.  Always those dead things walking around, disturbing ones sleep.  But, hey, that's why I'm here!  The dead have no need for treasure anymore so I figured they wouldn't mind if I took a little of it.\""])
   showMessage(e, ["\"I figured wrong, though.  I don't mind telling you.  These things will chase you forever for the smallest of reasons.  For the mindless dead they sure are touchy.\""])
   showMessage(e, ["\"Well maybe they aren't all dead, but they are still MOSTLY dead.  Take that fella up in the tower for instance.  I'm pretty sure that he is of the living type even though he appears to be less than sane.  There I was, just minding my own business when that crazy old man jumped out of nowhere and summoned up a bunch of the nastiest looking beasts I've ever seen.  I had 'em running in circles all over the tower until I was finally able to ditch them.\""])
   showMessage(e, ["\"And what about that thing up in the throne room?  Wow is he ugly!  Must be why he's so depressed.  All he'll ever tell you is to go away.  You would think he'd want someone to talk to or maybe he'd want to tell someone where he hid all of his treasure, but he just wants 'to be left alone' so he says.\""])
   showMessage(e, ["Melvin casts a quick eye at the chest that he was emptying before.", "", "When he again looks at you there is a small grin on his face."])
   showMessage(e, ["\"You know, I would join you, but I really work best solo.  It's not you, it's me.  It's hard to sneak around when you're in a group, you know.\""])
   showMessage(e, ["\"Well, good luck on your adventuring and all.  I'm certain that we will meet again.  I'll just be off for now.\""])
   showMessage(e, ["Melvin gives you a slight bow and hastily walks out of the room."])
   clearPicture(e)
   showMessage(e, ["That guy seemed a bit sneaky."])
   rtmelvinFlag = 1
   setTag(e, "rtmelvinFlag", rtmelvinFlag)
   return 1
