# clothing

$clothing_list_line = {
	!! a single line in a clothing list (wardrobe, etc)
	!! ARGS 0 - action type (wardrobe, sell)
	!! ARGS 1 - clothing type
	!! ARGS 2 - clothing index

	!$RESULT = FUNC('$short_description', $ARGS[1])
	!$RESULT += '<<ARGS[2]>>'
	$RESULT = '<TR><TD><<FUNC(''$short_description'', $ARGS[1])>> <<ARGS[2]>></TD>'
	if $ARGS[1] ! 'school' or ARGS[2] ! 6:
		!$RESULT += ' (strength ' + dyneval '$RESULT += <<$ARGS[1]>>H[<<ARGS[2]>>]'
		$RESULT += '<TD>' + dyneval '$RESULT += <<$ARGS[1]>>H[<<ARGS[2]>>]' + '</TD>'

		if $ARGS[1] ! 'exercise' and $ARGS[1] ! 'coat' and CloStyle ! 5:
			!$RESULT += ', hip size ' + dyneval '$RESULT += <<$ARGS[1]>>B[<<ARGS[2]>>]'
			$RESULT += '<TD>' + dyneval '$RESULT += <<$ARGS[1]>>B[<<ARGS[2]>>]' + '</TD>'
		else
			$RESULT += '<TD></TD>'
		end

		!$RESULT += ')'
	else
		$RESULT += '<TD td colspan="2"></TD>'
	end
	gs 'clothing_attributes', $ARGS[1], ARGS[2]
	if $ARGS[1] ! 'coat' and $ARGS[1] ! 'swimwear':
		gs 'clothing_descriptions'
		$RESULT += '<TD><<$description>></TD>'
	else
		$RESULT += '<TD>' + FUNC('$clothing_name', $ARGS[1], ARGS[2]) + '</TD>'
	end

	if CloBimbo = 1:
		$RESULT += '<TD>Yes</TD>'
	else
		$RESULT += '<TD>No</TD>'
	end

	if $ARGS[1] = 'naughty' and CloQuality < 4:
		$RESULT += '<TD>Yes</TD>'
	else
		$RESULT += '<TD>No</TD>'
	end

	$RESULT += '<TD><a href="exec:gt ''clothing'', ''view_clothing_item'', ''<<$ARGS[0]>>'', ''<<$ARGS[1]>>'', <<ARGS[2]>>">View</a>'

	if $ARGS[0] ! 'sell':
		if ($ARGS[1] ! 'coat' and $ARGS[1] ! 'swimwear') and dyneval('RESULT = <<$ARGS[1]>>H[<<ARGS[2]>>]') > 0:
			if $ARGS[1] ! 'exercise' and CloStyle ! 5 and (dyneval('RESULT = <<$ARGS[1]>>B[<<ARGS[2]>>]') < (bedra - 8) or dyneval('RESULT = <<$ARGS[1]>>B[<<ARGS[2]>>]') > (bedra + 8)):
				$RESULT += '</TD>'
			else
				$RESULT += ' <a href="exec:gs ''clothing'', ''wear'', ''<<$ARGS[1]>>'', <<ARGS[2]>> & gt ''clothing'', ''view_clothing_list'', ''wardrobe''">Wear</a></TD>'
			end
		else
			$RESULT += '</TD>'
		end
	end
}

