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

BEGIN ~IDJINNI~

IF ~NumTimesTalkedTo(0)
~ THEN BEGIN 0 // from:
  SAY #10867 /* ~I am bound. What do -- who are you? Ah, I see... the Master is gone and you've managed to get yourselves in trouble.~ [OGREM01] */
  IF ~~ THEN REPLY #10868 /* ~Who are you that you've been bound in this flask?~ */ DO ~SetGlobal("TalkedToDjinni","AR0601",1)
~ GOTO 1
  IF ~~ THEN REPLY #10869 /* ~I'm not sure that I understand what is going on here. Did you come out of this bottle?~ */ DO ~SetGlobal("TalkedToDjinni","AR0601",1)
~ GOTO 14
  IF ~~ THEN REPLY #10870 /* ~You would be the proverbial djinni in a bottle?~ */ DO ~SetGlobal("TalkedToDjinni","AR0601",1)
~ GOTO 3
END

IF ~~ THEN BEGIN 1 // from: 0.0
  SAY #10873 /* ~Enslaved would be a more accurate word. I was captured in my home, on this Plane of Air, by some wizard. He bound me to this flask that I might guard his things -- and something of yours.~ */
  IF ~~ THEN REPLY #10883 /* ~You have something that belongs to me?~ */ GOTO 4
  IF ~~ THEN REPLY #10885 /* ~It is not my concern. Give me what you have.~ */ GOTO 15
  IF ~~ THEN REPLY #10886 /* ~I've no time to spare talking to you. I must find away out of this madman's dungeon.~ */ GOTO 6
END

IF ~~ THEN BEGIN 2 // from: 14.0
  SAY #10890 /* ~I am a djinni and I have been bound by a wizard to guard his items, and your item it seems. I can sense your touch upon this weapon.~ */
  IF ~~ THEN REPLY #10891 /* ~You have something that belongs to me?~ */ GOTO 4
  IF ~~ THEN REPLY #10892 /* ~It is not my concern. Give me what you have.~ */ GOTO 15
  IF ~~ THEN REPLY #10893 /* ~I've no time to spare talking to you. I must find away out of this madman's dungeon.~ */ GOTO 6
END

IF ~~ THEN BEGIN 3 // from: 0.2
  SAY #10894 /* ~That I would, manling. I assume that, now that you have escaped, you have come seeking the magical item that has been stripped from you by our collective captor?~ */
  IF ~~ THEN REPLY #10900 /* ~You have an item of mine?~ */ GOTO 4
  IF ~~ THEN REPLY #10902 /* ~If you have something that I own, give it to me immediately.~ */ GOTO 15
  IF ~~ THEN REPLY #10903 /* ~I regret that I have no more time to speak with you. I must get back to escaping this madman's dungeon.~ */ GOTO 6
END

IF ~~ THEN BEGIN 4 // from: 3.0 2.0 1.0
  SAY #10906 /* ~I do. A thing of power that still carries a hint of your essence. There is something odd about the signature that you leave on this item. No matter.~ */
  IF ~~ THEN REPLY #10908 /* ~Can you give it to me?~ */ GOTO 15
  IF ~~ THEN REPLY #10978 /* ~I regret that I have no more time to speak with you. I must get back to escaping this madman's dungeon.~ */ GOTO 6
END

IF ~~ THEN BEGIN 5 // from: 15.0
  SAY #10912 /* ~If you can secure the means of my release, I will give you your weapon.~ */
  IF ~~ THEN REPLY #10913 /* ~That sounds like a fair trade. How do I secure the means of your release?~ */ GOTO 16
  IF ~~ THEN REPLY #10924 /* ~Why should I deal with you when I can merely kill you?~ */ GOTO 17
  IF ~~ THEN REPLY #10927 /* ~I will think about it.~ */ GOTO 9
END

IF ~~ THEN BEGIN 6 // from: 4.1 3.2 2.2 1.2
  SAY #10948 /* ~Not so quickly. I have a powerful item that belongs to you. A thing that was stripped from you by our collective captor.~ */
  IF ~~ THEN GOTO 15
END

IF ~~ THEN BEGIN 7 // from: 16.0
  SAY #10982 /* ~You must find the original flask and bring it back to me. Once it is within my grasp, I can break the enchantment and be freed.~ */
  IF ~~ THEN REPLY #10989 /* ~That sounds like more trouble than it's worth. I don't think that I'm interested.~ */ GOTO 9
  IF ~~ THEN REPLY #10993 /* ~Why should I deal with you when I can merely kill you?~ */ GOTO 17
  IF ~~ THEN REPLY #10994 /* ~Where can I find this flask?~ */ GOTO 18
END

