:: music_actions
<<set $here = 'music_actions'>>
<<set $ARGS = $location_var[$here]>>
<<if $location_var[$here][0] == 'music_icon'>>
	<!-- !! Everywhere-->
	<<set $ml_time_left = $ml_performance['max_perform_minutes']-$ml_performance['performed_minutes']>>
	<<if $pc.alko > 5>>
		You are too drunk to stream or record music without messing up or throwing up into your guitar.
		<!-- !! $location_type = ''public_outdoors'' means parks, streets. Some event types can be placed in these locations : playing music, recording music - e.g in front of-->
		<!-- !! the library, or at the church, etc.-->
	<<elseif $location_type == 'private' or ($location_type == 'public_outdoors' and !$weather.isRaining and $weather.temperature > 15) and getvar("$ml_no_music") == 0>>
		<<if $time.hour < 8>>
			It's too early to do anything noisy like playing the guitar or singing.
		<<elseif $time.hour > 22>>
			It's too late to do anything noisy like playing the guitar or singing.
		<<else>>
			<<if $ml_settings and $ml_settings['its_me'] == 1>>
				<<if $ml_guitar and $ml_guitar['hasguitar'] == 1 and ($ml_guitar['carried'] == 1 or $ml_guitar['location'] == $loc)>>

						<<link "Click to to see available music activities">>
							<<gs "music_actions" "start">>
						<</link>>
						<<imgage "system/icons/icon_transp_guitaraction01.png">>
				<<else>>
						<<link "Click to to see available music activities">>
							<<gs "music_actions" "start">>
						<</link>>
						<<imgage "system/icons/icon_trans/icon_transp_singeraction01.png">>
				<</if>>
			<<else>>
				<<actCLA 'Available musical activities'>>
					<<gs 'music_actions' 'start'>>
				<</actCLA>>
			<</if>>
		<</if>>
		<<if getvar("$ml_guitar['hasguitar']") == 1 and $location_type == 'private'>>
			<<gs 'music_actions' 'put_down_pick_up'>>

		<</if>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'start'>>
	<<set $ml_time_left = $ml_performance['max_perform_minutes']-$ml_performance['performed_minutes']>>
	<<if $location_type == 'public_outdoors'>>
		<!-- !! In public, Sveta is never alone-->
		<<gs 'music_actions' 'not_alone'>>
		<!-- !! Clear out accidentally stuck $access if Sveta is outdoors.-->
		<<set $access to null>>
	<</if>>
	<<if getvar("$ml_not_alone") != 0>>
		<<gs 'music_actions' 'willpower_cost'>>

	<</if>>
	<<if $access == ''>>
		<<gs 'internet_mobile' 'get_access'>>

	<</if>>
	<!-- !! $location_type = ''private'' = these are usually homes. ''indoors'' usually an office, shop or an NPC''s home. Same for ''public_indoors'' For those locations-->
	<!-- !! anything music related should be part of a storyline/quest, or some prewritten scene, like in the room of Anushka-->
	<<gs 'music_actions' 'play_something'>>
	<<gs 'music_actions' 'practice_guitar'>>
	<<if $location_type == 'public_outdoors'>>
		<<gs 'music_actions' 'busking'>>

	<</if>>
	<<gs 'music_actions' 'record_music'>>
	<<gs 'music_actions' 'stream_music'>>
	<!-- !! NOTE: When content gates are added-->
	<!-- !!if ml_activities['setlist'] = 1: gs 'music_actions', 'rehearse_gig'-->
	<!-- !!if ml_activities['busking'] = 1: gs 'music_actions', 'busking'-->
	<!-- !!if ml_activities['streaming'] = 1: gs 'music_actions', 'stream_music'-->
	<!-- !! if this is done outdoors, any editing, mixing must be dones at home. So 'Record and edit' is not available outdoors.-->
	<!-- !! Although more accurate would be to check whether Sveta is at home or not, and if she is not home then that option won''t be available.-->
	<!-- !!if ml_activities['recording'] = 1: gs 'music_actions', 'record_music'-->
	<<if $access != 'denied'>>
		<<gs 'music_actions' 'set_up_account'>>

	<</if>>
	<!-- !! if $access ! 'denied': gs 'music_actions', 'upload_music'-->
	<<gs 'music_actions' 'delete_music'>>
	<<actCLA 'Finish'>>
		<<gs 'music_actions' 'finish'>>
	<</actCLA>>