if $ARGS[0] = 'view_clothing_list':
	!! ARGS 0 - view_clothing_list
	!! ARGS 1 - action type (wardrobe, sell, resize)
	!! ARGS 2 - brothel flag (brothel)

	act 'Leave':gt $loc, $metka

	'<table border=1><TH>Name</TH><TH>Strength</TH><TH>Hip size</TH><TH>Description</TH><TH>Bimbo</TH><TH>Prostitute</TH><TH>Actions</TH>'

	if $ARGS[1] = 'wardrobe':
		if $clothingworntype ! 'nude':act 'Strip':gs 'clothing', 'strip' & gt $loc, $metka
		if StoryLine = 1 and SchoolAtestat = 0 and SchoolBlock = 0 and ($clothingworntype ! 'school' or clothingwornnumber ! 6):*P dyneval($clothing_list_line, $ARGS[1], 'school', 6)
	end

	i = 1
	:loopcheap
		if cheap[i] = 1 and ($clothingworntype ! 'cheap' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'cheap', i)
		i += 1
	if i <= 85:jump 'loopcheap'

	i = 1
	:loopaverage
		if average[i] = 1 and ($clothingworntype ! 'average' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'average', i)
		i += 1
	if i <= 125:jump 'loopaverage'

	i = 1
	:loopexpensive
		if expensive[i] = 1 and ($clothingworntype ! 'expensive' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'expensive', i)
		i += 1
	if i <= 147:jump 'loopexpensive'

	i = 1
	:loopformal
		if formal[i] = 1 and ($clothingworntype ! 'formal' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'formal', i)
		i += 1
	if i <= 14:jump 'loopformal'

	i = 1
	:loopoffice
		if office[i] = 1 and ($clothingworntype ! 'office' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'office', i)
		i += 1
	if i <= 30:jump 'loopoffice'

	i = 1
	:loopschool
		if school[i] = 1 and ($clothingworntype ! 'school' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'school', i)
		i += 1
		if i = 6: i = 7
	if i <= 14:jump 'loopschool'

	i = 1
	:loopexercise
		if exercise[i] = 1 and ($clothingworntype ! 'exercise' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'exercise', i)
		i += 1
	if i <= 26:jump 'loopexercise'

	i = 1
	:loopnaughty
		if naughty[i] = 1 and ($clothingworntype ! 'naughty' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'naughty', i)
		i += 1
	if i <= 67:jump 'loopnaughty'

	i = 1
	:loopexhibit
		if exhibit[i] = 1 and ($clothingworntype ! 'exhibit' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'exhibit', i)
		i += 1
	if i <= 30:jump 'loopexhibit'

	i = 1
	:loopuniform
		if uniform[i] = 1 and ($clothingworntype ! 'uniform' or clothingwornnumber ! i):*P dyneval($clothing_list_line, $ARGS[1], 'uniform', i)
		i += 1
	if i <= 24:jump 'loopuniform'

	i = 1
	:loopcoat
		if coat[i] = 1:*P dyneval($coat_list_line, $ARGS[1], 'coat', i)
		i += 1
	if i <= 12:jump 'loopcoat'

	i = 1
	:loopswimwear
		if swimwear[i] = 1:*P dyneval($clothing_list_line, $ARGS[1], 'swimwear', i)
		i += 1
	if i <= 30:jump 'loopswimwear'

	'</table>' 
end

