BEGIN ~USXHAAJ~

IF ~~ THEN BEGIN 0
  SAY @40300
  IF ~~ THEN GOTO 1
END

IF ~~ THEN BEGIN 1
  SAY @40301
  IF ~~ THEN EXTERN ~USREIGJ~ 28
END

IF ~~ THEN BEGIN 2
  SAY @40303
  IF ~~ THEN EXTERN ~USREIGJ~ 29
END

IF ~~ THEN BEGIN 3
  SAY @40305
  IF ~~ THEN EXTERN ~USREIGJ~ 30
  IF ~InParty("USVUNA")
See("USVUNA",0)
!StateCheck("USVUNA", EX_NO_DIALOGUE)~ THEN EXTERN ~USVUNAJ~ 0
  IF ~InParty("USEMMA")
See("USEMMA",0)
!StateCheck("USEMMA", EX_NO_DIALOGUE)~ THEN EXTERN ~USEMMAJ~ 0
  IF ~InParty("USZACK")
See("USZACK",0)
!StateCheck("USZACK", EX_NO_DIALOGUE)~ THEN EXTERN ~USZACKJ~ 0
END

IF ~~ THEN BEGIN 4
  SAY @40309
  IF ~~ THEN EXTERN ~USREIGJ~ 30
END

IF ~~ THEN BEGIN 5
  SAY @40311
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 6
  SAY @40918
  IF ~~ THEN EXTERN ~USZACKJ~ 11
END

IF ~~ THEN BEGIN 7
  SAY @40921
  IF ~~ THEN EXTERN ~USZACKJ~ 13
END

IF ~~ THEN BEGIN 8
  SAY @40923
  IF ~~ THEN EXTERN ~USZACKJ~ 14
END

IF ~~ THEN BEGIN 9
  SAY @40925
  IF ~~ THEN EXTERN ~USZACKJ~ 15
END

IF ~~ THEN BEGIN 10
  SAY @40927
  IF ~~ THEN EXTERN ~USZACKJ~ 16
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",1)~ THEN BEGIN 11
  SAY @40929
  IF ~~ THEN DO ~SetGlobal("DIDBANTERUSXHAAJ1","GLOBAL",1)
SetGlobal("BANTERUSZACKJ","GLOBAL",0)~ EXTERN ~USREIGJ~ 104
END

IF ~~ THEN BEGIN 12
  SAY @40931
  IF ~~ THEN EXTERN ~USREIGJ~ 105
END