<</if>>
<<if $location_var[$here][0] == 'put_down_pick_up'>>
	<<if getvar("$ml_guitar['carried']") == 1>>
		<<actCLA 'Place the guitar next to your desk'>>
			<<setinit $ml_guitar['carried'] = 0>>
			<<setinit $ml_guitar['location'] = $loc>>
			<<gt $location>>
		<</actCLA>>
	<<elseif $ml_guitar['location'] == $loc>>
		<<actCLA 'Pick up the guitar'>>
			<<setinit $ml_guitar['carried'] = 1>>
			<<setinit $ml_guitar['location'] = 'carried'>>
			<<gt $location>>
		<</actCLA>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'play_something'>>
	<<if getvar("$ml_guitar['hasguitar']") == 1 and (getvar("$ml_guitar['carried']") == 1 or $ml_guitar['location'] == $loc)>>
		<<if getvar("$ml_not_alone") == 0 or getvar("$will_cost") == 0>>
			<!-- !! TODO: This should be a new screen with some video or image or something-->
			<<actCLA 'Play something on the guitar (10 minutes)'>>
				<<set $pc.mood += 10>>
				<<set $time.minutes += 10>>
				<<image "pc/activities/music/guitarpractice_1.jpg">>
				You pick up your guitar and start to play some songs you know, just for your own entertainment.
				You hum along to the tune, relaxing into the music and enjoying it. When you look up, 10 minutes has passed and you are in a much better mood.
				<<actCLA 'Finish'>>
					<<gs 'music_actions' 'start'>>
				<</actCLA>>
			<</actCLA>>
		<<elseif $will_cost <= $pc.willpower>>
			<<actCLA 'Play something on the guitar (10 minutes) (will_cost Willpower - you are not alone)'>>
				<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
				<<gs 'willpower' 'pay' 'self'>>
				<<set $pc.mood += 5>>
				<<set $time.minutes += 10>>
				<<image "pc/activities/music/guitarpractice_1.jpg">>
				You pick up your guitar and start to play some songs you know, just for your own entertainment.
				You hum along to the tune, relaxing into the music and enjoying it. When you look up, 10 minutes has passed and you are in a much better mood.
				<<actCLA 'Finish'>>
					<<gs 'music_actions' 'start'>>
				<</actCLA>>
			<</actCLA>>
		<<else>>
			<!-- FAILED TO CONVERT
				act 'Play something on the guitar (<font color="red"><<will_cost>> Willpower - you are not alone</font>)': '<br><font color="red">You feel too embarrassed to pick up your guitar in front of people</font>'
			-----
				<<actCLA 'Play something on the guitar (<font color="red">will_cost Willpower - you are not alone</font>)'>>
				<<set ERROR: FAILED TO CONVERT LITERAL: """'<br><font color""" = ERROR: FAILED TO CONVERT LITERAL: """"red">You feel too embarrassed to pick up your guitar in front of people<""" / ERROR: FAILED TO CONVERT LITERAL: """font>'""">>
			<</actCLA>>

			-->
			<<warn "CONVERSION ERROR 9102754cda91432e6b091d83cec24561">>
		<</if>>
	<</if>>
	<<if getvar("$ml_not_alone") == 0 or getvar("$will_cost") == 0>>
		<<actCLA 'Sing something (10 minutes)'>>
			<<set $pc.mood += 10>>
			<<set $time.minutes += 10>>
			You hum a few notes to warm up your throat and start to some some songs you know, just for your own entertainment.
			You sway and move your head to keep the tempo, relaxing into the music and enjoying it. When you look up, 10 minutes has passed and you are in a much better mood.
			<<actCLA 'Finish'>>
				<<gs 'music_actions' 'start'>>
			<</actCLA>>
		<</actCLA>>
	<<elseif $will_cost <= $pc.willpower>>
		<<actCLA 'Sing something (10 minutes) (will_cost Willpower - you are not alone)'>>
			<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
			<<gs 'willpower' 'pay' 'self'>>
			<!-- !! TODO: This should be a new screen with some video or image or something-->
			<<set $pc.mood += 5>>
			<<set $time.minutes += 10>>
			You hum a few notes to warm up your throat and start to some some songs you know, just for your own entertainment.
			You sway and move your head to keep the tempo, relaxing into the music and enjoying it. When you look up, 10 minutes has passed and you are in a much better mood.
			<<actCLA 'Finish'>>
				<<gs 'music_actions' 'start'>>
			<</actCLA>>
		<</actCLA>>
	<<else>>
		<<actCLA 'Sing something (<font color="red">will_cost Willpower - you are not alone</font>)'>>
			<br><font color = "red">You feel too embarrassed to sing in front of people</font>
		<</actCLA>>
	<</if>>
