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

BEGIN ~UDVITH~

IF ~NumTimesTalkedTo(0)~ THEN BEGIN 0 // from:
  SAY #50356 /* ~Ahh, thank you for releasing me. I was sure my destiny was to end imprisoned here forever. I've never been more glad to be wrong.~ [VITHAL02] */
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",1)
~ THEN GOTO 1
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",0)
~ THEN GOTO 2
END

IF ~~ THEN BEGIN 1 // from: 0.0
  SAY #50358 /* ~Strange that my saviors are Drow in nature. I mean no disrespect to your culture, but you are not known for your kindness to strangers.~ */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 2 // from: 1.0 0.1
  SAY #50359 /* ~I am indebted to you. Perhaps we might be of use to each other. I had great plans before I was so rudely interrupted.~ */
  IF ~~ THEN REPLY #50360 /* ~Who were you battling here?~ */ GOTO 3
  IF ~~ THEN REPLY #50361 /* ~You must be looking for valuable treasure if you are willing to risk coming here.~ */ GOTO 6
  IF ~~ THEN REPLY #50362 /* ~I am part of those plans whether you like it or not. That is my price for your rescue.~ */ GOTO 7
END

IF ~~ THEN BEGIN 3 // from: 2.0
  SAY #50368 /* ~I am unsure of that myself, though I imagine that I simply insulted a local resident with my ignorance of custom. The value of my goal may have blinded me.~ */
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",1)
~ THEN GOTO 4
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",0)
~ THEN GOTO 5
END

IF ~~ THEN BEGIN 4 // from: 8.0 7.0 6.0 3.0
  SAY #50369 /* ~It may have been one of your Drow kin, I am sad to say, but I assure you that I meant no offense.~ */
  IF ~~ THEN GOTO 5
END

IF ~~ THEN BEGIN 5 // from: 8.1 7.1 6.1 4.0 3.1
  SAY #50370 /* ~Regardless, I must continue what I have begun, and would do so with your help... if you are willing.~ */
  IF ~~ THEN REPLY #50375 /* ~I will consider it.~ */ GOTO 9
  IF ~~ THEN REPLY #50376 /* ~I doubt I will have time for this.~ */ GOTO 9
END

IF ~~ THEN BEGIN 6 // from: 2.1
  SAY #50371 /* ~Indeed I am, and my goal may have blinded me to local custom. I fear I do not even know who it was that I angered, but their fury was great indeed.~ */
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",1)
~ THEN GOTO 4
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",0)
~ THEN GOTO 5
END

IF ~~ THEN BEGIN 7 // from: 2.2
  SAY #50372 /* ~I suppose that is fair. I have already angered someone in blind pursuit of my goal, and I do not wish it to happen again.~ */
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",1)
~ THEN GOTO 4
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",0)
~ THEN GOTO 5
END

IF ~~ THEN BEGIN 8 // from:
  SAY #50373 /* ~Are you? That is refreshing. I have already angered someone with the blind pursuit of my goal, I would not wish it to happen again.~ */
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",1)
~ THEN GOTO 4
  IF ~Global("PlayerLooksLikeDrow","GLOBAL",0)
~ THEN GOTO 5
END

IF ~~ THEN BEGIN 9 // from: 5.1 5.0
  SAY #50377 /* ~Hear me out, and I am sure I will entice you. The prize is wealthy, but the finding is tricky.~ */
  IF ~~ THEN GOTO 10
END

IF ~~ THEN BEGIN 10 // from: 9.0
  SAY #50379 /* ~This spot is 'thin,' and careful spells may breach the walls between dimensions. On the other side one might find some valuable magic, if one knows where to look.~ */
  IF ~~ THEN GOTO 11
END

