Browse Source

[added] New employment system with connection to tourist guide job from Hooded Silence

Kevin_Smarts 1 year ago
parent
commit
dac13ee2cc

+ 4 - 0
glife.qproj

@@ -558,6 +558,10 @@
 		<Location name="fbGar"/>
 		<Location name="zsoft_gopskverGorSlut"/>
 	</Folder>
+	<Folder name="Employment Systems">
+		<Location name="emp_functions"/>
+		<Location name="emp_job_array"/>
+	</Folder>
 	<Folder name="Fedor">
 		<Location name="FedorEv"/>
 		<Location name="FedorEv2"/>

+ 278 - 0
locations/emp_functions.qsrc

@@ -0,0 +1,278 @@
+# emp_functions
+
+!! Employmnent and Event Systems
+!! 2022-09-30
+!! Author: Hooded Silence
+!!
+!! v.01 - Initial code base
+!! v.02 - Event generator partially integrated
+!! v.03 - Job management system integrated
+!! 
+
+!! --------------------- UI Interface for Journal
+
+if $ARGS[0] = 'gen_schedule':
+	*clr & cla 
+		if night_mode = 1 or night_mode = 2:
+		$header_theme = '#91B0B4'
+		$body_theme = '#303030'
+		$body_theme_alt  = '#474747'
+		$font_theme = '#000000'
+	else
+		$header_theme = '#e27c00'
+		$body_theme = '#E0DED4'
+		$body_theme_alt  = '#D58B32'
+		$font_theme = '#FFFFFF'
+	end
+	if  function_sw = 1:	'<center><h2>' + $npc_firstname['A<<mod_npc_id>>'] + ' ' + $npc_lastname['A<<mod_npc_id>>'] + '</h2></center>'
+	if function_sw = 2: 
+		gs 'journal', 'journalmenu'
+		'<center><h2>Work</h2></center>'
+	end
+	!! Enable selector if attending school or Uni by NPC group type or by character and set default to School
+	if (npc_grupTipe['A<<mod_npc_id>>']>= 1 and npc_grupTipe['A<<mod_npc_id>>']<= 5) or mod_npc_id = 34 and function_sw <= 1: 
+		if flag_schedule = 0: flag_schedule = 1
+		school_group = 1
+		'<center>Change to: <a href="exec: flag_schedule = 1 & gs ''emp_functions'', ''gen_schedule''">School</a> | <a href="exec: flag_schedule = 2 &  gs ''emp_functions'', ''gen_schedule''">University</a> | <a href="exec: flag_schedule = 3 &  gs ''emp_functions'', ''gen_schedule''">Holiday</a> </center>'
+	else
+		!! Set schedule to holiday / non-edu NPCs
+		flag_schedule = 3
+	end
+
+	!! Initiate loop variables
+
+	i_day = 1
+    mod_max_day = 7
+	i_hour = ARGS[1]
+    mod_max_hour = ARGS[1] + 8 
+    header_switch = 1
+	killvar '$tablebody'   
+	killvar '$tableheader'
+
+	!! create header, using header switch to fill in :00 or :30 automatically using mod to determine odd/even and set display hour automatically.
+
+	$tableheader = '<tr border="1" align="center"  bgcolor="<<$header_theme>>"><th style="padding: 10px;"></th>'
+	:jmp_header_create
+		if (i_hour mod 2) = 0:
+			display_hour = i_hour/ 2
+		end
+		if display_hour = 24: Display_hour = 0
+		if header_switch = 1:
+			header_switch += 1
+			$tableheader += '<th style="padding: 10px;"><font color="<<$font_theme>>">' + iif(display_hour < 10, '0<<display_hour >>', display_hour) + ':00</font></th>'
+		elseif header_switch=2: 
+			header_switch = 1
+			$tableheader += '<th style="padding: 10px;"><font color="<<$font_theme>>">' + iif(display_hour < 10, '0<< display_hour>>', display_hour) + ':30</font></th>'
+		end		
+		i_hour += 1
+	if i_hour <=  mod_max_hour: jump 'jmp_header_create'
+	! Reset i_hour for next loop	
+	killvar 'display_hour'
+	killvar 'header_switch'
+	i_hour = ARGS[1]
+	header_switch = 1
+	!! Close out table header
+	$tableheader += '</tr>'
+	!! Create table body, with alternating colour rows for legibility
+    :jmp_day_create
+
+        !Set day
+        if i_day = 1 or i_day = 3 or i_day = 5 or i_day = 7:
+			$tablebody += '<tr><td  style="padding: 10px;" bgcolor="<<$header_theme>>"><b><font color="<<$font_theme>>">' + $week[i_day] + '</font></b></td>'
+		else
+			$tablebody += '<tr bgcolor="<<$body_theme_alt>>"><td  style="padding: 10px;" bgcolor="<<$header_theme>>"><b><font color="<<$font_theme>>">' + $week[i_day] + '</font></b></td>'
+		end
+		!! fill the slots from the NPC schedule
+
+        :jmp_hour_create 
+			if i_day >= 1:
+
+				!! Create function switcher:
+				!! 1: NPC tracker
+				!! 2: Job tracker
+				!! 3: Event Tracker
+
+				if function_sw = 1 or function_sw = 0:
+					dynamic $schedule_tracker 
+				elseif function_sw = 2:
+                    flag_active  = 1
+                    j_id = emp_rota_week[i_day +  '_' + i_hour]
+                    if emp_rota_week[i_day +  '_' + i_hour] ! 0:							
+                        $transient_tb =  '<a  href="exec:gs ''emp_functions'', ''job_info'', <<j_id>>">' + $emp_job_title[j_id] + '</a>'
+                    else
+                        $transient_tb  = 'Free'
+                    end
+				elseif function_sw = 3:
+				else
+					msg 'Error - Failed to create body. Please set content switch.'
+				end
+
+				if flag_active = 0:
+					$tablebody += '<td style="padding: 10px;">Slot: ' + i_hour +'</td>'
+				else
+					$tablebody +=  '<td style="padding: 10px;">' + $transient_tb +'</td>'
+					flag_active = 0
+					killvar '$transient_tb'
+				end	
+			else
+				 i_day += 1
+				 jump 'jmp_day_create'
+			end
+			i_hour += 1
+            if i_hour <=  mod_max_hour: jump 'jmp_hour_create'
+			$tablebody +='</tr>'
+			i_day += 1
+			i_hour = ARGS[1]
+        if i_day <= mod_max_day: jump 'jmp_day_create'	
+	!! Create navigaton bars
+	if (mod_max_hour + 8)  <= 48:
+		set_hour = ARGS[1] + 8
+		$msg_forward = '<a  href="exec:gs ''emp_functions'', ''gen_schedule'', <<set_hour>>"><b>Forward 4 hours</b></a>'
+	else
+		$msg_forward = 'End of Day'
+	end
+    if (mod_max_hour  - 8) >0 :
+		set_hour = ARGS[1] - 8
+        $msg_back = '<a  href="exec:gs ''emp_functions'', ''gen_schedule'', <<set_hour>>"><b>Back 4 hours</b></a>'
+    else
+		$msg_back = 'Start of day'
+    end
+
+    !! Start the table constuction    
+    '<center><table border=0 cellpadding=1 bgcolor="<<$body_theme>>" width="95%" align="center"><<$tableheader>><<$tablebody>></table>'
+    '<<$msg_back>> | <<$msg_forward>>'
+    *nl
+    if  function_sw = 1:
+	'<b>Note:</b> Times are approximate, some characters will appear at quarter past or quarter to the hour.</center>' 
+	end
+	if  function_sw = 2:
+		'<b>Note:</b> Times are approximate, some jobs may extend past the allotted time or have flexi-starts.</center>' 
+	end
+    act 'Back':
+		killvar 'flag_schedule'
+		killvar 'school_group'
+		killvar 'j_id'
+		gt $loc, $loc_arg
+	end
+end
+
+!! Job Info popup
+if $ARGS[0] = 'job_info':
+	j_id = ARGS[1]
+	killvar '$msg_body'
+	$msg_body +=  '<p>Job Title: ' + $emp_job_title[j_id] + '</p>'
+	$msg_body += '<p>Location: ' + $emp_job_loc[j_id] + '</p>'
+	$msg_body += '<p>Notes: ' + $emp_job_notes[j_id]+ '</p>'
+	$msg_body += '<p>Wages: ' +emp_job_wages[j_id] + '<b>₽</b></p>'
+	
+	msg '<<$msg_body>>'
+end
+
+!!  Removed event generation for initial code review and to make job integration easier.
+
+!! --------------------- Event Generator
+
+!! Author - Hooded Silence
+!! Date created - 26 Aug 22
+!! Event Generator - filler content only for one off events or recurring work from NPCs
+!!
+!! v. 01 - Initial code base
+!! v. 02 - UI improvements and feature feedback
+
+
+!! --------------------- Job management system
+
+
+!! book role, creates a time slot for emp_rota_week in format day_hour to be used in schedule mode.
+
+if $ARGS[0] = 'emp_booking':
+	gs 'emp_functions', 'emp_chk_clk'
+	if emp_rota_fail  = 0:	
+		gs 'emp_functions', 'loop_configure'
+		j_finish = emp_job_end[j_id]
+		:jmp_daily_book
+			j_idx = emp_job_start[j_id]
+			:jmp_hour_book
+				emp_rota_week[d_idx + '_' + j_idx]  = j_id
+				j_idx += 1
+			if j_idx <= j_finish: jump 'jmp_hour_book'	
+			d_idx += 1
+		if d_idx <= d_end: jump 'jmp_daily_book'
+		emp_job_status[j_id] = 1
+		emp_job[active] += 1
+		killvar 'j_idx'
+		killvar 'j_finish'
+		killvar 'd_idx'
+		killvar 'd_end'
+	else
+		msg 'Sorry, you''ve already got a job for this time period.'
+	end
+
+	killvar 'emp_rota_fail'
+end
+
+!! check if time slots are avaialble for this role. 
+
+if $ARGS[0] = 'emp_chk_clk':	
+	gs 'emp_functions', 'loop_configure'
+	j_finish = emp_job_end[j_id]
+	:jmp_daily_chk
+		j_idx = emp_job_start[j_id]
+		:jmp_job_chk
+			if emp_rota_week[d_idx + '_' + j_idx]  >  0:
+				!! booking failed					
+				emp_rota_fail = 1
+			else
+				!! booking passed
+				emp_rota_fail = 0
+			end	
+			j_idx +=1
+		if j_idx <= j_finish and emp_rota_fail = 0: jump 'jmp_job_chk'	
+		d_idx += 1
+	if d_idx <= d_end and emp_rota_fail = 0: jump 'jmp_daily_chk'
+end
+
+if $ARGS[0] = 'emp_terminate':
+	if ARGS[1] >= 4:
+		gs 'emp_functions', 'loop_configure'
+		j_finish = emp_job_end[j_id]
+		:jmp_daily_book
+			j_idx = emp_job_start[j_id]
+			:jmp_hour_book
+				emp_rota_week[d_idx + '_' + j_idx] = 0
+				j_idx += 1
+			if j_idx <= j_finish: jump 'jmp_hour_book'	
+			d_idx += 1
+		if d_idx <= d_end: jump 'jmp_daily_book'
+		!! Set the termination value
+		emp_job_status[j_id] = ARGS[1]
+		emp_job[active] -= 1
+	else
+		msg 'Job termination failed. Please ensure you set to  4 - Terminated or 5 - Fired'
+	end
+	killvar 'j_idx'
+	killvar 'j_finish'
+	killvar 'd_idx'
+	killvar 'd_end'	
+end
+
+if $ARGS[0] = 'loop_configure':	
+	if  j_day= 0 or j_day = 1 or j_day = 2:
+		d_idx = 1
+	else
+		d_idx= 6
+	end
+	if  j_day <= 1:
+		d_end = 5
+	else
+		d_end= 7
+	end	
+end
+--- emp_functions ---------------------------------
+
+
+
+
+
+
+

