// creator  : weidu.exe (version 23100)
// argument : MAIRYN.DLG
// game		 : .
// source	 : ./DATA/DIALOG.BIF
// dialog	 : ./DIALOG.TLK
// dialogF  : (none)

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

IF WEIGHT #0 ~Global("IgenPlot","GLOBAL",1)
!GlobalGT("UmarPlot","GLOBAL",0)
!Global("RangerProtector","GLOBAL",6)
Global("MairynFoundPlayer","GLOBAL",0)~ THEN BEGIN 0 // from:
  SAY #38223 /* ~You, there... you are the <PRO_RACE> who has become the ranger for this place?  My name is Mairyn... I am a spirit of this forest, and I am in desperate need of your aid!~ */
  IF ~~ THEN DO ~SetGlobal("MairynFoundPlayer","GLOBAL",1)~ GOTO 1
END

IF ~~ THEN BEGIN 1 // from: 0.0
  SAY #38225 /* ~There are... other humans... in my sacred lands to the north of this place where the temple of the sun god once stood.  They have come recently,  digging and tearing down the trees...~ */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 2 // from: 1.0
  SAY #38226 /* ~I have begged them to stop, good ranger... I have pleaded with them that they are destroying not only I, but many of the other forest spirits as well.  The humans have refused.~ */
  IF ~~ THEN GOTO 3
END

IF ~~ THEN BEGIN 3 // from: 2.0
  SAY #38227 /* ~I implore you... go to the forest in the north and do whatever you can to stop these humans from further desecrating my forest!~ */
  IF ~~ THEN REPLY #38236 /* ~I have no interest in doing this.  Find another to aid you.~ */ GOTO 4
  IF ~~ THEN REPLY #38237 /* ~Who are these people?  Why are they doing this?~ */ GOTO 5
  IF ~~ THEN REPLY #38238 /* ~What kind of reward are you offering for my help?~ */ GOTO 7
  IF ~~ THEN REPLY #38239 /* ~Very well, Mairyn... I will do what I can to help.~ */ GOTO 8
END

IF ~~ THEN BEGIN 4 // from: 6.0 3.0
  SAY #38242 /* ~No interest?  You are a ranger, are you not?  You are a defender of the wild... and I am in desperate need of your assistance.  Will you turn your back on me, ranger?~ */
  IF ~~ THEN REPLY #38243 /* ~I will.  As I said, find another to help you.~ */ GOTO 9
  IF ~~ THEN REPLY #38245 /* ~Perhaps if there was some kind of reward, I might be more inclined to help you out.~ */ GOTO 7
  IF ~~ THEN REPLY #38244 /* ~You are right... I will help you, if I can.~ */ GOTO 8
END

IF ~~ THEN BEGIN 5 // from: 3.1
  SAY #38246 /* ~I know not who these humans are... they claim, however, to be searching for something.  Something I do not know the location of.  They... threatened me, ranger.  I was forced to flee.~ */
  IF ~~ THEN GOTO 6
END

IF ~~ THEN BEGIN 6 // from: 5.0
  SAY #38247 /* ~You must go to them, and seek out the nature of their quest, if you wish.  Whatever you do, however, you must stop them.~ */
  IF ~~ THEN REPLY #38248 /* ~I have no interest in doing this.  Find another to help you.~ */ GOTO 4
  IF ~~ THEN REPLY #38249 /* ~What might the reward be for doing this?~ */ GOTO 7
  IF ~~ THEN REPLY #38250 /* ~Very well... I will go and help you, if I can.~ */ GOTO 8
END

IF ~~ THEN BEGIN 7 // from: 6.1 4.1 3.2
  SAY #38251 /* ~Reward?  You are the first ranger I have heard of who has desired something in compensation for his duty.  I... I have nothing to offer you, ranger, other than my gratitude.~ */
  IF ~~ THEN REPLY #38252 /* ~Then you are on your own.~ */ GOTO 9
  IF ~~ THEN REPLY #38253 /* ~Very well... I will see what I can do.~ */ GOTO 8
END