IF ~~ THEN BEGIN 13
  SAY @40933
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 14
  SAY @40980
  IF ~~ THEN EXIT
  IF ~IEex_LuaTrigger("return IEex_IfValidForPartyDialogue(USVUNA)")~ THEN EXTERN ~USVUNAJ~ 34
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",2)~ THEN BEGIN 15
  SAY @41016
  IF ~~ THEN REPLY @40988 DO ~SetGlobal("DIDBANTERUSXHAAJ2","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 16
END

IF ~~ THEN BEGIN 16
  SAY @40989
  IF ~~ THEN GOTO 17
END

IF ~~ THEN BEGIN 17
  SAY @40990
  IF ~~ THEN GOTO 19
END

IF ~~ THEN BEGIN 18
  SAY @40991
  IF ~~ THEN GOTO 19
END

IF ~~ THEN BEGIN 19
  SAY @41018
  IF ~~ THEN EXIT
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",3)~ THEN BEGIN 20
  SAY @41076
    IF ~~ THEN DO ~SetGlobal("DIDBANTERUSXHAAJ3","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ EXIT
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",4)~ THEN BEGIN 21
  SAY @41115
  IF ~~ THEN REPLY @41116 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 22
  IF ~~ THEN REPLY @41117 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 27
  IF ~~ THEN REPLY @41118 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 28
  IF ~~ THEN REPLY @41119 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 29
  IF ~~ THEN REPLY @41120 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 30
  IF ~~ THEN REPLY @41121 DO ~SetGlobal("DIDBANTERUSXHAAJ4","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ GOTO 31
END

IF ~~ THEN BEGIN 22
  SAY @41122
  IF ~~ THEN REPLY @41123 GOTO 23
  IF ~~ THEN REPLY @41124 GOTO 24
  IF ~~ THEN REPLY @41125 GOTO 25
  IF ~~ THEN REPLY @41126 GOTO 26
END

IF ~~ THEN BEGIN 23
  SAY @41027
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 24
  SAY @41028
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 25
  SAY @41029
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 26
  SAY @41030
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 27
  SAY @41031
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 28
  SAY @41032
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 29
  SAY @41033
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 30
  SAY @41034
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 31
  SAY @41035
  IF ~~ THEN EXIT
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",5)~ THEN BEGIN 32
  SAY @41298
  IF ~~ THEN DO ~SetGlobal("DIDBANTERUSXHAAJ5","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ EXIT
  IF ~IEex_LuaTrigger("return IEex_IfValidForPartyDialogue(USSERS)")~ THEN DO ~SetGlobal("DIDBANTERUSXHAAJ5","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ EXTERN ~USSERSJ~ 12
END

IF ~~ THEN BEGIN 33
  SAY @41610
  IF ~~ THEN EXTERN ~67ORMIS~ 1
END

IF ~~ THEN BEGIN 34
  SAY @41622
  IF ~~ THEN GOTO 35
END

IF ~~ THEN BEGIN 35
  SAY @41623
  IF ~~ THEN EXTERN ~63YXBU~ 12
END

IF ~~ THEN BEGIN 36
  SAY @41625
  IF ~~ THEN EXTERN ~63YXBU~ 13
END

IF ~~ THEN BEGIN 37
  SAY @41627
  IF ~False()~ THEN EXIT
END

IF ~~ THEN BEGIN 38
  SAY @41631
  IF ~~ THEN REPLY @41632 DO ~SetGlobal("US_Xhaan_Yxbu_Deal","GLOBAL",-1)
LeaveParty()
ChangeEnemyAlly(Myself,ENEMY)~ EXIT
  IF ~Global("US_Ask_Xhaan_Yxbu_1","GLOBAL",0)~ THEN REPLY @41633 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_1","GLOBAL",1)~ GOTO 39
  IF ~Or(6)
  CheckStatGT(Player1,16,INT)
  CheckStatGT(Player2,16,INT)
  CheckStatGT(Player3,16,INT)
  CheckStatGT(Player4,16,INT)
  CheckStatGT(Player5,16,INT)
  CheckStatGT(Player6,16,INT)~ THEN REPLY @41634 GOTO 41
  IF ~Global("US_Ask_Xhaan_Yxbu_2","GLOBAL",0)~ THEN REPLY @41635 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_2","GLOBAL",1)~ GOTO 40
END

IF ~~ THEN BEGIN 39
  SAY @41636
  IF ~~ THEN REPLY @41632 DO ~SetGlobal("US_Xhaan_Yxbu_Deal","GLOBAL",-1)
LeaveParty()
ChangeEnemyAlly(Myself,ENEMY)~ EXIT
  IF ~Global("US_Ask_Xhaan_Yxbu_1","GLOBAL",0)~ THEN REPLY @41633 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_1","GLOBAL",1)~ GOTO 39
  IF ~Or(6)
  CheckStatGT(Player1,16,INT)
  CheckStatGT(Player2,16,INT)
  CheckStatGT(Player3,16,INT)
  CheckStatGT(Player4,16,INT)
  CheckStatGT(Player5,16,INT)
  CheckStatGT(Player6,16,INT)~ THEN REPLY @41634 GOTO 41
  IF ~Global("US_Ask_Xhaan_Yxbu_2","GLOBAL",0)~ THEN REPLY @41635 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_2","GLOBAL",1)~ GOTO 40
END

IF ~~ THEN BEGIN 40
  SAY @41637
  IF ~~ THEN REPLY @41632 DO ~SetGlobal("US_Xhaan_Yxbu_Deal","GLOBAL",-1)
LeaveParty()
ChangeEnemyAlly(Myself,ENEMY)~ EXIT
  IF ~Global("US_Ask_Xhaan_Yxbu_1","GLOBAL",0)~ THEN REPLY @41633 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_1","GLOBAL",1)~ GOTO 39
  IF ~Or(6)
  CheckStatGT(Player1,16,INT)
  CheckStatGT(Player2,16,INT)
  CheckStatGT(Player3,16,INT)
  CheckStatGT(Player4,16,INT)
  CheckStatGT(Player5,16,INT)
  CheckStatGT(Player6,16,INT)~ THEN REPLY @41634 GOTO 41
  IF ~Global("US_Ask_Xhaan_Yxbu_2","GLOBAL",0)~ THEN REPLY @41635 DO ~SetGlobal("US_Ask_Xhaan_Yxbu_2","GLOBAL",1)~ GOTO 40
END

IF ~~ THEN BEGIN 41
  SAY @41638
  IF ~~ THEN EXTERN ~63YXBU~ 16
END

IF ~~ THEN BEGIN 42
  SAY @41640
  IF ~~ THEN REPLY @41641 DO ~SetGlobal("US_Xhaan_Yxbu_Deal","GLOBAL",3)
StartCutSceneMode()
StartCutScene("USXHAAY1")~ EXIT
  IF ~~ THEN REPLY @41642 GOTO 43
END

IF ~~ THEN BEGIN 43
  SAY @41643
  IF ~~ THEN DO ~SetGlobal("US_Xhaan_Yxbu_Deal","GLOBAL",-1)
LeaveParty()
ChangeEnemyAlly(Myself,ENEMY)~ EXIT
END

IF ~InParty(Myself)
Global("BANTERUSXHAAJ","GLOBAL",6)~ THEN BEGIN 44
  SAY @41647
  IF ~~ THEN DO ~SetGlobal("DIDBANTERUSXHAAJ6","GLOBAL",1)
SetGlobal("BANTERUSXHAAJ","GLOBAL",0)~ EXTERN ~63YXBU~ 18
END