BEGIN ~TCCHESNA~

IF ~Global("TCChesnarGetsHelp","GLOBAL",0)~ THEN BEGIN Chesnar1
  SAY ~I guess you’re the cargo the slavers have been talking about.  You better be careful and get out of here before they kill us all.~
  IF ~~ THEN REPLY ~Who are you?~ GOTO Chesnar2
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",0)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3a
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",1)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3b
  IF ~~ THEN REPLY ~How can I escape Westgate?~ GOTO Chesnar4
END

IF ~~ THEN BEGIN Chesnar2
  SAY ~I am Chesnar, I am the owner of this sawmill.  The slavers have threatened my life if I don’t help with repairs to their ship.~
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",0)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3a
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",1)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3b
  IF ~~ THEN REPLY ~How can I escape Westgate?~ GOTO Chesnar4
  IF ~~ THEN REPLY ~I guess that is all the questions I have for now.~ EXIT
END

IF ~~ THEN BEGIN Chesnar3a
  SAY ~Yes, but I need all of the slavers killed first.  They damaged the stairs to prevent the watch from coming while in port.  Fixing the stairs would only be temporary.~
  IF ~~ THEN REPLY ~Who are you?~ GOTO Chesnar2
  IF ~~ THEN REPLY ~How can I escape Westgate?~ GOTO Chesnar4
END

IF ~~ THEN BEGIN Chesnar3b
  SAY ~I have already fixed the stairs.  However, the slavers destroy it all the time to keep the watch from entering the docks.  So you need to defeat all of the slavers to keep the stairs from being broken again.~
  IF ~~ THEN REPLY ~Who are you?~ GOTO Chesnar2
  IF ~~ THEN REPLY ~How can I escape Westgate?~ GOTO Chesnar4
END

IF ~~ THEN BEGIN Chesnar4
  SAY ~There is a door near the stairway.  It leads to a tunnel system.  It is one of the smuggling routes out of the city.  There used to be another one in one of the warehouses but it caved in the other day.~
  IF ~~ THEN GOTO Chesnar5
END

IF ~~ THEN BEGIN Chesnar5
  SAY ~I hear some of your equipment is in the ruined temple outside of the city.  I guess they plan to use some of it.~
  IF ~~ THEN REPLY ~Who are you?~ GOTO Chesnar2
  IF ~~ THEN REPLY ~Can you help me escape?~ GOTO ChesnarEscape
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",0)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3a
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",1)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3b
END

IF ~~ THEN BEGIN ChesnarEscape
  SAY ~Are you insane?  Just talking to you is enough to get me in trouble.~
  IF ~~ THEN REPLY ~I'm an adventurer.  I'm here to shut down the slave trading but I need equipment.~ GOTO ChesnarEscape1
END

IF ~~ THEN BEGIN ChesnarEscape1
  SAY ~Shut it down you say?  Very well.  I'll see if the Lathander church can help me.  Stay here and hide out of sight.~
  IF ~~ THEN DO ~SetGlobal("TCChesnarGetsHelp","GLOBAL",1)~ EXIT
END

IF ~Global("TCChesnarGetsHelp","GLOBAL",3)~ THEN BEGIN ChesnarReturns
  SAY ~I think these should help you.~
  IF ~~ THEN DO ~SetGlobal("TCChesnarGetsHelp","GLOBAL",4)~ EXTERN ~TCWGPR1~ HelpingPC
END

IF ~~ THEN BEGIN HelpingPC1
  SAY ~The Dawn Priest here has brought some equipment that you can use.~
  IF ~~ THEN EXTERN ~TCWGPR1~ HelpingPC2
END

IF ~OR(2) !NumberOfTimesTalkedTo(0) GlobalGT("TCChesnarGetsHelp","GLOBAL",4)~ THEN BEGIN ChesnarReturn
  SAY ~Greetings again.  What can I help you with?~
  IF ~~ THEN REPLY ~Who are you?~ GOTO Chesnar2
  IF ~GlobalLT("TCChesnarGetsHelp","GLOBAL",2)~ THEN REPLY ~Can you help me escape?~ GOTO ChesnarEscape
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",0)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3a
  IF ~Global("TCKnowStairsBroken","GLOBAL",1) Global("TCBeentoTC1200","GLOBAL",1)~ THEN REPLY ~Can you fix the stairs?~ GOTO Chesnar3b
  IF ~~ THEN REPLY ~How can I escape Westgate?~ GOTO Chesnar4
END

APPEND ~TCWGPR1~

IF ~~ THEN BEGIN HelpingPC
  SAY ~Greetings to you and may the bright light of Lathander shine on you.~
  IF ~~ THEN EXTERN ~TCCHESNA~ HelpingPC1
END

IF ~~ THEN BEGIN HelpingPC2
  SAY ~It is not much but I hope it will assist you in your, eh, endevour.~
  IF ~~ THEN REPLY ~I'm sure it will help us.~ DO ~GiveItemCreate("CHAN01",Player1,0,0,0) GiveItemCreate("STAF01",Player1,0,0,0) GiveItemCreate("BLUN01",Player1,0,0,0) GiveItemCreate("HELM01",Player1,0,0,0)~ EXIT
END
END