IF ~~ THEN BEGIN 11 // from: 10.0
  SAY #50380 /* ~If you could aid me a bit I would be forever grateful. There will be items enough for us both.~ */
  IF ~~ THEN REPLY #50381 /* ~What is required of me?~ */ GOTO 12
  IF ~~ THEN REPLY #50382 /* ~I suppose I am to be your enforcer? Someone to take the punishment?~ */ GOTO 12
  IF ~~ THEN REPLY #50383 /* ~You are sketchy in your details. I do not trust you.~ */ GOTO 12
END

IF ~~ THEN BEGIN 12 // from: 11.2 11.1 11.0
  SAY #50385 /* ~I cannot lie; there will be combat. I thought I was prepared for such but my failure has obviously proved me wrong.~ */
  IF ~~ THEN GOTO 13
END

IF ~~ THEN BEGIN 13 // from: 12.0
  SAY #50387 /* ~With your aid things should go smoother... though your first duties would be less dangerous by far. A few errands...~ */
  IF ~~ THEN REPLY #50388 /* ~I am no errand <GIRLBOY>.~ */ GOTO 14
  IF ~~ THEN REPLY #50389 /* ~I am no stranger to mundane tasks.~ */ GOTO 14
  IF ~~ THEN REPLY #50390 /* ~This is quickly sounding like it is beneath me.~ */ GOTO 14
END

IF ~~ THEN BEGIN 14 // from: 13.2 13.1 13.0
  SAY #50391 /* ~I apologize if I have suggested anything that would demean you, but the greatest plans have simple flaws.~ */
  IF ~~ THEN GOTO 15
END

IF ~~ THEN BEGIN 15 // from: 14.0
  SAY #50393 /* ~I can stay here and begin preparatory spells, but I cannot cast the actual dimension-breaching spells without the procedures outlined in my book of rituals.~ */
  IF ~~ THEN GOTO 16
END

IF ~~ THEN BEGIN 16 // from: 15.0
  SAY #50394 /* ~I imagine it was taken after I was imprisoned. There were svirfneblin observing my conflict: perhaps they took it. I cannot blame them. I am sure I appeared quite permanently lost.~ */
  IF ~~ THEN REPLY #50396 /* ~I will fetch your book of rituals for you then. Where might they have taken it?~ */ GOTO 18
  IF ~~ THEN REPLY #50397 /* ~So I will be your lackey while you 'prepare' here? Menial duty.~ */ GOTO 17
  IF ~~ THEN REPLY #50398 /* ~I have no interest in helping you.~ */ GOTO 17
  IF ~~ THEN REPLY #50404 /* ~Could you not do this yourself? It sounds simple enough.~ */ GOTO 17
END

IF ~~ THEN BEGIN 17 // from: 16.3 16.2 16.1
  SAY #50402 /* ~My recent experience has made me nervous about traveling around here on my own, for obvious reasons. I will be here whether you agree to help or not.~ */
  IF ~~ THEN GOTO 18
END

IF ~~ THEN BEGIN 18 // from: 17.0 16.0
  SAY #50405 /* ~I believe there is a svirfneblin village to the north. They may have taken my gear there. If you go, tell them they may keep everything but the book.~ */
  IF ~~ THEN GOTO 19
END

IF ~~ THEN BEGIN 19 // from: 18.0
  SAY #50406 /* ~Thank you if you can do anything. I will be at the earth elemental portal 'softening' the area with minor spells.~ */
  IF ~~ THEN DO ~SetGlobal("TalkedToVithal","GLOBAL",1)
EraseJournalEntry(57518)
DialogueInterrupt(FALSE)
MoveToPointNoInterrupt([2377.3316])
DialogueInterrupt(TRUE)~ UNSOLVED_JOURNAL #57533 /* ~A Mage's Proposal.

I released Vithal from magical imprisonment. He was trying to find a secret treasure trove in another dimension. I have to find his book of rituals, which he thinks was taken by svirfneblin. The dark gnome village is to the north.~ */ EXIT
END

