# prostitution_functions

!! ---- Variables -------------------------------------------------------------------------------------------------------
!!
!! prostitute['payment_method']: 1 - Sveta works for herself; 0 - Sveta works for someone else who will take a cut
!! prostitute['blocked']: 1 - WLife is loaded which blocks some of the locations: Pavlovsk will rely on the WLife mod 
!!							  and the Gas Station will be completely blocked
!!						  0 - WLife is not loaded, everything works as normal.	
!! prostitute[<<$location>>]: 1 - Sveta can work at the location.
!!                            0 - Sveta can''t work at the location'
!!     current locations: Pavlovsk - ''pavlovsk'', Gadukino - ''gadukino'', 
!!                        Road between Pavlovsk and St Petersburg - ''road'', Gas Station ''gas_station''
!! prostitute['active']: 1- Sveta ''unlocked'' prostitution somewhere. It is use for non-location specific checks, like
!!							being able set a default prostitute outfit at home, or finding new places to work at.
!! prostitute['work_clothes']: 1 - Sveta is wearing a prostitute outfit, i.e. clothes and shoes
!! prostitute['outfit_is_set']: 1 - Sveta has a default outfit set up. Needed if she wants to change in restrooms 
!!									or in the car on location, and not travel wearing that outfit
!! prostitute['changed_for_work']: 1 - It measn that Sveta changed into her prostitute outfit on site from some regular
!!                                     clothes. This enables the 'Change into regular clothes' action in the changing
!!									   location. 
!!								   0 - Sveta didn''t change which means she can''t change into regular clothing. 

!!---------- Initial set up, enabling locations, etc. -------------------------------------------------------------------
!!-----------------------------------------------------------------------------------------------------------------------

!! This will run every time for now until I find out how to call this whenever Sveta changes clothes regardless of where and how. I don't want to put it in gs 'stat'


if $ARGS[0] = 'check_for_wlife':
    if mod_list > 0:
        mod_i=1
        :mod_exec
        if $mod_name[mod_i] = 'wlife':
            prostitute['blocked'] = 1
        end
        if mod_list > mod_i:
            mod_i+=1
            jump 'mod_exec'
        end
    end
end

if $ARGS[0] = 'set_pavlovsk_prostitute':
    if fame['pav_prostitute'] > 250 or fame['pav_slut'] > 250 and prostitute['blocked'] = 0:
        prostitute['pavlovsk'] = 1
		prostitute['active'] = 1
        prostitute['payment_method'] = 1
    else
        prostitute['pavlovsk'] = 0
    end
end

if $ARGS[0] = 'set_gadukion_prostitute':
	if gadriver_gang = 2 and (mirapimp = 0 or mirapimp = 2): 
		prostitute['gadukino'] = 1
		prostitute['active'] = 1
		prostitute['payment_method'] = 1
	else
		prostitute['gadukino'] = 0
	end
end

!!-----------------------------------------------------------------------------------------------------------------------
!!-----------------------------------------------------------------------------------------------------------------------
!!


!!---------- Setting default working outfit -----------------------------------------------------------------------------
!! When calling check if Sveta is at home (i.e. the wardrobe is in her current home)

if $ARGS[0] = 'prostitute_outfit_at_home':
	if func('homes_properties', 'is_current_home') and prostitute['active']:
		gs 'prostitution_functions', 'work_clothes'
		if prostitute['work_clothes']:
			gs 'prostitution_functions', 'is_default'
			if prostitute['outfit_is_set'] = 1 and is_default = 0:
				act 'Replace your default prostitute outfit with the current outfit': 
					gs 'prostitution_functions', 'set_default_outfit'
					gt $loc, $loc_arg
				end
			elseif prostitute['outfit_is_set'] = 0:
				act 'Set the current as your default prostitute outfit': 
					gs 'prostitution_functions', 'set_default_outfit'	
					gt $loc, $loc_arg
				end
			end
			act 'Change into regular clothes': 
				gs 'prostitution_functions', 'change_into_regular_clothes'
				gt $loc, $loc_arg
			end
		elseif prostitute['outfit_is_set']: 
			act 'Change into prostitute outfit': 
				gs 'prostitution_functions', 'change_into_prostitute_outfit'
				gt $loc, $loc_arg
			end
		end
		killvar 'is_default'
	end
end

!!---- Outfit checks ---------------------------------------------------------------------------------  
if $ARGS[0] = 'work_clothes':
	prostitute['work_clothes'] = (PCloStyle = 4 and (PShoStyle = 1 or PShoStyle = 2 or PShoHeels >= 3))
end

if $ARGS[0] = 'is_default':
	is_default = prostitute['clothingwornnumber'] = clothingwornnumber & prostitute['pantywornnumber'] = pantywornnumber & prostitute['brawornnumber'] = brawornnumber & prostitute['shoewornnumber'] = shoewornnumber
