// creator  : weidu.exe (version 23100)
// argument : QUAYLE.DLG
// game		 : .
// source	 : ./override/QUAYLE.DLG
// dialog	 : ./DIALOG.TLK
// dialogF  : (none)

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

IF ~~ THEN BEGIN 0 // from:
  SAY #2246 /* ~Ha!  I knew Kalah would trip over himself, eventually.  I'm just pleased he despised me enough to play with me rather than dispose of me like some of the others!~ */
  IF ~~ THEN EXTERN ~AERIE~ 15
END

IF ~~ THEN BEGIN 1 // from:
  SAY #2248 /* ~I... I think you need to find out, my dear.  I've taught you everything I can.  It's time, Aerie... time for you to learn the rest on your own.~ */
  IF ~~ THEN EXTERN ~AERIE~ 16
END

IF ~~ THEN BEGIN 2 // from:
  SAY #2250 /* ~I wasn't always, my dear.  You changed that.  But I can't keep you here.  <CHARNAME>... you can provide for her better than I.  Perhaps you will take her with you?~ */
  IF ~~ THEN REPLY #2251 /* ~Aerie, should you be willing, we would appreciate a cleric/mage with your heart and stature.~ */ EXTERN ~AERIE~ 17
  IF ~~ THEN REPLY #2252 /* ~There is no room for her at my side, right now at least. Perhaps another time.~ */ EXTERN ~AERIE~ 19
END

IF ~~ THEN BEGIN 3 // from:
  SAY #2254 /* ~Then you shall have to come and visit me from time to time and tell me what you've learned.  Go... go with my blessing, girl.~ */
  IF ~~ THEN EXTERN ~AERIE~ 18
END

IF ~~ THEN BEGIN 4 // from:
  SAY #2256 /* ~Oh, don't worry about me.  If you find happiness, maybe the pain of losing your wings will be lessened... nothing would please me more.  Be well, my Aerie.~ */
  IF ~GlobalLT("chapter","GLOBAL",4)
~ THEN REPLY #42164 /* ~You should know, Aerie, that my goal is to rescue a friend of mine... Imoen... who has been captured by the Cowled Wizards.  It could be dangerous.~ */ DO ~SetGlobalTimer("CircusEnded","GLOBAL",ONE_DAY)~ EXTERN ~AERIE~ 54
  IF ~~ THEN REPLY #42165 /* ~Alright, let's go then, Aerie.~ */ DO ~ActionOverride("Aerie",JoinParty())
