// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(109,0) == 0;
	question = "special";
	text1 = "You enter the Eastern Gallery, the second largest cavern in Avernum. It stretches many miles to the west, though most of it is occupied with an enormous, subterranean ocean.";
	text2 = "This is the front of Avernum's war with the Slith Horde. The invaders are currently kept bottled up by Fort Duvno, to the north.";
	text3 = "All Avernum lives in fear of what would happen if the slithzerikai broke through. If they managed to seize the bridge behind you, they would be a short march from the heart of Avernum. The horde needs to be held here.";
	text4 = "There are two major cities in the Eastern Gallery: Silvar, to the east, and Cotra, to the northwest.";
	text5 = "You can hear Silvar from here, a constant hive of activity. You can see, dimly, Cotra in the distance. It looks very quiet, and few lights are shining.";
	action = SET_SDF 109 0 1;


begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This soldier stands guard at the gate. He holds a huge, nasty lizard at the end of a long chain. He can't talk. He's too busy concentrating on controlling the lizard.";

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There is a small force of Avernite soldiers stationed here, guarding the bridge. And, if necessary, destroying it. It's a grim duty, and they are happy to welcome visitors.";
	text2 = "You spend some time with them, breaking bread and trading stories. They've seen a lot of action. Slithzerikai raids are common. In the end, once you have rested, you rise and move on.";

begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The lizard sniffs at you and lets out a long, suspicious hiss.";

begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Silvar - East";
	text3 = "  Cotra, Fort Dranlon - Northwest";
	text4 = "  Fort Duvno - North";
	text5 = "  Mertis, Tower Colony, Great Cave - South";


// Sergeant Olalla

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "You stand at the gate leading to the Eastern Gallery, the primary battleground against the Slith Horde. There is a sergeant peering out at you through the window. She looks like she is barely seventeen, if that.";
	text2 = "The situation up here must be desperate if warriors so young are being promoted like this.";
	text3 = "She looks out at you nervously through the bars. You don't think she has held this post long. _Greetings, soldier. I am Sergeant Olalla. I have a ... a list here of people who can pass through ... through the gate. Give me your name._";
	text5 = "Sergeant Olalla gawks at you, staring at your armor and weaponry. Then she looks at her bow, cavewood and barely used. She clearly has a lot of questions, but she keeps them to herself.";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) == 0;
	question = "Why do you need my name?";
	text1 = "_We keep lists of soldiers who are allowed to travel freely. There aren't many, so we can keep track of them. It's to solve the ... the problems we've been having._";

begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) == 0;
	question = "I need to pass through the gate.";
	text1 = "Olalla nods. _So everyone says. But we have had problems with deserters._ Her voice drops to a whisper. _And spies._";
	text2 = "";

begintalknode 13;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) == 0 && gf(170,1) < 18;
	question = "(Give your name.)";
	text1 = "Sergeant Olalla checks her papers. Then checks them again. Then she shakes her head. _I am sorry. I'm sure there is a mistake. Are you sure you have orders sending you to the Eastern Gallery?_";
	text2 = "_You should ask your commanding officer. Maybe the proper paperwork did not get sent._ You try to convince her to let you by, but, nervous as she is, she is determined to follow her orders.";
	action = END_TALK;
	
begintalknode 14;
	state = 10;
	nextstate = 11;
	condition = gf(109,5) == 0 && gf(170,1) >= 18;
	question = "(Give your name.)";
	text1 = "Sergeant Olalla checks her papers. It doesn't take long for her to find you. _Yes. All right. Now all we need to do is have the lizards sniff you, and you can pass through._";

begintalknode 15;
	state = 11;
	nextstate = 12;
	condition = 1;
	question = "Lizards? Sniff?";
	text1 = "_Yes. I'm afraid there have been troubles with skribbane herb being carried in and out. My superiors want to make sure you don't have any ... accidentally._";

begintalknode 16;
	state = 12;
	nextstate = -1;
	condition = gf(170,0) < 2;
	question = "I order to you let me past, right now.";
	text1 = "Nervous as she is, Olalla realizes that you don't outrank her. _I'm sorry. These are the rules._";

begintalknode 17;
	state = 12;
	nextstate = 10;
	condition = gf(170,0) >= 2;
	question = "I order to you let me past, right now.";
	text1 = "Nervous as she is, Olalla is not about to contradict a senior officer. _I'm sorry. Of course. You may pass._ She gives a command. The gate starts to open.";
	code =
		sf(109,5,1);
	break;
	