end



!!---- Setting, clearing and changing outfits ------------------------------------------------------------------
if $ARGS[0] = 'set_default_outfit':
	!!-- Clothing	
	$prostitute['clothingworntype'] = $clothingworntype
	prostitute['clothingwornnumber'] = clothingwornnumber

	!!-- Underwear
	$prostitute['pantyworntype'] = $pantyworntype
	prostitute['pantywornnumber'] = pantywornnumber
	$prostitute['braworntype'] = $braworntype
	prostitute['brawornnumber'] = brawornnumber

	!!-- Shoes
	$prostitute['shoeworntype'] = $shoeworntype
	prostitute['shoewornnumber'] = shoewornnumber

	prostitute['outfit_is_set'] = 1
end

if $ARGS[0] = 'clearing_default_outfit':
	!!-- Clothing	
	$prostitute['clothingworntype'] = ''
	prostitute['clothingwornnumber'] = 0

	!!-- Underwear
	$prostitute['pantyworntype'] = ''
	prostitute['pantywornnumber'] = 0
	$prostitute['braworntype'] = ''
	prostitute['brawornnumber'] = 0

	!!-- Shoes
	$prostitute['shoeworntype'] = ''
	prostitute['shoewornnumber'] = 0
	
	prostitute['outfit_is_set'] = 0
end


if $ARGS[0] = 'change_into_prostitute_outfit':	
	gs 'clothing', 'wear', $prostitute['clothingworntype'], prostitute['clothingwornnumber']
	gs 'panties', 'wear', $prostitute['pantyworntype'], prostitute['pantywornnumber']
	gs 'bras', 'wear', $prostitute['braworntype'], prostitute['brawornnumber']
	gs 'shoes', 'strip'
	gs 'shoes', 'wear', $prostitute['shoeworntype'], prostitute['shoewornnumber']

!	!! TODO: Check for worn out here?

	!! CHeck if the change happened not at home and if yes, then store the fact of change.
	gs 'prostitution_functions', 'work_clothes'
	if $ARGS[1] = 'work': prostitute['changed_for_work'] = 1
end

if $ARGS[0] = 'change_into_regular_clothes':
	!!-- Clothing	
	gs 'clothing', 'wear_last_worn'
	!!-- Underwear
	gs 'panties', 'wear_last_worn'
	gs 'bras', 'wear_last_worn'

	!!-- Shoes
	gs 'shoes', 'wear', 'last_worn'
	gs 'prostitution_functions', 'work_clothes'
	if prostitute['changed_for_work']: prostitute['changed_for_work'] = 0
end

!!---------- Chaging outfits in public locations ------------------------------------------------------------------------
!!------ CHanging clothes --------------------------
if $ARGS[0] = 'change_to_work':
	cla
	*clr
	minut += 10
	if $ARGS[1] = 'car':
		!! TODO: Video / image and some text describing the cloth change in the car
		''+iif($loc_desc = $loc_desc, 'You quickly change into your working outfit in your car.', $loc_desc)
	end

	if $ARGS[1] = 'restroom':
		!! TODO: Video / image and some text describing the cloth change in the men''s restroom
		!! Is there a way to know if it''s a men''s or women''s restroom?
		''+iif($loc_desc = $loc_desc,  'You slip into a stall and quickly change into your working outfit, trying t avoid your clothes touching the floor or, really, anything before you place them safely in your bag.', $loc_desc)
	end

	gs 'prostitution_functions', 'change_into_prostitute_outfit', 'work'
	act 'Finish': gt $loc, $loc_arg
end

if $ARGS[0] = 'change_back':
	cla
	*clr
	minut += 10
	if $ARGS[1] = 'car':
		!! TODO: Video / image and some text describing the cloth change in the car
		'You quickly change into your working outfit in your car.'
	end

	if $ARGS[1] = 'restroom':
		!! TODO: Video / image and some text describing the cloth change in the men''s restroom
		'You quickly change into your working in the men''s restroom..'
	end

	if $loc_arg = 'restroom_women':
		!! TODO: Video / image and some text describing the cloth change in the women''s restroom
		'You quickly change into your working outfit in the women''s restroom.'
	end
	gs 'prostitution_functions', 'change_into_regular_clothes'
	act 'Finish': gt $loc, $loc_arg
end



!!-----------------------------------------------------------------------------------------------------------------------
!!---------- Checking for events ----------------------------------------------------------------------------------------
!!-----------------------------------------------------------------------------------------------------------------------