SetGlobalTimer("CircusEnded","GLOBAL",ONE_DAY~ EXIT
END

IF ~~ THEN BEGIN 5 // from:
  SAY #2282 /* ~Little Aerie, is that you? I have no eyes, no eyes!~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 0
END

IF ~~ THEN BEGIN 6 // from:
  SAY #2581 /* ~Haer'Dalis, is it? And acting lessons? Oh, my little Aerie, you have surrounded yourself with such wonderful friends... or is he more than a friend?~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 8
END

IF ~~ THEN BEGIN 7 // from:
  SAY #2583 /* ~A ten-day? Hoi, my dear, you overestimate my stomach for young love. Come for a week and I promise not to be driven mad by your longing gazes.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 9
END

IF ~~ THEN BEGIN 8 // from:
  SAY #2585 /* ~Until then, my dear.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 9 // from:
  SAY #2587 /* ~Oh, my little Aerie, every visit from you is a gift.  You have come so far and surrounded yourself with such wonderful friends... or is he more than a friend?~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 8
END

IF ~~ THEN BEGIN 10 // from:
  SAY #20309 /* ~Ha!  I knew Kalah would trip over himself, eventually.  I'm just pleased he despised me enough to play with me rather than dispose of me like some of the others!~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 16
END

IF ~~ THEN BEGIN 11 // from:
  SAY #20310 /* ~I... I think you need to find out, my dear.  I've taught you everything I can.  It's time, Aerie... time for you to learn the rest on your own.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 17
END

IF ~~ THEN BEGIN 12 // from:
  SAY #20324 /* ~I wasn't always, my dear.  You changed that, Aerie.  But I can't keep you here for myself forever.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 18
END

IF ~~ THEN BEGIN 13 // from:
  SAY #20325 /* ~Then you shall have to come and visit me from time to time and tell me what you've learned.  Go... go with my blessing, girl.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 19
END

IF ~~ THEN BEGIN 14 // from:
  SAY #20326 /* ~Oh, don't worry about me.  If you find happiness, maybe the pain of losing your wings will be lessened... nothing would please me more.  Be well, my Aerie.~ */
  IF ~~ THEN DO ~SetGlobal("AerieQ","GLOBAL",1)~ EXIT
END

IF WEIGHT #9 /* Triggers after states #: 18 23 24 28 31 44 45 46 48 even though they appear after this state */
~Global("AerieJoined","GLOBAL",0)
!InPartyAllowDead("Aerie")
!Dead("Aerie")
See("Aerie")~ THEN BEGIN 15 // from:
  SAY #29420 /* ~Ah, it is too bad you could not take her.  Her spirit is stifling here, it would not be smart to leave her. Maybe one day, soon, she will be able to go.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #14 /* Triggers after states #: 18 19 20 21 22 23 24 28 31 44 45 46 48 even though they appear after this state */
~InPartyAllowDead("Aerie")
!Dead("Aerie")
See("Aerie")
GlobalTimerExpired("CircusEnded","GLOBAL")
!StateCheck("Aerie",STATE_SLEEPING)
~ THEN BEGIN 16 // from:
  SAY #8227 /* ~My amazing brain told me you would return! I trust you are taking fine care of Aerie? Yes, the sparkle in her eye has returned. It is best she leave this place behind her.~ */
  IF ~OR(2)
!InPartySlot(LastTalkedToBy,0)
GlobalGT("chapter","GLOBAL",3)~ THEN EXIT
  IF ~InPartySlot(LastTalkedToBy,0)
GlobalLT("chapter","GLOBAL",4)~ THEN REPLY #45482 /* ~I have a question to ask you.  A friend of mine has been imprisoned by the Cowled Wizards... do you know where they keep people they capture?~ */ GOTO 33
  IF ~InPartySlot(LastTalkedToBy,0)
GlobalLT("chapter","GLOBAL",4)~ THEN REPLY #45483 /* ~What do you know about the Shadow Thieves here in Athkatla?~ */ GOTO 35
END

IF WEIGHT #15 /* Triggers after states #: 18 19 20 21 22 23 24 28 31 44 45 46 48 even though they appear after this state */
~Global("AerieJoined","GLOBAL",1)
GlobalTimerExpired("CircusEnded","GLOBAL")
OR(2)
!InPartyAllowDead("Aerie")
Dead("Aerie")
!See("Aerie")
~ THEN BEGIN 17 // from:
  SAY #29421 /* ~Eh, you have returned and Aerie is not among you? I should have known as much; she is a restless child. Wherever she is, I wish her well.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #0 ~Name("Aerie",LastTalkedToBy)
!Global("QuayleRaelis","GLOBAL",1)~ THEN BEGIN 18 // from:
  SAY #36744 /* ~It is good to see you again, my dear.  It does these old bones good to see you out of this circus and seeing the world.  I knew I couldn't keep you here forever.~ */
  IF ~True()~ THEN EXIT
  IF ~Global("MinscWitch","LOCALS",1)
IsValidForPartyDialog("Minsc")
Global("IntroduceMinsc","LOCALS",0)~ THEN DO ~SetGlobal("IntroduceMinsc","LOCALS",1)~ EXTERN ~AERIEJ~ 37
END

IF WEIGHT #10 /* Triggers after states #: 23 24 28 31 44 45 46 48 even though they appear after this state */
~Global("AerieJoined","GLOBAL",0)
!InPartyAllowDead("Aerie")
Dead("Aerie")~ THEN BEGIN 19 // from:
  SAY #36745 /* ~Ahhh, I knew the child should have gone sooner.  Now she's dead, and all she knew was this circus.  It does a poor gnome's heart ill to have outlived her.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #11 /* Triggers after states #: 23 24 28 31 44 45 46 48 even though they appear after this state */
~InPartyAllowDead("Aerie")
!GlobalTimerExpired("CircusEnded","GLOBAL")
~ THEN BEGIN 20 // from:
  SAY #36747 /* ~I thank you, my good <MANWOMAN>, for helping us.  Kalah was a fine illusionist... just more deluded than anyone knew.  Take care of my Aerie, then, will you?~ */
  IF ~OR(2)
!InPartySlot(LastTalkedToBy,0)
GlobalGT("chapter","GLOBAL",3)~ THEN EXIT
  IF ~InPartySlot(LastTalkedToBy,0)
GlobalLT("chapter","GLOBAL",4)~ THEN REPLY #45475 /* ~I have a question to ask you.  A friend of mine has been imprisoned by the Cowled Wizards... do you know where they keep people they capture?~ */ GOTO 33
  IF ~InPartySlot(LastTalkedToBy,0)
GlobalLT("chapter","GLOBAL",4)~ THEN REPLY #45476 /* ~What do you know about the Shadow Thieves here in Athkatla?~ */ GOTO 35
END

IF WEIGHT #12 /* Triggers after states #: 23 24 28 31 44 45 46 48 even though they appear after this state */
~Global("AerieJoined","GLOBAL",1)
!InPartyAllowDead("Aerie")
!Dead("Aerie")
!GlobalTimerExpired("CircusEnded","GLOBAL")
~ THEN BEGIN 21 // from:
  SAY #37484 /* ~It is too bad that you won't take Aerie with you.  She should see the world.  Think about it, my good <PRO_MANWOMAN>... talk to her when you get the chance.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #13 /* Triggers after states #: 23 24 28 31 44 45 46 48 even though they appear after this state */
~Global("AerieJoined","GLOBAL",1)
!InPartyAllowDead("Aerie")
Dead("Aerie")
!GlobalTimerExpired("CircusEnded","GLOBAL")~ THEN BEGIN 22 // from:
  SAY #37485 /* ~My poor girl is dead, I see.  I hoped she would see the world with you, and not die fighting Kalah's pathetic vanity.  It breaks an old gnome's heart, truly...~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #5 /* Triggers after states #: 44 45 46 48 even though they appear after this state */
~Global("KickedOut","LOCALS",1)
See("Aerie")
!Dead("Aerie")
!InParty("Aerie")~ THEN BEGIN 23 // from:
  SAY #37486 /* ~I ask that you take Aerie with you again, to see the world... but it is your affair, after all.  It does my heart ill to see her cooped up here, though.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #6 /* Triggers after states #: 44 45 46 48 even though they appear after this state */
~InParty("Jan")
See("Jan")
!StateCheck("Jan",STATE_SLEEPING)
Global("QuayleJan","LOCALS",0)~ THEN BEGIN 24 // from:
  SAY #38879 /* ~Is... is that you, Jansen?~ */
  IF ~~ THEN DO ~SetGlobal("QuayleJan","LOCALS",1)~ EXTERN ~JANJ~ 81
END

IF ~~ THEN BEGIN 25 // from:
  SAY #38881 /* ~Now, that's a name I haven't heard in a while.~ */
  IF ~~ THEN EXTERN ~JANJ~ 82
END

IF ~~ THEN BEGIN 26 // from:
  SAY #38883 /* ~Come, now, Jan... we're in mixed company here, and I'm sure that's not a tale for certain ears, if you take my meaning.~ */
  IF ~~ THEN EXTERN ~JANJ~ 83
END

IF ~~ THEN BEGIN 27 // from:
  SAY #38885 /* ~Ah, but a life of thievery and barter was too appealing, I see.  Heh heh... it is good to see you, too, Jansen.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #7 /* Triggers after states #: 44 45 46 48 even though they appear after this state */
~InParty("Jan")
See("Jan")
!StateCheck("Jan",STATE_SLEEPING)
Global("QuayleJan","LOCALS",1)~ THEN BEGIN 28 // from:
  SAY #38886 /* ~Hello again, Jansen.  Try not to steal the circus while you're here, will you?~ */
  IF ~~ THEN DO ~SetGlobal("QuayleJan","LOCALS",2)~ EXTERN ~JANJ~ 84
END

IF ~~ THEN BEGIN 29 // from:
  SAY #38907 /* ~Ah.  You must be from Rashemen, then, I suppose.  Big fellow, aren't you?~ */
  IF ~~ THEN EXTERN ~MINSCJ~ 123
END

IF ~~ THEN BEGIN 30 // from:
  SAY #38909 /* ~Well that's good to know.  Nice meeting you, Minsc.  Always good to know there are people looking out for Aerie.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #8 /* Triggers after states #: 44 45 46 48 even though they appear after this state */
~Name("Minsc",LastTalkedToBy)
Global("MinscWitch","LOCALS",1)
Global("IntroduceMinsc","LOCALS",1)~ THEN BEGIN 31 // from:
  SAY #38910 /* ~Take care of Aerie, Minsc.  She's delicate... I wouldn't want anything happen to her.   I'm sure you'll do everything in your power to protect your witch, right?~ */
  IF ~~ THEN DO ~SetGlobal("IntroduceMinsc","LOCALS",2)~ EXTERN ~MINSCJ~ 70
END

IF ~~ THEN BEGIN 32 // from:
  SAY #38912 /* ~Ahh, yes... that's what I meant, I suppose.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 33 // from: 20.1 16.1
  SAY #45477 /* ~Hmm.  Crossed the Cowled Wizards, have you?  Beware, <CHARNAME>.  They have deep roots here in Athkatla..~ */
  IF ~~ THEN GOTO 34
END

IF ~~ THEN BEGIN 34 // from: 33.0
  SAY #45478 /* ~If they've taken someone, that person is gone.  Best just to accept it.  Your only other chance would be to get help from an organization just as powerful.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 35 // from: 20.2 16.2
  SAY #45479 /* ~Not much.  They rule the Docks, so some say, and the local guard won't even go there.  Probably the safest part of town, if you ask me.~ */
  IF ~~ THEN GOTO 36
END

IF ~~ THEN BEGIN 36 // from: 35.0
  SAY #45480 /* ~I've heard some nonsense about someone challenging them, but I don't put stock in it.  The Shadow Thieves have as much power as the Cowled Wizards, you know...~ */
  IF ~~ THEN GOTO 37
END

IF ~~ THEN BEGIN 37 // from: 36.0
  SAY #45481 /* ~If someone's challenging them, the Bloodscalp... that's what they call their leader, I hear... he'll deal with them, sure enough.  I wouldn't get involved, were I you.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 38 // from:
  SAY #59012 /* ~Aerie!  It is always good to see you!  And, yes... I did ask you to come.  With <CHARNAME> and <HISHER> friends, I think you can help me.  Or one of my friends, rather.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 203
END

IF ~~ THEN BEGIN 39 // from:
  SAY #59015 /* ~No one you know of, my dear.  A lass I met in my earlier days, when I happened to find myself in the Outer Planes.  That's a long story I won't get into.~ */
  IF ~~ THEN GOTO 40
END

IF ~~ THEN BEGIN 40 // from: 39.0
  SAY #59019 /* ~She is here in Athkatla, and has herself in a bit of a bind.  She wrote me a letter asking for my help... but you and <CHARNAME> may be able to help more than I.~ */
  IF ~!Global("HaerDalisPlotStarted","GLOBAL",1)
!Global("HaerDalisFree","GLOBAL",2)~ THEN EXTERN ~AERIEJ~ 204
  IF ~OR(2)
Global("HaerDalisPlotStarted","GLOBAL",1)
Global("HaerDalisFree","GLOBAL",2)~ THEN EXTERN ~AERIEJ~ 215
END

IF ~~ THEN BEGIN 41 // from:
  SAY #59025 /* ~There's no rush on such a thing.  If you find the time, her name is Raelis Shai. She can be found at the playhouse beneath the Five Flagons Inn in the Bridge District.~ */
  IF ~~ THEN GOTO 42
END

IF ~~ THEN BEGIN 42 // from: 41.0
  SAY #59026 /* ~If you can't help her... well, then you can't help her.  But Raelis is a dear heart, and it would do an old gnome's heart good if you could try.~ */
  IF ~~ THEN EXTERN ~AERIEJ~ 205
END

IF ~~ THEN BEGIN 43 // from:
  SAY #59028 /* ~I hope so.  It's been good to see you again, dear one.  Be safe.~ */
  IF ~~ THEN DO ~SetGlobal("QuayleJob","GLOBAL",1)
SetGlobalTimer("AerieRemindsRaelis","GLOBAL",TWO_DAYS)~ EXIT
END

IF WEIGHT #1 ~Global("QuayleJob","GLOBAL",1)
!Global("HaerDalisPlotStarted","GLOBAL",1)
!Global("HaerDalisFree","GLOBAL",2)~ THEN BEGIN 44 // from:
  SAY #59029 /* ~I hope you get the time to see Raelis soon.  Like I said, she was an... old friend.  I'm sure you'll do what suits you, though.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #2 ~Global("QuayleJob","GLOBAL",1)
OR(2)
Global("HaerDalisPlotStarted","GLOBAL",1)
Global("HaerDalisFree","GLOBAL",2)
!Dead("Raelis")
Global("QuayleThanks","LOCALS",0)~ THEN BEGIN 45 // from:
  SAY #59030 /* ~You've gone to see Raelis, have you?  Good.  I hope that you were able to be of some help to her.  It would do my heart good to know that she is safe.~ */
  IF ~~ THEN DO ~SetGlobal("QuayleThanks","LOCALS",1)~ EXIT
END

IF WEIGHT #3 ~Global("QuayleJob","GLOBAL",1)
OR(2)
Global("HaerDalisPlotStarted","GLOBAL",1)
Global("HaerDalisFree","GLOBAL",2)
Dead("Raelis")
Global("QuayleThanks","LOCALS",0)~ THEN BEGIN 46 // from:
  SAY #59035 /* ~I heard what happened at the playhouse.  She's dead, isn't she?  Ahhhh, I should have known better than to send someone else.  I'm too old for this... too old...~ */
  IF ~~ THEN DO ~SetGlobal("QuayleThanks","LOCALS",1)~ EXIT
END

IF ~~ THEN BEGIN 47 // from:
  SAY #59412 /* ~You have?  Never mind me, then, my dear... go about your business.  But if you can help Raelis more than you have, it would do my heart good.~ */
  IF ~~ THEN DO ~SetGlobal("QuayleJob","GLOBAL",1)~ EXIT
END

IF WEIGHT #4 ~Global("QuayleRaelis","GLOBAL",1)
See("Aerie")
!Dead("Aerie")~ THEN BEGIN 48 // from:
  SAY #61074 /* ~Ah!  You've come, all of you!  Most excellent!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #16 ~True()~ THEN BEGIN 49 // from:
  SAY #62059 /* ~Greetings, <GABBER>.  I trust all is well?~ */
  IF ~~ THEN EXIT
END