<</if>>

<!-- !! NOTE: Having a guitar really matters here-->
<<if $location_var[$here][0] == 'practice_guitar'>>
	<<if getvar("$ml_guitar['hasguitar']") == 1 and (getvar("$ml_guitar['carried']") == 1 or $ml_guitar['location'] == $loc) and (getvar("$ml_guitar['chordbook']") == 1 or getvar("$ml_guitarlesson['lessoncount']") > 0)>>
		<<if getvar("$ml_time_left") < 15>>
			<<actCLA 'Practice guitar (<font color="red">You are too tired</font>)'>>
				<br><font color = "red">You have played so much today that your brain and hands are too tired to practice any more.</font>
			<</actCLA>>
		<<elseif getvar("$ml_not_alone") != 0 and getvar("$will_cost") != 0>>
			<<if $will_cost <= $pc.willpower>>
				<<actCLA 'Practice guitar (15 minutes) (will_cost Willpower - you are not alone)'>>
					<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
					<<gs 'willpower' 'pay' 'self'>>
					<<gt 'music_bedroomPractice' 'guitar'>>
				<</actCLA>>
			<<else>>
				<<actCLA 'Practice guitar (<font color="red">will_cost Willpower - you are not alone</font>)'>>
					<br><font color = "red">You feel too embarrassed to pick up your guitar in front of people</font>
				<</actCLA>>
			<</if>>
		<<else>>
			<<act 'Practice guitar (15 minutes)'>>
				<<gt 'music_bedroomPractice' 'guitar'>>
			<</act>>
		<</if>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'busking'>>
	With the weather being pleasant and sunny, there are groups of people moving around the streets. You could play some music, practice performing songs and maybe make some money too.
	<<if getvar("$ml_time_left") < 60>>
		<<actCLA 'Start busking (<font color="red">You are too tired</font>)'>>
			<br><font color = "red">You have played so much today, that your brain and hands are too tired to play a whole stream.</font>
		<</actCLA>>
	<<elseif getvar("$will_cost") != 0>>
		<<if $will_cost <= $pc.willpower>>
			<<actCLA 'Start busking (60 minutes) (will_cost Willpower)'>>
				<<run $pc.skillExperienceGain('inhibition',rand(1,3))>>
				<<gs 'willpower' 'pay' 'self'>>
				<<gs 'music_buskingevents' 'busking'>>
			<</actCLA>>
		<<else>>
			<<actCLA 'Start busking (<font color="red">will_cost Willpower</font>)'>>
				<br><font color = "red">You don't feel comfortable enough to play in front of people right now.</font>
			<</actCLA>>
		<</if>>
	<<else>>
		<<actCLA 'Start busking (60 minutes)'>>
			<<gs 'music_buskingevents' 'busking'>>
		<</actCLA>>
	<</if>>
<</if>>

