# city_library

$loc_arg = $ARGS[0]
$loc = 'city_library'
$menu_loc = 'city_library'
$menu_arg = ''
menu_off = 0
$location_type = 'public_indoors'
frost = 0
gs 'stat'
gs 'themes', 'indoors'

! Stuff to do on Studying a Book
!	$ARGS[0] = Skill to Check
killvar '$downlibrary'
$downlibrary['BookStudy'] = {
	$downlibrary['Skill'] = $ARGS[0]
	*clr & cla
	menu_off = 1
	if blizoruk = 500 or glassqw = 1:
		glassqw = 1
		msg '	The text blurs across the page. It seems you have poor eyesight. Maybe you should visit an ophthalmologist?'
		gt 'city_library'
	end
	if pcs_nerd > 0:
		lastread = totminut
		lastreadday = daystart
		pcs_nerd += 1
	end
	minut += 60
	if $downlibrary['Skill'] ! '':
		dynamic "
			if pcs_<<$downlibrary['Skill']>> >= 50:
				<<$downlibrary['Skill']>>_exp += rand(0,1)
			elseif pcs_<<$downlibrary['Skill']>> >= 25:
				<<$downlibrary['Skill']>>_exp += rand(1,2)
			else
				<<$downlibrary['Skill']>>_exp += rand(1,3)
			end"
	end

	blizoruk += 1
}

'<center><b><font color="maroon">National Library of Russia</font></b></center>'
'<center><img <<$set_imgh>> src="images/locations/city/citycenter/library/downlibint.jpg"></center>'
'A huge library with thousands upon thousands of books. You could spend years in here and probably still wouldn''t be able to read it all.'

act 'Leave': minut += 5 & gt 'city_center'

if hour >= 8 and hour <= 18:
	'There is a large IT section with <a href="exec: gs ''internet_mobile'', ''get_access'', ''free'', ''noporn'',''nocamshow'' & gs ''internet_mobile'', ''add_limitation'', ''general-text'', ''On this public computer all adult content sites are blocked'' & gt ''Komp'',''start''">computers</a> available for public use.'
	act 'Read a book':
		gt 'city_library', 'read'
	end
	
	act 'Borrow a book':
		gt 'city_library', 'loan'
	end

	if MagicLibrary = 1:
		act 'Read magic books':
			dynamic $downlibrary['BookStudy'], 'splcstng'
			gs 'stat'
			'You pick out one of the magic books you can actually read and sit down with it.'
			'You discover that not only is the subject matter complex and mostly a mystery to you, but the descriptions and explanations are unnecessarily wordy, as if the writer had something to prove.'
			'After about an hour, you decide to take a break from it and instead test your memory. You don''t remember much, but you understand magic a little better than before.'

			! Find Researchable Spells
			if func('spellList','numAvailableSpells','librarySpells') > 0:
				if rand(1,10) = 10:
					gs 'spellList','addAvailableSpells','librarySpells'
					*nl
					*pl 'You have come across a lead on a new spell.'
				end
			else
				'There doesn''t seem to be any more spells to learn here, but you can still improve your skills in the ones that you''ve already found.'
			end

			!!Adding to the Actions opportunity to practice spells MC found
			gs 'spellList', 'teacherActions', '$librarySpells', 'city_library', ''

			act 'Put the book down': gt $curloc
		end
		!!Adding to the Actions opportunity to practice spells MC found
		gs 'spellList', 'teacherActions', '$librarySpells', 'city_library', ''
	end
else
	'The library is closed.'
end

gs 'camera', 'check_location'

if $ARGS[0] = 'read':
	cla
	act 'Read a book on science (1:00)':
		dynamic $downlibrary['BookStudy'], ''
		gs 'exp_gain', 'intel', rand(3,6) + rand(0, drugVars['mentats_dose'])
		grupvalue[3] += 1
		gs 'stat'
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/science1.jpg"></center>'
		'You spend an hour reading, trying to make sense of all the clever propositions writen inside and understand the subject it describes.'
		act 'Put the book back': gt 'city_library', 'read'
	end

	act 'Read an adventure novel (1:00)':
		dynamic $downlibrary['BookStudy'], ''
		pcs_mood = 100
		grupvalue[3] += 1
		gs 'stat'
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/fiction' + rand(1,2) + '.jpg"></center>'
		'You spend an hour reading an adventure novel, immersing yourself in daring deeds and awesome twists.'
		act 'Put the book back': gt 'city_library', 'read'
	end

	act 'Read a fantasy novel (1:00)':
		dynamic $downlibrary['BookStudy'], ''
		pcs_mood = 100
		grupvalue[3] += 1
		gs 'stat'
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/fantasy' + rand(1,9) + '.jpg"></center>'
		'You spend an hour reading a fantasy novel, rescuing damsels from dragons, digging for jewels with dwarves and performing word changing magic alongside elves and druids.'
		act 'Put the book back': gt 'city_library', 'read'
	end

	act 'Read a science fiction novel (1:00)':
		dynamic $downlibrary['BookStudy'], ''
		pcs_mood = 100
		grupvalue[3] += 1
		gs 'stat'
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/scifi' + rand(1,6) + '.jpg"></center>'
		'You spend an hour reading a science fiction novel - flying off into space, travelling though time, running from rogue AI and creating monsters with your hunchbacked assistant.'
		act 'Put the book back': gt 'city_library', 'read'
	end

	act 'Read a romance novel (1:00)':
		dynamic $downlibrary['BookStudy'], ''
		pcs_mood = 100
		pcs_horny += 20
		gs 'stat'
		'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/romance' + rand(1,20) + '.jpg"></center>'
		'You spend a very short hour reading a romance novel - choosing between a vampire or a werewolf, falling in love with an obscenely wealthy Grey... Several of the scenes are very steamy and you find yourself getting quite aroused.'
		act 'Put the book back': gt 'city_library', 'read'
	end
	
	temp = pcs_intel * 2 + pcs_sprt
	if temp < 100:
		$diff = 'hard'
	elseif temp < 150:
		$diff = 'medium'
	else
		$diff = 'easy'
	end
	gs 'willpower', 'misc', 'self', $diff
	if will_cost <= pcs_willpwr:
		act 'Read from the collected works of Leo Tolstoy (1:00) (<<will_cost>> Willpower)':
			gs 'willpower', 'pay', 'self'
			killvar 'will_cost'

			dynamic $downlibrary['BookStudy'], ''
			gs 'exp_gain', 'sprt', rand(3,6)
			grupvalue[3] += 2
			gs 'stat'
			'<center><img <<$set_imgh>> src="images/pc/items/accessories/books/tolstoy.jpg"></center>'
			'You read the book for an hour. Tolstoy is certainly a classic writer, but he used a <i>lot</i> of words.'
			act 'Put the book back': gt 'city_library', 'read'
		end
	else
		act 'Read from the collected works of Leo Tolstoy (1:00) (<font color="red"><<will_cost>> Willpower</font>)': '<br><font color="red">You don''t have enough willpower to use this action.</font>'
	end
	
	act 'Go back': gt 'city_library'