+ 124 - 0
locations/emp_job_array.qsrc

@@ -0,0 +1,124 @@
+# emp_job_array
+
+!! Jobs array
+!! < 4 hours is classed as ad-hoc work 
+!! => 4 hours is contract roles
+!! Events are non-permanent employment of varying rates/times and set in the future.
+!!
+!! Index:
+!! 1 - Tourist Guide
+!! 2 - Pavlosk Hotel Maid
+!! 3 - Pussy Kats Shop Assistant
+!! 4 - Titran Secretary
+!! 5 - City Burger Joint
+
+if $ARGS[0] = 'emp_tourist_guide':
+	!! Transitory variables to initialise job start - REQ
+	j_id = 1
+	
+	!! j_day defines work days: 1 - Mon-Sun, 2 Mon-Fr, 3 Weekend.  - REQ
+	j_day = 2
+
+	!! Role ID - Array index and used as job identifier.
+	emp_job_id[j_id] = 1
+	
+	!! Job Role	- REQ
+	$emp_job_title[j_id] = 'Tourist Guide' 
+	
+	!! Job start time - a day has 48 slots from base 0 - REQ
+	emp_job_start[j_id] = 16
+	
+	!! Job finish time - REQ
+	emp_job_end[j_id] = 32
+	
+	!! Job pay rate- REQ
+	emp_job_wages[j_id] = 1000
+	
+	!! Job employment location- REQ
+	$emp_job_loc[j_id] = 'Pavlosk Park'
+	
+	!! Job notes - to remind the player of the job details
+	$emp_job_notes[j_id] = 'Summer job with flexible days - start between 08:00 and 09:00'
+		
+	if emp_job_status[j_id] < 1:
+		!! Job status 1 Employed, 2 Started with favour, 3 Started with merit, 4 Terminated/suspended, 5 Fired permanently - REQ. <= 10 reserved for core mechanics, 10 + for custom quest markers
+		emp_job_status[j_id] = 0
+	end
+	if emp_job_rank[j_id] < 1:
+		!! Job ranking system for promotions and career progression. - Opt
+		emp_job_rank[j_id] = 1
+	end
+	
+end
+
+if $ARGS[0] = 'emp_pav_maid':
+	j_id = 2
+	j_day = 2
+	emp_job_id[j_id] = 2
+	$emp_job_title[j_id] = 'Hotel Maid'
+	emp_job_start[j_id] = 33
+	emp_job_end[j_id] = 40
+	emp_job_wages[j_id] = 375
+	$emp_job_loc[j_id] = 'Pavlosk Park'
+	$emp_job_notes[j_id] = 'Be at the Pavlosk Hotel reception between 16:00-17:00 to start your shift.'		
+	if emp_job_status[j_id] < 1:
+		emp_job_status[j_id] = 0
+	end
+	if emp_job_rank[j_id] < 1:
+		emp_job_rank[j_id] = 1
+	end
+
+end
+
+if $ARGS[0] = 'emp_pussy_kats':
+	j_id = 3
+	if ARGS[1] = 1:
+		!! Weekdays
+		j_day = 2
+		emp_job_start[j_id] = 32
+		emp_job_end[j_id] = 40
+	else
+		!! P/T weekend
+		j_day = 3
+		emp_job_start[j_id] = 18
+		emp_job_end[j_id] = 30
+	end
+	emp_job_id[j_id] = 3
+	$emp_job_title[j_id] = 'Shop Assistant'
+	emp_job_wages[j_id] = 205
+	$emp_job_loc[j_id] = 'Pussy Cats'
+	$emp_job_notes[j_id] = 'Shop assistant at Pussy Cat''s in the City Center Mall. You''ve missed <<young_shop_miss>> day(s).'
+		
+	if emp_job_status[j_id] < 1:
+		emp_job_status[j_id] = 0
+	end
+	if emp_job_rank[j_id] < 1:
+		emp_job_rank[j_id] = 1
+	end
+
+end
+
+if $ARGS[0] = 'emp_titran':
+	j_id = 4
+	j_day = 2
+	emp_job_start[j_id] = 18
+	emp_job_end[j_id] = 34
+
+	emp_job_id[j_id] = 3
+	$emp_job_title[j_id] = 'Secretary'
+	emp_job_wages[j_id] = 1500
+	$emp_job_loc[j_id] = 'Titran-Express Engineering'
+	$emp_job_notes[j_id] = 'You work as a secretary at Titran Express. You need to come to work by 09:00 during the week Monday-Friday. Salary is automatically transferred on the 25th of each month.'
+		
+	if emp_job_status[j_id] < 1:
+		emp_job_status[j_id] = 0
+	end
+
+	!! Secretatry Career examples
+	!! 1 Office Secretary 2 Pool Secretary 3 Head Secretary 4 PA - Trainable through the Ind Comm Ctr
+	if emp_job_rank[j_id] < 1:
+		emp_job_rank[j_id] = 1
+	end
+end
+
+--- emp_job_array ---------------------------------