if $ARGS[0] = 'check_solicitation_event':
	gs 'prostitution_functions', 'work_clothes'
    if prostitute['blocked'] = 0:
        if (($loc_arg = '' and ($loc = 'pav_commcenter' or $loc = 'pav_residential' or $loc = 'pav_industrial' or $loc = 'pav_commercial' or $loc = 'pav_market' or $loc = 'liam')) or ($loc_arg = 'start' and ($loc = 'pav_complex' or $loc = 'pav_park'))) and hour > 6 and hour < 23 and $curloc ! 'shop' and menu_off = 0 and $loc = $curloc:

            if prostitute['pavlovsk'] = 1 and prostitute['pav_time_hour'] ! hour and rand(-20, 70) < minut and $curloc ! 'prostitution_pavlovsk' and $curloc ! 'shop' and menu_off = 0 and $loc = $curloc: 
                gs 'prostitution_pavlovsk', 'chance'
            end
            
            if prostitute['pavlovsk'] = 1 and prostitute['work_clothes'] :
                pl '<center><a href="exec: gt ''prostitution_pavlovsk'', ''search''"><img title="Click to start working in Pavlovsk." height = 80 src="images/system/icons/icon_prostitute.png"></a></center>'
            end

            if prostitute['pav_residential_prost_day'] ! daystart: prostitute['pav_residential_prost_day'] = daystart
            !!pav_residential_prost_day
        end 
    end
end


!!-----------------------------------------------------------------------------------------------------------------------
!!---------- Willpower checks -------------------------------------------------------------------------------------------
!!-----------------------------------------------------------------------------------------------------------------------

if $ARGS[0] = 'will_unprotected':
	gs 'willpower', 'calc'
	will_cost = 0
	if missCum >= timeTresh: will_calc += 100
	if $ARGS[1] = 'resist':
		if pro_stats['unprotected'] <= 90:
			will_cost = (10 + pro_stats['unprotected'] + will_calc) / 10
		else
			will_cost = (100 + will_calc)/10
		end
	else
		if pro_stats['unprotected'] <= 90:
			will_cost = (100 - pro_stats['unprotected'] + will_calc) / 10
		else
			will_cost = (10 + will_calc)/10
		end
	end
	gs 'willpower', 'difficulty', '<<$ARGS[2]>>'
end

if $ARGS[0] = 'will_rimming':
	gs 'willpower', 'calc'

	if $ARGS[1] = 'self':
		if stat['rimming_give'] <= 90:
			will_cost = (100 - stat['rimming_give'] + will_calc)/10
		else
			will_cost = (10 + will_calc)/10
		end
	elseif $ARGS[1] = 'force':
		if stat['rimming_give'] <= 40:
			will_cost = (110 - will_enforced - stat['rimming_give'] + will_calc)/10
		else
			will_cost = (70 - will_enforced + will_calc)/10
		end
	else
		if stat['rimming_give'] <= 90:
			will_cost = (10 + stat['rimming_give'] + will_calc)/10
		else
			will_cost = (100 + will_calc)/10
		end
	end
	gs 'willpower', 'difficulty', '<<$ARGS[2]>>'
end

if $ARGS[0] = 'will_atm':
	gs 'willpower', 'calc'

	if $ARGS[1] = 'self':
		if pro_stats['atm'] <= 90:
			will_cost = (100 - pro_stats['atm'] + will_calc)/10
		else
			will_cost = (10 + will_calc)/10
		end
	elseif $ARGS[1] = 'force':
		if pro_stats['atm'] <= 40:
			will_cost = (110 - will_enforced - pro_stats['atm'] + will_calc)/10
		else
			will_cost = (70 - will_enforced + will_calc)/10
		end
	else
		if pro_stats['atm'] <= 90:
			will_cost = (10 + pro_stats['atm'] + will_calc)/10
		else
			will_cost = (100 + will_calc)/10
		end
	end
	gs 'willpower', 'difficulty', '<<$ARGS[2]>>'
end


!!-----------------------------------------------------------------------------------------------------------------------
!!---------- Condoms & STDs----------------------------------------------------------------------------------------------
!!-----------------------------------------------------------------------------------------------------------------------


if $ARGS[0] = 'std_check':
	pro_std_check_rand = rand(0,10)
	if protect = 1:
		pro_std_rand = rand(0,1000)
		if pro_std_rand = 1000: gs 'prostitution_functions' , 'std_chance'
	else
		if $ARGS[1] = 'high':
			pro_std_rand = rand(-20,120)
		else
			pro_std_rand = rand(-60,100)
		end
		if pro_std_rand >= 80: gs 'prostitution_functions' , 'std_chance'
	end
end