begintalknode 18;
	state = 12;
	nextstate = 10;
	condition = party_has_item(225) == 0 && has_spec_item(26) == 0;
	question = "All right. Sniff away.";
	text1 = "The gate slowly opens, and a soldier brings a lizard out. It sniffs at you. Then it lets out a little grunt. She gives a command. The guard stands aside to let you by.";
	text2 = "Olalla says, _I apologize. You are free to go._";
	code =
		sf(109,5,1);
	break;

begintalknode 19;
	state = 12;
	nextstate = 10;
	condition = party_has_item(225) > 0 || has_spec_item(26) > 0;
	question = "All right. Sniff away.";
	text1 = "The gate slowly opens, and a soldier brings a lizard out. It sniffs at you. Then it lets out a long, accusatory hiss. The guards seize you. Soon, you have been relieved of all skribbane on your person.";
	text2 = "The sergeant shakes her head, disappointed. _Even the best of us give in to temptation. I won't try to get you in trouble for this. These papers say you are doing very important work. Only, please don't let this happen again._";
	code =
		sf(109,5,1);
		if (has_spec_item(26))
			set_spec_item(26,-1);
		take_num_of_item(225,200);
	break;
	
begintalknode 20;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) > 0;
	question = "How is the war going?";
	text1 = "_I am the wrong person to ask. I would not want to spread rumors ... As upsetting as they are. The headquarters for the battle are in Fort Duvno, to the north._";
	text3 = "_I believe we are near victory. At least, that is what I am told. I am starting to be able to sleep at night again._";
	action = DEP_ON_SDF 170 8 0;
	
begintalknode 21;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) > 0;
	question = "Where can I rest and get provisions near here?";
	text1 = "_I would go into Silvar. It is a chaotic place, but there are people there. Cotra is being abandoned, by order of the crown._";

begintalknode 22;
	state = 10;
	nextstate = -1;
	condition = gf(109,5) > 0;
	question = "I'll be going, then.";
	text1 = "_All right. And I apologize for inconveniencing you._";
	action = END_TALK;


// Neron

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "This is a combination trading post and smithy, perched on the shore. For many years, merchants have stopped here to obtain supplies and get necessary repairs. Now the main customers are soldiers and desperate refugees.";
	text2 = "The proprietor is a small, greasy man with very sharp eyes. Within moments of entering his store, he has appraised your goods and made a quick mental calculation of how desperate you are.";
	text3 = "He scuttles up and gives you a quick, low bow. _Welcome, welcome. I am Neron, and this is my humble shop. I am eager to trade with Avernum's mighty warriors. I buy and sell, as needed._";
	text5 = "As you wander around Neron's shop, he constantly lurks nearby. There is no potential method of liberating you from your cash that hasn't passed through his head.";
	action = INTRO;

begintalknode 31;
	state = 30;
	nextstate = 31;
	condition = 1;
	question = "Tell me about your shop.";
	text1 = "_Oh, this is a good, honest little business, struggling to survive in difficult times. I buy things that are no longer needed, and I sell them to those who require equipment. Usually soldiers._";
	text2 = "_Please tell me if you need anything. I am eager to assist anyone as clearly important as yourself._";

begintalknode 32;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Are you afraid of the Slith Horde?";
	text1 = "He grimaces. _Of course. Everyone in the Eastern Gallery is. Happily, I am positioned next to the bridge. At the first sign of a breakthrough, I will fill a pack and head south to the Great Cave._";
	text2 = "_I am a trader, not a warrior, you see._";

begintalknode 33;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Do you do a lot of business with refugees?";
	text1 = "_Of course. They leave home with all of their possessions and wind up needing to sell them. And I, of course, am here to buy them._";
	text2 = "_It is very lucky for them that I am here._";

begintalknode 34;
	state = 31;
	nextstate = 32;
	condition = 1;
	question = "Is there anything in particular you want to buy?";
	text1 = "He nods. _Actually ... Well, there is a marvelous market for sacks of meal now. Everyone is ... desperate._ His eye glitter with greed. _Yes, I can always sell meal. And so I pay a very good price for it._";
	text2 = "_If you find bags of meal, bring them to me. You will be well rewarded._";
	code = 
		set_flag(109,7,1);
		toggle_quest(99,1);
	break;

begintalknode 35;
	state = 32;
	nextstate = 30;
	condition = 1;
	question = "And you sell it to the desperate? For a high price?";
	text1 = "_I ... I am a merchant. And I think your tone of voice is very insulting. Although the offer still stands._";