+ 12 - 14
locations/journal_work.qsrc

@@ -1,14 +1,11 @@
 # journal_work
-! Created 12/9/22 
-! 12/9/22 Initial code
-! Authored by Hooded Silence
-! Game Character work section. This is the container file for all work roles in game. Used to track income, work days and other relevant data.
-! V .01 Refactored code from Journal section into it''s own section to make legibility easier.
-!
-! Work Variables:
-!
-! employed[qw] = Work tracker if employed. To be set on starting or leaving a job.
-
+!! Created 12/9/22 
+!! 12/9/22 Initial code
+!! Authored by Hooded Silence
+!! Game Character work section. This is the container file for all work roles in game. Used to track income, work days and other relevant data.
+!! V .01 Refactored code from Journal section into it''s own section to make legibility easier.
+!! V. 02 New job schedule system integrated
+!!
 
 if $ARGS[0] = 'start':
 
@@ -18,8 +15,11 @@ if $ARGS[0] = 'start':
 	$jumploc = 'worktab'
 	gs 'journal', 'journalmenu'
 	'<center><h2>Work</h2></center>'
-	if employedqw['status'] = 0:
+	if emp_job[active] < 1:
 		'You need to find a job or get training to develop your career. Check the Quests or Information section.'
+	else
+		function_sw = 2
+		gs 'emp_functions', 'gen_schedule'
 	end
 	
 	if workPTU > 2:'You work as a teacher at the Lycée and your schedule is Monday to Saturday, teaching between 14:00 and 16:00. Your salary is 300 <b>₽</b> per day.'
