// creator  : weidu.exe (version 23600)
// argument : PHEIRK.DLG
// game     : .
// source   : ./override/PHEIRK.DLG
// dialog   : lang\en_us/dialog.tlk
// dialogF  : (none)

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

IF WEIGHT #0 ~  Global("StartedPheirkasQuest","GLOBAL",0)
!InParty([0.0.0.THIEF_ALL])
~ THEN BEGIN 0 // from:
  SAY #15107 /* ~Hmm, I prefer not to work with amateurs.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #1 ~  Global("StartedPheirkasQuest","GLOBAL",0)
~ THEN BEGIN 1 // from:
  SAY #15108 /* ~There's a fat man by the name of Algernon staying at Feldepost's Inn in Beregost. He keeps a cloak with him in his room and I need you to get your larcenous hands on it and bring it back to me. I assure you that your reward will be handsome. Try not to kill him, just filch it off his person.~ */
  IF ~~ THEN DO ~SetGlobal("StartedPheirkasQuest","GLOBAL",1)
~ UNSOLVED_JOURNAL #27360 /* ~Algernon's Cloak
The dwarf Pheirkas wants me to steal a cloak from an obese man named Algernon, who I can find at Feldepost's Inn in Beregost. Pheirkas awaits his cloak in the northwest section of Baldur's Gate.~ */ EXIT
  IF ~Global("X#PHEIRK1","GLOBAL",0)
InParty("coran")
InMyArea("coran")
!StateCheck("coran",CD_STATE_NOTVALID)
~ THEN DO ~SetGlobal("X#PHEIRK1","GLOBAL",1)~ GOTO 7
  IF ~Global("X#PHEIRK1","GLOBAL",0)
InParty("coran")
InMyArea("coran")
!StateCheck("coran",CD_STATE_NOTVALID)
~ THEN DO ~SetGlobal("X#PHEIRK1","GLOBAL",1)~ EXTERN ~CORANJ~ 294
  IF ~Global("X#PHEIRK1","GLOBAL",0)
InParty("ajantis")
InMyArea("ajantis")
!StateCheck("ajantis",CD_STATE_NOTVALID)
~ THEN DO ~SetGlobal("X#PHEIRK1","GLOBAL",1)~ EXTERN ~AJANTJ~ 247
END

IF WEIGHT #5 /* Triggers after states #: 3 4 5 even though they appear after this state */
~  Global("StartedPheirkasQuest","GLOBAL",1)
Global("HelpPheirkas","GLOBAL",0)
~ THEN BEGIN 2 // from:
  SAY #15109 /* ~Do you have Algernon's cloak with you?~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #2 ~  ReactionLT(LastTalkedToBy,FRIENDLY_LOWER)
PartyHasItem("CLCK08")
~ THEN BEGIN 3 // from:
  SAY #15110 /* ~Ah, thank you so much. Here is 150 gold pieces for your efforts.~ */
  IF ~~ THEN DO ~EraseJournalEntry(27360)
SetGlobal("HelpPheirkas","GLOBAL",1)
TakePartyItem("CLCK08")
AddexperienceParty(200)
GiveGoldForce(150)
~ SOLVED_JOURNAL #27361 /* ~Algernon's Cloak
Pheirkas paid me well for my larceny.~ */ EXIT
END

IF WEIGHT #3 ~  ReactionGT(LastTalkedToBy,NEUTRAL_UPPER)
PartyHasItem("CLCK08")
~ THEN BEGIN 4 // from:
  SAY #15111 /* ~Oh, I do like your handiwork. Here is 200 gold pieces for the trouble.~ */
  IF ~~ THEN DO ~EraseJournalEntry(27360)
SetGlobal("HelpPheirkas","GLOBAL",1)
TakePartyItem("CLCK08")
AddexperienceParty(300)
GivePartyGold(200)
~ SOLVED_JOURNAL #27361 /* ~Algernon's Cloak
Pheirkas paid me well for my larceny.~ */ EXIT
END

IF WEIGHT #4 ~  False()
~ THEN BEGIN 5 // from:
  SAY #15112 /* ~Damn, I was hoping you were more the passive-aggressive type.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #6 ~  True()
~ THEN BEGIN 6 // from:
  SAY #15113 /* ~How do you like my new cloak?~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 7 // from: 1.1
  SAY #49856 /* ~If I like your work, and you do it fast, there'd be 200 gold in it fer you.~ */
  IF ~~ THEN DO ~SetGlobal("StartedPheirkasQuest","GLOBAL",1)
~ UNSOLVED_JOURNAL #27360 /* ~Algernon's Cloak
The dwarf Pheirkas wants me to steal a cloak from an obese man named Algernon, who I can find at Feldepost's Inn in Beregost. Pheirkas awaits his cloak in the northwest section of Baldur's Gate.~ */ EXIT
END

IF ~~ THEN BEGIN 8 // from:
  SAY #49856 /* ~If I like your work, and you do it fast, there'd be 200 gold in it fer you.~ */
  IF ~~ THEN DO ~SetGlobal("StartedPheirkasQuest","GLOBAL",1)
~ UNSOLVED_JOURNAL #27360 /* ~Algernon's Cloak
The dwarf Pheirkas wants me to steal a cloak from an obese man named Algernon, who I can find at Feldepost's Inn in Beregost. Pheirkas awaits his cloak in the northwest section of Baldur's Gate.~ */ EXIT
END

IF ~~ THEN BEGIN 9 // from:
  SAY #49856 /* ~If I like your work, and you do it fast, there'd be 200 gold in it fer you.~ */
  IF ~~ THEN DO ~SetGlobal("StartedPheirkasQuest","GLOBAL",1)
~ UNSOLVED_JOURNAL #27360 /* ~Algernon's Cloak
The dwarf Pheirkas wants me to steal a cloak from an obese man named Algernon, who I can find at Feldepost's Inn in Beregost. Pheirkas awaits his cloak in the northwest section of Baldur's Gate.~ */ EXIT
END
