// creator  : weidu.exe (version 23100)
// argument : JAHEIJ.DLG
// game		 : .
// source	 : ./DATA/DIALOG.BIF
// dialog	 : ./DIALOG.TLK
// dialogF  : (none)

BEGIN ~JAHEIJ~
//////////////////////////////////////////////////
// WARNING: this file contains non-trivial WEIGHTs
//////////////////////////////////////////////////

IF WEIGHT #4 /* Triggers after states #: 2 3 4 5 even though they appear after this state */
~!InParty("Khalid")
~ THEN BEGIN 0 // from:
  SAY #16687 /* ~Bless you, my Lord.  It is too much to hope for, but I wish you well.~ */
  IF ~~ THEN DO ~LeaveParty()
SetDialog("JaheiP")
~ EXIT
END

IF WEIGHT #5 /* Triggers after states #: 2 3 4 5 even though they appear after this state */
~InParty("Khalid")
~ THEN BEGIN 1 // from:
  SAY #16688 /* ~That is terrible, but there is little I can do to help you at the moment.~ */
  IF ~~ THEN DO ~ActionOverride("Khalid",ChangeAIScript("",DEFAULT))
ActionOverride("Khalid",LeaveParty())
ActionOverride("Khalid",SetDialog("KhalidP"))
LeaveParty()
SetDialog("JaheiP")
~ EXIT
END

IF WEIGHT #2 /* Triggers after states #: 4 5 even though they appear after this state */
~HappinessLT(Myself,0)
!InParty("Khalid")
~ THEN BEGIN 2 // from:
  SAY #16689 /* ~Of course, my Lord.  I expect nothing more.  Do you still wish to spend the evening?~ */
  IF ~~ THEN DO ~LeaveParty()
EscapeArea()
~ EXIT
END

IF WEIGHT #3 /* Triggers after states #: 4 5 even though they appear after this state */
~HappinessLT(Myself,0)
InParty("Khalid")
~ THEN BEGIN 3 // from:
  SAY #16690 /* ~I do need the rest, actually, so I will stay.  Here is the 50 gold pieces so your mistress will not be angry with you.~ */
  IF ~~ THEN DO ~ActionOverride("Khalid",ChangeAIScript("",DEFAULT))
ActionOverride("Khalid",LeaveParty())
ActionOverride("Khalid",EscapeArea())
LeaveParty()
EscapeArea()
~ EXIT
END

IF WEIGHT #0 ~GlobalTimerExpired("Jaheira","GLOBAL")
Global("Chapter","GLOBAL",1)
Global("GoToNashkell","GLOBAL",0)
~ THEN BEGIN 4 // from:
  SAY #17216 /* ~What has *that* to do with anything?!~ */
  IF ~~ THEN DO ~SetGlobalTimer("Jaheira","GLOBAL",FOUR_DAYS)
SetGlobal("GoToNashkell","GLOBAL",1)
~ EXIT
END

IF WEIGHT #1 ~GlobalTimerExpired("Jaheira","GLOBAL")
Global("Chapter","GLOBAL",1)
Global("GoToNashkell","GLOBAL",1)
~ THEN BEGIN 5 // from:
  SAY #17217 /* ~Jaheira! I question your loyalty to our cause.  My method will become clear in the end. I ask again, <CHARNAME>, what is your favorite color?~ */
  IF ~~ THEN DO ~SetGlobal("GoToNashkell","GLOBAL",2)
~ EXIT
END