@@ -32,7 +32,7 @@ if $ARGS[0] = 'start':
 	if (work = 1 or cheatWork = 1) and young_shop_work1 = 1:'You work in the city as a store clerk at the Pussy Cats clothing store. Work starts at 09:00 Saturday and Sunday. The salary shall be issued once a week, on Fridays.'
 	if (work = 1 or cheatWork = 1) and young_shop_work2 = 1:'You work in the city as a store clerk at the Pussy Cats clothing store. Work starts at 09:00 Monday through Friday. The salary shall be issued once a week, on Fridays.'
 	if (work = 1 or cheatWork = 1) and workFabrika = 1:'You work as a seamstress in the factory in Pavlovsk. Work is every weekday, with weekends off. Salary is automatically transferred on the 25th of each month.'
-	if (work = 1 or cheatWork = 1) and TourGuide = 1:'You work as a tour guide in the Pavlovsk park. Work is any day during the summer holidays for 8 hours, starting between 08:00 and 12:00. Salary is 1,000 <b>₽</b> .'
+	!!if (work = 1 or cheatWork = 1) and TourGuide = 1:'You work as a tour guide in the Pavlovsk park. Work is any day during the summer holidays for 8 hours, starting between 08:00 and 12:00. Salary is 1,000 <b>₽</b> .'
 	if workrin = 1:'You are working at the market in Arthur''s tent as a clothing saleswoman. You work on Tuesday, Thursday and Saturday with a start time of 08:00. Salary depends on sales.'
 	if maidqw = 1:
 		'You work in the Pavlovsk hotel as a maid. Your work schedule is every day from 16:00 to 19:00 and your salary is 250 <b>₽</b> plus tips.'