if $ARGS[0] = 'view_clothing_item':
	!! ARGS 0 - view_clothing_item
	!! ARGS 1 = action type (wardrobe, shop, sell, resize)
	!! ARGS 2 - clothing type
	!! ARGS 3 - clothing index
	!! ARGS 4 - price for shop

	cla
	'<center><img src="<<FUNC(''$clothing_image'',  $ARGS[2], ARGS[3])>>"></center>'
	$RESULT = FUNC('$short_description', $ARGS[2])
	$RESULT += '<<ARGS[3]>>'
	'<<$RESULT>>'
	gs 'clothing_attributes', $ARGS[2], ARGS[3]
	if $ARGS[2] ! 'coat' and $ARGS[2] ! 'swimwear':
		gs 'clothing_descriptions'
		'<<$description>>'
	else
		FUNC('$clothing_name', $ARGS[2], ARGS[3])
	end

	if CloBimbo = 1:'This item is considered bimbo clothing.'

	if $ARGS[2] = 'naughty' and CloQuality < 4:'This outfit can be used for prostitution.'
	if $ARGS[2] = 'uniform':
		if CloStyle2 = 1:
			'This outfit is considered to be a maid uniform.'
		else
			'This outfit is a server uniform, suitable for jobs that require one.'
		end
	end

	if $ARGS[1] ! 'shop' and ($ARGS[2] ! 'school' or $ARGS[3] ! 6):
		$RESULT = '(strength '
		dynamic '$RESULT += <<$ARGS[2]>>H[<<ARGS[3]>>]'
		if $ARGS[2] ! 'exercise' and $ARGS[2] ! 'coat' and CloStyle ! 5:
			$RESULT += ', hip size '
			dynamic '$RESULT += <<$ARGS[2]>>B[<<ARGS[3]>>]'
		end
		$RESULT += ')'
		'<<$RESULT>>'
	end

	if $ARGS[1] = 'shop':
		if dyneval('RESULT = <<$ARGS[2]>>[<<ARGS[3]>>]') = 1:
			'You already own this item.'
			act 'Leave': gt $loc, $metka
		else
			price = ('<<ARGS[4]>>' * ((5 * CloQuality) + 100) / 100) * 1000 / (1250 - Clothingstock[ARGS[3]])
			'Price: <<price>>'
			act 'Leave': gt $loc, $metka
			if money >= Price:
				act 'Buy':
					h = 0
					if CloStyle = 2:h = 10
					if CloStyle = 5:h = 20
					h += (3 * CloQuality)
					money -= price
					dynamic $ARGS[2] + '[<<ARGS[3]>>] = 1'
					if $ARGS[2] = 'cheap' or $ARGS[2] = 'office':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 70 + <<h>>'
					elseif $ARGS[2] = 'average':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 90 + <<h>>'
					elseif $ARGS[2] = 'formal':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 15 + <<h>>'
					elseif $ARGS[2] = 'naughty' or $ARGS[2] = 'exhibit':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 35 + <<h>>'
					elseif $ARGS[2] = 'school' or $ARGS[2] = 'uniform':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 120 + <<h>>'
					elseif $ARGS[2] = 'exercise':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 100 + <<h>>'
					elseif $ARGS[2] = 'coat':
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 250 + <<h>>'
					else
						dynamic $ARGS[2] + 'H[<<ARGS[3]>>] = 60 + <<h>>'
					end
					dynamic $ARGS[2] + 'B[<<ARGS[3]>>] = bedra'
					gt $loc, $metka
				end
			else
				'You cannot afford this outfit.'
			end
		end
	elseif $ARGS[1] = 'wardrobe':
		act 'Leave in closet':gt 'clothing', 'view_clothing_list', $ARGS[1]

		if $ARGS[2] ! 'school' and $ARGS[3] ! 6:
			!! if the clothing is worn out
			if dyneval('RESULT = <<$ARGS[2]>>H[<<ARGS[3]>>]') <= 0:
				'This item is worn and is not suitable for further wear.'
				exit
			end

			!! if the clothing is a type that checks for hip size
			if $ARGS[2] ! 'exercise' and $ARGS[2] ! 'coat' and CloStyle ! 5:
				!! if the hipsize is too far from your hipsize
				dynamic 'RESULT = <<$ARGS[2]>>B[<<ARGS[3]>>]'
				if RESULT < bedra - 8:
					'This item is too small for you to wear.'
					if poSkill >= 100:
						cla
						'You can resize this thanks to your sewing skill.'
						minut += 15
						act 'Resize':
							dynamic '<<$ARGS[2]>>B[<<ARGS[3]>>] = bedra'
							gt 'clothing', 'view_clothing_list', $ARGS[1]
						end
						act 'Leave in closet':
							gt 'clothing', 'view_clothing_list', $ARGS[1]
						end
					end
					exit
				elseif RESULT > bedra + 8:
					'This item is too large for you to wear.'
					if poSkill >= 100:
						cla
						'You can resize this thanks to your sewing skill.'
						minut += 15
						act 'Resize':
							dynamic '<<$ARGS[2]>>B[<<ARGS[3]>>] = bedra'
							gt 'clothing', 'view_clothing_list', $ARGS[1]
						end
						act 'Leave in closet':
							gt 'clothing', 'view_clothing_list', $ARGS[1]
						end
					end
					exit
				end
			end
		end

		! WD: Bimbo look
		if $ARGS[2] ! 'coat' and $ARGS[2] ! 'swimwear':
			act 'Wear':
				gs 'clothing', 'wear', $ARGS[2], ARGS[3]
				dynamic $ARGS[2] + 'W[<<ARGS[3]>>] = 1'
				gt 'clothing', 'view_clothing_list', $ARGS[1]
			end
		end

		if dyneval('RESULT = <<$ARGS[2]>>H[<<ARGS[3]>>]') < 5 and poSkill >= 200 and tkan > 0:
			act 'Repair item':
				if rand (1, 100) < 30:
					cla
					tkan -= 1
					minut += 30
					dynamic $ARGS[2] + 'H[<<ARGS[3]>>] += 30'
					'You spend 30 minutes fixing the outfit.'
					act 'Return':gt 'clothing', 'view_clothing_list', $ARGS[1]
				else
					cla
					tkan += 3
					minut += 30
					dynamic $ARGS[2] + '[<<ARGS[3]>>] = 0'
					'Despite your skill with a needle, this outfit has proved beyond repair. All that is left of it is only good for your cloth pile.'
					act 'Return':gt 'clothing', 'view_clothing_list', $ARGS[1]
				end
			end
		end
		
	elseif $ARGS[1] = 'sell':
		act 'Keep item':gt 'clothing', 'view_clothing_list', $ARGS[1]

		!! value is based on the strength remaining
		dynamic 'RESULT = <<$ARGS[2]>>H[<<ARGS[3]>>]'
		if RESULT > 45:
			'You can sell this item for 500 rubles.'
			act 'Sell':
				dynamic '<<$ARGS[2]>>[<<ARGS[3]>>] = 0'
				money += 500
				gt 'clothing', 'view_clothing_list', $ARGS[1]
			end
		elseif RESULT > 30:
			'You can sell this item for 300 rubles.'
			act 'Sell':
				dynamic '<<$ARGS[2]>>[<<ARGS[3]>>] = 0'
				money += 300
				gt 'clothing', 'view_clothing_list', $ARGS[1]
			end
			elseif RESULT > 0:
			'You can sell this item for 100 rubles.'
			act 'Sell':
				dynamic '<<$ARGS[2]>>[<<ARGS[3]>>] = 0'
				money += 100
				gt 'clothing', 'view_clothing_list', $ARGS[1]
			end
		else
			'This item is too worn to have any sale value.'
		end
	elseif $ARGS[1] = 'resize':
		act 'Leave item alone':gt 'clothing', 'view_clothing_list', $ARGS[1]

		if $ARGS[2] ! 'exercise' and $ARGS[2] ! 'coat' and CloStyle ! 5:
			if dyneval('RESULT = <<$ARGS[2]>>B[<<ARGS[3]>>]') ! bedra and money >= 500:
				'You can have this resized for 500 rubles.'
				act 'Resize':
					money -= 500
					dynamic '<<$ARGS[2]>>B[<<ARGS[3]>>] = bedra'
					gt 'clothing', 'view_clothing_list', $ARGS[1]
				end
			end
		end
	end