if $ARGS[0] = 'std_chance':
	if cheatHealth = 0:
		if pro_std_check_rand = 8:
			!!herpes
			if rand(1, 100) > 90:
				if GerpesOnce = 0:
					GerpesOnce = 1
					Venera += 1
					Gerpes += 1
					GenHerpes = 1
				end
			end
		elseif pro_std_check_rand = 7:
			!!syphilis
			if rand(1, 100) > 95: Venera += 1
			if SifacOnce = 0:
				SifacOnce = 1
				Sifilis += 1
			end
		elseif pro_std_check_rand >= 5 and pro_std_check_rand < 7:
			!!gonorrhea/triper
			if rand(1, 100) > 95: Venera += 1
			if TriperOnce = 0:
				TriperOnce = 1
				Triper += 1
			end
		elseif pro_std_check_rand < 5:
			!!candidiasis/thrush
			if rand(1, 100) > 85:
				if KandidozOnce = 0:
					KandidozOnce = 1
					Kandidoz += 1
				end
			end
		end
	end
end

if $ARGS[0] = 'std_check_oral':
	pro_std_check_rand = rand(0,10)
	if protect = 1:
		pro_std_rand = rand(0,1000)
		if pro_std_rand = 1000: gs 'prostitution_functions' , 'std_oral_chance'
	else
		if $ARGS[1] = 'high':
			pro_std_rand = rand(-20,120)
		elseif $ARGS[1] = 'low':
			pro_std_rand = rand(-80,90)
		else
			pro_std_rand = rand(-60,100)
		end
		if pro_std_rand >= 80: gs 'prostitution_functions' , 'std_oral_chance'
	end
end

if $ARGS[0] = 'std_oral_chance':
	if cheatHealth = 0:
		if pro_std_check_rand >= 5 and pro_std_check_rand < 7:
			if rand(1, 100) > 95: Venera += 1
			if TriperOnce = 0:
				TriperOnce = 1
				TriperOral += 1
				if rand (0,100) < 15: TriperOralSigns = 1
			end
		elseif pro_std_check_rand = 7:
			if rand(0,1) = 1:
				!!syphilis
				if rand(1, 100) > 95: Venera += 1
				if SifacOnce = 0:
					SifacOnce = 1
					Sifilis += 1
				end
			end
		elseif pro_std_check_rand < 5:
			!!candidiasis/thrush
			if rand(1, 100) > 85:
				if KandidozOnce = 0:
					KandidozOnce = 1
					Kandidoz += 1
				end
			end
		elseif pro_std_check_rand = 8:
			!!herpes
			if rand(1, 100) > 90:
				if GerpesOnce = 0:
					GerpesOnce = 1
					Venera += 1
					Gerpes += 1
					OrHerpes = 1
				end
			end
		end
	end
end

if $ARGS[0] = 'remove_condom':
	if prezik > 0:
		prezik -= 1
	elseif prezikcount > 0:
		prezikcount -= 1
	end
end

if $ARGS[0] = 'your_condom':
	prostitute['condom'] = 1
	protect = iif(prezik > 0,1,0)
	if prezik > 0:
		if rand(1,prezik) <= badprezik:
			badprezik -= 1
			noprotect = 1
			sexcontra = 7
		else
			sexcontra = 3
		end
		prezik -= 1
		sexcontra = iif(preziktype = 2,7,sexcontra)
	else
		sexcontra = 0
	end
end

if $ARGS[0] = 'his_condom':
	$bwa_boy = iif($ARGS[1] = '',$boydesc,$ARGS[1])
	protect = 1
	sexcontra = 3
	*p '<<ucase(mid($bwa_boy,1,1))>><<mid($bwa_boy,2,len($bwa_boy)-1)>> takes his condom and puts it on his <<dick>> centimeter dick.'
end


!!---------- Background: Black-----------------------------------------------------------------------------------

if $ARGS[0] = 'darkness':
	fcolor = rgb(255, 255, 255)
	bcolor = rgb(0, 0, 0)
	lcolor = rgb(106, 90, 205)
end

if $ARGS[0] = 'parameters':
	!!Reset
	protect = 0
	sexcontra = 0
	$pro_client_condom = 'tbd'
	$pro_client_cumshot = 'tbd'

	!!Client
	gs 'npcgeneratec', 0, 'client', rand(18,65)
	gs 'boyStat', $npclastgenerated

	!!
!!---------- Time -----------------------------------------------------------------------------------------------

	if hour > 19 or hour < 7:
		$pro_work_time = 'night'
	else
		$pro_work_time = 'day'
	end

	gs 'prostitution_functions', 'std_cum_check'

!!---------- Client Likes/Dislikes ------------------------------------------------------------------------------

	if rand(1,10) = 10:
		prostitute['mesec_mod'] = 1
	else
		prostitute['mesec_mod'] = 0
	end

	if rand(1,100) > 97:
		prostitute['dirty_anal_mod'] = 1
	else
		prostitute['dirty_anal_mod'] = 0
	end

	if rand(1,10) = 10:
		prostitute['cum_visible_mod'] = 1
	else
		prostitute['cum_visible_mod'] = 0
	end