IF ~~ THEN BEGIN 8 // from: 7.1 6.2 4.2 3.3
  SAY #38254 /* ~I ask nothing more of you.  Go to the forest near here, with the shadowy ruins of human origin... there you will find the humans and their many tools.  Go, I beg you, and stop them.~ */
  IF ~~ THEN GOTO 11
END

IF ~~ THEN BEGIN 9 // from: 27.0 18.1 7.0 4.0
  SAY #38255 /* ~Then you are not worthy of your station.  This village has chosen unwisely in replacing the human who protected here before you.~ */
  IF ~~ THEN GOTO 10
END

IF ~~ THEN BEGIN 10 // from: 9.0
  SAY #38256 /* ~I will tell them of their mistake... and I will deal with the humans in the west as best I can.  Go, unworthy ranger... go and be a simple warrior or mercenary, if you must.  The forest needs not one such as you.~ */
  IF ~~ THEN DO ~SetGlobal("RangerProtector","GLOBAL",6)
ForceSpell(Myself,SWOOSH_GONE)~ SOLVED_JOURNAL #2940 /* ~Ranger-Protector of the Umar Hills

I did not ask for the position of ranger-protector, and after refusing to aid a forest spirit named Mairyn, I was stripped of the task and the cabin both.  So much for the village's gratitude.~ */ EXIT
END

IF ~~ THEN BEGIN 11 // from: 8.0
  SAY #38257 /* ~I shall wait by your cabin for you to bring word of what has occurred.  May Mielikki shine on you, good ranger.~ */
  IF ~~ THEN DO ~SetGlobal("MairynMoves","AR1100",1)
ForceSpell(Myself,SWOOSH_GONE)~ UNSOLVED_JOURNAL #2957 /* ~Ranger-Protector of the Umar Hills

A forest spirit named Mairyn has implored me to aid her against humans who are tearing down her forest in the west, in the area where the Shadow altar once was.  She says the humans will not listen to her and I have agreed to go and do what I can to help.~ */ EXIT
END

IF WEIGHT #3 /* Triggers after states #: 22 35 even though they appear after this state */
~Global("IgenPlot","GLOBAL",1)
InPartySlot(LastTalkedToBy,0)
~ THEN BEGIN 12 // from:
  SAY #38258 /* ~I... I sense that the humans yet continue their desecration of my sacred forest.  What is it, good ranger?  Is there a problem?~ */
  IF ~Global("TalkedToIgen","GLOBAL",1)
~ THEN REPLY #38259 /* ~I talked to the noble, Lord Igen, and he refuses to stop.~ */ GOTO 13
  IF ~Global("IgenJob","GLOBAL",1)
~ THEN REPLY #38260 /* ~I have agreed to find what the noble, Lord Igen, was looking for... but I cannot seem to find it.~ */ GOTO 14
  IF ~~ THEN REPLY #38261 /* ~There is no problem, Mairyn... I will continue trying.~ */ GOTO 17
  IF ~Global("TalkedToIgen","GLOBAL",1)
~ THEN REPLY #38262 /* ~Yes, there is.  I cannot make the Lord stop his search... I can do nothing more to help you.~ */ GOTO 13
  IF ~Global("TalkedToIgen","GLOBAL",0)
~ THEN REPLY #38263 /* ~Yes, there is.  I have changed my mind... I do not have the time to help you.~ */ GOTO 18
END

IF ~~ THEN BEGIN 13 // from: 12.3 12.0
  SAY #38275 /* ~But you must find a way to stop him, ranger... you must!  He cannot continue his actions!  He gives no thought to the consequence of what he does!~ */
  IF ~~ THEN REPLY #38277 /* ~I will not harm him, Mairyn... and I cannot help you.~ */ GOTO 18
  IF ~~ THEN REPLY #38278 /* ~Very well... I will keep on trying.~ */ GOTO 17
END

IF ~~ THEN BEGIN 14 // from: 12.1
  SAY #38279 /* ~What is it that this human Lord seeks?~ */
  IF ~~ THEN REPLY #38280 /* ~He seeks a cache of mithril hidden by an ancestor... but he has only half of the directions to where it lays.~ */ GOTO 15
