#plane of earth dwarves
from eventAPI import *
from APIUtils import *

rtfollowdwarf = 0

def fireEvent(e):
   global rtfollowdwarf
   rtfollowdwarf = getTag(e, "rtfollowdwarf")
   if (rtfollowdwarf == 0):
      dwarveshere(e)
   else:
      return 1


def dwarveshere(e):
   showMessage(e, ["As you enter this cavern your light falls upon a party of dwarves standing in the corner.", "", "They quickly form up and prepare to defend against you."])
   showPicture(e, "Dwarf_Male04")
   showMessage(e, ["\"Hold there!  Caution, now.  We dun want this to end badly, now do we?\"", "", "\"Jes come on over here and keep your hands away from yer weapons.\""])
   showMessage(e, ["\"Ye look harmless enough.  I think we can call an end to this standoff.\""])
   showMessage(e, ["\"My name is Bron Brokeblade\", the lead dwarf says.", "", "He takes your hand and vigorously shakes it.", "", "\"This is my lieutenant Gred Glassjaw.\""])
   showPicture(e, "Dwarf_Male02")
   showMessage(e, ["Gred gives you a small salute.", "", "\"Oy.\""])
   showPicture(e, "Dwarf_Male04")
   showMessage(e, ["\"..and of course I cannot ferget our resident spellcaster, Sten Singebeard.\""])
   showPicture(e, "Dwarf_Male03")
   showMessage(e, ["Sten appears distracted.", "", "\"Yes, yes. Well met and all that.\""])
   showPicture(e, "Dwarf_Male04")
   showMessage(e, ["\"Well, yer the first beings of flesh and blood we have seen since we arrived here.  Problem is, I'm not entirely sure where we are.  I dun suppose that you ken remember the way out, do ya?\""])
   showMessage(e, ["You give rough directions and a description of the portal that you used to arrive here."])
   showPicture(e, "Dwarf_Male02")
   showMessage(e, ["Gred traces his finger across a crude map and shakes his head.", "", "\"No, we've already been through there.  No portal.\""])
   showPicture(e, "Dwarf_Male03")
   showMessage(e, ["\"Of course not, Gred.  It's a marked portal only available to those who have obtained the key.\""])
   showPicture(e, "Dwarf_Male02")
   showMessage(e, ["\"Well, I'd take any option to leave at this point.  You seem to be doing the least to help us.\""])
   showPicture(e, "Dwarf_Male03")
   showMessage(e, ["\"I'm a wizard, not a cartographer.  I did warn you that we were not where we thought we were.  This is not the Elemental Cavern of Enourmous Diamonds.\""])
   showPicture(e, "Dwarf_Male02")
   showMessage(e, ["\"You always were a weird dwarf, Sten.\"", "", "\"Next you'll be telling me that blasting away at the rocks is what angered the elementals and caused the walls to rearrange.\""])
   showPicture(e, "Dwarf_Male03")
   showMessage(e, ["\"Why point out the obvious?\""])
   showPicture(e, "Dwarf_Male02")
   showMessage(e, ["\"Well, our only option is to go back to this cavern.  The one full of elementals.  The exit has to be there.\""])
   showPicture(e, "Dwarf_Male04")
   if (poseYesNo(e, ["\"Too many.  I kenna handle any more than forty or fifty by myself and there were hundreds of them there..\"", "", "Turning to you, Bron gives you a sly smile.", "", "\"I dun suppose you would be interested in taking on a small army of elementals to help out a few dwarves, would ye?\""])):
      showMessage(e, ["\"Good.  I knew you were the fightin type as soon as I layed eyes on ya.\""])
      showMessage(e, ["\"Directions, Gred.\""])
      showPicture(e, "Dwarf_Male02")
      showMessage(e, ["\"Yes, of course.  This way\""])
      rtfollowdwarf = 1
      setTag(e, "rtfollowdwarf", rtfollowdwarf)
      setExit(e, "maps/rtplaneofearth.cfg", 17, 13, 0)
      return 0
   else:
      showMessage(e, ["\"We'll jes have to try on our own.  Let's get ta movin.\"", "", "Bron gives you a small nod as the dwarves walk from the room.", "", "\"Luck to ye.  Careful of the elementals wandering about.\""])
      rtfollowdwarf = 5
      setTag(e, "rtfollowdwarf", rtfollowdwarf)
      return 1