begintalknode 36;
	state = 32;
	nextstate = 30;
	condition = 1;
	question = "I'll see what I can do.";
	text1 = "_I am pleased to hear it. I knew, the moment you walked through the door, that you were someone I could do good business with._";

begintalknode 37;
	state = 30;
	nextstate = -1;
	condition = gf(109,7) == 1 && party_has_item(191) > 0;
	question = "I have bags of meal. (Sell one.)";
	text1 = "Neron takes the meal and pays you generously for the bag. _Yes. Yes. Profit for you. And, later, profit for me. Oh, you should see how the refugees ..._ He smiles and shakes his head.";
	text2 = "_Well, best not to dwell on it. If you find more, I'd happily buy it._";
	action = REUSABLE;
	code =
		take_item(191);
		change_coins(30);
		award_party_xp(20,average_level());
	break;
	
begintalknode 38;
	state = 30;
	nextstate = -1;
	condition = gf(109,7) == 1 && party_has_item(191) > 0;
	question = "I have bags of meal. (Sell all.)";
	text1 = "Neron takes the meal and pays your generously for each bag. _Yes. Yes. Profit for you. And, later, profit for me. Oh, you should see how the refugees ..._ He smiles and shakes his head.";
	text2 = "_Well, best not to dwell on it. If you find more, I'd happily buy it._";
	code =
		i = num_of_item(191);
		take_num_of_item(191,i);
		change_coins(30 * i);
		award_party_xp(20 * i,average_level());
	break;

begintalknode 39;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Let me see what you have for sale.";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Neron's Shop",
		  "Neron is an accomplished war profiteer. His goods are very expensive, although the quality is high.",
		  62,6,0);	
	break;
	
begintalknode 40;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I have something I'd like to sell.";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode 41;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "That is all I need.";
	text1 = "He gives you a servile little smile. _Then good day to you, and I hope to see you again. Very soon._";
	action = END_TALK;

	
// nazil

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = "There is a poor refugee wandering around this store, desperately looking for something he can afford. He is very thin, and his clothes are dirty and torn. The proprietor constantly shoots nasty looks at him..";
	text2 = "When he sees you, he turns and gives you a little bow. _Hello, soldier. I am Nazil. I am looking for food, or something I can use to hunt it._ He adds, quietly, _The owner is mainly interested in fleecing travelers for all he can._";
	text5 = "Nazil continues to walk around the shop, evaluating each item to see if it is worth the price. _If we only still had a farm, a tiny one, life would be so much easier._";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = 51;
	condition = 1;
	question = "Where are you from?";
	text1 = "_Oh, I can hardly remember anymore. We started out near here, actually. Then we traveled to the Great Cave, and then the Great Portal._";
	text2 = "_And then the portal was destroyed, and we fled. And we lost ... so much._";

	
begintalknode 52;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "What do you know about the portal's destruction?";
	text1 = "_Very little. We have heard every rumor you can imagine. It was destroyed by demons. By the Slith Horde. By the slithzerikai of Gnass. By nephilim. By the wretches of the Abyss._";
	text2 = "_I no longer listen. It is gone, and we are doomed. That is all I need to know._";
	
begintalknode 53;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "What did you lose?";
	text1 = "_We no longer travel with everyone we started our journey with. It was ... I am sorry. It is too painful to discuss._";
	
begintalknode 54;
	state = 50;
	nextstate = 52;
	condition = 1;
	question = "You are looking for food?";
	text1 = "_Or a way to hunt it, yes. I am proud. I am a true Avernite. But I have a family to watch out for. I will take what I can._";
	text2 = "";
	
begintalknode 55;
	state = 52;
	nextstate = -1;
	condition = gf(109,8) == 0 && party_has_item(191) > 0;
	question = "Here, you can take this. (Give a bag of meal.)";
	text1 = "He takes the sack and holds it with reverence. _I ... I am so grateful. Thank you. Now we can move on. Maybe find someplace ... better._";
	text2 = "Neron watches this and mutters something about you stealing his customers.";
	code =
		take_item(191);
		award_party_xp(20,average_level());
	break;
	
begintalknode 56;
	state = 52;
	nextstate = 50;
	condition = gf(109,8) == 0 && party_has_item(191) > 0;
	question = "I'd like to know something else.";
	text1 = "_Yes?_";
	
begintalknode 57;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Do you know anything about the Eastern Gallery?";
	text1 = "_Only that it has become a horrible place, with no safe place to turn to. Silvar is close to anarchy, and ... I am sorry. I can spare no more time to talk. I must find a way to move my family on. Excuse me._";
	action = END_TALK;

////

begintalknode 299;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		