END

IF ~~ THEN BEGIN 15 // from: 14.0
  SAY #38281 /* ~I do not know where this human might find this mithril.  I truly do not.  I might suggest that you look to the human temple beneath the ground... the place where you, yourself, banished the shadows.~ */
  IF ~~ THEN GOTO 16
END

IF ~~ THEN BEGIN 16 // from: 15.0
  SAY #38284 /* ~Perhaps you might find what you seek there... I cannot say, for certain.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 17 // from: 18.0 13.1 12.2
  SAY #38285 /* ~Mielikki bless you, good ranger... I will continue to wait here.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 18 // from: 13.0 12.4
  SAY #38287 /* ~You do not take your duties very seriously, for a ranger, <PRO_RACE>.  You have sworn to uphold your tenets, have you not?  I implore you to think again, to help one in need that falls under your charge!~ */
  IF ~~ THEN REPLY #38288 /* ~Very well... I will try again.~ */ GOTO 17
  IF ~~ THEN REPLY #38289 /* ~Sorry, but you're on your own, Mairyn.~ */ GOTO 9
END

IF WEIGHT #4 /* Triggers after states #: 22 35 even though they appear after this state */
~!GlobalGT("UmarPlot","GLOBAL",0)
Global("IgenPlot","GLOBAL",2)
InPartySlot(LastTalkedToBy,0)
Dead("rigen01")
Global("GivenIgenReward","GLOBAL",0)~ THEN BEGIN 19 // from:
  SAY #38291 /* ~I already sense that the violation of my forest has ceased, good ranger.  I... I am sorry that it had to come to violence.  You have protected your charge, nevertheless, and I am grateful.~ */
  IF ~~ THEN DO ~SetGlobal("GivenIgenReward","GLOBAL",1)~ GOTO 20
END

IF ~~ THEN BEGIN 20 // from: 21.0 19.0
  SAY #38292 /* ~I will return to my home, now, and thank Mielikki that one who is true to her service has taken up a station here... that justice is upheld in this woodland.  Bless you, good ranger.~ */
  IF ~~ THEN DO ~EraseJournalEntry(2957)
EraseJournalEntry(2965)
EraseJournalEntry(2966)
AddExperienceParty(21500)
SetGlobal("RangerProtector","GLOBAL",2)
SetGlobalTimer("OgronAssault","GLOBAL",FOUR_DAYS)
ForceSpell(Myself,SWOOSH_GONE)
~ SOLVED_JOURNAL #2967 /* ~Ranger-Protector of the Umar Hills

I was able to save the forest of a local spirit named Mairyn from the desecration of a local noble.  As a ranger, the protection of nature and all that lies within it is my provence.~ */ EXIT
END

IF WEIGHT #5 /* Triggers after states #: 22 35 even though they appear after this state */
~!GlobalGT("UmarPlot","GLOBAL",0)
Global("IgenPlot","GLOBAL",2)
InPartySlot(LastTalkedToBy,0)
!Dead("rigen01")
Global("GivenIgenReward","LOCALS",0)~ THEN BEGIN 21 // from:
  SAY #38296 /* ~I already sense that the violation of my forest has ceased, good ranger.  You have chosen your course wisely, and you have protected your charge.  I am most grateful.~ */
  IF ~~ THEN DO ~SetGlobal("GivenIgenReward","LOCALS",1)~ GOTO 20
END

IF WEIGHT #1 ~!InPartySlot(LastTalkedToBy,0)
~ THEN BEGIN 22 // from:
  SAY #38297 /* ~I will speak to the ranger and no other, <RACE>.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #6 /* Triggers after states #: 35 even though they appear after this state */
~Global("RangerProtector","GLOBAL",3)
Global("UmarPlot","GLOBAL",1)
Global("Mairyn3","GLOBAL",0)
InPartySlot(LastTalkedToBy,0)
~ THEN BEGIN 23 // from:
  SAY #38299 /* ~Good ranger... it is I, Mairyn, and once again I must ask you for help.  The witch who has threatened your village... her dark and foul magics have also begun to poison the woodland!  You must do something!~ */
  IF ~Global("Minister3","GLOBAL",0)
