:: crossfit_north_box
<<set $here = 'crossfit_north_box'>>
<<set $ARGS = $location_var[$here]>>
<<set $menu_off = 0>>
<<gs 'shortgs' 'setloc' 'crossfit_north_box' $location_var[$here][0]>>
<<set $sexloc = 'crossfit_north_box'>>
<<set $location_type = 'public_indoors'>>
<<set $crossfit_north_image_dir = 'images/locations/city/citycenter/gym/crossfit/'>>
<<if $location_var[$here][0] == 'box'>>
	<<act 'Leave'>>
		<<gt 'fit' 'dressing_room'>>
	<</act>>
	<<if $crossfit_random_choice < daystart OR $todays_crossfit_wod>>
		<<gs 'crossfit_north_wod' 'setup_wod'>>
		<<set $todays_crossfit_wod = $crossfit_wods[rand(0, ARRSIZE('$crossfit_wods') - 1)]>>
		<<set $crossfit_random_choice = $time.daystart>>
	<</if>>
	<<if $previous_record_holder != '' and getvar("$pcs_lover") < 3 and $last_crossfit_workout < $time.daystart>>
		<<gt 'crossfit_north_girlmeet' 'start'>>
	<</if>>
	<h2>Crossfit North St. Petersburg</h2>
	<center><img <<$set_imgh>> src="<<$crossfit_north_image_dir>>start.jpg"></center>
	This crossfit box might not look like it, but is said to be one of the best ones in the region.
	<p>Today's exercise is $todays_crossfit_wod.</p>
	It consists of:
	<<gs 'crossfit_north_wod' $todays_crossfit_wod>>
	<<if getvar("$crossfit_first") == 1>>
		<<actCLA 'Check personal records'>>
			<<set $menu_off = 1>>
			<<gt 'crossfit_north_record' 'view_records'>>
		<</actCLA>>
	<</if>>
	<<if $pc.pcs_energy >= 20 and $pc.pcs_stam >= $pc.stammax / 5>>
		<<actCLA 'Start the exercise'>>
			<<set $menu_off = 1>>
			<<if $last_crossfit_workout == $time.daystart>>
				<<msg '<b><font color = red>You already did this workout today. That""s enough for one day.</font></b>'>>
			<<else>>
				<<set $last_crossfit_workout = $time.daystart>>
				<<set $crossfit_first = 1>>
				<<set $abonement -= 1>>
				You start with the workout.
				<<gs 'crossfit_north_wod' $todays_crossfit_wod>>
				<<gs 'exercise' 'tier4' 20 'stren' 'vital' 'agil'>>
				<center><video autoplay loop src="<<$crossfit_north_image_dir>><<$wod_video[$todays_crossfit_wod]>>.mp4"></video></center>
				<<set $current_wod_score = Math.max(1,(100 - ((100 * pcs_health * (rand(40,100) + pcs_sleep  + pcs_vital + pcs_agil + pcs_stren))/ ($pc.healthmax * 500))))>>
				<<actCLA 'Check your score'>>
					<<set $resultstring = setup.func('crossfit_north_record', 'recordstring', $todays_crossfit_wod,  current_wod_score)>>
					<p>You successfully finish the workout $pc.name_nick in $resultstring</p>
					<<if getvar("$personal_wod_record["+$todays_crossfit_wod+"]") == 0>>
						<<setinit $personal_wod_record[$todays_crossfit_wod] = $current_wod_score>>
					<<elseif $current_wod_score < $personal_wod_record[$todays_crossfit_wod]>>
						<p>This is a new personal record!</p>
						<<setinit $personal_wod_record[$todays_crossfit_wod] = $current_wod_score>>
					<</if>>
					<<if getvar("$box_wod_record["+$todays_crossfit_wod+"]") == 0>>
						<<setinit $box_wod_record[$todays_crossfit_wod] = $current_wod_score>>
						<<setinit $box_wod_record_holder[$todays_crossfit_wod] = $pc.name_nick>>
					<<elseif $current_wod_score < $box_wod_record[$todays_crossfit_wod]>>
						<p>Not only that, it's also a new best record for the whole box!</p>
						<<set $prevrecordstring = setup.func('crossfit_north_record', 'recordstring', $todays_crossfit_wod, box_wod_record[$todays_crossfit_wod])>>
						<<if $box_wod_record_holder[$todays_crossfit_wod] != $pc.name_nick>>
							<<set $previous_record_holder = $box_wod_record_holder[$todays_crossfit_wod]>>
							<p>You beat $previous_record_holder's record of $prevrecordstring</p>
						<<else>>
							<p>You beat your own old box record of $prevrecordstring</p>
						<</if>>
						<<set $prevrecordstring to null>>
						<<setinit $box_wod_record[$todays_crossfit_wod] = $current_wod_score>>
						<<setinit $box_wod_record_holder[$todays_crossfit_wod] = $pc.name_nick>>
					<</if>>
					<<set $current_wod_score to null>>
					<<act 'Finish and go to the changing room'>>
						<<gt 'fit' 'dressing_room'>>
					<</act>>
				<</actCLA>>
			<</if>>
		<</actCLA>>
	<<elseif $pc.pcs_stam >= $pc.stammax / 5>>
		<!-- FAILED TO CONVERT
			act 'Start the exercise': '<br><font color="red">You feel too hungry to do this exercise now.</font>'
		-----
			<<actCLA 'Start the exercise'>>
			<<set ERROR: FAILED TO CONVERT LITERAL: """'<br><font color""" = ERROR: FAILED TO CONVERT LITERAL: """"red">You feel too hungry to do this exercise now.<""" / ERROR: FAILED TO CONVERT LITERAL: """font>'""">>
		<</actCLA>>

		-->
		<<warn "CONVERSION ERROR f19cce635edcedfbd8a99e50b66188a0">>
	<<else>>
		<!-- FAILED TO CONVERT
			act 'Start the exercise': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to do this exercise.</font>'
		-----
			<<actCLA 'Start the exercise'>>
			<<set ERROR: FAILED TO CONVERT LITERAL: """'<br><font color""" = ERROR: FAILED TO CONVERT LITERAL: """"red">You are to exhausted to do this. Recover your stamina before trying to do this exercise.<""" / ERROR: FAILED TO CONVERT LITERAL: """font>'""">>
		<</actCLA>>

		-->
		<<warn "CONVERSION ERROR 7bf49017e26f32de1e237cb568379d7e">>
	<</if>>
<</if>>