end

if $ARGS[0] = 'strip':
	cumspclnt = 6
	gs 'cum_cleanup'
	if cloth_vid = 1:
		last_vid = 1
	else
		last_vid = 0
	end
	if $clothingworntype = 'school':schtype = clothingwornnumber
	$lastwornclothingtype = $clothingworntype
	lastwornclothingnumber = clothingwornnumber
	$clothingworntype = 'nude'
	clothingwornnumber = 0
	CloQuality = 0
	CloThinness = 0
	CloTopCut = 0
	CloPantsShortness = 0
	CloSkirtShortness = 0
	CloStyle = 0
	CloBimbo = 0
	PCloQuality = 0
	PCloThinness = 0
	PCloTopCut = 0
	PCloPants = 0
	PCloSkirt = 0
	PCloStyle = 0
	PCloBimbo = 0
	glamur = 0
	sport = 0
	ski = 0
	ofclo = 0
	sexual = 0
	odevnesh = 0
	! WD: Bimbo look
	cloth_vid = 0
	exhibiHideNewCloth = 0

end

if $ARGS[0] = 'wear':
	!! ARGS 0 - action
	!! ARGS 1 - clothing type name
	!! ARGS 2 - clothing index

	gs 'clothing', 'strip'

	$clothingworntype = $ARGS[1]
	clothingwornnumber = ARGS[2]
	
	if $ARGS[1] ! 'coat' and $ARGS[1] ! 'swimwear':
		gs 'clothing_descriptions'
	else
		FUNC('$clothing_name', $ARGS[1], ARGS[2])
	end

	gs 'clothing_attributes', $ARGS[1], ARGS[2]

	PCloQuality = CloQuality
	PCloThinness = CloThinness
	PCloTopCut = CloTopCut
	PCloPants = CloPantsShortness
	PCloSkirt = CloSkirtShortness
	PCloStyle = CloStyle
	PCloStyle2 = CloStyle2
	PCloBimbo = CloBimbo
	if CloBimbo = 1:bimbocl = 1

	if PCloTopCut > 1:
		if tits = 2 or tits = 3:PCloTopCut += 1
		if tits = 4 or tits = 5:PCloTopCut += 2
		if tits >= 6:PCloTopCut += 3
	end