!!---------- Age ------------------------------------------------------------------------------------------------

	if vidage < 18 and rand(1,10) < 7:
		prostitute['vidage_mod'] = 1
	else
		prostitute['vidage_mod'] = 0
	end

!!---------- Scenes ----------------------------------------------------------------------------------------------	
!!----------------------------------------------------------------------------------------------------------------	

	pro_scene_rand = rand(1,100)

	if pro_scene_rand <= 50:
		if mesec = 0 or prostitute['mesec_mod'] = 1:
			$prostitute['client_scene'] = 'Vaginal'
		elseif mesec > 0 and prostitute['mesec_mod'] = 0 and (klismaday = daystart or prostitute['dirty_anal_mod'] = 1):
			$prostitute['client_scene'] = 'Anal'
		else
			$prostitute['client_scene'] = 'Blowjob'
		end
	elseif pro_scene_rand > 50 and pro_scene_rand <= 75:
		if klismaday = daystart or prostitute['dirty_anal_mod'] = 1:
			$prostitute['client_scene'] = 'Anal'
		elseif klismaday ! daystart and prostitute['dirty_anal_mod'] = 0 and (mesec = 0 or prostitute['mesec_mod'] = 1):
			$prostitute['client_scene'] = 'Vaginal'
		else
			$prostitute['client_scene'] = 'Blowjob'
		end
	else
		$prostitute['client_scene'] = 'Blowjob'
	end

	!!---- Regular Worker ----------------------------------------------------------------------------------------	

	if prostitute['customer_total'] < 10:
		prostitute['regular_chance'] = 0
	elseif prostitute['customer_total'] >= 10 and prostitute['customer_total'] <= 25:
		prostitute['regular_chance'] = 1
	elseif prostitute['customer_total'] > 25 and prostitute['customer_total'] <= 50:
		prostitute['regular_chance'] = 2
	elseif prostitute['customer_total'] > 50 and prostitute['customer_total'] <= 100:
		prostitute['regular_chance'] = 3
	elseif prostitute['customer_total'] > 100 and prostitute['customer_total'] <= 250:
		prostitute['regular_chance'] = 4
	end

	!!---- Chance to find a client --------------------------------------------------------------------------------	

	prostitute['client_chance'] = hotcat * 10 + prostitute['regular_chance'] * 5 + rand(1,100) + prostitute['pity_counter']
	if $pantyworntype = 'sexshop' and CloSkirtShortness > 4: prostitute['client_chance'] += 10

	!!---- Client ------------------------------------------------------------------------------------------------	

	if prostitute['regular_timer'] ! daystart and $prostitute['client_scene'] ! 'Blowjob':
		if (prostitute['regular_chance'] = 1 and rand(1,100) > 95) or (prostitute['regular_chance'] = 2 and rand(1,100) > 90) or (prostitute['regular_chance'] = 3 and rand(1,100) > 80) or (prostitute['regular_chance'] = 4 and rand(1,100) > 60):
			prostitute['regular'] = 1
		else
			prostitute['regular'] = 0
		end
	else
		prostitute['regular'] = 0
	end

!!ToDo: Rough Clients
!!	if prostitute['regular'] = 0:
!!		if (pro_work_day = 0 and rand(1,100) > 90) or (pro_work_day = 1 and rand(1,100) > 95):
!!			if prostitute['rough'] = 1
!!		else
!!			prostitute['rough'] = 0
!!		end
!!	end

	if prostitute['regular'] = 0 and prostitute['rough'] = 0 and prostitute['std_mod'] = 0 and rand(1,100) > iif($pro_brand['text_pubic'] = 'cumslut', 84, 92):
		prostitute['client_creampie'] = 1
	else
		prostitute['client_creampie'] = 0
	end

	if prostitute['rough'] = 1 or (prostitute['rough'] = 0 and rand(1,100) > 40):
		prostitute['propose'] = 0
	else
		prostitute['propose'] = 1
	end
end

!!---------- Payment ---------------------------------------------------------------------------------------------	

