# uni_lessons
close all
!2021/22/12
!! This file includes the code to make sure that the player characters can go to class and exams when they are enrolled in the university.
!! The file does not include the selection of classes depending upon which program they are enrolled in only the part of the code that don''t depend on the program.
!! The code for the individual programs is in uni_programs

if $ARGS[0] = 'cikl':
!! Setting the weeks in the university semester and making sure that the grades are calculated at the right times

	if university['semester_week'] = 0 and (month = 8 or month = 1) and (day - week) >= 20:
		university['semester_week'] = -1
	else
		if week = 1:
			if university['semester_week'] = -1:
				university['semester_week'] = 1
			elseif university['semester_week'] > 0 and university['semester_week'] < 15: 
				university['semester_week'] += 1
				if university['enrolled_in_semester'] > university['semester_passed']:
					gs 'grades', 'calculate_grade', 'uni_<<$university[''enrolled_in'']>>_semester_<<university[''enrolled_in_semester'']>>'
					gs 'grades', 'assing_grade_description', 'uni_<<$university[''enrolled_in'']>>_semester_<<university[''enrolled_in_semester'']>>'
				end
			elseif university['semester_week'] = 15:
				university['semester_week'] = 0
				university['exam_week'] = 1
				if university['enrolled_in_semester'] > university['semester_passed']:
					gs 'grades', 'calculate_grade', 'uni_<<$university[''enrolled_in'']>>_semester_<<university[''enrolled_in_semester'']>>'
					gs 'grades', 'assing_grade_description', 'uni_<<$university[''enrolled_in'']>>_semester_<<university[''enrolled_in_semester'']>>'
				end
			elseif university['exam_week'] = 1: 
				university['exam_week'] = 2
			elseif university['exam_week'] = 2: 
				university['exam_week'] = 0
				if university['enrolled_in_semester'] > university['semester_passed']:
					i = 0
					passed_count = 0
					class_count = 0
					:passed_exams_loop
					if $class_list_institution[i] = 'uni_<<$university[''enrolled_in'']>>_semester_<<university[''enrolled_in_semester'']>>':
						class_count += 1
						if dyneval ('RESULT = class[''<<$class_list_institution[i]>>_<<$class_list_name[i]>>_grade'']') > 40 and dyneval ('RESULT = class[''<<$class_list_institution[i]>>_<<$class_list_name[i]>>_exam_done'']') = 1:
							passed_count += 1
						elseif dyneval ('RESULT = class[''<<$class_list_institution[i]>>_<<$class_list_name[i]>>_exam_done'']') = 0:
							dynamic 'class[''<<$class_list_institution[i]>>_<<$class_list_name[i]>>_grade''] = 0'
							university['expelled_for_missing_exam'] = 1
						end
					end
					i += 1
					if ARRSIZE('class_list_institution') >= i: jump 'passed_exams_loop'
					killvar 'i'
					if passed_count = class_count: 
						university['semester_passed'] = university['enrolled_in_semester']
					else
						university['expelled'] = 1
						university['student'] = 0
					end
					if university['semester_passed'] = 8:
						university['diploma'] = 1
						university['student'] = 0
					end
					killvar 'class_count'
					killvar 'passed_count'
				end
			end
		end
	end
end

if $ARGS[0] = 'short_break':
	$location_type = 'public_indoors'
	menu_off = 1
	if hour = 9: minut += 90 - minut					
	if hour = 10 and minut < 30: minut += 30 - minut
	if hour = 11: minut += 90 - minut
	if hour = 12 and minut < 30: minut += 30 - minut	
	if hour = 13: minut += 105 - minut
	if hour = 14 and minut < 45: minut += 45 - minut
	gs 'stat'
	if katjaQW['QWstage'] < 2 and hour >= 14 and npc_rel['A14'] >= 70 and fame['city_slut'] < 150 and pcs_makupskl >= 40 and hotcat >= 6: gt 'katja_uni', 'dorm_room_invite'
	if week = 4 and hour > 14 and nerd_game['fixed_uni_day'] = 0 and (npc_rel['A153'] >= 50 or nerd_game['stage'] > 0) and nerd_game['invite_day'] ! 2147483647: gt 'nerd_game_night', 'invite_uni'
	if rand(0,19)= 0: gt 'uni_events', 'lecture_hall_events'
	*clr & cla
	'<center><b><font color="maroon">Lecture Building Hallway</font></b></center>'
	'<center><img <<$set_imgh>> src="images/locations/city/island/university/lecture_hall/lecture_hall.jpg"></center>'
	'Walking down the halls, you are still amazed at how well maintained the buildings are compared to your old school.'
	gs 'uni_lessons', 'schedule'
	act 'Go to the university plaza': gt 'uni_grounds', 'main'
end

if $ARGS[0] = 'schedule':
	gs 'stat'
	if uni_period['first'] ! daystart and hour > 6 and hour < 9:
		gs 'uni_programs', 'uni_period_first'
	elseif uni_period['second'] ! daystart and hour = 10:
		gs 'uni_programs', 'uni_period_second'
	elseif uni_period['third'] ! daystart and (hour = 12 or (hour = 13 and minut < 15)):
		gs 'uni_programs', 'uni_period_third'
	end
end

if $ARGS[0] = 'exam_schedule':
	gs 'stat'
	if uni_period['exam'] ! daystart and hour > 6 and hour < 9:
		gs 'uni_programs', 'exam'
	end
end

--- uni_lessons ---------------------------------
