# wardrobe

if $ARGS[0] = 'start':
	if ward_img_hgt = 0:ward_img_hgt = 250
	'<center><B><U>Outfit overview - Click on an item to change it</U></B></center>'

	'<center><table border=0 cellspacing=<<ward_img_hgt/25>> cellpadding=5>'
	*p '<TH>Bra worn</TH><TH>Outfit worn</TH><TH>Coat (only worn outside when cold)</TH>'
	*P '<TR><TD><center><a href="exec:gt ''bras'', ''view_bra_list'', ''wardrobe''"><img Height = <<ward_img_hgt>> src="<<FUNC(''$body_image'',''bra'')>>"></a></center></TD><TD><center><a href="exec:gt ''clothing_QV'', ''list''"><img Height = <<ward_img_hgt * 2>> src="<<FUNC(''$body_image'',''clothes'')>>"></a></center></TD><TD><center>'
	if defaultcoat = 0:
		'<a href="exec:gt ''cloakroom'', ''view_coat_list''"><img Height = <<ward_img_hgt * 2>> src="images/pc/noitemdh.png"></a>'
	else
		'<a href="exec:gt ''cloakroom'', ''view_coat_list''"><img Height = <<ward_img_hgt * 2>> src="<<FUNC(''$body_image'', ''coat'')>>"></a>'
	end
	'</center></TD>'

	'<TR><TD><center>'
	if $braworntype ! 'none':
		'<a href="exec:gs ''bras'', ''remove'' & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD><TD><center>'
	if $clothingworntype ! 'nude':
		'<a href="exec:gs ''clothing'', ''strip'' & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD><TD><center>'
	if defaultcoat ! 0:
		'<a href="exec:defaultcoat_warmth = 0 & defaultcoat = 0 & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD>'

	*p '<TR><TH>Panties worn</TH><TH>Shoes (Only worn outside)</TH><TH>Purse worn</TH>'
	*P '<TR><TD><center><a href="exec:gt ''panties'', ''view_panty_list'', ''wardrobe''"><img Height = <<ward_img_hgt>> src="<<FUNC(''$body_image'',''panties'')>>"></a></center></TD><TD><center><a href="exec:gt ''shoes'', ''view_shoe_list'', ''wardrobe''"><img Height = <<ward_img_hgt>> src="<<FUNC(''$body_image'', ''shoes'')>>"></a></center></TD><TD><center>'
	if bag = 1:
		'<a href="exec:gt ''purses'', ''view_purse_list''"><img Height = <<ward_img_hgt>> src="<<FUNC(''$purse_image'',  $currentpursetype, currentpursenumber)>>"></a>'
	else
		'<a href="exec:gt ''purses'', ''view_purse_list''"><img Height = <<ward_img_hgt>> src="images/pc/noitem.png"></a>'
	end
	'</center></TD>'

	'<TR><TD><center>'
	if $pantyworntype ! 'none':
		'<a href="exec:gs ''panties'', ''remove'' & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD><TD><center>'
	if $shoeworntype ! 'none':
		'<a href="exec:gs ''shoes'', ''strip'' & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD><TD><center>'
	if bag = 1:
		'<a href="exec:gs ''purses'', ''remove'' & gt ''wardrobe'', ''start''">Remove</a>'
	else
		'Remove'
	end
	'</center></TD>'

	'</table></center>'
	act 'Leave': gt $Loc, $Metka

	act 'Strip all clothes/shoes':
		gs 'bras', 'remove'
		gs 'clothing', 'strip'
		gs 'panties', 'remove'
		gs 'shoes', 'strip'
		gt 'wardrobe', 'start'
	end
		
	act 'Remove everything':
		gs 'bras', 'remove'
		gs 'clothing', 'strip'
		defaultcoat = 0
		gs 'panties', 'remove'
		gs 'shoes', 'strip'
		gs 'purses', 'remove'
		gt 'wardrobe', 'start'
	end

	act 'Set outfit as a default': gt 'wardrobe', 'default_set'

	act 'Choose a default outfit': gt 'wardrobe', 'default'

	act 'Set image height for this view':
		cla
		*clr
		'The default is 250px'
		ward_img_hgt = input("Enter height in pixels you want for images on this page (min 100, max 500)")
		if ward_img_hgt < 100:
			ward_img_hgt = 100
		elseif ward_img_hgt > 500:
			ward_img_hgt = 500
		end
		act 'Return': gt 'wardrobe', 'start'
	end
end

!!---------------------------Oufit stuff----------------------------------

if $ARGS[0] = 'default':
	gs 'stat'
	if ARRSIZE('defclothingnumber') = 0:
		'You have no default outfits set.'
	else
		i = 0
		:loopdefclothing
		'<<$def_clothing_name[i]>> <a href="exec:gs ''wardrobe'', ''default_entry_wear'', <<i>>">Wear this default outfit</a> <a href="exec:gs ''wardrobe'', ''default_entry_delete'', <<i>>">Delete this default outfit</a>'
		i += 1
		if i < ARRSIZE('defclothingnumber'):jump 'loopdefclothing'
	end
	act 'Return': gt 'wardrobe', 'start'
end

