123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- # uniutil
- if $ARGS[0] = 'eligible_for_university':
- RESULT = func('uniutil', 'student', 'status') = 0 and func('uniutil', 'diploma', 'obtained') = 0 and (age >= 17 or fakepassport = 1)
- end
- if $ARGS[0] = 'prepclass':
- if $ARGS[1] = 'cost':
- RESULT = 15000
- end
- if $ARGS[1] = 'closing_hour':
- RESULT = 21
- end
- if $ARGS[1] = 'is_enrolled':
- RESULT = prepclassstats['enrolled'] = 1
- end
- if $ARGS[1] = 'set_enrolled':
- prepclassstats['enrolled'] = ARGS[2]
- end
- if $ARGS[1] = 'count':
- RESULT = prepclassstats['count']
- end
- if $ARGS[1] = 'set_count':
- prepclassstats['count'] = ARGS[2]
- end
- if $ARGS[1] = 'update_count':
- gs 'uniutil', 'prepclass', 'set_count', func('uniutil', 'prepclass', 'count') + 1
- end
- if $ARGS[1] = 'enroll':
- money -= func('uniutil', 'prepclass', 'cost')
- gs 'uniutil', 'prepclass', 'set_enrolled', 1
- gs 'uniutil', 'prepclass', 'set_count', 0
- end
- if $ARGS[1] = 'unenroll':
- killvar 'prepclassstats'
- end
- if $ARGS[1] = 'offered_this_month':
- RESULT = month <= func('uniutil', 'entrance_exam', 'month')
- end
- if $ARGS[1] = 'offered_today':
- RESULT = func('uniutil', 'entrance_exam', 'offered_this_month') and week < 6
- end
- if $ARGS[1] = 'in_session':
- RESULT = func('uniutil', 'prepclass', 'offered_today') and hour < func('uniutil', 'prepclass', 'closing_hour')
- end
- end
- if $ARGS[0] = 'entrance_exam':
- if $ARGS[1] = 'month':
- RESULT = 8
- end
- if $ARGS[1] = 'offered_today':
- RESULT = month = func('uniutil', 'entrance_exam', 'month')
- end
- if $ARGS[1] = 'is_passed':
- RESULT = pcs_intel + func('uniutil', 'prepclass', 'count') >= 60
- end
- if $ARGS[1] = 'print_month':
- $RESULT = $monthName[func('uniutil', 'entrance_exam', 'month')]
- end
- end
- !! The legacy vars are the vars used by the university before the vars were largely consolidated into
- !! arrays with string indices. This function exists to avoid breaking old save files with this change,
- !! which was made in September 2020. It can be removed whenever it is felt enough time has passed.
- if $ARGS[0] = 'transfer_legacy_vars':
- if abiturient > 0:
- gs 'uniutil', 'prepclass', 'set_enrolled', 1
- gs 'uniutil', 'prepclass', 'set_count', abiturient - 1
- end
- killvar 'abiturient'
- if kurs > 0:
- if (semestr = 1 and month < func('uniutil', 'entrance_exam', 'month')) or (semestr = 2 and month > func('uniutil', 'exam', 'month', 2)):
- !! under the old system, the semestr variable was advanced when the exam was passed, so if the
- !! variable is set to a value that does not match the current month, the player skipped the exam
- !! and is expelled
- gs 'uniutil', 'student', 'set_status', -2
- killvar 'unisemestrstats'
- elseif semestr = 2 and month = func('uniutil', 'exam', 'month', 1):
- !! semestr = 2 in first semester exam month in the old system indicates that its still the first
- !! semester (time-wise) but the exam has been passed, so we set the new variables accordingly.
- gs 'uniutil', 'semester', 'set', 1
- gs 'uniutil', 'attendance', 'reset'
- gs 'uniutil', 'assignment_progress', 'reset'
- gs 'uniutil', 'assignments_done', 'reset'
- gs 'uniutil', 'semester_result', 'set_passed'
- gs 'uniutil', 'passed_semesters', 'set', 0
- else
- gs 'uniutil', 'semester', 'set', semestr
- gs 'uniutil', 'attendance', 'set', lektor
- gs 'uniutil', 'assignment_progress', 'set', kursovik
- gs 'uniutil', 'assignments_done', 'set', kursovikD
- gs 'uniutil', 'semester_result', 'reset'
- gs 'uniutil', 'passed_semesters', 'set', iif(semestr = 2, 1, 0)
- end
- gs 'uniutil', 'semester', 'update_year'
- gs 'uniutil', 'scholarship', 'set', iif(stipuha = 1, func('uniutil', 'scholarship', 'honors_value'), 0)
- end
- killvar 'kurs'
- killvar 'semestr'
- killvar 'stipuha'
- killvar 'lektor'
- killvar 'kursovik'
- killvar 'kursovikD'
- killvar 'examen'
- end
- if $ARGS[0] = 'check_semester_vs_date':
- if year > func('uniutil', 'semester', 'get_year') + 1:
- !! if year has advanced by more than one since a semester was finished, semesters were skipped.
- RESULT = -1
- exit
- end
- unilect_sm = func('uniutil', 'lecture', 'start_month', func('uniutil', 'semester', 'get'))
- uniexam_m = func('uniutil', 'exam', 'month', func('uniutil', 'semester', 'get'))
- uniexam_mns = func('uniutil', 'exam', 'month', func('uniutil','semester', 'next'))
- if year = func('uniutil', 'semester', 'get_year') + 1:
- if month > uniexam_m mod 12 and func('uniutil', 'semester_passed') and month <= uniexam_mns:
- !! the semester was passed and the next one is not over
- RESULT = 1
- elseif month <= uniexam_m:
- !! the semester is still in progress
- RESULT = 0
- else
- !! expelled
- RESULT = -1
- end
- else
- if unilect_sm > uniexam_m or month <= uniexam_m:
- !! The semester is still in progress
- RESULT = 0
- elseif func('uniutil', 'semester_result', 'is_passed') and (uniexam_m > uniexam_mns or month <= uniexam_mns):
- !! the semester was passed and the next one is not over
- RESULT = 1
- else
- !! expelled
- RESULT = -1
- end
- end
- killvar 'unilect_sm'
- killvar 'uniexam_m'
- killvar 'uniexam_mns'
- end
- if $ARGS[0] = 'student':
- if $ARGS[1] = 'status':
- if student > 0:
- uni_semvdateres = func('uniutil', 'check_semester_vs_date')
- if uni_semvdateres < 0:
- !! date indicates semester exam skipped
- gs 'uniutil', 'student', 'expel'
- elseif uni_semvdateres > 0:
- !! date indicates semester exam passed and next semester started
- gs 'uniutil', 'semester', 'update'
- gs 'uniutil', 'semester', 'update_year'
- gs 'uniutil', 'semester_result', 'reset'
- gs 'uniutil', 'passed_semesters', 'update'
- else
- !! date indicates semester is still in progress
- gs 'uniutil', 'semester', 'update_year'
- end
- killvar 'uni_semvdateres'
- end
- RESULT = student
- end
- if $ARGS[1] = 'set_status':
- student = ARGS[2]
- end
- if $ARGS[1] = 'enroll':
- gs 'uniutil', 'prepclass', 'unenroll'
- gs 'uniutil', 'student', 'set_status', 1
- gs 'uniutil', 'semester', 'set', 1
- gs 'uniutil', 'semester', 'update_year'
- gs 'uniutil', 'scholarship', 'reset'
- gs 'uniutil', 'attendance', 'reset'
- gs 'uniutil', 'assignment_progress', 'reset'
- gs 'uniutil', 'assignments_done', 'reset'
- gs 'uniutil', 'semester_result', 'reset'
- end
- if $ARGS[1] = 'unenroll':
- gs 'uniutil', 'prepclass', 'unenroll'
- if student > 0:
- killvar 'student'
- killvar 'unisemestrstats'
- end
- end
- if $ARGS[1] = 'expel':
- if func('uniutil', 'semester_result', 'is_failed'):
- gs 'uniutil', 'student', 'unenroll'
- gs 'uniutil', 'student', 'set_status', -1
- elseif func('uniutil', 'check_semester_vs_date') < 0:
- gs 'uniutil', 'student', 'unenroll'
- gs 'uniutil', 'student', 'set_status', -2
- else
- gs 'uniutil', 'student', 'unenroll'
- gs 'uniutil', 'student', 'set_status', -3
- end
- end
- if $ARGS[1] = 'graduate':
- gs 'uniutil', 'student', 'unenroll'
- gs 'uniutil', 'diploma', 'set_obtained'
- end
- if $ARGS[1] = 'expelled_for_failing':
- RESULT = func('uniutil', 'student', 'status') = -1
- end
- if $ARGS[1] = 'expelled_for_skipping':
- RESULT = func('uniutil', 'student', 'status') = -2
- end
- if $ARGS[1] = 'expelled_for_other_reason':
- RESULT = func('uniutil', 'student', 'status') = -3
- end
- if $ARGS[1] = 'enrolled':
- RESULT = func('uniutil', 'student', 'status') > 0
- end
- if $ARGS[1] = 'not_enrolled':
- RESULT = func('uniutil', 'student', 'enrolled') = 0
- end
- if $ARGS[1] = 'semesters_to_graduate':
- RESULT = 2
- end
- end
- if $ARGS[0] = 'diploma':
- if $ARGS[1] = 'get':
- RESULT = diplom
- end
- if $ARGS[1] = 'set':
- diplom = ARGS[2]
- end
- if $ARGS[1] = 'set_obtained':
- gs 'uniutil', 'diploma', 'set', 1
- if func('uniutil', 'fake_diploma', 'aware_needed'):
- gs 'uniutil', 'fake_diploma', 'reset'
- end
- end
- if $ARGS[1] = 'obtained':
- RESULT = func('uniutil', 'diploma', 'get') > 0
- end
- end
- if $ARGS[0] = 'fake_diploma':
- if $ARGS[1] = 'get':
- RESULT = fakediplom
- end
- if $ARGS[1] = 'set':
- fakediplom = ARGS[2]
- end
- if $ARGS[1] = 'set_aware_needed':
- gs 'uniutil', 'fake_diploma', 'set', 2
- end
- if $ARGS[1] = 'set_obtained':
- gs 'uniutil', 'fake_diploma', 'set', 1
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'fake_diploma', 'set', 0
- end
- if $ARGS[1] = 'aware_needed':
- RESULT = func('uniutil', 'fake_diploma', 'get') = 2
- end
- if $ARGS[1] = 'obtained':
- RESULT = func('uniutil', 'fake_diploma', 'get') = 1
- end
- end
- if $ARGS[0] = 'appear_to_have_graduated':
- RESULT = func('uniutil', 'diploma', 'obtained') or func('uniutil', 'fake_diploma', 'obtained')
- end
- if $ARGS[0] = 'attendance':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['lectures_attendad']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['lectures_attendad'] = ARGS[2]
- end
- if $ARGS[1] = 'update':
- gs 'uniutil', 'attendance', 'set', func('uniutil', 'attendance', 'get') + 1
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'attendance', 'set', 0
- end
- if $ARGS[1] = 'is_great':
- RESULT = func('uniutil', 'attendance', 'get') > 55
- end
- if $ARGS[1] = 'is_ok':
- RESULT = func('uniutil', 'attendance', 'get') > 40
- end
- if $ARGS[1] = 'is_bad':
- RESULT = func('uniutil', 'attendance', 'is_ok') = 0
- end
- end
- if $ARGS[0] = 'assignment_progress':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['assignment_progress']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['assignment_progress'] = iif(ARGS[2] <= 100, ARGS[2], 100)
- end
- if $ARGS[1] = 'update':
- gs 'uniutil', 'assignment_progress', 'set', func('uniutil', 'assignment_progress', 'get') + rand(pcs_intel / 20, pcs_intel / 10)
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'assignment_progress', 'set', 0
- end
- if $ARGS[1] = 'is_finished':
- RESULT = func('uniutil', 'assignment_progress', 'get') >= 100
- end
- if $ARGS[1] = 'is_not_finished':
- RESULT = func('uniutil', 'assignment_progress', 'is_finished') = 0
- end
- end
- if $ARGS[0] = 'assignments_done':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['assignments_done']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['assignments_done'] = ARGS[2]
- end
- if $ARGS[1] = 'update':
- gs 'uniutil', 'assignment_progress', 'reset'
- gs 'uniutil', 'assignments_done', 'set', func('uniutil', 'assignments_done', 'get') + 1
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'assignments_done', 'set', 0
- end
- if $ARGS[1] = 'great_num':
- RESULT = 11
- end
- if $ARGS[1] = 'min_num':
- RESULT = 1
- end
- if $ARGS[1] = 'did_great_num':
- RESULT = func('uniutil', 'assignments_done', 'get') >= func('uniutil', 'assignments_done', 'great_num')
- end
- if $ARGS[1] = 'did_min_num':
- RESULT = func('uniutil', 'assignments_done', 'get') >= func('uniutil', 'assignments_done', 'min_num')
- end
- end
- if $ARGS[0] = 'scholarship':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['scholarship']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['scholarship'] = ARGS[2]
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'scholarship', 'set', 0
- end
- if $ARGS[1] = 'is_active':
- RESULT = unisemestrstats['scholarship'] > 0 and func('uniutil', 'semester', 'is_active')
- end
- if $ARGS[1] = 'honors_value':
- RESULT = 1200
- end
- end
- if $ARGS[0] = 'lecture':
- if $ARGS[1] = 'start_hour':
- RESULT = 8
- end
- if $ARGS[1] = 'length':
- RESULT = 6
- end
- if $ARGS[1] = 'start_month':
- if ARGS[2] = 1:
- RESULT = 9
- elseif ARGS[2] = 2:
- RESULT = 2
- else
- !! Set to impossible month if it is not semester 1 or 2
- RESULT = 13
- end
- end
- if $ARGS[1] = 'end_month':
- if ARGS[2] = 1:
- RESULT = 11
- elseif ARGS[2] = 2:
- RESULT = 4
- else
- !! Set to impossible month if it is not semester 1 or 2
- RESULT = 0
- end
- end
- if $ARGS[1] = 'offered_this_month':
- unilect_sm = func('uniutil', 'lecture', 'start_month', func('uniutil', 'semester', 'get'))
- unilect_em = func('uniutil', 'lecture', 'end_month', func('uniutil', 'semester', 'get'))
- if unilect_sm <= unilect_em:
- !! if semester is in one calendar year
- RESULT = month >= unilect_sm and month <= unilect_em
- else
- !! if semester continues through New Years
- RESULT = month >= unilect_sm or month <= unilect_em
- end
- killvar 'unilect_sm'
- killvar 'unilect_em'
- end
- if $ARGS[1] = 'offered_today':
- RESULT = func('uniutil', 'lecture', 'offered_this_month') and week < 6
- end
- if $ARGS[1] = 'in_session':
- RESULT = func('uniutil', 'lecture', 'offered_today') and hour < func('uniutil', 'lecture', 'start_hour')
- end
- if $ARGS[1] = 'print_start_month':
- $RESULT = $monthName[func('uniutil', 'lecture', 'start_month', ARGS[2])]
- end
- if $ARGS[1] = 'print_months':
- unilect_idx = func('uniutil', 'lecture', 'start_month', ARGS[2])
- unilect_end = func('uniutil', 'lecture', 'end_month', ARGS[2])
- :lectureprintmonthsloop
- $RESULT += $monthname[unilect_idx]
- if unilect_idx ! unilect_end:
- $RESULT += ', '
- unilect_idx = (unilect_idx mod 12) + 1
- jump 'lectureprintmonthsloop'
- end
- killvar 'unilect_idx'
- killvar 'unilect_end'
- end
- end
- if $ARGS[0] = 'exam':
- if $ARGS[1] = 'month':
- if ARGS[2] = 1:
- RESULT = 12
- elseif ARGS[2] = 2:
- RESULT = 5
- else
- !! Set to impossible month if it is not semester 1 or 2
- RESULT = 0
- end
- end
- if $ARGS[1] = 'offered_this_month':
- RESULT = month = func('uniutil', 'exam', 'month', func('uniutil', 'semester', 'get'))
- end
- if $ARGS[1] = 'offered_today':
- RESULT = func('uniutil', 'exam', 'offered_this_month') and week < 6
- end
- if $ARGS[1] = 'print_month':
- $RESULT = $monthname[func('uniutil', 'exam', 'month', ARGS[2])]
- end
- end
- if $ARGS[0] = 'semester':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['num']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['num'] = ARGS[2]
- end
- if $ARGS[1] = 'next':
- RESULT = (func('uniutil', 'semester', 'get') mod func('uniutil', 'semester', 'total')) + 1
- end
- if $ARGS[1] = 'total':
- RESULT = 2
- end
- if $ARGS[1] = 'update':
- gs 'uniutil', 'semester', 'set', func('uniutil', 'semester', 'next')
- end
- if $ARGS[1] = 'get_year':
- RESULT = unisemestrstats['year']
- end
- if $ARGS[1] = 'update_year':
- unisemestrstats['year'] = year
- end
- if $ARGS[1] = 'is_active':
- RESULT = func('uniutil', 'lecture', 'offered_this_month') or func('uniutil', 'exam', 'offered_this_month')
- end
- if $ARGS[1] = 'print_months':
- $RESULT = 'Semester ' + ARGS[2] + ' lectures: ' + func('uniutil', 'lecture', 'print_months', ARGS[2]) + '.
- '
- $RESULT += 'Semester ' + ARGS[2] + ' exams: ' + func('uniutil', 'exam', 'print_month', ARGS[2]) + '.
- '
- end
- if $ARGS[1] = 'print_all_months':
- unisemester_idx = 1
- :semesterprintmonthsloop
- $RESULT += func('uniutil', 'semester', 'print_months', unisemester_idx)
- if unisemester_idx < func('uniutil', 'semester', 'total'):
- unisemester_idx += 1
- jump 'semesterprintmonthsloop'
- end
- killvar 'unisemester_idx'
- end
- end
- if $ARGS[0] = 'semester_result':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['is_passed']
- end
- if $ARGS[1] = 'set':
- unisemestrstats['is_passed'] = ARGS[2]
- end
- if $ARGS[1] = 'set_passed':
- gs 'uniutil', 'semester_result', 'set', 1
- end
- if $ARGS[1] = 'set_failed':
- gs 'uniutil', 'semester_result', 'set', -1
- end
- if $ARGS[1] = 'reset':
- gs 'uniutil', 'semester_result', 'set', 0
- end
- if $ARGS[1] = 'is_passed':
- RESULT = func('uniutil', 'semester_result', 'get') > 0
- end
- if $ARGS[1] = 'is_failed':
- RESULT = func('uniutil', 'semester_result', 'get') < 0
- end
- end
- if $ARGS[0] = 'exam_outcome':
- gs 'uniutil', 'assignment_progress', 'reset'
- gs 'uniutil', 'assignments_done', 'reset'
- gs 'uniutil', 'attendance', 'reset'
- if $ARGS[1] = 'passed_honors':
- gs 'uniutil', 'semester_result', 'set_passed'
- gs 'uniutil', 'scholarship', 'set', func('uniutil', 'scholarship', 'honors_value')
- elseif $ARGS[1] = 'passed':
- gs 'uniutil', 'semester_result', 'set_passed'
- gs 'uniutil', 'scholarship', 'reset'
- else
- gs 'uniutil', 'semester_result', 'set_failed'
- gs 'uniutil', 'scholarship', 'reset'
- end
- end
- if $ARGS[0] = 'passed_semesters':
- if $ARGS[1] = 'get':
- RESULT = unisemestrstats['prev_passed_count'] + iif(func('uniutil', 'semester_result', 'is_passed'), 1, 0)
- end
- if $ARGS[1] = 'set':
- unisemestrstats['prev_passed_count'] = ARGS[2]
- end
- if $ARGS[1] = 'update':
- gs 'uniutil', 'passed_semesters', 'set', func('uniutil', 'passed_semesters', 'get')
- end
- end
- --- uniutil ---------------------------------
|