IF ~NumTimesTalkedToGT(0)
GlobalLT("dwVithal","GLOBAL",1)~ THEN BEGIN 20 // from:
  SAY #50407 /* ~You have returned. My work goes well, though there is only so much I can do without your help.~ [VITHAL07] */
  IF ~Global("WaitingForRitual","GLOBAL",0)
~ THEN REPLY #50409 /* ~Where did you think your book of rituals was taken?~ */ GOTO 21
  IF ~Global("WaitingForRitual","GLOBAL",0)~ THEN REPLY #50410 /* ~I tire of being your errand <GIRLBOY>. This isn't worth it.~ */ GOTO 22
  IF ~Global("WaitingForRitual","GLOBAL",0)~ THEN REPLY #50411 /* ~Sorry to bother. I'll be back when I have your book.~ */ GOTO 23
  IF ~Global("WaitingForRitual","GLOBAL",0)
PartyHasItem("miscA3")~ THEN REPLY #50413 /* ~I have found your book of rituals. Here, have it back.~ */ DO ~TakePartyItem("miscA3")
EraseJournalEntry(57533)
EraseJournalEntry(57851)
EraseJournalEntry(57854)
EraseJournalEntry(57856)~ GOTO 27
  IF ~Global("WaitingForRitual","GLOBAL",0)
PartyHasItem("miscA3")~ THEN REPLY #50415 /* ~What's to stop me from using your book to do the rituals myself?~ */ DO ~EraseJournalEntry(57533)
EraseJournalEntry(57851)
EraseJournalEntry(57854)
EraseJournalEntry(57856)~ GOTO 24
  IF ~Global("WaitingForRitual","GLOBAL",1)
~ THEN REPLY #50453 /* ~I'm ready now. Perform your ritual and let us challenge this guardian.~ */ DO ~SetGlobal("WaitingForRitual","GLOBAL",0)
~ GOTO 29
  IF ~Global("WaitingForRitual","GLOBAL",1)
~ THEN REPLY #50454 /* ~I am not ready to face the guardian yet.~ */ GOTO 33
END

IF ~~ THEN BEGIN 21 // from: 20.0
  SAY #50408 /* ~There was a svirfneblin village to the north. The deep gnomes may have taken it there. They may keep the rest of my gear, but I must have the book.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 22 // from: 20.1
  SAY #50418 /* ~It will be worth it in the end, I promise. I would not venture into this place if I did not think it warranted the risk. If you can help, please do.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 23 // from: 20.2
  SAY #50419 /* ~Thank you for you help in this matter. I will see that you get a reward for your efforts.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 24 // from: 20.4
  SAY #50420 /* ~I understand your reasoning, but it is for naught. I have already memorized the necessary spells back at my laboratory. The book you have contains the rituals to complete them, not the entire spells.~ */
  IF ~~ THEN GOTO 25
END

IF ~~ THEN BEGIN 25 // from: 24.0
  SAY #50423 /* ~You see, I anticipated something like this. I have made myself indispensable to the project. I will compensate you fairly, I assure you. ~ */
  IF ~~ THEN REPLY #50425 /* ~Fine then, here is your book.~ */ DO ~TakePartyItem("miscA3")~ GOTO 27
  IF ~~ THEN REPLY #50426 /* ~Still not good enough. I'm not handing it over.~ */ GOTO 26
END

IF ~~ THEN BEGIN 26 // from: 25.1
  SAY #50427 /* ~Then we are at an impasse that can only be solved with violence. I am sorry that it came to this yet again. Raise your weapons, I have no choice!~ */
  IF ~~ THEN DO ~Enemy()~ EXIT
END

IF ~~ THEN BEGIN 27 // from: 25.0 20.3
  SAY #50428 /* ~Thank you. This will prove a profitable venture yet, I assure you. Now, to the dangerous bit. There will be three gates I must enter.~ */
  IF ~~ THEN GOTO 28
END

