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

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

IF WEIGHT #0 ~NumberOfTimesTalkedTo(0)
~ THEN BEGIN 0 // from:
  SAY #76937 /* ~... the best of schools...~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #1 ~NumberOfTimesTalkedTo(1)
~ THEN BEGIN 1 // from:
  SAY #76938 /* ~... a storehouse of arcane knowledge...~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #2 ~NumberOfTimesTalkedTo(2)
~ THEN BEGIN 2 // from:
  SAY #76939 /* ~... lost, all lost... a common dungeon, now...~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #6 /* Triggers after states #: 4 5 6 even though they appear after this state */
~True()
~ THEN BEGIN 3 // from:
  SAY #76940 /* ~... we all shall live again... someday...~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #3 ~NumberOfTimesTalkedTo(3)
~ THEN BEGIN 4 // from:
  SAY #76941 /* ~... all for knowledge did we strive... nothing left... Hope would return with the retrieval of the simplest of tomes... beneath the rubble... on the lowest floors... return hope... history is so important...~ */
  IF ~~ THEN UNSOLVED_JOURNAL #76942 /* ~Tomes of magic

Apparently the ghost of Ulcaster himself haunts the ruins of his doomed school.  I don't know what he seeks exactly, but he did mention that simply returning a few tomes would restore some hope to him.  His words seemed to suggest that there are books in the rubble below.  I will keep an eye out for them.~ */ EXIT
END

IF WEIGHT #4 ~PartyHasItem("_BOOK54")
~ THEN BEGIN 5 // from:
  SAY #76943 /* ~... knowledge returns with these simple words on parchment... to teach once more... in a celestial class... I will prevent the same from happening... some day...~ */
  IF ~~ THEN DO ~AddexperienceParty(1000)
TakePartyItem("_BOOK54")
SetGlobal("MACUlcasterJournal","GLOBAL",1)
EraseJournalEntry(76942)
EraseJournalEntry(74891)
EraseJournalEntry(75714)
~ SOLVED_JOURNAL #76946 /* ~Ulcaster's ghost

I retrieved a book from the ruins of the Ulcaster School, and it seemed to restore some clarity to the specter of Ulcaster himself.  He still haunts this place, but he is perhaps a little closer to letting go.~ */ EXIT
  IF ~Global("X#ImoenUlcaster","GLOBAL",0)
InParty("imoen")
InMyArea("imoen")
!StateCheck("imoen",CD_STATE_NOTVALID)
~ THEN DO ~SetGlobal("X#ImoenUlcaster","GLOBAL",1)~ EXTERN ~_IMOEN2~ 223
END

IF WEIGHT #5 ~Dead("doomsayer")
PartyHasItem("_MISC82")
PartyHasItem("_MISC48")
~ THEN BEGIN 6 // from:
  SAY #76940 /* ~... we all shall live again... someday...~ */
  IF ~~ THEN DO ~TakePartyItem("_MISC82")
TakePartyItem("_MISC48")
GiveItemCreate("_SW1H19",LastTalkedToBy,0,0,0)
SetGlobal("MACFirewineKnights","GLOBAL",1)
EraseJournalEntry(77714)
EraseJournalEntry(77643)
EraseJournalEntry(77645)
~ EXIT
END

IF ~~ THEN BEGIN 7 // from:
  SAY #100415 /* ~Farewell...~ */
  IF ~~ THEN DO ~AddexperienceParty(1000)
TakePartyItem("_BOOK54")
SetGlobal("MACUlcasterJournal","GLOBAL",1)
EraseJournalEntry(76942)
EraseJournalEntry(74891)
EraseJournalEntry(75714)
~ SOLVED_JOURNAL #76946 /* ~Ulcaster's ghost

I retrieved a book from the ruins of the Ulcaster School, and it seemed to restore some clarity to the specter of Ulcaster himself.  He still haunts this place, but he is perhaps a little closer to letting go.~ */ EXIT
END