!Calculations for clothing beauty, multiplied by natural beauty
	if PCloThinness > 0:
		if PCloThinness = 1:
			PXCloThinness = 25
		elseif PCloThinness = 2:
			PXCloThinness = 50
		elseif PCloThinness = 3:
			PXCloThinness = 100
		elseif PCloThinness = 4:
			PXCloThinness = 150
		elseif PCloThinness = 5:
			PXCloThinness = 200
		elseif PCloThinness = 6:
			PXCloThinness = 300
		elseif PCloThinness >= 7:
			PXCloThinness = 400
		end
	end

	if PCloTopCut > 0:
		if PCloTopCut = 1:
			PXCloTopCut = 25
		elseif PCloTopCut = 2:
			PXCloTopCut = 50
		elseif PCloTopCut = 3:
			PXCloTopCut = 100
		elseif PCloTopCut = 4:
			PXCloTopCut = 150
		elseif PCloTopCut = 5:
			PXCloTopCut = 200
		elseif PCloTopCut = 6:
			PXCloTopCut = 300
		elseif PCloTopCut >= 7:
			PXCloTopCut = 400
		end
	end

	if PCloSkirt > 0:
		if PCloSkirt = 1:
			PXCloSkirtShortness = 25
		elseif PCloSkirt = 2:
			PXCloSkirtShortness = 50
		elseif PCloSkirt = 3:
			PXCloSkirtShortness = 100
		elseif PCloSkirt = 4:
			PXCloSkirtShortness = 150
		elseif PCloSkirt = 5:
			PXCloSkirtShortness = 200
		elseif PCloSkirt = 6:
			PXCloSkirtShortness = 300
		elseif PCloSkirt >= 7:
			PXCloSkirtShortness = 400
		end
	end

	if PCloPants > 0:
		if PCloPants = 1:
			PXCloPantsShortness = 25
		elseif PCloPants = 2:
			PXCloPantsShortness = 50
		elseif PCloPants = 3:
			PXCloPantsShortness = 100
		elseif PCloPants = 4:
			PXCloPantsShortness = 150
		elseif PCloPants = 5:
			PXCloPantsShortness = 200
		elseif PCloPants = 6:
			PXCloPantsShortness = 300
		elseif PCloPants >= 7:
			PXCloPantsShortness = 400
		end
	end
end

if $ARGS[0] = 'wear_last_worn':
	gs 'clothing', 'wear', $lastwornclothingtype, lastwornclothingnumber
end

--- clothing ---------------------------------

