//Changing Duke Elatn's Block 7

ADD_TRANS_TRIGGER ~DELTAN~ 7 ~OR(2) GlobalLT("X#KagainCW","GLOBAL",5) GlobalGT("X#KagainCW","GLOBAL",7)~

EXTEND_BOTTOM DELTAN 7
IF ~PartyHasItem("SCRL3C") OR(3) Global("X#KagainCW","GLOBAL",5) Global("X#KagainCW","GLOBAL",6) Global("X#KagainCW","GLOBAL",7)
~ THEN REPLY ~We didn't find any incriminating evidence, but we did learn that the leaders of the Iron Throne are in Candlekeep.~ /* #74482 */ GOTO 10Mine
  IF ~Global("SearchIronThrone","GLOBAL",1) OR(3) Global("X#KagainCW","GLOBAL",5) Global("X#KagainCW","GLOBAL",6) Global("X#KagainCW","GLOBAL",7)
~ THEN REPLY ~We know that any incriminating evidence would be found with Reiltar, the overall leader of the Iron Throne in Baldur's Gate.  He's currently supposed to be at Candlekeep on some sort of business.~ /* #74484 */ GOTO 10Mine
IF ~OR(3) Global("X#KagainCW","GLOBAL",5) Global("X#KagainCW","GLOBAL",6) Global("X#KagainCW","GLOBAL",7)~ THEN REPLY ~We didn't learn anything.~ /* #74480 */ GOTO 8
IF ~OR(3) Global("X#KagainCW","GLOBAL",5) Global("X#KagainCW","GLOBAL",6) Global("X#KagainCW","GLOBAL",7)~ THEN REPLY ~We came here to tell you that we no longer wish to work for you.~ /* #74481 */ GOTO 5
IF ~OR(3) Global("X#KagainCW","GLOBAL",5) Global("X#KagainCW","GLOBAL",6) Global("X#KagainCW","GLOBAL",7)~ THEN REPLY ~We have a few more things to do in the city.  Once we're finished, we'll come back and finish things up with the Iron Throne.~ /* #74485 */ EXIT
END

APPEND DELTAN

IF ~~ 10Mine
SAY ~Then proof is still wanting. Tell me, <CHARNAME>, what makes you *so* certain that the masters of the Iron Throne are the culprits we seek?~
++ ~Why, at every step our quest has led to a new level of villainy. The despoiler of the Nashkel mines pointed to the caravan bandits. At the bandit camp, we learned they reported to the master of the Cloakwood iron mine. At the mines, we found these orders for the master from Rieltar, the leader of the Iron Throne here in the city.~
DO ~SetGlobal("X#KagainCW","GLOBAL",8)~ + 10Mine1
END

IF ~~ 10Mine1
SAY ~I…beg your pardon. Did you just say 'Cloakwood iron mine'? ~
++ ~Er…yes.~  + 10Mine2
END

IF ~~ 10Mine2
SAY ~I was unaware that any such establishment currently exists. What iron mine, precisely, do you speak of?~
++ ~Well, the Iron Throne had drained the old Orothiar clan mines and were planning to sell the iron produced there at a vast profit in the midst of the shortage they had caused between the Nashkel mine and the iron bandits.~ + 10Mine3
END

IF ~~ 10Mine3
SAY ~Indeed? Then that is the most ruthless corner in a commodity market that *I* have ever heard of. Tell me, <CHARNAME>, if you had such vital information for the safety, nay for the bare survival, of the city, why did you not come forward with it at once?~
++ ~As strangers here, it has taken us some time to determine whom we might trust. Also, as liberators of this mine, we feel entitled to claim it as our property. ~ + 10Mine4
END