~ THEN REPLY #38302 /* ~Threatened the village?  What are you talking about?~ */ DO ~SetGlobal("Mairyn3","GLOBAL",1)
~ GOTO 24
  IF ~Global("Minister3","GLOBAL",0)
~ THEN REPLY #38304 /* ~Sorry, but I have no time to help you.~ */ DO ~SetGlobal("Mairyn3","GLOBAL",1)
~ GOTO 27
  IF ~Global("Minister3","GLOBAL",0)
~ THEN REPLY #38305 /* ~Very well... I will seek her out and stop her.~ */ DO ~SetGlobal("Mairyn3","GLOBAL",1)
~ GOTO 28
  IF ~Global("Minister3","GLOBAL",1)
~ THEN REPLY #38309 /* ~Yes, I already know of her... I will do what I can, Mairyn.~ */ DO ~SetGlobal("Mairyn3","GLOBAL",1)
~ GOTO 28
END

IF ~~ THEN BEGIN 24 // from: 23.0
  SAY #38316 /* ~You do not know?  A witch has come into the area very recently... a human witch... and she has threatened your village with her magic.  Either they leave... or she will kill them.~ */
  IF ~~ THEN GOTO 25
END

IF ~~ THEN BEGIN 25 // from: 24.0
  SAY #38317 /* ~Already she gathers her dark powers in the buried human temple... that place where you destroyed the Shadow Lord.  Her magic seeps into the earth and poisons it with evil.~ */
  IF ~~ THEN GOTO 26
END

IF ~~ THEN BEGIN 26 // from: 25.0
  SAY #38318 /* ~You must stop this creature, good ranger.  Save your village and the forest both.~ */
  IF ~~ THEN REPLY #38319 /* ~Sorry, but I have no time to do this.~ */ GOTO 27
  IF ~Global("Minister3","GLOBAL",0)
~ THEN REPLY #38320 /* ~I must go to Imnesvale and see what has occurred, there.~ */ GOTO 29
  IF ~~ THEN REPLY #38321 /* ~Very well, I will stop this witch, now.~ */ GOTO 28
END

IF ~~ THEN BEGIN 27 // from: 26.0 23.1
  SAY #38322 /* ~You refuse to help me?  And you refuse to aid the village you have been sworn to defend?  How is it that you are a ranger, and yet will turn your back on the helpless?  Would you truly do this?~ */
  IF ~~ THEN REPLY #38323 /* ~Yes, as I said... I have more important things to do.~ */ DO ~EraseJournalEntry(3013)
EraseJournalEntry(3017)
EraseJournalEntry(3024)
EraseJournalEntry(3028)~ GOTO 9
  IF ~Global("Minister3","GLOBAL",0)
~ THEN REPLY #38324 /* ~Very well... I will see what I can do.  But I must go to Imnesvale, first.~ */ GOTO 29
  IF ~~ THEN REPLY #38325 /* ~Very well, I will see what I can do.~ */ GOTO 28
END

IF ~~ THEN BEGIN 28 // from: 27.2 26.2 23.3 23.2
  SAY #38326 /* ~Do so, ranger!  Go into the dungeon below and seek her out.  I will wait here for you.~ */
  IF ~~ THEN UNSOLVED_JOURNAL #3028 /* ~Ranger-Protector of the Umar Hills

Mairyn, the forest spirit, appeared again and told me of the sorceress that has been poisoning her forest with infernal magic.  The sorceress, claiming to be Umar, has set herself up in the now-empty Shadow Portal dungeon.~ */ EXIT
END

IF ~~ THEN BEGIN 29 // from: 27.1 26.1
  SAY #38327 /* ~She lies below, good ranger, and the need is most urgent... but if you must go to your village, first, then do so quickly.  I will wait here for you.~ */
  IF ~~ THEN UNSOLVED_JOURNAL #3028 /* ~Ranger-Protector of the Umar Hills