@@ -144,6 +144,4 @@ if $ARGS[0] = 'start':
 		end
 	end
 end
-
-
 --- journal_work ---------------------------------

+ 4 - 5
locations/pav_park.qsrc

@@ -226,15 +226,14 @@ if $ARGS[0] = 'start':
 		if hour >= 8 and hour <= 18:
 			act 'Apply for the Tour Guide job (0:30)':gt 'tour_guide', 'tourstart'
 		end
-	elseif month >= 6 and month <=8 and TourGuide = 1:
+	elseif month >= 6 and month <=8 and emp_job_status[1] = 1 and (emp_job_status[1] ! 4 or emp_job_status[1] ! 5):
 		if hour >= 8 and hour <= 12:
 			act 'Work as Tour Guide (8:00)':gt 'tour_guide', 'tourstart'
 		end
-	elseif month >= 9 and month <= 5 and TourGuide = 1:
-		TourGuide = 0
+	elseif emp_job_status[1] = 1:
+		!! out of season
 		work = 0
-	elseif month >= 9 and month <= 5 and TourGuide = 3:
-		TourGuide = 0
+		emp_job_status[1]  = 4
 	end
 
 	if mey_vika['mey_vika_qw'] > 0 and mey_vika['mey_vika_qw'] < 27 and mey_vika['qw_day'] ! daystart:

+ 15 - 6
locations/tour_guide.qsrc

@@ -1,6 +1,7 @@
 # tour_guide
 ! Tour Guide - Full Time Summer Only Job
 
+
 if $ARGS[0] = 'tourstart':
 	CLOSE ALL
 	$loc = 'tour_guide'
@@ -10,7 +11,8 @@ if $ARGS[0] = 'tourstart':
 	$menu_arg = 'tourstart'
 	menu_off = 1
 	cla & *clr
-	if TourGuide = 0:
+	!! TourGuide = 0
+	if (emp_job_status[1] = 0  or emp_job_status[1] =4) and emp_job_status[1] ! 5:
 		minut += 30
 		gs 'stat'
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/palace/office/tour_office.jpg"></center>'
@@ -19,17 +21,21 @@ if $ARGS[0] = 'tourstart':
 		'You answer a few questions the management team asks you and are offered a summer position at 100 <b>₽</b> an hour, 8 hours a day. Fresh uniforms are provided daily and training will be you shadowing another guide for the first couple of days to make sure you know the details required to lead your groups.'
 		'Like any teenager your only questions are about breaks and days off. The manager smiles, not surprised, and tells you that working is voluntary. If you do not show up then obviously you will not make any money that day, but otherwise no daily commitment is required from you. Breaks will be allowed if there are no groups to lead at that time and you will be given a small lunch everyday that you choose to work.'
 		act 'Accept the position':
+			gs 'emp_job_array', 'emp_tourist_guide'
 			if cheatWork = 1:
-				TourGuide = 1
+				!TourGuide = 1
+				gs 'emp_functions','emp_booking'
 				gt 'pav_park', 'start'
 			else
-				TourGuide = 1
+				!TourGuide = 1
+				gs 'emp_functions','emp_booking'
 				work = 1
 				gt 'pav_park', 'start'
 			end
 		end
 		act 'Change your mind': gt 'pav_park', 'start'
-	elseif TourGuide = 1:
+		!! TourGuide = 1
+	elseif emp_job_status[1] = 1:
 		*clr & cla
 		minut += 240
 		inhib_exp += rand(0,1)
@@ -395,7 +401,8 @@ if $ARGS[0] = 'resign':
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/palace/office/angry_boss.jpg"></center>'
 	'You let your boss know you have decided to quit your job for the rest of the summer. He is not pleased about you quitting, but manages to keep his temper and lets you know if you want to come back next summer he will at least consider it.'
 	act 'Resign':
-		TourGuide = 3
+		gs 'emp_functions','emp_terminate', 4
+		!! TourGuide = 3
 		work = 0
 		gt 'pav_park', 'start'
 	end
@@ -431,7 +438,8 @@ if $ARGS[0] = 'backroom':
 	end
 	act 'Take your punishment': gt 'tour_guide', 'spank'
 	act 'Quit your job':
-		TourGuide = 2
+		gs 'emp_functions','emp_terminate', 5
+		!! TourGuide = 2
 		work = 0
 		killvar 'riverbusted'
 		pcs_mood -= 25
@@ -510,5 +518,6 @@ if $ARGS[0] = 'after_spank':
 	act 'Leave the office': gt 'pav_park', 'start'
 end
 
+
 --- tour_guide ---------------------------------