IF ~~ 10Mine4
SAY ~Titles by right of 'conquest' are not well regarded here. You had no warrant, save your own will, for your deeds so, even if matters are exactly as you described them, you are in no better a legal position than a brigand claiming ownership of stolen property because you seized it from the corpse of another brigand, whom you had slain, rather than directly from the lawful owner. You may think yourselves fortunate not to be indicted as co-conspirators in the ongoing iron shortage.~
= ~Still, you have, however unwittingly, brought this matter to my attention. Rest assured that the mine will be secured by the government of Baldur's Gate and any iron produced will be used for the public safety. As for your own case, the Iron Throne could hardly be made a defendant in a mere civil suit for damages based on your conjectures and such "evidence" as, for all I or any man knows, you may have forged yourself.~
IF ~~ THEN DO ~AddexperienceParty(500) ~GOTO 10
END
END

//Changing Scar's conversation after doing Seven Suns:
ADD_STATE_TRIGGER ~SCAR~ 8 ~OR(2) GlobalLT("X#KagainCW","GLOBAL",5) GlobalGT("X#KagainCW","GLOBAL",6)~ 14

CHAIN IF ~OR(2) Global("ScarMission","GLOBAL",1) Global("ScarMission","GLOBAL",2)!Dead("jhasso") Global("X#KagainCW","GLOBAL",6)~ THEN SCAR ScarJhassoTalk
~Jhasso, my friend!~
END 
IF ~~ THEN DO ~CreateCreature("JHASSO",[-1.-1],0)~ + JhassoTalkScar

CHAIN SCAR JhassoTalkScar
~How are you?~
== JHASSO ~Better than I would have dared hope, even an hour ago. These young heroes you sent to rescue me… ~
== SCAR ~Will be well rewarded! They have done more that I could have hoped.~
== JHASSO ~They have done more than you have even dreamed, old friend. They tell me that they have discovered an iron mine, operating secretly in the Cloakwoods and allegedly an appendage of the Iron Throne.~
== SCAR ~What?!? An iron mine? A *working* iron mine? Is this true, <CHARNAME>?~
END
++ ~Yes, it is.~  DO ~SetGlobal("X#KagainCW","GLOBAL",7) ActionOverride("jhasso",EscapeArea())~ EXTERN SCAR ScarMineTalk1

CHAIN SCAR ScarMineTalk1
~Then the Duke must be informed immediately!~
== KAGAIJ IF ~InParty("kagain")~ THEN ~Uh-oh. We're onna slippery slope here, <CHARNAME>.~
== SCAR ~But before you go see the Duke, you will need to fill me in on how matters are in Seven Suns.~
END
IF ~Global("ScarMission","GLOBAL",1)~ THEN DO ~AddexperienceParty(500)~ GOTO ScarMine8
IF ~Global("ScarMission","GLOBAL",2)~ THEN DO ~AddexperienceParty(500)~ GOTO ScarMine14

CHAIN SCAR NoJhassoMine
~If I can fit it into my duties, I will do all I can.~
END
++ ~You see, we discovered that the Iron Throne was operating a secret iron mine in the Cloakwood Forest. We have eliminated their agents there and…thought…to claim its ownership. Can you help us?~ EXTERN SCAR ScarMineTalk1

EXTEND_BOTTOM SCAR 8 14
+ ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING) Global("X#KagainCW","GLOBAL",5)~+ ~Well, there is one thing you might help us with.~ EXTERN SCAR NoJhassoMine
END

APPEND SCAR

IF ~~ ScarMine8
SAY ~So what news do you bring me?~
  IF ~~ THEN REPLY ~We didn't learn anything, sorry.  Do you have anything else for us to do?~ GOTO 9
  IF ~Global("CheckedSevenSuns","GLOBAL",2)
~ THEN REPLY~According to one of the merchants we met, the Seven Suns has been infiltrated by some sort of shapeshifter.  I don't know what kind of monsters they are, but the merchants are fearful.~ GOTO 10
  IF ~GlobalGT("KilledDopple","GLOBAL",4)
~ THEN REPLY ~Dopplegangers had taken over many of the higher echelons in the coster.  The monsters are all dead now, slain by us.~ GOTO 13
  IF ~~ THEN REPLY ~We haven't found anything yet, but we want to keep on searching.~ EXIT
END

IF ~~ ScarMine14
  SAY ~How did your battle fare?~
  IF ~~ THEN REPLY ~We don't think we would be able to defeat all of the dopplegangers.~ GOTO 15
  IF ~Global("KilledDopple","GLOBAL",5)