IF ~~ THEN BEGIN 8 // from: 17.0
  SAY #10995 /* ~You must help me. There is no other way for you to obtain your magical weapon.~ */
  IF ~~ THEN REPLY #10998 /* ~Very well, I shall help you. What do I need to do?~ */ GOTO 16
  IF ~~ THEN REPLY #10999 /* ~That sounds like more trouble than it's worth. I don't think that I'm interested.~ */ GOTO 9
END

IF ~~ THEN BEGIN 9 // from: 11.1 8.1 7.0 5.2
  SAY #11001 /* ~In your place, I would not be so quick to give up such powerful equipment. Free me, I beg you, and I shall give this thing back to you.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 10 // from: 18.0
  SAY #11002 /* ~I cannot pinpoint its location from another Plane. You shall have to search for it. Return to me when you have found it and we shall exchange my freedom for your weapon.~ */
  IF ~~ THEN DO ~SetGlobal("HelpDjinni","GLOBAL",1)
~ UNSOLVED_JOURNAL #34099 /* ~Freeing the djinn.

To retrieve what is in possession of the djinn Malaaq, I must first secure his release by obtaining the twin to the flask he is bound to.  He informed me that the flask is kept close to his master... either in his chambers or in the possession of some dryads or golems.~ */ EXIT
END

IF ~Global("TalkedToDjinni","AR0601",1)
Global("HelpDjinni","GLOBAL",0)
~ THEN BEGIN 11 // from:
  SAY #11004 /* ~Will you now help me to be free in exchange for your magical weapon?~ */
  IF ~~ THEN REPLY #11008 /* ~Yes, I am willing to make a deal.~ */ GOTO 16
  IF ~~ THEN REPLY #11010 /* ~I will think about it.~ */ GOTO 9
END

IF ~PartyHasItem("misc4d")~ THEN BEGIN 12 // from:
  SAY #11012 /* ~I sense that you have the flask. Let us make the exchange.~ */
  IF ~~ THEN DO ~EraseJournalEntry(34099)
EraseJournalEntry(47514)
AddExperienceParty(15000)
GivePartyAllEquipment()
TakePartyItem("misc4d")
~ SOLVED_JOURNAL #47515 /* ~Freeing the djinn.

I freed the genie Malaaq by retrieving a flask from three dryads and giving it to him.  In return, he returned some equipment that he was keeping in storage for the wizard, Irenicus.~ */ GOTO 19
END

IF ~~ THEN BEGIN 13 // from: 19.0
  SAY #11013 /* ~He will torture you for escaping and kill you for freeing his djinni slave. Escape from his lair quickly if you value your life. Farewell!~ */
  IF ~~ THEN DO ~SetGlobal("HelpDjinni","GLOBAL",2)
PlaySound("EFF_M01")
CreateVisualEffectObject("SPPLANAR",Myself)
Wait(2)
PlaySound("EFF_M38")
DestroySelf()
~ EXIT
END

IF ~~ THEN BEGIN 14 // from: 0.1
  SAY #19798 /* ~It is no wonder that the master was able to take you so easily despite all of your magical equipment. Even for a fleshling you don't catch on very quickly.~ */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 15 // from: 6.0 4.0 3.1 2.1 1.1
  SAY #19801 /* ~If I had the power to give you your weapon, I would, but the force that binds me is strong. As long as I am trapped within this flask, I am within the mage's power.~ */
  IF ~~ THEN GOTO 5
END

IF ~~ THEN BEGIN 16 // from: 11.0 8.0 5.0
  SAY #19894 /* ~This flask that I am bound in is a creation of magic. It is unbreakable as long as it remains apart from its twin, the real flask.~ */
  IF ~~ THEN GOTO 7
END

IF ~~ THEN BEGIN 17 // from: 7.1 5.1
  SAY #19916 /* ~You are welcome to try. While I am bound, neither myself nor the flask can be damaged. While I am bound, I cannot give you your weapon.~ */
  IF ~~ THEN GOTO 8
END

IF ~~ THEN BEGIN 18 // from: 7.2
  SAY #19926 /* ~He will keep the flask close to himself. The master would not risk it falling into other hands. Perhaps he keeps it in his chambers, or with his dryad concubines. Perhaps the golems have it.~ */
  IF ~~ THEN GOTO 10
END

IF ~~ THEN BEGIN 19 // from: 12.0
  SAY #19930 /* ~At last! I am free! Here is your item, fleshling. You are an honorable person and I feel that I must warn you. Keep away from the master!~ */
  IF ~~ THEN GOTO 13
END

IF ~Global("TalkedToDjinni","AR0601",1)~ THEN BEGIN 20 // from:
  SAY #44816 /* ~Please find the flask that is the twin to the one in which I am bound. Do this for me and I shall give you a weapon of power.~ */
  IF ~~ THEN EXIT
END