Mairyn, the forest spirit, appeared again and told me of the sorceress that has been poisoning her forest with infernal magic.  The sorceress, claiming to be Umar, has set herself up in the now-empty Shadow Portal dungeon.~ */ EXIT
END

IF WEIGHT #7 /* Triggers after states #: 35 even though they appear after this state */
~Global("RangerProtector","GLOBAL",3)
Global("UmarPlot","GLOBAL",1)
Global("Mairyn3","GLOBAL",1)
InPartySlot(LastTalkedToBy,0)
~ THEN BEGIN 30 // from:
  SAY #38328 /* ~Please, good ranger!  Do not give up, yet!  This sorceress must be stopped!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #8 /* Triggers after states #: 35 even though they appear after this state */
~Global("UmarPlot","GLOBAL",2)
InPartySlot(LastTalkedToBy,0)
Global("GivenUmarReward","LOCALS",0)~ THEN BEGIN 31 // from:
  SAY #38329 /* ~I sense that the sorceress is dead... the foul presences she has conjured have ceased.  You have done well, good ranger.~ */
  IF ~~ THEN DO ~SetGlobal("RangerProtector","GLOBAL",4)
SetGlobal("GivenUmarReward","LOCALS",1)~ GOTO 32
END

IF ~~ THEN BEGIN 32 // from: 31.0
  SAY #38330 /* ~You have served the natural order with honor and strength, good ranger.  I... I have something to give you.  It is a present from Mielikki, a most rare thing...~ */
  IF ~~ THEN GOTO 33
END

IF ~~ THEN BEGIN 33 // from: 32.0
  SAY #38331 /* ~... an idol of the Moon Dog to help when you struggle.  Take it, <PRO_RACE>, and be thankful that a goddess smiles upon you.~ */
  IF ~!FallenRanger(Player1)~ THEN DO ~EraseJournalEntry(2939)
EraseJournalEntry(3013)
EraseJournalEntry(3017)
EraseJournalEntry(3024)
EraseJournalEntry(3028)
GiveItemCreate("MISC7T",LastTalkedToBy,1,0,0)
AddExperienceParty(26750)
ReputationInc(1)
ForceSpell(Myself,SWOOSH_GONE)~ SOLVED_JOURNAL #3029 /* ~Ranger-Protector of the Umar Hills

I have killed the sorceress who had assumed the name of Umar to scare off the villagers, and Mairyn has granted me a gift from the goddess Mielikki.  The cabin is now mine to use for the remainder of my quest... and I have a feeling things will be more peaceful in the valley for some time to come.~ */ EXIT
  IF ~FallenRanger(Player1)~ THEN DO ~EraseJournalEntry(2939)
EraseJournalEntry(3013)
EraseJournalEntry(3017)
EraseJournalEntry(3024)
EraseJournalEntry(3028)~ SOLVED_JOURNAL #3029 /* ~Ranger-Protector of the Umar Hills

I have killed the sorceress who had assumed the name of Umar to scare off the villagers, and Mairyn has granted me a gift from the goddess Mielikki.  The cabin is now mine to use for the remainder of my quest... and I have a feeling things will be more peaceful in the valley for some time to come.~ */ GOTO 34
END

IF ~~ THEN BEGIN 34 // from: 33.1
  SAY #58656 /* ~I have little doubt that Mielikki shall also forgive you for your trespasses in the past, good ranger.  She restores your status.  Do not squander this second chance.~ */
  IF ~~ THEN DO ~GiveItemCreate("MISC7T",LastTalkedToBy,1,0,0)
ActionOverride(Player1,RegainRangerhood())
ReputationInc(1)
AddExperienceParty(26750)
ForceSpell(Myself,SWOOSH_GONE)~ EXIT
END

IF WEIGHT #2 ~InPartySlot(LastTalkedToBy,0)
Global("RangerProtector","GLOBAL",6)~ THEN BEGIN 35 // from:
  SAY #61596 /* ~Begone, <PRO_RACE>.  You are unworthy of your title.~ */
  IF ~~ THEN DO ~ApplySpell(Myself,SWOOSH_GONE)~ EXIT
END