if $ARGS[0] = 'payment':
	!!---- Basic Payment -----------------------------------------------------------------------------------------	

	if $ARGS[1] = 'pav':
		if $prostitute['pav_scene'] = 'blowjob':
			prostitute['payment'] = 425
		elseif $prostitute['pav_scene'] = 'anal':
			prostitute['payment'] = 1200
		else
			prostitute['payment'] = 1000
		end
	else
		if $prostitute['client_scene'] = 'Blowjob':
			prostitute['payment'] = 350
			if $ARGS[1] = 'condom_no': prostitute['payment'] += 75
			if $ARGS[2] = 'inside_yes': prostitute['payment'] += 50
		elseif $prostitute['client_scene'] = 'Vaginal':
			prostitute['payment'] = 700
			if $ARGS[1] = 'condom_no': prostitute['payment'] += 300
			if $ARGS[2] = 'inside_yes': prostitute['payment'] += 300
		elseif $prostitute['client_scene'] = 'Anal':
			prostitute['payment'] = 900
			if $ARGS[1] = 'condom_no': prostitute['payment'] += 200
			if $ARGS[2] = 'inside_yes': prostitute['payment'] += 100
		end
	end

	!!---- Bonus -------------------------------------------------------------------------------------------------	
	
	prostitute['payment_mod'] = hotcat * 10
	if pcs_makeup = 0:
		prostitute['payment_mod'] -= 20
	elseif pcs_makeup > 1:
		prostitute['payment_mod'] += pcs_makeup * 10
	end

	if mesec > 0 and $prostitute['client_scene'] = 'Vaginal':
		if prostitute['mesec_mod'] = 0:
			prostitute['payment_mod'] -= 200
		else
			prostitute['payment_mod'] += 300
		end
	end

	if klismaday ! daystart and $prostitute['client_scene'] = 'Anal':
		if prostitute['dirty_anal_mod'] = 0:
			if $ARGS[1] = 'condom_no':
				prostitute['payment_mod'] -= 600
			elseif $ARGS[1] = 'condom_yes':
				prostitute['payment_mod'] -= 300
			end
		else
			prostitute['payment_mod'] += 300
		end
	end

	if prostitute['cum_dressed'] = 1:
		if prostitute['cum_visible_mod'] = 0:
			prostitute['payment_mod'] -= 200
		else
			prostitute['payment_mod'] += 300
		end
	end

	prostitute['payment_mod'] += pcs_mood - 50

	if $pantyworntype = 'sexshop' and CloSkirtShortness > 4: prostitute['payment_mod'] += 50

	if prostitute['vidage_mod'] = 1:
		prostitute['payment_mod'] += 50 * (18 - vidage)
	else
		prostitute['payment_mod'] -= 50 * (18 - vidage)
	end

	if ($prostitute['client_scene'] = 'Blowjob') or ($prostitute['pav_scene'] = 'blowjob'):
		prostitute['payment_mod'] = prostitute['payment_mod'] / 2
		if pirsA = 2:
			prostitute['payment_mod'] += 50
		elseif pirsA = 4:
			prostitute['payment_mod'] += 75
		elseif pirsA > 0 and pirsA < 10000:
			prostitute['payment_mod'] += 25
		end
	end
	prostitute['payment'] += prostitute['payment_mod']
	prostitute['payment_backup'] = prostitute['payment']

	prostitute['payment'] = (prostitute['payment'] * (100 + prostitute['client_satisfaction'])) / 100

	!!Rounding
	prostitute['payment'] = func('prostitution_functions', 'exact_round', prostitute['payment'], 10)
	prostitute['payment_backup'] = func('prostitution_functions', 'exact_round', prostitute['payment_backup'], 10)
end

!!---------- Abortion --------------------------------------------------------------------------------------------	

if $ARGS[0] = 'abortion':
	abort += 1
	abortionbirthdate = daystart

	gs 'medical_din', 'remove_preg'
	knowpregloss = 2

	abortrand = rand(0, 10)
	if age > 18:
		if abortrand < 10:sterilewb += 1
		if abortrand = 10:sterilewb += 10
	else
		if abortrand < 7:sterilewb += 2
		if abortrand >= 7:sterilewb += 10
	end
	killvar 'abortrand'

	pcs_hydra += 20

	if broodcurse > 0: over = 13 & gt'gameover'
end

!!---------- Random Name -----------------------------------------------------------------------------------------	