end

if $ARGS[0] = 'loan':
	cla
	if $lib_book_loaned ! '':
		'You''ve currently borrowed a <<$lib_book_loaned>>.'
		if lib_debt <= 0:
			temp_loan_days_left = lib_debt / -50
			'You have <<temp_loan_days_left>> days left before you need to return it.'
		else
			'<font color="red">Your book is overdue!</font>'
		end

		act 'Return your loaned book':
			if lib_book_read = 0:
				if $lib_book_loaned = 'fantasy': f_book -= 1
			elseif lib_book_read = 1:
				if $lib_book_loaned = 'fantasy': fantasybook = 0
			end
			$lib_book_loaned = ''
			if lib_debt <= 0: lib_debt = 0
			gt 'city_library'
		end
	end

	if lib_debt > 0:
		'You owe an outstanding debt of <<lib_debt>> <b>₽</b> to the library.'
		if money < lib_debt and karta < lib_debt:
			'You don''t have enough money to pay your debt!'
		else
			if money >= lib_debt:
				act 'Pay your debt (cash)':
					money -= lib_debt
					lib_debt = 0
					gt 'city_library', 'loan'
				end
			end
			if karta >= lib_debt:
				act 'Pay your debt (card)':
					karta -= lib_debt
					lib_debt = 0
					gt 'city_library', 'loan'
				end
			end
		end
	end

	if $lib_book_loaned = '' and lib_debt = 0:
		!!There''s currently only code for fantasy novels
		!{act 'Borrow a book on science':
			*clr & cla
			menu_off = 1
			s_book += 1
			$lib_book_loaned = 'a science book'
			lib_debt = -700
			!!Picture here
			'You find a science book that catches your interest and bring it to the librarian, who notes your name and the title of the book down before handing it to you.'
			'"You need to return it within 2 weeks. Every day that you''re late incurs a 50 <b>₽</b> fine."'
			act 'Continue': gt 'city_library'
		end
		
		act 'Borrow an adventure novel':
			*clr & cla
			menu_off = 1
			a_book += 1
			$lib_book_loaned = 'an adventure novel'
			lib_debt = -700
			!!Picture here
			'You find an adventure novel that catches your interest and bring it to the librarian, who notes your name and the title of the book down before handing it to you.'
			'"You need to return it within 2 weeks. Every day that you''re late incurs a 50 <b>₽</b> fine."'
			act 'Continue': gt 'city_library'
		end}
		
		act 'Borrow a fantasy novel':
			*clr & cla
			menu_off = 1
			f_book += 1
			$lib_book_loaned = 'a fantasy novel'
			lib_debt = -700
			!!Picture here
			'You find a fantasy novel that catches your interest and bring it to the librarian, who notes your name and the title of the book down before handing it to you.'
			'"You need to return it within 2 weeks. Every day that you''re late incurs a 50 <b>₽</b> fine."'
			act 'Continue': gt 'city_library'
		end
		
		!{act 'Borrow a science fiction novel':
			*clr & cla
			menu_off = 1
			sf_book += 1
			$lib_book_loaned = 'a science fiction novel'
			lib_debt = -700
			!!Picture here
			'You find a fantasy novel that catches your interest and bring it to the librarian, who notes your name and the title of the book down before handing it to you.'
			'"You need to return it within 2 weeks. Every day that you''re late incurs a 50 <b>₽</b> fine."'
			act 'Continue': gt 'city_library'
		end
		
		act 'Borrow a romance novel':
			*clr & cla
			menu_off = 1
			r_book += 1
			$lib_book_loaned = 'a romance novel'
			lib_debt = -700
			!!Picture here
			'You find a romance novel that catches your interest and bring it to the librarian, who notes your name and the title of the book down before handing it to you.'
			'"You need to return it within 2 weeks. Every day that you''re late incurs a 50 <b>₽</b> fine."'
			act 'Continue': gt 'city_library'
		end}
	end

	act 'Go back': gt 'city_library'
end

--- city_library ---------------------------------

