begintownscript;

variables;

int choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(3);

	set_name(6,"Gordon");
	set_name(7,"John");
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	if (get_flag (3,1) == 1) {
			text_bubble_on_char(6,"I'm the librarian");
		if (get_ran(1,0,100) < 6)
			text_bubble_on_char(6,"I can guide you");
		if (get_ran(1,0,100) < 6)
			text_bubble_on_char(6,"Bring your books here");
		if (get_ran(1,0,100) < 6)
			text_bubble_on_char(7,"Very interesting");
		if (get_ran(1,0,100) < 6)
			text_bubble_on_char(7,"Hmmmm");
		}
break;

beginstate 10;
	move_to_new_town(3,9,33);
break;

beginstate 11;
if (get_flag(4,0) == 1)
		end();
	message_dialog("You stand at the entrance to lower library of the castle. Perhaps here you can find evidence to what the Emperor plans, or, at any rate, planned to do.","");
	set_flag(4,0,1);
break;

beginstate 12;
	if (get_flag(4,3) == 0) {
			reset_dialog();
			add_dialog_str(0,"An old book sits on a pedestal. Its pages are very old and some are partly burnt. Other pages are just wrinkled because of the humid conditions. Nevertheless, you can still read the book.",0);
			add_dialog_str(1,"You start reading it. There are some very interesting things in here: _We should kill her quickly. She is one of most important people. The Empire mustn't know what we are doing here!_",0);
			add_dialog_str(2,"You close the book. Thralni wants to kill, or wanted to kill, Mayor Ruth. When you come back to her, you should speak to her about it. You take the page you read and pocket it.",0);
			add_dialog_choice(0,"Okay");
			choice = run_dialog(1);
			
			set_flag(4,3,1);
			change_spec_item(11,1);
			end();
			}
		message_dialog("You already read the book and found the evidence of Thralni wanting to abduct and kill Mayor Ruth. There is no use in reading the book a second time.","");
break;

beginstate 13;
if (get_flag(5,3) > 0) {
		if (get_flag(4,1) == 0) {
				message_dialog("This book contains several Empire orders. They seem to have been stolen from the Empire Liaison of Voughton. Thinking of Mayor Ruth, you take the scrolls with you.","");
				set_flag(4,1,1);
				end();
				}
			message_dialog("This book doesn't contain any useful information for you anymore.","");
		}
	message_dialog("This book seems hardly important to you. You flip through it a bit, but you close it soon enough and go away.","");
break;

beginstate 14;
if (has_item(490) == 1) {
		message_dialog("While holding the map in one hand, and your sword in the other, you walk into this room. According to Thralni's map there should be some sort of passage here.","");
		end();
		}
break;

beginstate 15;
if (get_flag(4,2) == 0) {
		if (has_item(490) == 1) {
				message_dialog("You walk against this wall, searching for a secret door, as shown on Thralni's map. Finally, you find one. You can now walk through the secret passage, and see where it will lead you.","");
				set_flag(4,2,1);
				end();
				}
		}
		
		if (has_item(490) == 0)
				block_entry(1);	
break;

beginstate 16;
	move_to_new_town(41,8,42);
break;