if $ARGS[0] = 'random_name':

	$pro_boyname[1] = ''
	$pro_boyname[2] = ''

	:pro_rng_jump

	pro_temp = rand(0,23)

	if pro_temp = 0:
		$pro_temp = 'Abram'
	elseif pro_temp = 1:
		$pro_temp = 'Alexei'
	elseif pro_temp = 2:
		$pro_temp = 'Adrian'
	elseif pro_temp = 3:
		$pro_temp = 'Dima'
	elseif pro_temp = 4:
		$pro_temp = 'Dimitri'
	elseif pro_temp = 5:
		$pro_temp = 'Igor'
	elseif pro_temp = 6:
		$pro_temp = 'Leonid'
	elseif pro_temp = 7:
		$pro_temp = 'Petka'
	elseif pro_temp = 8:
		$pro_temp = 'Michail'
	elseif pro_temp = 9:
		$pro_temp = 'Vasily'
	elseif pro_temp = 10:
		$pro_temp = 'Oleg'
	elseif pro_temp = 11:
		$pro_temp = 'Olezka'
	elseif pro_temp = 12:
		$pro_temp = 'Pasha'
	elseif pro_temp = 13:
		$pro_temp = 'Pavel'
	elseif pro_temp = 14:
		$pro_temp = 'Sacha'
	elseif pro_temp = 15:
		$pro_temp = 'Slava'
	elseif pro_temp = 16:
		$pro_temp = 'Ruslan'
	elseif pro_temp = 17:
		$pro_temp = 'Taras'
	elseif pro_temp = 18:
		$pro_temp = 'Timofey'
	elseif pro_temp = 19:
		$pro_temp = 'Vanya'
	elseif pro_temp = 20:
		$pro_temp = 'Viktor'
	elseif pro_temp = 21:
		$pro_temp = 'Vladimir'
	elseif pro_temp = 22:
		$pro_temp = 'Yaromir'
	elseif pro_temp = 23:
		$pro_temp = 'Yevgeni'
	end

	if $pro_boyname[1] = '':
		$pro_boyname[1] = $pro_temp
		jump 'pro_rng_jump'
	elseif $pro_boyname[2] = '':
		$pro_boyname[2] = $pro_temp
	end

	if $pro_boyname[1] = $pro_boyname[2]:
		$pro_boyname[2] = ''
		jump 'pro_rng_jump'
	end

	killvar 'pro_temp'
	killvar '$pro_temp'
end

!!---------- Payment ---------------------------------------------------------------------------------------------	

if $ARGS[0] = 'tat_pierce_count':
	tattCount = 0

	if tatarm >= 1: tattCount += 1
	if tatass >= 1:	tattCount += 1
	if tatback >= 1: tattCount += 1
	if tatblly >= 1: tattCount += 1
	if tatbrst >= 1: tattCount += 1
	if tatchst >= 1: tattCount += 1
	if tatfce >= 1:	tattCount += 1
	if tatankle >= 1: tattCount += 1
	if tatleg >= 1:	tattCount += 1
	if tatlip >= 1:	tattCount += 1
	if tatneck >= 1: tattCount += 1
	if tatvag >= 1: tattCount += 1
	if tatlech >= 1: tattCount += 1
	if tatside >= 1: tattCount += 1
	if tatupb >= 1: tattCount += 1
	if tatunder >= 1: tattCount += 1
	if tatwrist >= 1: tattCount += 1
	if tathand >= 1: tattCount += 1

	pierWearCount = 0

	if pirsA > 0 and pirsA ! 10000:	pierWearCount += 1
	if pirsB > 0 and pirsB ! 10000:	pierWearCount += 1
	if pirsC > 0 and pirsC ! 10000:	pierWearCount += 1
	if pirsD > 0 and pirsD ! 10000:	pierWearCount += 1
	if pirsE > 0 and pirsE ! 10000:	pierWearCount += 1
	if pirsF > 0 and pirsF ! 10000:	pierWearCount += 1
	if pirsG > 0 and pirsG ! 10000:	pierWearCount += 1
	if pirsN > 0 and pirsN ! 10000:	pierWearCount += 1
end

!!---------- Random Name -----------------------------------------------------------------------------------------	

if $ARGS[0] = 'pav_client':
	!!Reset
	prostitute['pav_internal'] = 0

	gs 'prostitution_functions', 'std_cum_check'

	!!Regular
	if prostitute['pav_total'] < 10:
		prostitute['pav_chance'] = 0
	elseif prostitute['pav_total'] >= 10 and prostitute['pav_total'] <= 25:
		prostitute['pav_chance'] = 1
	elseif prostitute['pav_total'] > 25 and prostitute['pav_total'] <= 50:
		prostitute['pav_chance'] = 2
	elseif prostitute['pav_total'] > 50 and prostitute['pav_total'] <= 100:
		prostitute['pav_chance'] = 3
	elseif prostitute['pav_total'] > 100 and prostitute['pav_total'] <= 250:
		prostitute['pav_chance'] = 4
	end

	if ((prostitute['pav_chance'] = 1 and rand(1,100) > 95) or (prostitute['pav_chance'] = 2 and rand(1,100) > 90) or (prostitute['pav_chance'] = 3 and rand(1,100) > 80) or (prostitute['pav_chance'] = 4 and rand(1,100) > 60)) and (pro_rand ! 8 or (pro_rand = 8 and prostitute['pav_regular_s8'] = 1)):
		prostitute['pav_regular'] = 1