IF ~~ THEN BEGIN 28 // from: 27.0
  SAY #50429 /* ~There will be a guardian in each, and it will not be pleased to see us. I will lure each one through in turn. Be ready with your defenses.~ */
  IF ~~ THEN REPLY #50430 /* ~I am ready. Perform your ritual.~ */ GOTO 29
  IF ~~ THEN REPLY #50431 /* ~A guardian? What kind of guardian? Whose treasure is this that you seek?~ */ GOTO 30
  IF ~~ THEN REPLY #50432 /* ~I knew it. Now we get to throw ourselves at some creature while you relax.~ */ GOTO 30
END

IF ~~ THEN BEGIN 29 // from: 32.0 31.0 28.0 20.5
  SAY #50434 /* ~Very well. Let the walls between dimensions yield to me! Let the ether be made solid, that a mortal man may pass!~ */
  IF ~~ THEN DO ~StartCutSceneMode()
StartCutScene("Cut44b")
EraseJournalEntry(57534)
~ EXIT
END

IF ~~ THEN BEGIN 30 // from: 28.2 28.1
  SAY #50435 /* ~I do not know the nature of the guardians, nor who placed them there. I imagine the place was a safehold of a mage from ancient times, but I cannot be sure..~ */
  IF ~~ THEN GOTO 31
END

IF ~~ THEN BEGIN 31 // from: 30.0
  SAY #50437 /* ~Curiosity has driven me crazy to find out what is there. I regret placing you in harm's way, but I cannot fight the creature while maintaining the spell. I will pay you well with a share of what I find, I assure you.~ */
  IF ~~ THEN REPLY #50439 /* ~Then perform your rituals, I am ready!~ */ GOTO 29
  IF ~~ THEN REPLY #50440 /* ~This is more than I bargained for. Are you certain the creature is beatable?~ */ GOTO 32
END

IF ~~ THEN BEGIN 32 // from: 31.1
  SAY #50446 /* ~Do you require time to prepare?~ */
  IF ~~ THEN REPLY #50447 /* ~No, I am ready now. Perform your ritual.~ */ GOTO 29
  IF ~~ THEN REPLY #50448 /* ~I am not ready yet.~ */ GOTO 33
END

IF ~~ THEN BEGIN 33 // from: 32.1 20.6
  SAY #50450 /* ~Then I will wait. Let me know when I should proceed.~ */
  IF ~~ THEN DO ~SetGlobal("WaitingForRitual","GLOBAL",1)
~ UNSOLVED_JOURNAL #57534 /* ~A Mage's Proposal.

I have returned Vithal's book of rituals. He is ready to attempt opening gates to other planes in search of some valuable items. I will dispatch any guardians that might appear.~ */ EXIT
END

IF ~Global("dwVithal","GLOBAL",2)~ THEN BEGIN 34 // from:
  SAY #50455 /* ~Well done! Now the way is clear for the first gate. We are close to our goal. Wish me luck.~ [VITHAL08] */
  IF ~~ THEN DO ~ForceSpell(Myself,FLASHY_2)