if $ARGS[0] = 'default_entry_wear':
	default_entry = ARGS[1]
	
	gs 'clothing_attributes', $defclothingtype[default_entry], defclothingnumber[default_entry]
	if dyneval('RESULT = <<$defclothingtype[default_entry]>>[<<defclothingnumber[default_entry]>>]') = 0:
		$defclothingtype[default_entry] = 'none' & defclothingnumber[default_entry] = 0
	elseif dyneval('RESULT = <<$defclothingtype[default_entry]>>H[<<defclothingnumber[default_entry]>>]') <= 0 or CloExhibit > pcs_exhibition:
		$defclothingtype[default_entry] = 'none' & defclothingnumber[default_entry] = 0
	elseif $defclothingtype[default_entry] ! 'exercise' and $defclothingtype[default_entry] ! 'coat' and CloStyle ! 5:
		!! if the hipsize is too far from your hipsize
		dynamic 'RESULT = <<$defclothingtype[default_entry]>>B[<<defclothingnumber[default_entry]>>]'
		if RESULT < pcs_hips - 8 or RESULT > pcs_hips + 8:
			$defclothingtype[default_entry] = 'none' & defclothingnumber[default_entry] = 0
		else
			gs 'clothing', 'wear', $defclothingtype[default_entry], defclothingnumber[default_entry]
		end
	end
	gs 'clothing', 'wear', $defclothingtype[default_entry], defclothingnumber[default_entry]

	if dyneval('RESULT = <<$defbratype[default_entry]>>_bras[<<defbranumber[default_entry]>>]') = 0: $defbratype[default_entry] = 'none' & defbranumber[default_entry] = 0
	gs 'bras', 'wear', $defbratype[default_entry], defbranumber[default_entry]

	if dyneval('RESULT = <<$defpantytype[default_entry]>>_panties[<<defpantynumber[default_entry]>>]') = 0: $defpantytype[default_entry] = 'none' & defpantynumber[default_entry] = 0
	gs 'panties', 'wear', $defpantytype[default_entry], defpantynumber[default_entry]

	if dyneval('RESULT = s<<$defshoetype[default_entry]>>[<<defshoenumber[default_entry]>>]') = 0: $defshoetype[default_entry] = 'none' & defshoenumber[default_entry] = 0
	gs 'shoes', 'wear', $defshoetype[default_entry], defshoenumber[default_entry]

	if dyneval('RESULT = <<$defpursetype[default_entry]>>_purses[<<defpursenumber[default_entry]>>]') = 0:
		$defpursetype[default_entry] = 'none' & defpursenumber[default_entry]
	end
	$currentpursetype = $defpursetype[default_entry]
	currentpursenumber = defpursenumber[default_entry]
	if $currentpursetype = 'none':
		bag = 0
	else
		bag = 1
	end
	if menu_option = 1:dynamic $menu_addoldmenu
	if menu_option = 0:gs 'obj_din', 'new'

	if dyneval('RESULT = coat[<<defcoat[default_entry]>>]') = 0: defcoat[default_entry] = 0
	defaultcoat = defcoat[default_entry]

	killvar 'default_entry'
	gs 'stat'
end

if $ARGS[0] = 'default_set':
	gs 'stat'
	if ARRSIZE('defclothingnumber') ! 0:
		i = 0
		:loopdefclothing_set
		'<<$def_clothing_name[i]>> <a href="exec:gs ''wardrobe'', ''default_entry_set'', <<i>>">Overwrite this</a>'
		i += 1
		if i < ARRSIZE('defclothingnumber'):jump 'loopdefclothing_set'
	end
	act 'Add as new default': gt 'wardrobe', 'default_entry_set', ARRSIZE('defclothingnumber')
	act 'Return': gt 'wardrobe', 'start'
end

if $ARGS[0] = 'default_entry_set':
	gs 'stat'
	i = ARGS[1]
	$defclothingtype[i] = $clothingworntype
	defclothingnumber[i] = clothingwornnumber
	$defbratype[i] = $braworntype
	defbranumber[i] = brawornnumber
	$defpantytype[i] = $pantyworntype
	defpantynumber[i] = pantywornnumber
	$defshoetype[i] = $shoeworntype
	defshoenumber[i] = shoewornnumber
	$defpursetype[i] = $currentpursetype
	defpursenumber[i] = currentpursenumber
	defcoat[i] = defaultcoat

	$def_clothing_name[i] = input ('Enter name for for this outfit (Leave blank for default)')
	if $def_clothing_name[i] = '': $def_clothing_name[i] = 'default <<i>>'
	gt 'wardrobe', 'default_set'
end

if $ARGS[0] = 'default_entry_delete':
	gs 'stat'
	i = ARGS[1]
	killvar 'defclothingtype', i
	killvar 'defclothingnumber', i
	killvar 'defbratype', i
	killvar 'defbranumber', i
	killvar 'defpantytype', i
	killvar 'defpantynumber', i
	killvar 'defshoetype', i
	killvar 'defshoenumber', i
	killvar 'defpursetype', i
	killvar 'defpursenumber', i
	killvar 'defcoat', i
	killvar 'def_clothing_name', i
	gt 'wardrobe', 'default_set'
end

--- wardrobe ---------------------------------

