// TOWN DIALOGUE SCRIPT
//    Town 117: Little Vale

begintalkscript;

variables;

short i,j,k,r1,choice;

begintalknode;
	tag = 1;
	state = -1;
	nextstate = -1;
	condition = 1;
	text1 = "_Moo._";
	
// Waldby

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Waldby";
	text1 = "You meet a small, dapper man with carefully tended black hair and an elegant moustache. He watches you with interest. Though you're far from civilization, he doesn't seem worried about you.";
	text2 = "He says, _Do not be afraid. This is a place of rest for wandering Avernites. I am Waldby. Welcome to my store._";
	text5 = "Waldby smiles. _Is there any other way I can assist you? I would hate to think you traveled all the way out here for nothing._";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What do you do out here?_";
	text1 = "He grins. _Why, I am a salesman! What else?_";

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_This is a shop?_";
	text1 = "_Believe it or not. This is my lovely shop. Or, it will be until the Empire comes._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What will you do when the Empire comes?_";
	text1 = "_Any day now, I expect to hear news of Empire troops coming. When that happens, I'm ready to be out of here within the hour. I'm not interested in suicide._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Suicide?_";
	text1 = "_That is what I would be committing if I tried to defend my shop against the Empire._";

begintalknode;
	state = 1;
	nextstate = 4;
	question = "_How do you get customers out here?_";
	text1 = "_You came, didn't you? I am remote, I know, but this is where I prefer to be. From here, I scavenge items as best I can. Then I sell them. Would you like to buy something?_";

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Let me see your wares._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Waldby's Bazaar","Waldby has gathered up an unusual assortment of weird and interesting items.",79,5,3);
	break;

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_What sort of things do you scavenge?_";
	text1 = "_With all the battles and refugees and such, there's useful stuff abandoned all over these caves. Empire supplies. Lost goods. Salvage. I find it, clean it up, and sell it to my fellow prisoners of Avernum._";
	text2 = "He sighs. _Now, if only I could find an Empire supply cache. Then I would be set._";

begintalknode;
	state = 5;
	nextstate = 6;
	question = "_Tell us about the supply caches._";
	text1 = "_They're all over the place, heavily trapped and filled with valuable supplies straight from the surface. Even dirt! The only problem is, I can't find the password._";
	code =
		sf(117,11,1);
		toggle_quest(75,1);
	break;

begintalknode;
	state = 6;
	nextstate = -1;
	question = "_What is so valuable about dirt?_";
	text1 = "_Dirt from the surface is really rare down here. More valuable than silver!_";

begintalknode;
	state = 6;
	nextstate = 7;
	question = "_Why do you need a password?_";
	text1 = "_Empire caches are sealed by a password, and I haven't the foggiest idea what it is. The only way you could find it is by getting it from the Empire, and I don't know how someone could do that._";
	text2 = "_I suppose looking for Empire soldiers in the Eastern Gallery would be a start._";
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = (gf(158,11) >= 1 || gf(158,12) > 0) && gf(117,11) == 1;
	question = "_I found out the password. It's 'Skulls'._";
	text1 = "He looks ecstatic. _Thank you! This will be a huge help! Time to go loot!_ He almost collapses under the weight of the waves of greed washing over him.";
	text2 = "_I want to do something for you in return. If you would like, I can sell you my special goods in the future, the sort I normally only sell to Avernite agents. Or people with lots and lots of money._";
	action = SET_SDF 117 11 2;
	code =
		toggle_quest(75,3);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(117,11) >= 2;
	question = "_Will you sell me some of your special goods?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("The Private Stock","Waldby offers several unusual and valuable items for sale.",80,4,3);
	break;

begintalknode;
	state = 7;
	nextstate = 1;
	condition = gf(158,11) >= 1 && gf(117,11) == 0;
	question = "_I have no idea what the password is._";
	text1 = "_Really? I didn't say you did. Oh well. If you find out, say from an Empire courier, I'd appreciate it if you told me._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_All right. Thank you for the company. It does get lonely out here._";
	action = END_TALK;