!!	elseif prostitute['pav_chance'] > 0 and rand(1,100) > 92:
!!		prostitute['pav_regular'] = -1
	else
		prostitute['pav_regular'] = 0
	end

!!ToDo: Add cheat for this chance
	$prostitute['client_behavior'] = iif(rand(1,100) < prostitute['client_behavior_chance'] or prostitute['pav_regular'] = -1, 'nice', 'abusive')

	!!---- Scene --------------------------------------------------------------------------------------------------	
	
	if pro_rand > 7:
		$prostitute['pav_scene'] = 'anal'
	elseif mesec = 0 and rand(0,100) < 50:
		$prostitute['pav_scene'] = 'pussy'
	else
		$prostitute['pav_scene'] = 'blowjob'
	end

	if pro_rand = 0 or pro_rand = 8 or pro_rand = 9 or ((pro_rand = 2 or pro_rand = 3 or (pro_rand = 5 and $prostitute['client_behavior'] = 'nice') or pro_rand = 6 or pro_rand = 7) and $prostitute['pav_scene'] = 'pussy'):
		$prostitute['pav_location'] = 'private'
		if pro_rand = 3 or pro_rand = 8: $prostitute['client_behavior'] = 'abusive'
	elseif pro_rand = 1 and $prostitute['pav_scene'] = 'pussy':
		$prostitute['pav_location'] = iif($prostitute['client_behavior'] = 'nice', 'private', 'public')
	elseif ((pro_rand = 2 or pro_rand = 3 or pro_rand = 6 or pro_rand = 7) and $prostitute['pav_scene'] = 'blowjob') or pro_rand = 4 or pro_rand = 5:
		$prostitute['pav_location'] = 'public'
		if pro_rand = 5: $prostitute['client_behavior'] = 'abusive'
	else
		gt 'prostitution_pavlovsk', 'rng'
	end

	if prostitute['pav_regular_s8'] = 1 and pro_rand = 8: prostitute['pav_regular'] = 1

	if (pro_rand = 3 or pro_rand = 8) and $prostitute['pav_scene'] = 'private' and prostitute['pav_regular'] = 1:
		prostitute['pav_condom_refusal'] = 1
	else
		prostitute['pav_condom_refusal'] = 0
	end

	!!---- Generator ----------------------------------------------------------------------------------------------	
	
	gs 'npcgeneratec', 0, 'pavlovsk client', rand(18,45)
	gs 'boyStat', $npclastgenerated
end

!!---- Checking visible STD and cum -------------------------------------------------------------------------------	

if $ARGS[0] = 'std_cum_check':
	!!---- Visible STD --------------------------------------------------------------------------------------------	
	
	if pcs_apprnc = -10 and rand(1,10) < 8:
		prostitute['std_mod'] = 1
	else
		prostitute['std_mod'] = 0
	end

	!!---- Non-Visible Cum ----------------------------------------------------------------------------------------	
	
	if cumloc[0] = 1:
		prostitute['cum_vaginal_mod'] = 1
	else
		prostitute['cum_vaginal_mod'] = 0
	end

	if cumloc[3] = 1:
		prostitute['cum_anal_mod'] = 1
	else
		prostitute['cum_anal_mod'] = 0
	end

	!!---- Visible Cum (Dressed) ----------------------------------------------------------------------------------	
	
	if cumloc[7] = 1 or cumloc[11] = 1 or cumloc[13] = 1 or cumloc[15] = 1:
		prostitute['cum_dressed'] = 1
	else
		prostitute['cum_dressed'] = 0
	end

	!!Visible Cum (Undressed)
	if cumloc[1] = 1 or cumloc[4] = 1 or cumloc[8] = 1 or cumloc[14] = 1 or cumloc[16] = 1:
		prostitute['cum_undressed'] = 1
	else
		prostitute['cum_undressed'] = 0
	end
end

	
!!---------- Exact Rounding --------------------------------------------------------------------------------------	
if $ARGS[0] = 'exact_round':
	!! ARGS[1] = value you want divided
	!! ARGS[2] = divider
	!!  func('prostitution_functions','exact_round', number, divider)
	!!  func('prostitution_functions','exact_round', 12345, 7)
	if ARGS[2] ! 0:
		round_number = ARGS[1]/ARGS[2]
		if (ARGS[2] mod 2 ! 0 and ARGS[1] mod ARGS[2] > ARGS[2]/2) or (ARGS[2] mod 2 = 0 and ARGS[1] mod ARGS[2] >= ARGS[2]/2): round_number += 1
		round_number = round_number * ARGS[2]
		result = round_number
		killvar 'round_number'
	else
		'<b>Developer Note: No division by 0. Please report this and some text from the mainscreen as a bug in the whore life thread.</b>'
	end
end


--- prostitution_functions ---------------------------------