# courtletter

if $ARGS[0] = '':
	if arrsize('policeQW_courtletter_dates') > 0 and daystart >= policeQW_courtletter_dates[0]: gt 'courtletter', 'letter'
end


if $ARGS[0] = 'letter':
	*clr & cla
	menu_off = 1
	minut += 5

	if (policeQW['missed_court_dates'] + policeQW['missed_fine_deadlines']) > 1:
		if (policeQW['tot_court_dates_missed'] + policeQW['tot_fines_deadlines_missed']) > 30 and policeQW['tot_arrested'] > 10:
			policeQW['tot_arrested'] += 1
			if policeQW['arrest_gameover_flag'] = 1:
				gt 'sentence', 'police_arrest', 2
			else
				policeQW['arrest_gameover_flag'] = 1
				gt 'sentence', 'police_arrest', 1
			end

		elseif (policeQW['missed_court_dates'] + policeQW['missed_fine_deadlines']) > 3:
			policeQW['tot_arrested'] += 1
			gt 'sentence', 'police_arrest', 0
		end
	end

	'<center><img <<$set_imgh>> src="images/locations/city/shared/court/openletter.jpg"></center>'

	!! Handling the various different letters.
	if $policeQW_courtletter_subjects[0] = 'fine':

		if policeQW['courtletter_fine_counter'] < 10:
			policeQW['courtletter_fine_counter'] += 1
			pcs_mood -= 100
			gs 'stat'

			'As you enter your home you notice an envelope from the court. You anxiously look at it and take a deep breath before opening the envelope.'

			if week < 6:
				'Going through the letter you read that you''ve a week to pay your fine in full.'
			else
				'Going through the letter you read that you''ve until Monday, a week from now, to pay your fine in full.'
			end

			'<i>Failure to pay the fine in full with in a week from now, will have dire consequences for the accused.</i> Your heart drops as you read that line...'
			'<i>You should mail your fine payment using the enclosed envelope.</i>'
			'You put the letter back in the envelope and let out a loud sigh...'

			if policeQW['legal_fine'] <= 0:
				pcs_mood += 90
				gs 'stat'
				'You realise that you''ve already paid off your fines and sigh with relief.'
			else
				'You put the letter back in the envelope and let out a loud sigh...'
			end

		else
			'As you come home you see the familiar envelope from the court. You already know the gist of it, <i>failure to pay your fine will have dire consequences,</i> yadda yadda...'
			'You glance through the letter seeing the same information once again and as you finish you throw it to the side and continue further on inside your apartment...'
			if policeQW['legal_fine'] <= 0:
				'You''ve already paid your fines, why are they even bothering you.'
			end
		end

		if policeQW['legal_fine'] > 0:
			if money < policeQW['legal_fine']:
				act 'Mail the payment for your legal fine/s (<font color="red"><<policeQW[''legal_fine'']>> <b>₽</b></font>)': '<br><font color="red">You don''t have enough cash to use this action.</font>'
			else
				act 'Mail the payment for your legal fine/s (<<policeQW[''legal_fine'']>> <b>₽</b>)':
					*clr & cla
					money -= policeQW['legal_fine']
					policeQW['legal_fine'] = 0
					policeQW['missed_fine_deadlines'] = 0
					policeQW['fine_deadline'] = 0
					policeQW['arrest_gameover_flag'] = 0
					minut += 5
					gs 'stat'

					!!Need an image of Sveta putting money in the envelope!!
					!'<center><img <<$set_imgh>> src="images/locations/shared/postoffice/counter.jpg"></center>'
					'You put the full amount of your outstanding fine/s in the evelope and seal it. No more than 5 minutes later you''ve posted the letter and are back.'
					act 'Done': gt $loc, $loc_arg
				end
			end
		end

	elseif $policeQW_courtletter_subjects[0] = 'missed_fine':
		if policeQW['courtletter_fine_counter'] < 10:
			policeQW['courtletter_fine_counter'] += 1
			pcs_mood -= 100
			gs 'stat'

			'As you enter your home you notice an envelope from the court. You anxiously look at it and take a deep breath before opening the envelope.'

			if policeQW['legal_fine'] <= 0:
				pcs_mood += 90
				gs 'stat'
				'Going through the letter you read that you''ve a week to pay your fine in full, which you already did.'
				'Happy that you''ve managed to avoid this worry, you put the letter away.'
			else
				temp_fine = 250 * rand(5, 10)
				gs 'sentence', 'add_fine', temp_fine
				if week < 6:
					'Going through the letter you read that you''ve failed to pay your fine. The court given you another <<temp_rand>> <b>₽</b> fine and has graciously decided to give you a week to pay your fine in full.'
				else
					'Going through the letter you read that you''ve failed to pay your fine. The court given you another <<temp_rand>> <b>₽</b> fine and has graciously decided to give you until Monday, a week from now, to pay your fine in full.'
				end

				'<i>Failure to pay the fine in full with in a week from now, will have dire consequences for the accused.</i> Your heart drops as you read that line...'
				'<i>You should mail your fine payment using the enclosed envelope.</i>'
				'You put the letter back in the envelope and let out a loud sigh...'
			end

		else
			if policeQW['legal_fine'] <= 0:
				'As you come home you see the familiar envelope from the court. You already know the gist of it, <i>failed to pay your fine, failure to pay your fine will have dire consequences,</i> yadda yadda...'
				'You already paid off your fines and as you finish you throw it to the side and continue further on inside your apartment...'

			else
				temp_fine = 250 * rand(10, 20)
				gs 'sentence', 'add_fine', temp_fine
				'As you come home you see the familiar envelope from the court. You already know the gist of it, <i>failed to pay your fine, additional <<temp_rand>> <b>₽</b> fine, failure to pay your fine will have dire consequences,</i> yadda yadda...'
				'You glance through the letter seeing the same information once again and as you finish you throw it to the side and continue further on inside your apartment...'
			end
		end

		if policeQW['legal_fine'] > 0:
			if money < policeQW['legal_fine']:
				act 'Mail the payment for your legal fine/s (<font color="red"><<policeQW[''legal_fine'']>> <b>₽</b></font>)': '<br><font color="red">You don''t have enough cash to use this action.</font>'
			else
				act 'Mail the payment for your legal fine/s (<<policeQW[''legal_fine'']>> <b>₽</b>)':
					*clr & cla
					money -= policeQW['legal_fine']
					policeQW['legal_fine'] = 0
					policeQW['missed_fine_deadlines'] = 0
					policeQW['fine_deadline'] = 0
					policeQW['arrest_gameover_flag'] = 0
					minut += 5
					gs 'stat'

					!!Need an image of Sveta putting money in the envelope!!
					!'<center><img <<$set_imgh>> src="images/locations/shared/postoffice/counter.jpg"></center>'
					'You put the full amount of your outstanding fine/s in the evelope and seal it. No more than 5 minutes later you''ve posted the letter and are back.'
					act 'Done': gt $loc, $loc_arg
				end
			end
		end


	elseif mid($policeQW_courtletter_subjects[0], 1, 12) = 'missed_court':
		if week = 6:
			policeQW_courthearing_dates[] = daystart + 9
		elseif week = 7:
			policeQW_courthearing_dates[] = daystart + 8
		else
			policeQW_courthearing_dates[] = daystart + 7
		end

		$policeQW_courthearing_subjects[] = mid($policeQW_courtletter_subjects[0], 14)

		if $policeQW['courtletter_hearing_counter'] < 10:
			policeQW['courtletter_hearing_counter'] += 1
			pcs_mood -= 100
			gs 'stat'

			'As you enter your home you notice an envelope from the court. You anxiously look at it and take a deep breath before opening the envelope.'

			temp_fine = 500 * rand(5, 10)
			gs 'sentence', 'add_fine', temp_fine
			if week < 6:
				'Going through the letter you read that you''ve missed your court hearing. A new court hearing has been scheduled a week from now and you''ve been fined <<temp_rand>> <b>₽</b>.'
			else
				'Going through the letter you read that you''ve missed your court hearing. A new court hearing has been scheduled on Monday, a week from now and you''ve been fined <<temp_rand>> <b>₽</b>.'
			end

			'<i>Failing to appear in court will have dire consequences for the accused.</i> Your heart drops as you read that line...'
			'<i>The court is located in the city center. You should arrive at 9:00 as there are a lot of cases and we can''t say when your turn might come up.</i>'
			'You put the letter back in the envelope and let out a loud sigh...'

		else
			temp_fine = 500 * rand(10, 20)
			gs 'sentence', 'add_fine', temp_fine
			'As you come home you see the familiar envelope from the court. You already know the gist of it, <i>missed court, <<temp_rand>> <b>₽</b> fine, failure to show up will have dire consequences,</i> yadda yadda...'
			'You glance through the letter seeing the same information once again and as you finish you throw it to the side and continue further on inside your apartment...'
		end

	else
		if week = 6:
			policeQW_courthearing_dates[] = daystart + 9
		elseif week = 7:
			policeQW_courthearing_dates[] = daystart + 8
		else
			policeQW_courthearing_dates[] = daystart + 7
		end

		$policeQW_courthearing_subjects[] = $policeQW_courtletter_subjects[0]

		if $policeQW['courtletter_hearing_counter'] < 10:
			policeQW['courtletter_hearing_counter'] += 1
			pcs_mood -= 100
			gs 'stat'

			'As you enter your home you notice an envelope from the court. You anxiously look at it and take a deep breath before opening the envelope.'

			if week < 6:
				'Going through the letter you read that you''ve been summoned to appear in court a week from now.'
			else
				'Going through the letter you read that you''ve been summoned to appear in court on Monday, a week from now.'
			end

			'<i>Failing to appear in court will have dire consequences for the accused.</i> Your heart drops as you read that line...'
			'<i>The court is located in the city center. You should arrive at 9:00 as there are a lot of cases and we can''t say when your turn might come up.</i>'
			'You put the letter back in the envelope and let out a loud sigh...'

		else
			'As you come home you see the familiar envelope from the court. You already know the gist of it, <i>failure to show up will have dire consequences,</i> yadda yadda...'
			'You glance through the letter seeing the same information once again and as you finish you throw it to the side and continue further on inside your apartment...'
		end
	end

	killvar 'temp_fine'
	killvar 'policeQW_courtletter_dates', 0
	killvar 'policeQW_courtletter_subjects', 0

	act 'Continue': gt $loc, $loc_arg
end



--- courtletter ---------------------------------
