BEGIN ~BG1x5~

IF ~NumTimesTalkedTo(0)~ THEN BEGIN Talk1
SAY @0
=
@1
=
@2
IF ~~ THEN REPLY @3 GOTO NAME1
IF ~~ THEN REPLY @4 GOTO NAME2
END

IF ~~ THEN BEGIN NEXT1
SAY @5
=
@6
IF ~~ THEN REPLY @7 GOTO answer1
IF ~~ THEN REPLY @8 GOTO answer2
IF ~~ THEN REPLY @9 GOTO answer3
IF ~~ THEN REPLY @10 GOTO answer4
END

IF ~~ THEN BEGIN answer2
SAY @11
IF ~~ THEN GOTO answer1
END

IF ~~ THEN BEGIN answer3
SAY @12
=
@13
IF ~~ THEN GOTO answer1
END

IF ~~ THEN BEGIN answer4
SAY @14
IF ~~ THEN GOTO answer1
END

IF ~~ THEN BEGIN NAME1
SAY @15
IF ~~ THEN GOTO NEXT1
END

IF ~~ THEN BEGIN NAME2
SAY @16
IF ~~ THEN GOTO NEXT1
END


IF ~~ THEN BEGIN answer1
SAY @17
=
@18
=
@19
=
@20 
IF ~~ THEN DO ~GiveItemCreate("MISCAT",PLAYER1,1,0,0)SetGlobal("BG1X5","GLOBAL",1)~ EXIT
END



IF ~Global("BG1X5","GLOBAL",1)~ THEN BEGIN Talk2
SAY @21
=
@22 
IF ~~ THEN REPLY @23 DO ~SetGlobal("BG1X5","GLOBAL",0)~GOTO Talk2-1c
IF ~~ THEN REPLY @24 GOTO Talk2-1a
IF ~~ THEN REPLY @25 GOTO Talk2-1b

END


IF ~Global("BG1X5","GLOBAL",0)~ THEN BEGIN Talk2-1c2
SAY @26
=
@27
IF ~~ THEN REPLY @28 GOTO RUDE1
IF ~~ THEN REPLY @29 GOTO Talk2-1d
IF ~~ THEN REPLY @30 GOTO Talk2-1a
IF ~~ THEN REPLY @25 GOTO Talk2-1b
END

IF ~~ THEN BEGIN Talk2-1d
SAY @12
=
@13
IF ~~ THEN EXIT
END

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

IF ~~ THEN BEGIN Talk2-1a
SAY @32
=
@33
=
@34
IF ~~ THEN REPLY @25 GOTO Talk2-1b
IF ~~ THEN REPLY @35 DO ~SetGlobal("BG1X5","GLOBAL",0)~GOTO Talk2-1c
END

IF ~~ THEN BEGIN Talk2-1c
SAY @36
IF ~~ THEN EXIT
END


IF ~~ THEN BEGIN Talk2-1b
SAY @37
IF ~~ THEN REPLY @38 DO ~AddJournalEntry(@1789,QUEST)~ GOTO ACCEPTQUEST
IF ~~ THEN REPLY @39 DO ~SetGlobal("BG1X5","GLOBAL",0)~GOTO Talk2-1c
END


IF ~~ THEN BEGIN ACCEPTQUEST
SAY @40
=
@41
IF ~~ THEN DO ~SetGlobal("BG1X5","GLOBAL",2)GiveItemCreate("Book56",PLAYER1,1,0,0)~EXIT
END

IF ~Global("BG1X5","GLOBAL",6)~ THEN BEGIN FINALQUESTTALKxxxx
SAY @42
IF ~~ THEN REPLY @43 GOTO FINALQUESTTALK3
END


IF ~Global("BG1X5","GLOBAL",7)~ THEN BEGIN FINALQUESTTALK
SAY @42
IF ~PartyHasItem("BGSX19")~ THEN REPLY @44 GOTO FINALQUESTTALK2
IF ~~ THEN REPLY @43 GOTO FINALQUESTTALK3
END

IF ~~ THEN BEGIN FINALQUESTTALK3
SAY @45
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN FINALQUESTTALK2
SAY @40
=
@46 
IF ~~ THEN DO ~TakePartyItem("BGSX19")AddJournalEntry(@1790,QUEST_DONE)
GiveItemCreate("PLATNUM",PLAYER1,1275,0,0)SetGlobal("BG1X5","GLOBAL",8)~ EXIT
END



IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,1)~ THEN BEGIN Random1
SAY @47
=
@48
IF ~~ THEN EXIT
END

IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,2)~ THEN BEGIN Random2
SAY @49
=
@50
=
@51
=
@52
=
@53
IF ~~ THEN EXIT
END

IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,3)~ THEN BEGIN Random3
SAY @54
=
@55
=
@56
=
@57
=
@58
IF ~~ THEN EXIT
END


IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,4)~ THEN BEGIN Random4
SAY @59
=
@60
IF ~~ THEN EXIT
END


IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,5)~ THEN BEGIN Random5
SAY @61
=
@62
IF ~~ THEN EXIT
END


IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,6)~ THEN BEGIN Random6
SAY @63
=
@64
IF ~~ THEN EXIT
END



IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,7)~ THEN BEGIN Random7
SAY @65
=
@66
IF ~~ THEN EXIT
END


IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,8)~ THEN BEGIN Random8
SAY @67
=
@68
=
@69
IF ~~ THEN EXIT
END


IF ~Global("BG1X5","GLOBAL",8)RandomNum(9,9)~ THEN BEGIN Random9
SAY @70
IF ~~ THEN EXIT
END




///////////////////////////////////////////////////////////////////////////////////////////////////

APPEND DAWNMAS
IF WEIGHT #-10 ~Global("BG1X5","GLOBAL",2)~ THEN BEGIN DAWNMAS-Ricster1
SAY @71
IF ~PartyHasItem("BOOK56")~ THEN REPLY @72 GOTO DAWNMAS-Ricster2
IF ~~ THEN REPLY @73 DO ~StartStore("Temlath",LastTalkedToBy())~ EXIT
IF ~~ THEN REPLY @74 GOTO DAWNMAS-Ricster0
END
END

APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster0
SAY @75
IF ~~ THEN EXIT
END
END

APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster2
SAY @76
=
@77
IF ~~ THEN DO ~TakePartyItem("BOOK56")EraseJournalEntry(@1789)~ GOTO DAWNMAS-Ricster2b
END
END

APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster2b
SAY @78
IF ~~ THEN REPLY @79 GOTO DAWNMAS-Ricster3
IF ~~ THEN REPLY @80 GOTO DAWNMAS-Ricster3a
END
END

APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster3
SAY @81
=
@82
=
@83
=
@84 
IF ~~ THEN GOTO DAWNMAS-Ricster3b
END
END

APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster3b
SAY @85
=
@86
IF ~~ THEN DO ~SetGlobal("BG1X5","GLOBAL",3)
AddJournalEntry(@1792,QUEST)~EXIT
END
END


APPEND DAWNMAS
IF ~~ THEN BEGIN DAWNMAS-Ricster3a
SAY @87
=
@88
IF ~~ THEN DO ~SetGlobal("BG1X5","GLOBAL",3)~EXIT
END
END

APPEND ORIONA
IF WEIGHT #-10 ~Global("BG1X5","GLOBAL",3)~ THEN BEGIN ORIONA1
SAY @89
IF ~~ THEN REPLY @90 DO~EraseJournalEntry(@1792)~GOTO ORIONA2
IF ~~ THEN REPLY @91 EXIT
END
END

APPEND ORIONA
IF ~~ THEN BEGIN ORIONA2
SAY @92
=
@93
=
@94
=
@95
=
@96
=
@97
IF ~~ THEN DO ~SetGlobal("BG1X5","GLOBAL",4)AddJournalEntry(@1791,QUEST)~EXIT
END
END

APPEND SHOP08
IF WEIGHT #-10 ~Global("BG1X5","GLOBAL",4)~ THEN BEGIN SHOP08-1
SAY @98
=
@99
IF ~~ THEN REPLY @100GOTO BOOKPOWER
IF ~~ THEN REPLY @101GOTO THREAT1
IF ~~ THEN REPLY @102GOTO DEAL
IF ~~ THEN REPLY @103 GOTO MOVEONWARD
END
END

APPEND SHOP08
IF ~~ THEN BEGIN DEAL
SAY @104
IF ~~ THEN GOTO MOVEONWARD
END
END



APPEND SHOP08
IF ~~ THEN BEGIN BOOKPOWER
SAY @105
IF ~~ THEN GOTO MOVEONWARD
END
END

APPEND SHOP08
IF ~~ THEN BEGIN THREAT1
SAY @106
=
@107
IF ~~ THEN GOTO MOVEONWARD
END
END

APPEND SHOP08
IF ~~ THEN BEGIN MOVEONWARD
SAY @108
=
@109
=
@110
=
@111
IF ~~ THEN REPLY @112 DO ~SetGlobal("BG1X5","GLOBAL",5)~ GOTO NOTIME
IF ~~ THEN REPLY @113 DO ~SetGlobal("BG1X5","GLOBAL",5)~ EXIT
END
END


APPEND SHOP08
IF ~~ THEN BEGIN NOTIME
SAY @114
=
@115
IF ~~ THEN EXIT
END
END



APPEND SHOP08
IF WEIGHT #-11 ~Global("BG1X5","GLOBAL",6)Dead("BG1x6")~ THEN BEGIN SHOP08-2
SAY @116
=
@117
IF ~~ THEN DO ~GiveItemCreate("BGSX19",PLAYER1,1,0,0)SetGlobal("BG1X5","GLOBAL",7)~ EXIT
END
END