<<if $location_var[$here][0] == 'stream_music'>>
	<!-- !! Streaming music-->
	<!-- !! NOTE: The check for guitar is done in the 'live_stream', without a guitar Sveta will sing-->
	<<if getvar("$ml_online['account']") == 0>>
		<<actCLA 'Live stream (<font color="red">No online account</font>)'>>
			<br><font color = "red">You will have to set up an online account first to stream.</font>
		<</actCLA>>

	<<elseif $access == 'denied'>>
		<<actCLA 'Live stream (<font color="red">No internet access</font>)'>>
			<br><font color = "red">You have no internet access.</font>
		<</actCLA>>

	<<elseif $ml_streaming['lastday'] == $time.daystart>>
		<<actCLA 'Live stream (<font color="red">Already streamed today</font>)'>>
			<br><font color = "red">You already streamed today.</font>
		<</actCLA>>
	<<elseif getvar("$ml_not_alone") == 1 and $location_type == 'private'>>
		<<actCLA 'Live stream (<font color="red">You are not alone, can`t stream right now</font>)'>>
			<br><font color = "red">You are not alone in the room, which makes starting a stream impossible until they leave.</font>
		<</actCLA>>

	<<elseif getvar("$ml_time_left") < 60>>
		<<actCLA 'Live stream (<font color="red">You are too tired</font>)'>>
			<br><font color = "red">You have played so much today, that your brain and hands are too tired to play a whole stream.</font>
		<</actCLA>>
	<<else>>
		<<if getvar("$will_cost") == 0>>
			<<act 'Live stream (60 minutes)'>>
				<<gt 'music_onlinemusic' 'live_stream'>>
			<</act>>
		<<elseif $will_cost <= $pc.willpower>>
			<<actCLA 'Live stream (60 minutes) (will_cost Willpower)'>>
				<<run $pc.skillExperienceGain('inhibition',rand(1,3))>>
				<<gs 'willpower' 'pay' 'self'>>
				<<gt 'music_onlinemusic' 'live_stream'>>
			<</actCLA>>
		<<else>>
			<<actCLA `'Live stream ('+$will_cost+')'`>><font color=red><br/>You don`t have enough willpower to use this action.</font><</actCLA>>
		<</if>>
	<</if>>
<</if>>

<!-- !! TODO: This needs to be split, editing can happen after the music was recorded. And it can happen to music recorded with a phone too.-->
<!-- !! 1. Record with a computer-->
<!-- !! 2. Edit video/music-->
<!-- !! 3. Mix if there are several recording - this will need some better recroded music management, but something simple, no one wants to-->
<!-- !! click a hundred times to do something. Boring.-->
<!-- !! 4. Computer based recording is removed for now, some changes are needed-->
<<if $location_var[$here][0] == 'record_music'>>
	<!-- !! Recording music-->
	<<if getvar("$ml_time_left") < 30>>
		<<actCLA 'Record a song (<font color="red">You are too tired</font>)'>>
			<br><font color = "red">You have played so much today, that your brain and hands are too tired to record anything right now.</font>
		<</actCLA>>
	<<elseif getvar("$will_cost") == 0>>
		<<act 'Record a song with your phone (30 minutes)'>>
			<<gt 'music_onlinemusic' 'record_song'>>
		<</act>>
	<<elseif $will_cost <= $pc.willpower>>
		<<actCLA 'Record a song with your phone (30 minutes) (will_cost Willpower - you are not alone)'>>
			<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
			<<gs 'willpower' 'pay' 'self'>>
			<<gt 'music_onlinemusic' 'record_song'>>
		<</actCLA>>
	<<else>>
		<<actCLA 'Record a song (<font color="red">will_cost Willpower - you are not alone</font>)'>>
			<br><font color = "red">You don't feel comfortable recording in front of other people right now.</font>
		<</actCLA>>

	<</if>>
<</if>>
<!-- !! TODO: Split from recording music, editing is a separate thing-->
<<if $location_var[$here][0] == 'edit_recording'>>
	<<if $inventory.get("computer") == 1 and getvar("$webcamera") == 1 and $ml_studio['scarlet-3rd-gen'] == 1>>
		<<actCLA 'Edit a song (will_cost Willpower)'>>
			<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
			<<gs 'willpower' 'pay' 'self'>>
			<<gt 'music_onlinemusic' 'recordAndEditSong'>>
		<</actCLA>>
	<</if>>
<</if>>
<!-- !! TODO: How to differentiate between guitar based and vocal sets? It is possible to rehearse just the singing part of a set, but obviously has to-->
<!-- !! practice the guitar parts too.-->
<<if $location_var[$here][0] == 'rehearse_sets'>>
	<<if $ml_performance['performed_minutes'] < $ml_performance['max_perform_minutes']>>
		<<if getvar("$ml_not_alone") == 0 or getvar("$will_cost") == 0>>
			<<act 'Rehearse your sets (30 minutes)'>>
				<<gt 'music_bedroompractice' 'rehearse'>>
			<</act>>
		<<elseif $will_cost <= $pc.willpower>>
			<<actCLA 'Rehearse your sets (30 minutes) (will_cost Willpower)'>>
				<<run $pc.skillExperienceGain('inhibition',rand(1,2))>>
				<<gs 'willpower' 'pay' 'self'>>
				<<gt 'music_bedroompractice' 'rehearse'>>
			<</actCLA>>
		<<else>>
			<<actCLA `'Rehearse your sets (30 minutes) ('+$will_cost+')'`>><font color=red><br/>You don`t have enough willpower to use this action.</font><</actCLA>>
		<</if>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'set_up_account'>>
	<<if getvar("$ml_online['account']") == 0 and $subscription[$access['subscription']] > 0>>
		<<act 'Set up an online music account (0:30)'>>
			<<gt 'music_onlinemusic' 'set_up_account'>>
		<</act>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'upload_music'>>
	<!-- !!Uploading recorded music if there are any not uploaded yet-->
	<<if getvar("$ml_uploadablemusic") > 0 and $subscription[$access['subscription']] > 0 and getvar("$ml_online['account']") == 1>>
		<<if getvar("$will_cost") == 0>>
			<<act 'Upload music'>>
				<<gt 'music_onlinemusic' 'uploadallmusic'>>
			<</act>>
		<<elseif $will_cost <= $pc.willpower>>
			<<act 'Upload music (will_cost Willpower)'>>
				<<gt 'music_onlinemusic' 'uploadmusic'>>
			<</act>>
		<<else>>
			<<actCLA `'Upload music ('+$will_cost+')'`>><font color=red><br/>You don`t have enough willpower to use this action.</font><</actCLA>>
		<</if>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'delete_music'>>
	<<if getvar("$ml_uploadablemusic") > 0>>
		<<act 'Delete old recordings'>>
			<<gt 'music_onlinemusic' 'deleteoldmusic'>>
		<</act>>
	<</if>>
<</if>>
<!-- !! This is called from the actual location where all the info is present to decide whether someone else is around or not.-->
<<if $location_var[$here][0] == 'not_alone'>>
	<<set $ml_not_alone = 1>>
	<<gs 'music_actions' 'willpower_cost'>>
<</if>>
<!-- !! This is called from the actual location where all the info is present to decide whether something actively blocking anything music related.-->
<!-- !! FOr example a drunken husband, or if Sveta and Anya hate each other, or any other temporary block-->
<<if $location_var[$here][0] == 'no_music'>>
	<<set $ml_no_music = 1>>
<</if>>
<!-- !! TODO: Will modify to ask all three (''easy'', ''medium'' and ''hard'') because local (friends, family), public (strangers) and global (online)-->
<!-- !! will have different inhibition thresholds-->
<!-- !! IMPORTANT: I always try to add a check for skills, but the will_cost already includes Sveta''s performance ability!-->
<<if $location_var[$here][0] == 'willpower_cost'>>
	<<if $pc.pcs_inhib < 30>>
		<<if $pc.pcs_inhib < 10>>
			<<set $diff = 'hard'>>
		<<elseif $pc.pcs_inhib < 20>>
			<<set $diff = 'medium'>>
		<<else>>
			<<set $diff = 'easy'>>
		<</if>>
		<<gs 'willpower' 'skill' 'self' $diff>>
		<<set $will_cost = ($will_cost * 3) - (pcs_perform)>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'clear_restrictions'>>
	<<set $will_cost to null>>
	<<set $ml_not_alone to null>>
	<<set $ml_no_music to null>>
<</if>>
<<if $location_var[$here][0] == 'finish'>>
	<<set $will_cost to null>>
	<<set $ml_not_alone to null>>
	<<set $ml_no_music to null>>
	<<set $ml_time_left to null>>
	<<gt $location>>
<</if>>