!Dead("jhasso")
~ THEN REPLY ~The dopplegangers are all dead; Jhasso is back in control of the business.~ GOTO 16
  IF ~Global("KilledDopple","GLOBAL",5)
Dead("jhasso")
~ THEN REPLY ~We killed all the dopplegangers, but we weren't able to save Jhasso.~ GOTO 17
END

END

EXTEND_BOTTOM JHASSO 6
IF ~GlobalLT("X#KagainCW","GLOBAL",5)~ THEN DO ~EscapeArea()
~ JOURNAL ~We've learned from Jhasso that a group of shapeshifting creatures has taken over the Seven Suns consortium.~ /* #80656 */ EXIT
+~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING) Global("X#KagainCW","GLOBAL",5)~+ ~*Kagain clears his throat to remind you that Jhasso looks like an important merchant here, who could help you with taking posession of the Cloackwood Mines. All things considered, you do not think it's the best time to deal with that issue.~ DO ~EscapeArea()
~ JOURNAL ~We've learned from Jhasso that a group of shapeshifting creatures has taken over the Seven Suns consortium.~ /* #80656 */ EXIT
+ ~Global("X#KagainCW","GLOBAL",5)~+ ~Wait! You are an important merchant here. I trust you because your gratitude seems sincere so I would make you a business offer if you would hear me out.~ EXTERN JHASSO JHKAMI
END

APPEND JHASSO

IF ~~  JHKAMI
SAY ~I am afraid, considering the shambles of my coster at the moment, that it will be some time before I can undertake any fresh activity.~
++ ~This is different! The Iron Throne was operating a secret iron mine in the Cloakwood Forest. We found it, eliminated their agents and intend to claim its ownership. Can you help us?~ + JHKAMI1.1
END

