// OUTDOOR SECTION SCRIPT
//    Section: X = 0, Y = 3: Near Thassaka

beginoutdoorscript;

variables;

int choice,i,j,k;
string dlgstr;

body;

beginstate INIT_STATE;
// This state called whenever this section is loaded into memory.
break;

beginstate START_STATE;
// Starting state of the section, called every turn the party 
// stands inside this section until you change the state.
break;

beginstate 10;
if (get_flag(203,0) == 0) {
	message_dialog("In the distance, you can see the city of Thassaka! More importantly, it appears to be completely intact, not conquered by barbarians or abandoned! Thassaka may be the first city you enter that can give you real answers about the slith homeland!","Suddenly you recall that they are not expecting anything like you. Avernites were a strange concept to those in Vasskolis; they would be doubly so for those in Thassaka.");
	set_flag(203,0,1);
	}
break;

beginstate 11;
if (get_flag(203,1) == 0) {
	if (get_flag(11,1) == 0)
		message_dialog("You approach a small couple of houses outside Thassaka. A number of sliths live here, and you can see them outside, working in their fields. They see you and shy away.","You make as if to speak to them, but they clearly don't want to have anything to do with you, making hostile motions as you approach. You stay back.");
	else
		message_dialog("You approach a small couple of houses outside Thassaka. A number of sliths live here, and you can see them outside, working in their fields. They see you and do not look afraid: they must know that you've been welcomed in Thassaka.","You approach to speak with them. They are willing to talk, but they know little more than you learned in the city: barbarians roam the land and travel is hardly safe.");
	set_flag(203,1,1);
	}
break;

beginstate 12;
	outdoor_enc_result(1);
	if (get_flag(203,1) == 0) {
		if (get_flag(11,1) == 0)
			message_dialog("There is a quarry here, and these sliths are working in it. They look at you suspiciously as you approach, but when you make no move to attack them, they ignore you.","This quarry must supply Thassaka with most of its rock for construction. The mines not far away must also be part of the city's source for materials.");
		else
			message_dialog("There is a quarry here, and these sliths are working in it. They seem not to mind your presence. They must've heard that you've been welcomed in Thassaka. You approach and speak with one of them.","He explains that this quarry supplies Thassaka with most of its rock for construction. The mines not far away are also part of the city's source for materials. He adds that the bandits don't normally raid here, so this area is safe without guards.");
		}
	else
		print_str_color("You pass the quarry. The sliths nod to you.",2);
break;

beginstate 13;
	if (get_flag(11,1) == 0)
		message_dialog("You approach the mines. The sliths here look at you in a hostile fashion, touching their weapons as you approach, and you back off.","");
	else
		message_dialog("You approach the mines. The sliths here greet you as you approach. They explain that they mine for metal to make into weapons. Those weapons are forged just north of here. Then they're shipped to Thassaka, where they are used to fight bandits.","You poke around the mines for a bit but find nothing of interest.");
break;

beginstate 14;
	if (get_flag(11,1) == 0)
		message_dialog("There is a forge here, but the several heavily armed sliths warn you away by waving their weapons. You back off.","");
	else
		begin_shop_mode("Thassaka Forge","When you approach the forge, the smiths stop and offer to sell you some of their items. The quality is top-notch, rivaling the best in Avernum.",2,3,-1);
break;

beginstate 15;
if (get_flag(11,3) != 0)
	end();
	
	reset_dialog();
	add_dialog_str(0,"You approach the front gates of the slith city, looking at the banners that cover the walls and the guards that stand by. You approach causes a small alarm to go up in the city, and, not wanting to cause problems, you wait as they get organized.",0);
	add_dialog_str(1,"After a short while, an important-looking slith comes to the gates and speaks to you. He speaks the ancient slith language with a strange accent.",0);
	clear_buffer();
	append_string("_My name is Khalthanas,_ he says. _I am the king of Thassaka.");
	if ((species_in_party(0)) || (species_in_party(2)))
		append_string("_ He looks at you with confusion on his face. It must be because he's never seen a non-slith humanoid. _Who... and what... are you?_");
	else
		append_string(" You are not from these lands, but you are clearly not like the barbarians that menace us. Who are you?_");
	get_buffer_text(dlgstr);
	add_dialog_str(2,dlgstr,0);
	add_dialog_str(3,"You quickly fill him in, explaining where you're from and why you've come to Thassaka. You begin to describe the expedition that is coming behind you when he cuts you off in horror.",0);
	add_dialog_str(4,"_Darklings! The children of Thsss have returned? We do not need yet another enemy!_ He looks very upset, so you hurriedly explain that you intend no harm. You briefly describe Bahssikava and the repentance.",0);
	add_dialog_str(5,"He looks somewhat reassured but still a little skeptical. _You can enter the city,_ he says, _but do not bring your friends here yet. Come speak with me among my advisors, and we will decide what to do._ He walks back inside the city walls.",0);
	set_flag(11,3,run_dialog(1));
break;

beginstate 16;
if (get_skill_total(16) < 14) {
	message_dialog("You find some strange-looking plants. Unfortunately, you don't know enough about Nature Lore to know what they are or how they might be used.","");
	end();
	}
	
if (get_flag(203,2) == 0) {
	reset_dialog();
	add_dialog_str(0,"You find a patch of Toadstools! Your knowledge of Nature Lore extends to how to pick them so that they will keep their vital parts that are useful in potions. Do you wish to pick them?",0);
	add_dialog_choice(0,"No. (Leave them alone.)");
	add_dialog_choice(1,"Yes. (Pick them.)");
	if (run_dialog(1) == 2) {
		set_flag(203,2,reward_give(218));
		reward_give(218);
		}
	}
else
	message_dialog("Toadstools grow back slowly, and these have not yet grown back.","");
break;