SetGlobal("dwVithal","GLOBAL",3)
SetGlobalTimer("dwVith,"GLOBAL",20)
CreateVisualEffectObject("SPPLANAR","udvith")
Deactivate(Myself)~ EXIT
END

IF ~Global("dwVithal","GLOBAL",5)~ THEN BEGIN 35 // from:
  SAY #50456 /* ~Well, that was unpleasant. I cannot survive on the other side very long, which is appropriate, I suppose.~ [VITHAL09] */
  IF ~~ THEN GOTO 36
END

IF ~~ THEN BEGIN 36 // from: 35.0
  SAY #50457 /* ~I have acquired some of the trove, but more awaits. Come to the fire gate.~ */
  IF ~~ THEN DO ~SetGlobal("dwVithal","GLOBAL",10)
DialogueInterrupt(FALSE)
MoveToPointNoInterrupt([2618.2968])
DialogueInterrupt(TRUE)~ EXIT
END

IF ~Global("dwVithal","GLOBAL",10)~ THEN BEGIN 37 // from:
  SAY #50458 /* ~Here is the second part of the journey. I will enter the plane of fire and return... if I am able. Again, I ask for your well wishes. Be wary. Another Guardian may protect this portal as well.~ [VITHAL10] */
  IF ~~ THEN DO ~ForceSpell(Myself,FLASHY_2)
Wait(1)
SetGlobal("dwVithal","GLOBAL",11)
CreateVisualEffect("SPPORTAL",[2732.2991])
CreateVisualEffect("SPFLSRIN",[2732.2991])
Wait(1)
CreateCreature("udeldf",[2732.2991],4)~ EXIT
END

IF ~Global("dwVithal","GLOBAL",14)
Global("firegate","LOCALS",0)~ THEN BEGIN 38 // from:
  SAY #50459 /* ~Another portion of the prize is ours. Come now, to the air elemental gate.~ [VITHAL11] */
  IF ~~ THEN DO ~SetGlobal("firegate","LOCALS",1)
DialogueInterrupt(FALSE)
MoveToPointNoInterrupt([959.2848])
DialogueInterrupt(TRUE)~ EXIT
END

IF ~Global("dwVithal","GLOBAL",14)~ THEN BEGIN 39 // from:
  SAY #50460 /* ~One more trip and we shall have all there is to have. A pity I could not have known the mage that secreted these things away. They would have made a powerful friend.~ [VITHAL12] */
  IF ~~ THEN GOTO 40
END

IF ~~ THEN BEGIN 40 // from: 39.0
  SAY #50461 /* ~Again I ask for your well wishes as I pass beyond. Again you must face a guardian first.~ */
  IF ~~ THEN DO ~ForceSpell(Myself,FLASHY_2)
Wait(1)
SetGlobal("dwVithal","GLOBAL",15)
CreateVisualEffect("SPPORTAL",[845.2896])
CreateVisualEffect("SPFLSRIN",[845.2896])
Wait(1)
CreateCreature("udelda",[845.2896],4)~ EXIT
END

IF ~Global("dwVithal","GLOBAL",18)~ THEN BEGIN 41 // from:
  SAY #50462 /* ~I return! Ahh, it's good to have the Prime Material under my feet. There is beauty on the other side, but it is not my home.~ [VITHAL13] */
  IF ~~ THEN DO ~SetGlobal("airgate","LOCALS",1)~ GOTO 42
END

IF ~~ THEN BEGIN 42 // from: 41.0
  SAY #50463 /* ~And you, my friend, my helpful stranger, I am true to my word. You shall receive your due, just as I have promised.~ */
  IF ~~ THEN DO ~GiveItem("rods01",LastTalkedToBy)
SetGlobal("udMind","GLOBAL",41)
AddXPObject(Player1,20000)
AddXPObject(Player2,20000)
AddXPObject(Player3,20000)
AddXPObject(Player4,20000)
AddXPObject(Player5,20000)
AddXPObject(Player6,20000)
~ GOTO 43
END

IF ~~ THEN BEGIN 43 // from: 42.0
  SAY #50464 /* ~There, I trust you will be satisfied with this potent item. I have only taken a brief look at it, but I am sure it is worth the pains we took. A small portion of the whole amount, but worthy of your service.~ */
  IF ~~ THEN REPLY #50465 /* ~I thank you. I'm sure that this enchanted rod is sufficient payment.~ */ FLAGS 128 GOTO 44
  IF ~~ THEN REPLY #50466 /* ~Hmm, perhaps my portion is a bit too small. I would ask that you reconsider.~ */ GOTO 45
  IF ~~ THEN REPLY #50467 /* ~That's it? Some simple rod? After the risk I took?~ */ GOTO 45
END

IF ~~ THEN BEGIN 44 // from: 48.0 47.0 43.0
  SAY #50468 /* ~It will serve you well, of that I am sure. Farewell, my friend, and take care in your journey.~ */
  IF ~~ THEN DO ~EraseJournalEntry(57533)
EraseJournalEntry(57534)
EraseJournalEntry(57851)
EraseJournalEntry(57854)
EraseJournalEntry(57856)
ForceSpell(Myself,SWOOSH_GONE)~ SOLVED_JOURNAL #57535 /* ~A Mage's Proposal.

I helped Vithal retrieve some valuable magic items from another plane. I received my fair share in the end.~ */ EXIT
END

IF ~~ THEN BEGIN 45 // from: 43.2 43.1
  SAY #50469 /* ~I believe that I took the majority of the risk in this instance. I was the one that traversed the planes, you know.~ */
  IF ~~ THEN GOTO 46
END

IF ~~ THEN BEGIN 46 // from: 45.0
  SAY #50470 /* ~Still, if you are so insistent I suppose that I could up your reward a bit more, though I reserve the right to take the majority for myself.~ */
  IF ~~ THEN DO ~GiveItem("scrl8z",LastTalkedToBy)
GiveItem("scrl9g",LastTalkedToBy)~ GOTO 47
END

IF ~~ THEN BEGIN 47 // from: 46.0
  SAY #50471 /* ~There, a couple of the spell scrolls that were there. That must suffice, as I will give no more.~ */
  IF ~~ THEN REPLY #50472 /* ~That is sufficient. I thank you for your generosity.~ */ GOTO 44
  IF ~~ THEN REPLY #50473 /* ~That is still not enough. I must ask for more.~ */ GOTO 48
  IF ~~ THEN REPLY #50474 /* ~I think I deserve it all. Hand it over or I will be forced to take it from you.~ */ GOTO 49
END

IF ~~ THEN BEGIN 48 // from: 47.1
  SAY #50475 /* ~And I must refuse your request. I have been more than reasonable, and yet you demand more. What I have given will suffice or we will face each other in battle.~ */
  IF ~~ THEN REPLY #50478 /* ~It is enough.~ */ GOTO 44
  IF ~~ THEN REPLY #50479 /* ~I deserve it all! Hand it over!~ */ GOTO 49
END

IF ~~ THEN BEGIN 49 // from: 48.1 47.2
  SAY #50476 /* ~I expected as much from a stranger in the Underdark. Very well, let us raise our weapons and spells and settle our feud. I regret it has come to this.~ */
  IF ~~ THEN DO ~EraseJournalEntry(57533)
EraseJournalEntry(57534)
EraseJournalEntry(57851)
EraseJournalEntry(57854)
EraseJournalEntry(57856)
Enemy()~ SOLVED_JOURNAL #57536 /* ~A Mage's Proposal.

I helped Vithal retrieve the items he sought. He tried to give me a small portion, but I demanded more. In the end I got what I deserved.~ */ EXIT
END

IF ~Global("dwVithal","GLOBAL",12)~ THEN BEGIN 50 // from:
  SAY #51733 /* ~Now I shall enter the fire portal.~ [VITHAL14] */
  IF ~~ THEN DO ~ForceSpell(Myself,FLASHY_2)
SetGlobal("dwVithal","GLOBAL",13)
SetGlobalTimer("dwVith,"GLOBAL",20)
CreateVisualEffectObject("SPPLANAR","udvith")
Deactivate(Myself)~ EXIT
END

IF ~Global("dwvithal","GLOBAL",16)~ THEN BEGIN 51 // from:
  SAY #51735 /* ~Now I shall enter the air portal.~ [VITHAL15] */
  IF ~~ THEN DO ~ForceSpell(Myself,FLASHY_2)
SetGlobal("dwVithal","GLOBAL",17)
SetGlobalTimer("dwVith,"GLOBAL",20)
CreateVisualEffectObject("SPPLANAR","udvith")
Deactivate(Myself)~ EXIT
END