IF ~~ JHKAMI1.1
SAY ~This is tremendous news! Far bigger and more important than the Seven Suns would have aspired to in its palmiest day. If what you say is even remotely true, we must go see my friend, Scar, at once.~
++ ~All right!~ DO ~
SetGlobal("X#KagainCW","GLOBAL",6)
ActionOverride(Player1,LeaveAreaLUAPanic("AR7607","",[1515.1000],12))
ActionOverride(Player1,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride(Player2,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride(Player3,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride(Player4,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride(Player5,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride(Player6,LeaveAreaLUA("AR7607","",[1515.1000],12))
ActionOverride("jhasso",EscapeArea())
~ SOLVED_JOURNAL ~We've learned from Jhasso that a group of shapeshifting creatures has taken over the Seven Suns consortium.~
EXIT

END
END

//Intejection to kick off the quest in CW mines

I_C_T2 SLAVE4 0 X#KagainSlaveForge
== ~KAGAIJ~ IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Humans ain't no miners anyhow and these is so weak, they can't lift no picks much less strike a vein with 'em. Need dwarves here. Then you'd see some minin' bein' done!~
END

I_C_T2 _LAVLEAD 2 X#KagainRill
== ~KAGAIJ~ IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Easy now, <CHARNAME>! Why waste good money here? We've kilt half the guards already and are like to get most of the rest afore we're done. What, then, is this scarecrow excuse for a miner gonna need protectin' from, I ask ya?~
== LAVLEAD IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Why...from the floodwaters. If the guards are still keeping the miners at their stations, they'll all drown together.~
== ~KAGAIJ~ IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Pfeh! Time we're done here, any guards left will be bribin' *us* to let 'em live! For sure, they won't have no time to worry 'bout you lot, so you'll be safe enough - if your safety's worth thinkin' about, much less payin' gold over.~
== LAVLEAD IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~How can you be so cruel?!? Free the mines only to drown the slaves that mined them?~
== ~KAGAIJ~ IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Did *I* say anything 'bout drownin' anybody? No. <CHARNAME> and us'll be the masters here then. No need to be hasty on that account.~
== LAVLEAD IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~But then...the Iron Throne will return! They... ~
== ~KAGAIJ~ IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN ~Iron Throne nothin'! This place won't be no secret anymore, see? They can't come *back* here 'thout admittin' they set up the whole deal in the first place. No. They ain't got the chops for top place on the Public Enemies list so they'll stay right clear of here from now on.~
END

EXTEND_BOTTOM MINEC2 10
IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN  EXTERN ~KAGAIJ~ KagainMineQuest
END

CHAIN KAGAIJ KagainMineSpeech
~Cause the cursed mine is worth ten times your cursed hides, ten times over.~
== LAVFREE ~What?!? You would place profit ahead of obliterating the memory of so much suffering?~
== KAGAIJ ~I would. I think them dukes of the Gate would too, strapped for iron as they are. ~
== LAVFREE ~ Strapped for iron...? I don't understand... ~
== KAGAIJ ~ Ah, you fellas wouldn't of got much news here, I dassay. No matter. You just trot off into the woods 'n' get et by the beasties. Save me 'n' <CHARNAME> the trouble of payin' ya afore we gets our claim to this mine free and clear. ~
== LAVFREE ~Ah...beasties?~
== KAGAIJ ~Spiders, mostly. Nasty way they got o' doin' a fella; their poison knocks a body down but not out. Guess they likes watchin' the expression on the faces as they sucks the guts out.~
== LAVFREE ~Umm...and this...hypothetical rate of pay...~
== KAGAIJ ~Six silver per ton, for ore. Twenty-five if ya remember to refine it. And there's supplies enough for six months at least. ~
== LAVFREE ~But...what assurance do we have that you would return...and pay us...release us, I mean. ~
== KAGAIJ ~ Well, *someone* will be along. This place is valuable, I tell ya. Won't be no Iron Throne no more either. But you run along. You look like you'd do better as an eight-leg's dinner than a miner anyway. ~
== LAVFREE ~ Excuse me, please. I must catch up to my fellows...consult with them.~
END
IF ~~ THEN DO ~ActionOverride("X#LAVEFREE",DestroySelf())~ EXTERN KAGAIJ KagainMineSpeech1

APPEND KAGAIJ

IF ~~ KagainMineQuest
SAY ~Hold hard, <CHARNAME>! Ya think what yer about doin'? Yer about to drown the only working iron mine on the Sword Coast!~
++ ~What about Nashkel?~ DO ~SetGlobal("X#KagainCW","GLOBAL",1)~ + KAMINE1.1
END

IF ~~ KAMINE1.1
SAY ~Pfah! Call that workin'? Half the miners be dead and ALL the ore they've got in stock is spoilt. And, lest ya've forgot, that's in AMN! Think the dukes of Baldur's Gate might be a wee bit cross with ya, they hear what ya done to *their* mine?~
++ ~And what if the Iron Throne comes to reclaim their property? ~ + KAMINE1.2
END

IF ~~ KAMINE1.2
SAY ~They won't. 'Twas only an advantage to 'em, when it was *secret*. They try to come back *now* 'n' they'll just be provin' all the charges we'll be makin' against 'em and have to beat all the power of Baldur's Gate to get it, too. ~
++ ~What if they don't think quite as clearly as you do? Or if they have a greater commitment to meaningless revenge?~ + KAMINE1.3
END

IF ~~ KagainFlood
SAY ~Idjit!!! ~
IF ~~ THEN DO ~StartMovie("INEFLOD")
SetGlobal("FLOODED","GLOBAL",1) SetGlobal("X#KagainCW","GLOBAL",2)
ActionOverride(Player1,LeaveAreaLUAPanic("FW8600","",[3099.718],12))
ActionOverride(Player1,LeaveAreaLUA("AR8600","",[3099.718],12))
ActionOverride(Player2,LeaveAreaLUA("AR8600","",[3088.686],12))
ActionOverride(Player3,LeaveAreaLUA("AR8600","",[3087.649],12))
ActionOverride(Player4,LeaveAreaLUA("AR8600","",[3090.588],12))
ActionOverride(Player5,LeaveAreaLUA("AR8600","",[2998.680],12))
ActionOverride(Player6,LeaveAreaLUA("AR8600","",[2936.699],12))
~ SOLVED_JOURNAL ~I have flooded the mines of Cloakwood, killing anyone who remained in its depths.  My party and I barely escaped the onrushing waters, but now that we're safe, I am comfortable in the knowledge that I have dealt a great blow to the Iron Throne.~ EXIT
END

IF ~~  KagainNoFlood
SAY ~Nah. Since ya raised the point, I don't hold with no slavery. Miners mine. 'Tis a waste of coin to pay guards to force 'em to their proper jobs. 'Specially when they's so many toothy critters outside to guard against. So gather your chums, laddie-boy, and get back t' yer work. Ya'll be safer here'n onna road and, we gets back, ya won't lose by it. ~
IF ~~ THEN DO ~StartMovie("DUNGEON")
SetGlobal("FLOODED","GLOBAL",1) SetGlobal("X#KagainCW","GLOBAL",3)
ActionOverride(Player1,LeaveAreaLUAPanic("AR8600","",[3099.718],12))
ActionOverride(Player1,LeaveAreaLUA("AR8600","",[3099.718],12))
ActionOverride(Player2,LeaveAreaLUA("AR8600","",[3088.686],12))
ActionOverride(Player3,LeaveAreaLUA("AR8600","",[3087.649],12))
ActionOverride(Player4,LeaveAreaLUA("AR8600","",[3090.588],12))
ActionOverride(Player5,LeaveAreaLUA("AR8600","",[2998.680],12))
ActionOverride(Player6,LeaveAreaLUA("AR8600","",[2936.699],12))
~ SOLVED_JOURNAL ~Kagain suggested that we take ownership of the Cloackwood Mine from the Iron Throne. I guess it's one way to deal them a blow, and perhaps even a profitable way for a change. We need to discuss it further.~ EXIT
END

IF ~~ KagainMineMess
SAY ~Pfah! A right mess you've made of this, <CHARNAME>!~
++ ~It had to be done. We can't risk the Iron Throne keeping such an asset as this.~ + KAMAME1
END

IF ~~ KAMAME1
SAY ~Ah, well. I knows where this is now. Them Thrones could dry it out once, I figure someone else could again in future. C'mon, let's get goin'; see if we got a future so's we can think 'bout projects like this here by-and-bye.~
IF ~~ THEN EXIT
END

IF ~~ KagainMineSpeech1
SAY ~Ah, <CHARNAME>, <CHARNAME>. We got us an iron mine! We gotta get us t' th' Gate, pronto! This is gonna make us *RICH*!~
++ ~What about the slaves? And the Black Talons we've set loose? ~ + KAMISP1.2
++ ~A little high-handed with them, weren't you? ~ + KAMISP1.3
++ ~There must be…formalities. How do you propose we deal with them? ~ + KAMISP1.4
++ ~Forget it, Kagain. I'm not going to waste my time grubbing after coins when there is a life-or-death quest to finish. ~ + KAMISP1.5
++ ~Do you really think all that double-talk will retain our labor force here?~ + KAMISP1.15
END

IF ~~ KAMISP1.2
SAY ~They'll set here for a bit mebbe. Til stores run low. Better workin' here 'n gettin' et by critters along th' walk out. By then, we get this thing set up right, won't matter if they's happy or even alive. With a bit of luck, they'll get together a first ore shipment afore they falls out; help us defray th' start-up costs, while the market's still as hot as it is.~
++ ~Start-up costs? More late news there. ~ + KAMISP1.4
++ ~I don't know. Abandoning all those poor miners with those…villains…as their only protection… ~ + KAMISP1.6
++ ~I just don't have the time - or taste - for this, Kagain. ~ + KAMISP1.5
END

IF ~~ KAMISP1.3
SAY ~Best I could do on short notice. Didn't hear *you* chirp up with no bright ideas neither. Ah, it'll hold 'em.~
IF ~~ THEN GOTO KAMISP1.2
END

IF ~~ KAMISP1.4
SAY ~The absolute *first* thing we gotta do is get our ownership registered. Considerin' what we're layin' claim to, that won't be easy nor cheap.~
++ ~Tell me more about this. ~ + KAMISP1.7
++ ~Too much of a sideshow for me. My only interest is ending the threat of the Iron Throne. ~ + KAMISP1.5
END

IF ~~ KAMISP1.5
SAY ~Yer kiddin' me!?! Ain'tcha?~
++ ~ No. Foiling the Iron Throne is going to take all my time and attention. ~ + KAMISP1.8
++ ~I guess I am sort of curious. I'll hear you out at least. ~ + KAMISP1.7
END

IF ~~ KAMISP1.6
SAY ~As opposed to what? Turn 'em all loose t' starve or get et by beasties? If they got the good sense, cooperate here, they'll do fine. If they ain't, their loss won't trouble *my* conscience any.~
IF ~~ THEN GOTO KAMISP1.7
END

IF ~~ KAMISP1.7
SAY ~I ain't wholly for certain, understand. I can see need for a little investment capital, a useful contact or two, mebbe some dwarves hereabouts that'd make proper miners. But I knows to assurety that we'll need an "in" with the powers-that-be. Elsewise, some rich mucky-muck'll snatch away our mine and thank us kindly if we're lucky. That's where you come in, <CHARNAME>.~
++ ~Me? I've no training as a merchant and none in high society either. ~ + KAMISP1.9
++ ~Ah, I was sure you had *some* reason for including me in your largesse. Say on, oh sage dwarf. ~ + KAMISP1.10
++ ~ What?!? I will *not* let my good name be sullied by this…this grab for wealth through others' pain and misfortune. ~ + KAMISP1.8
END

IF ~~ KAMISP1.8
SAY ~Hmph. Had me fooled proper then. Never took ya for a complete idiot til now. But for droppin' this splendid chance my way, if you're at the Gate in a twelvemonth and want a grand reception, just ya come visit Lord Kagain in his mansion, okay?~
IF ~~ THEN DO ~LeaveParty() EscapeArea() SetGlobal("X#KagainCW","GLOBAL",4)~
EXIT
END 

IF ~~ KAMISP1.9
SAY ~No matter. Ya take rich enough, the nobs'll adjust to your ways, whatever they be.~
IF ~~ THEN GOTO KAMISP1.10
END

IF ~~ KAMISP1.10
SAY ~Ya see now, <CHARNAME>. Yer name be the one that's linked to *our* doin's of late. With some justice, mind. I won't hear elsewise. The point be, though, that *you* are somebody now. One who's done a sight of good by Baldur's Gate. So the big deals there, dukes and them, they can't fob you off and rob you blind, once they hears you got this here mine in yer pocket. They'll have ter make nice to ya, see? ~
++ ~And what about the mercantile houses? They won't feel bound by the dukes' attitude will they? ~ + KAMISP1.11
++ ~Yes. For instance, Yeslick's clan isn't extinct. They'll come calling for sure. ~ + KAMISP1.12
++ ~It would seem I'd just be making more of target for myself for the convenience of the Iron Throne. ~ + KAMISP1.13
++ ~No! This mine belongs to the city of Baldur's Gate in their hour of dire need. Besides, whatever we do, they'll take it from us. May as well gain such credit as we can by handing it over voluntarily.~ + KAMISP1.14
END

IF ~~ KAMISP1.11
SAY ~Oh, there'll be outsiders enough that wanna become insiders. But I'm around to guide you through that so no worries there.~
IF ~~ THEN DO ~SetGlobal("X#KagainCW","GLOBAL",5) AddXPObject("kagain",500)~EXIT
END

IF ~~ KAMISP1.12
SAY ~Hah! I wisht all our difficulties t' be so easy solved. *That* lot abandoned claim back after the first flood. They been ignoring themselves for ninety year; we can ignore 'em a bit longer still. ~
IF ~~ THEN DO ~SetGlobal("X#KagainCW","GLOBAL",5) AddXPObject("kagain",500)~EXIT
END

IF ~~ KAMISP1.13
SAY ~Ye'll be that anyways, them knowin' all about ya. May as well take such profit as ya can if ya live to take any.~
IF ~~ THEN DO ~SetGlobal("X#KagainCW","GLOBAL",5) AddXPObject("kagain",500)~EXIT
END

IF ~~ KAMISP1.14
SAY ~Hmm. Gold *is* power. Turnin' influence into gold ain't so simple. But ya *do* gotta point there, 'bout what they'll try and do to us in any case. Anyways we gotta be there, fore anything can happen for good nor ill, so let's start walkin'.~
IF ~~ THEN DO ~SetGlobal("X#KagainCW","GLOBAL",5) AddexperienceParty(1500)~EXIT
END

IF ~~ KAMISP1.15
SAY ~Who knows? Or cares? In the long run, I mean. These broke-down bags o' bones all gotta be replaced anyway, get production anywhere nigh to what it should be. I just thought a couple tons of bar iron, if it could be had, was a nice way to defray current expenses.~
++ ~Current expenses? You mean the miners' pay?~ + KAMISP1.16
++ ~A little high-handed with them, weren't you? ~ + KAMISP1.3
++ ~There must be…formalities. How do you propose we deal with them? ~ + KAMISP1.4
++ ~Forget it, Kagain. I'm not going to waste my time grubbing after coins when there is a life-or-death quest to finish. ~ + KAMISP1.5
END

IF ~~ KAMISP1.16
SAY ~Hoi! I'm forgettin'. You got brung up in a bookstall, don't know nothin' 'bout business. We gotta get our claim to this place pushed through fast - and that's gonna cost, ya know. ~
++ ~Hmph! If they're anything like you, I just hope they don't hit us on the head before they steal it from us. ~ + KAMISP1.17
++ ~It would seem I'd just be making more of target for myself for the convenience of the Iron Throne. ~ + KAMISP1.13
++ ~No! This mine belongs to the city of Baldur's Gate in their hour of dire need. Besides, whatever we do, they'll take it from us. May as well gain such credit as we can by handing it over voluntarily.~ + KAMISP1.14
END

IF ~~ KAMISP1.17
SAY ~Keep your tin hat on, then, and let's go see. Nothin' to lose, have we? ~
IF ~~ THEN DO ~SetGlobal("X#KagainCW","GLOBAL",5) AddXPObject("kagain",500)~EXIT
END

IF ~~ KagainMineFinal
SAY ~Ah, let's beat it, <CHARNAME>. Only thing to do here is split this numpate between the ears and that wouldn't help our claim none.~
IF ~~ THEN DO ~ForceSpellRES("x#wish05",Player1) SetGlobal("X#KagainCW","GLOBAL",9)~ EXIT
END

END

CHAIN KAGAIJ KAMINE1.3
~ Pfui! We beat 'em twice now already and look like havin' a third go, whether we would or not. May as well tuck this here mine onto our side of the ledger whilst we're whackin' on 'em.~
== MINEC2 ~But…the suffering here! The degradation…the slavery! ~
== KAGAIJ ~Who askt you?!? ~
== FALDOJ IF ~InParty("faldorn") !Dead("faldorn")~ THEN ~Grr! I came here to do but one thing, and a dwarf's greed will not stop me!~
END
+~OR(2) !InParty("faldorn") Dead("faldorn")~+ ~He's right, Kagain. There's too much misery stored here to preserver this place. Pull the plug.~ GOTO KagainFlood
+~OR(2) !InParty("faldorn") Dead("faldorn")~+ ~Easy now, slave. My friend here sounds like he's about to make some sense. I want to hear him out.~ DO ~AddXPObject("kagain",1000)~ GOTO KagainNoFlood
+~InParty("faldorn") !Dead("faldorn")~ + ~*You can but watch as Faldorn pulls the plug, scowling ferally. Then you have no time to watch, as the low growl of furious waters echoes that of the druid. RUN!*~ DO ~AddXPObject("faldorn",500)~ GOTO KagainFlood

REPLACE_STATE_TRIGGER NARRAT 0 ~!Global("X#KagainCW","GLOBAL",3)~

APPEND NARRAT
IF ~Global("X#KagainCW","GLOBAL",3)~THEN BEGIN 1
  SAY ~You decided not to flood the Cloakwood mines.  Instead, you agreed to listen out Kagain's offer to appropriate the mines from the Iron Throne.~
  IF ~~ THEN DO ~DestroySelf() SetGlobal("FLOODED","GLOBAL",2)
~ EXIT
END
END

ADD_STATE_TRIGGER LAVFREE 0 ~!Global("X#KagainCW","GLOBAL",3)~ 1

EXTEND_BOTTOM LAVFREE 1
IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING) Global("X#KagainCW","GLOBAL",2)~ THEN  EXTERN ~KAGAIJ~ KagainMineMess
END

APPEND LAVFREE

IF ~Global("X#KagainCW","GLOBAL",3)
~ THEN BEGIN 2
  SAY ~My fellows have fled to Baldur's Gate. I stayed behind to thank you for our freedom but I am at a loss to know why you did not destroy this cursed mine when you could.~
   IF ~~ THEN DO ~AddexperienceParty(1500)~ EXTERN KAGAIJ KagainMineSpeech
END

END

ADD_STATE_TRIGGER LAVTELL 0 ~GlobalLT("X#KagainCW","GLOBAL",5)~ 1

APPEND LAVTELL

IF ~GlobalGT("X#KagainCW","GLOBAL",4) GlobalLT("X#KagainCW","GLOBAL",8)
~ THEN BEGIN 2
  SAY ~Eh? Peace be on ye but one o' the fellers jammed the lift. I be workin' to get her to fall gentle but takes time, takes time. Don't ye worry none. Some o' the boys heard yer speech. We'll be back to work with all speed - soon's we get down again.~
   IF ~~ THEN EXIT
END

IF ~Global("X#KagainCW","GLOBAL",8)~ THEN BEGIN 3
SAY ~Us small folk betta keep outta troubles when lords quarrel.~
IF ~~ THEN DO ~DestroySelf() CreateCreature("X#ELHOS",[-1.-1],3)~ EXIT
END
END

BEGIN X#ELHOS

APPEND X#ELHOS

IF ~NumberOfTimesTalkedTo(0)~ ElhosSpeech
SAY ~Why...it is the discoverers of our little establishment here. How delightful. How may I assist you?~
++ ~Oh, we just wanted to see how things were going.~ + ELSP1
++ ~ We...uh...dropped something when we were here...very valuable. We'd like to retrieve it.~ + ELSP2
++ ~We wanted to see how you are doing with *our* mine.~+ ELSP3
END

IF ~~ ELSP1
SAY ~As well as could be expected, judging from my situation reports. Certainly nothing amiss that would require your attention - in the midst of all your proper duties to Baldur's Gate. So, if you'll excuse me? ~
IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN EXTERN KAGAIJ KagainMineFinal
IF ~OR(3)!InParty("kagain") Dead("kagain") StateCheck("kagain",STATE_SLEEPING)~ THEN EXIT
END

IF ~~ ELSP2
SAY ~Oh dear! Well, *all* valuables have been removed to the Department of Public Salvage back at Balur's Gate, so I fear you have had your journey for nothing. Simply apply to Duke Silvershield and I'm sure you will have no difficulty in recovering your property. Good day. ~
IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN EXTERN KAGAIJ KagainMineFinal
IF ~OR(3)!InParty("kagain") Dead("kagain") StateCheck("kagain",STATE_SLEEPING)~ THEN EXIT
END

IF ~~ ELSP3
SAY ~The *ducal* mine is operating satisfactorily, thank you very much. And - what of the tensions with Amn - production is, at present, a state secret so I am very afraid that *no* unauthorized person is allowed admittance. Not even your worthy self, good <CHARNAME>. ~
IF ~InParty("kagain") !Dead("kagain") !StateCheck("kagain",STATE_SLEEPING)~ THEN EXTERN KAGAIJ KagainMineFinal
IF ~OR(3)!InParty("kagain") Dead("kagain") StateCheck("kagain",STATE_SLEEPING)~ THEN EXIT
END

END





