code:
:: Forest Shop

	<<forestShop-main>>

:: Forest Shop Widgets [widget]

<<widget "forestShop-main">>
	<<set $outside to 0>><<set $location to "forest_shop">><<effects>>
	<<set $shopName = "forest">>
	<<if $tryOn.autoReset isnot false>><<tryOnReset>><</if>>
	<<specialClothesUpdate>>
	<<if $forest_shop_intro isnot 1>>
		<<set $forest_shop_intro to 1>>
		<<npc Gwylan>><<person1>>
		<<if $gwylan_rescue is 1>>
			You enter the strange building. The interior is dark and crowded by tall shelves, holding all manner of items.

			The quiet is broken by a scraping, then a thud. A mousy <<personsimple>> holding a stepladder appears at the end of the closest aisle. It's Gwylan.

			"You came!" <<he>> says, dropping the ladder and walking over. <<He>> wipes <<his>> hands on <<his>> apron. "Welcome to my shop."

			<<if $gwylan_aborted is 1>>
				<<set $gwylan_aborted to 0>>

				<<if $gwylan_eden_coop gte 1>>
					<<He>> rubs the back of <<his>> neck. "By the way, sorry for not saving you before, but I'm not messing with Eden. <<nnpc_He "Eden">> still scares me." <<He>> frowns. "Why were you two fighting anyway? Did you fall out?"

				<<else>>
					<<He>> rubs the back of <<his>> neck. "By the way, sorry for not saving you before, but I'm not messing with the <<nnpc_title "Eden">>. <<nnpc_Hes "Eden">> the scariest thing in the forest."
				<</if>>

			<<elseif $gwylan_aborted is 2>>
				<<set $gwylan_aborted to 0>>

				<<He>> rubs the back of <<his>> neck. "By the way, sorry for not saving you before, but I'm not messing with the alpha. I don't want the entire pack breaking my door down."

			<<elseif $gwylan_aborted is 3>>
				<<set $gwylan_aborted to 0>>

				<<He>> looks you over with concern. "Are you feeling okay? You look a little pale, and I thought I heard you screaming the other night..."
			<</if>>

		<<else>>
			You enter the strange building. The interior is dark and crowded by tall shelves, holding all manner of items. The quiet is broken by a scraping, then a thud. A <<personsimple>> holding a stepladder appears at the end of the closest aisle.

			"A customer!" <<he>> says, dropping the ladder and walking over. <<He>> wipes <<his>> hands on <<his>> apron. "Welcome to my shop."

			<<He>> looks about your age, with mousy hair and a hint of freckles. "I'm older than I look," <<he>> says, as if reading your mind. "I'm Gwylan." <<He>> reaches forward, lifts your hand, and shakes it in both <<his>> own. "Pleased to meet you. I sell-" <<he>> pauses. "My grand<<if $pronoun is "m">>father<<else>>mother<</if>> sells-" another pause. "I sell knick-knacks here. Things you won't find in normal shops. Even I don't know what I have in stock!" <<He>> sounds proud.

			"I hope you find something you like," <<he>> says, picking the ladder back up. "But don't worry if you don't. My grand<<if $pronoun is "m">>father<<else>>mother<</if>> would say the objects here hide from people they don't want to be bought by." <<He>> laughs. "I could believe it."
		<</if>>

		<<link [[Next|Forest Shop]]>><<endevent>><</link>>

	<<else>>
		You are in the forest shop. The interior is dark and crowded by tall shelves, holding all manner of items. Most are useless knick-knacks, but some interest you.

		<<if $gwylan_aborted is 1>>
			<<set $gwylan_aborted to 0>>
			<<if $gwylan_eden_coop gte 1>>
				"Hey," Gwylan says as you walk in. "Sorry for not saving you before, but I'm not messing with Eden. <<nnpc_He "Eden">> still scares me." <<He>> frowns. "Why were you two fighting anyway? Did you fall out?"

			<<else>>
				"Hey," Gwylan says as you walk in. "Sorry for not saving you before, but I'm not messing with the <<nnpc_title "Eden">>. <<nnpc_Hes "Eden">> the scariest thing in the forest."
			<</if>>

		<<elseif $gwylan_aborted is 2>>
			<<set $gwylan_aborted to 0>>
			"Hey," Gwylan says as you walk in. "Sorry for not saving you before, but I'm not messing with the alpha. I don't want the entire pack breaking my door down."

		<<elseif $gwylan_aborted is 3>>
			<<set $gwylan_aborted to 0>>

			"Hey," Gwylan says as you walk in. <<nnpc_He "Gwylan">> looks concerned. "Are you feeling okay? You look a little pale, and I thought I heard you screaming the other night..."

		<<else>>
			You hear Gwylan shuffling somewhere in the gloom.
		<</if>>

<<tryOnStats>>

		<<unset $shopListStartCount>>
		<<unset $clothes_choice>>
		<<set $shopPage = 0>>

		Warmth:
		<<warmthscale>>

			<<warmth_description>>

		<<if $christmas_gift_robin is undefined and $christmas is 1 and $NPCName[$NPCNameList.indexOf("Robin")].init is 1>>
			<<link [[Find a gift for Robin (0:10)|Forest Christmas Robin]]>><<pass 10>><</link>>

		<</if>>

		<<clothingcategoryicon "outfit">>
		<<link "Look behind the dark screen">><<replace "#clothingShop-div">><<OutfitShop>><</replace>><</link>>

		<<clothingcategoryicon "upper">>
		<<link "Look in the antique wardrobe">><<replace "#clothingShop-div">><<TopShop>><</replace>><</link>>

		<<clothingcategoryicon "lower">>
		<<link "Look on the strange ironing board">><<replace "#clothingShop-div">><<BottomShop>><</replace>><</link>>

		<<clothingcategoryicon "underoutfit">>
		<<link "Look in the moldering hutch">><<replace "#clothingShop-div">><<UnderOutfitShop>><</replace>><</link>>

		<<clothingcategoryicon "underupper">>
		<<link "Look on the rusted hangers">><<replace "#clothingShop-div">><<UnderTopShop>><</replace>><</link>>

		<<clothingcategoryicon "underlower">>
		<<link "Look in the dusky drawer">><<replace "#clothingShop-div">><<UnderBottomShop>><</replace>><</link>>

		<<clothingcategoryicon "head">>
		<<link "Look on the spindly hat stand">><<replace "#clothingShop-div">><<HeadShop>><</replace>><</link>>

		<<clothingcategoryicon "face">>
		<<link "Look on the gnarled wall">><<replace "#clothingShop-div">><<FaceShop>><</replace>><</link>>

		<<clothingcategoryicon "neck">>
		<<link "Look in the glowing box">><<replace "#clothingShop-div">><<NeckShop>><</replace>><</link>>

		<<clothingcategoryicon "hand">>
		<<link "Look in the tilted vanity">><<replace "#clothingShop-div">><<HandsShop>><</replace>><</link>>

		<<clothingcategoryicon "legs">>
		<<link "Look in the worn stocking">><<replace "#clothingShop-div">><<LegsShop>><</replace>><</link>>

		<<clothingcategoryicon "feet">>
		<<link "Look beneath the decaying rack">><<replace "#clothingShop-div">><<FeetShop>><</replace>><</link>>

		<<run linkifyDivs('.button-back-to-shop')>>

		<<if $tryOn.value gt 0 and $tryOn.value lt $money>>
			<<sendItemsToDropdown>>
			<<link "Buy clothes and send to wardrobe">>
				<<buyTryOnClothes "wardrobe">>
				<<updatesidebarmoney>>
				<<updatesidebarimg>>
				<<updatesidebardescription>>
				<<updateallure>>
				<<updatewarmthscale>>
				<<updatewarmthdescription>>
				<<updateclothingshop>>
			<</link>>

		<<elseif $tryOn.value is 0>>
			<<link [[Leave|Forest]]>><<shopClothingFilterReset>><<endnpc>><<unset $clothes_choice>><<ShowUnderEquip "normal">><<ShowUnderEquip "over">><<set $tryOn.autoReset to true>><<set $eventskip to 1>><<unset $tempDisable>><</link>>
		<</if>>
	<</if>>
<</widget>>

:: Forest Christmas Robin
<<effects>>

You search through an assortment of strange clothes, before finding a Christmas-themed outfit in Robin's size. There's a price tag: "£80".

<<if $money gte 8000>>
	<<link [[Buy it|Forest Christmas Robin Buy]]>><<set $christmas_gift_robin to "christmas_unwrapped">><</link>>

<</if>>
<<link [[Next|Forest Shop]]>><</link>>

:: Forest Christmas Robin Buy
<<effects>>

You hand Gwylan the cash.
<<if $christmas_wrap is undefined>>Now you just need wrapping paper. You can buy some at the shopping centre.<<else>>You can wrap it in your room.<</if>>

<<link [[Next|Forest Shop]]>><</link>>


code:
:: Special Clothing [widget]

<<widget "specialClothesEffectsSetup">>
<<if $specialClothesEffects is undefined>>
	<<set $specialClothesEffects to {
		bimbo:0,
		bimboTotal:0,
		bimboMessage:0
	}>>
<</if>>
<</widget>>

<<widget "bimboCheck">>
<<if $worn[$args[0]].type.includes("bimbo")>>
	<<set $specialClothesEffects.bimbo++>>
<</if>>
<</widget>>

<<widget "bimboUpdate">>
<<if $specialClothesEffects.bimbo gt 0>>
	<<set $breastgrowthtimer -= $specialClothesEffects.bimbo * 5>>
	<<if $player.penisExist>>
		<<set $penisgrowthtimer += $specialClothesEffects.bimbo * 5>>
	<</if>>
	<<set $bottomgrowthtimer -= $specialClothesEffects.bimbo * 5>>
	<<if $specialClothesEffects.bimboTotal lt 10000>>
		<<set $specialClothesEffects.bimboTotal += $specialClothesEffects.bimbo>>
	<</if>>
	<<set $specialClothesEffects.bimbo to 0>>

	<<if $specialClothesEffects.bimboTotal gte 400 and $specialClothesEffects.bimboMessage is 0>>
		<<set $specialClothesEffects.bimboMessage to 1>><<set _skipEvent to true>>
		<<if $player.gender_body is "m">>
			<<set $player.gender_body to "a">>
		<</if>>

			You feel different, but you're not sure how or why.
			<<if $worn.upper.type.includes("bimbo") or $worn.lower.type.includes("bimbo") or $worn.feet.type.includes("bimbo")>>
				Your clothing seems to cling to you.
			<</if>>

	<<elseif $specialClothesEffects.bimboTotal lt 400 and $specialClothesEffects.bimboMessage is 1>>
		<<set $specialClothesEffects.bimboMessage to 0>>
	<</if>>
	<<if $specialClothesEffects.bimboTotal gte 800 and $specialClothesEffects.bimboMessage is 1 and _skipEvent isnot true>>
		<<set $specialClothesEffects.bimboMessage to 2>><<set _skipEvent to true>>
		<<if $player.gender_body isnot "f">>
			<<set $player.gender_body to "f">>
		<</if>>

			You feel different yet again, this time you're more sure about it, something is making you look more feminine.
			<<if $worn.upper.type.includes("bimbo") or $worn.lower.type.includes("bimbo") or $worn.feet.type.includes("bimbo")>>
				You feel different yet again, but this time you're more sure about it.
			<<else>>
				Your thoughts turn to the outfit you had on earlier.
			<</if>>

	<<elseif $specialClothesEffects.bimboTotal lt 800 and $specialClothesEffects.bimboMessage is 2>>
		<<set $specialClothesEffects.bimboMessage to 1>>
	<</if>>
	<<if $specialClothesEffects.bimboTotal gte 1200 and $specialClothesEffects.bimboMessage is 2 and _skipEvent isnot true>>
		<<set $specialClothesEffects.bimboMessage to 3>>
		<<if !$backgroundTraits.includes("lustful")>>
			<<run $backgroundTraits.pushUnique("lustful")>>
		<</if>>
		<<arousal 10000>>
		You feel an odd sense of yearning grow within you, and you are filled with a deep desire. An unbearable lust soon takes hold.

	<<elseif $specialClothesEffects.bimboTotal lt 1200 and $specialClothesEffects.bimboMessage is 3>>
		<<set $specialClothesEffects.bimboMessage to 2>>
	<</if>>
<</if>>
<</widget>>

<<widget "heelsUpdate">>
<<if $worn.feet.type.includes("heels")>>
	<<if $feetskill lt $worn.feet.reveal>>
		<<set $tiredness += (($worn.feet.reveal - $feetskill) / 150)>>
	<</if>>
<</if>>
<</widget>>

repo_name: Area/degrees

license: mit


code:
:: Store Actions [widget]
<<widget "storeactions">>
<<set _temp_strip to $args[0]>>
<<exposure>>
<<outfitChecks>>
<<otherOutfitChecks>>
<<if $action_unclad_over_outfit is 1>><<set $action_unclad_over_outfit to 0>>
	<<if $worn.upper.name isnot "naked" and $worn.lower.name isnot "naked">>
		You remove your $worn.over_upper.name.
	<<elseif _temp_strip is "wolfcave">>
		You remove your $worn.over_upper.name. They may be animals, but stripping in front of them makes a chill run through your spine.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.over_upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.over_upper.name. Despite being alone, doing this in a public space makes a chill run through your spine.

	<</if>>
	<<overupperundress _temp_strip>>
<</if>>

<<if $action_unclad_over_upper is 1>><<set $action_unclad_over_upper to 0>>
	<<if $worn.upper.name isnot "naked">>
		You remove your $worn.over_upper.name.
	<<elseif _temp_strip is "wolfcave">>
		You remove your $worn.over_upper.name. They may be animals, but stripping in front of them makes your <<nipples>> erect and your newly-exposed skin tingle.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.over_upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.over_upper.name. Despite being alone, doing this in a public space makes your <<nipples>> erect and your newly-exposed skin tingle.

	<</if>>
	<<overupperundress _temp_strip>>
<</if>>

<<if $action_unclad_over_lower is 1>><<set $action_unclad_over_lower to 0>>
	<<if $worn.lower.name isnot "naked">>
		You remove your $worn.over_lower.name.
	<<elseif _temp_strip is "wolfcave">>
		You remove your $worn.over_lower.name. They may be animals, but stripping in front of them makes you shiver delightfully.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.over_lower.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.over_lower.name. Despite being alone, doing this in a public space makes you shiver delightfully.

	<</if>>
	<<overlowerundress _temp_strip>>
<</if>>

<<if $action_unclad_outfit is 1>><<set $action_unclad_outfit to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.upper.name. They may be animals, but stripping in front of them makes a chill run through your spine.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.upper.name. Despite being alone, doing this in a public space makes a chill run through your spine.

	<</if>>
	<<upperundress _temp_strip>>
<</if>>

<<if $action_unclad_upper is 1>><<set $action_unclad_upper to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.upper.name. They may be animals, but stripping in front of them makes your <<nipples>> erect and your newly-exposed skin tingle.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.upper.name. Despite being alone, doing this in a public space makes your <<nipples>> erect and your newly-exposed skin tingle.

	<</if>>
	<<upperundress _temp_strip>>
<</if>>

<<if $action_unclad_lower is 1>><<set $action_unclad_lower to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.lower.name. They may be animals, but stripping in front of them makes you shiver delightfully.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.lower.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.lower.name. Despite being alone, doing this in a public space makes you shiver delightfully.

	<</if>>
	<<lowerundress _temp_strip>>
<</if>>

<<if $action_unclad_under_outfit is 1>><<set $action_unclad_under_outfit to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.under_upper.name. They may be animals, but stripping in front of them makes a chill run through your spine.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.under_upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.under_upper.name. Despite being alone, doing this in a public space makes a chill run through your spine.

	<</if>>
	<<underupperundress _temp_strip>><<underlowerundress _temp_strip>>
<</if>>

<<if $action_unclad_under_upper is 1>><<set $action_unclad_under_upper to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.under_upper.name. They may be animals, but stripping in front of them makes your skin and <<genitals 1>> tingle.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.under_upper.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.under_upper.name. Despite being alone, doing this in a public space makes your skin and <<genitals 1>> tingle.

	<</if>>
	<<underupperundress _temp_strip>>
<</if>>

<<if $action_unclad_under_lower is 1>><<set $action_unclad_under_lower to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.under_lower.name. They may be animals, but stripping in front of them makes your skin and <<genitals 1>> tingle.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.under_lower.name.<<if $bird.activity is "bathe">> The <<beasttype>> doesn't seem to mind your exposure.<</if>>
	<<else>>
		You check to make sure no one is around, then slowly remove your $worn.under_lower.name. Despite being alone, doing this in a public space makes your skin and <<genitals 1>> tingle.

	<</if>>
	<<underlowerundress _temp_strip>>
<</if>>

<<if $action_unclad_legs is 1>><<set $action_unclad_legs to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.legs.name.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.legs.name<<if $worn.feet.type.includes("naked")>> and dip your feet into the water<</if>>.<<if $bird.activity is "bathe">> The <<beasttype>> looks at your legs, then at <<bhis>> own quizically.<</if>>
	<<else>>
		You remove your $worn.legs.name.

	<</if>>
	<<legsundress _temp_strip>>
<</if>>

<<if $action_unclad_feet is 1>><<set $action_unclad_feet to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.feet.name. You're glad you aren't the only one barefoot here.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.feet.name<<if $worn.legs.type.includes("naked")>> and dip your feet into the water<</if>>.<<if $bird.activity is "bathe" and $monster is 1>> The <<beasttype>> almost looks envious of your ability to hide your "talons".<</if>>
	<<else>>
		You remove your $worn.feet.name.

	<</if>>
	<<feetundress _temp_strip>>
<</if>>

<<if $action_unclad_neck is 1>><<set $action_unclad_neck to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.neck.name.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.neck.name.
	<<else>>
		You remove your $worn.neck.name.

	<</if>>
	<<neckundress _temp_strip>>
<</if>>

<<if $action_unclad_over_head is 1>><<set $action_unclad_over_head to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.over_head.name.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.over_head.name.
	<<else>>
		You remove your $worn.over_head.name.

	<</if>>
	<<overheadundress _temp_strip>>
<</if>>

<<if $action_unclad_head is 1>><<set $action_unclad_head to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.head.name.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.head.name.
	<<else>>
		You remove your $worn.head.name.

	<</if>>
	<<headundress _temp_strip>>
<</if>>

<<if $action_unclad_face is 1>><<set $action_unclad_face to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.face.name.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.face.name.
	<<else>>
		You remove your $worn.face.name.

	<</if>>
	<<faceundress _temp_strip>>
<</if>>

<<if $action_unclad_hands is 1>><<set $action_unclad_hands to 0>>
	<<if _temp_strip is "wolfcave">>
		You remove your $worn.hands.name. You try to think up a pun about being "bear handed", but then remember you're surrounded by wolves, not bears.

	<<elseif $location is "pool">>
	<<elseif $location is "tower">>
		You remove your $worn.hands.name.
	<<else>>
		You remove your $worn.hands.name.

	<</if>>
	<<handsundress _temp_strip>>
<</if>>

<<for _active_clothes range Object.keys($store)>>
	<<for _i to 0; _i lt $store[_active_clothes].length; _i++>>
		<<if $store[_active_clothes][_i].location is _temp_strip>>
		<<set _temp_clothes_present to 1>>
		<</if>>
	<</for>>
<</for>>

<<if _temp_clothes_present is 1>>

	<<link [[Get dressed|$passage]]>><<storeon _temp_strip>><<set $eventskip to 1>><</link>>

<</if>>

/*Just incase some items are removed*/
<<outfitChecks>>
<<otherOutfitChecks>>

<<set _stripOptions to {}>>

<<set _over_upper_protected to $worn.over_upper.exposed lt 2 or $player.gender_appearance_without_overwear isnot "f";
	_over_lower_protected to $worn.over_lower.exposed lt 2 and !setup.clothes.over_lower[clothesIndex('over_lower', $worn.over_lower)].skirt;
	_upper_protected to $worn.upper.exposed lt 2 or $player.gender_appearance_without_overwear isnot "f";
	_lower_protected to $worn.lower.exposed lt 2 and !setup.clothes.lower[clothesIndex('lower', $worn.lower)].skirt;
	_under_upper_protected to !$worn.under_upper.exposed or $player.gender_appearance_without_overwear isnot "f";
	_under_lower_protected to !$worn.under_lower.exposed;
>>

<<if !$worn.over_upper.cursed and !$worn.over_lower.cursed and _overOutfit>>

	<<if $exhibitionism gte 15 or ((_lower_protected or _under_lower_protected) and (_upper_protected or _under_upper_protected))>>

		<<set _stripOptions[$worn.over_upper.name] to "stripOverOutfit">>
	<</if>>
<</if>>

<<if !$worn.over_upper.cursed and $worn.over_upper.name isnot "naked" and !_overOutfit>>

	<<if $exhibitionism gte 15 or _upper_protected or _under_upper_protected>>
		<<set _stripOptions[$worn.upper.name] to "stripOverUpper">>
	<</if>>
<</if>>

<<if !$worn.over_lower.cursed and $worn.over_lower.name isnot "naked" and !_overOutfit>>

	<<if $exhibitionism gte 15 or _lower_protected or _under_lower_protected>>
		<<set _stripOptions[$worn.over_lower.name] to "stripOverLower">>
	<</if>>
<</if>>

<<if !$worn.upper.cursed and !$worn.lower.cursed and _middleOutfit>>
	<<if $exhibitionism gte 15 or ((_over_lower_protected or _under_lower_protected) and (_over_upper_protected or _under_upper_protected))>>
		<<set _stripOptions[$worn.upper.name] to "stripOutfit">>
	<</if>>
<</if>>

<<if $worn.upper.cursed isnot 1 and $worn.upper.name isnot "naked" and !_middleOutfit>>
	<<if $exhibitionism gte 15 or _over_upper_protected or _under_upper_protected>>
		<<set _stripOptions[$worn.upper.name] to "stripUpper">>
	<</if>>
<</if>>

<<if !$worn.lower.cursed and $worn.lower.name isnot "naked"	and !_middleOutfit>>
	<<if $exhibitionism gte 15 or _over_lower_protected or _under_lower_protected>>
		<<set _stripOptions[$worn.lower.name] to "stripLower">>
	<</if>>
<</if>>

<<if !$worn.under_upper.cursed and !$worn.under_lower.cursed and _underOutfit>>
	<<if $exhibitionism gte 15 or ((_over_lower_protected or _lower_protected) and (_over_upper_protected or _upper_protected))>>
		<<set _stripOptions[$worn.under_upper.name] to "stripUnderOutfit">>
	<</if>>
<</if>>

<<if !$worn.under_upper.cursed and $worn.under_upper.name isnot "naked" and !_underOutfit>>
	<<if $exhibitionism gte 15 or _over_upper_protected or _upper_protected>>
		<<set _stripOptions[$worn.under_upper.name] to "stripUnderUpper">>
	<</if>>
<</if>>

<<if !$worn.under_lower.cursed and $worn.under_lower.name isnot "naked" and !_underOutfit>>
	<<if $exhibitionism gte 15 or _over_lower_protected or _lower_protected>>
		<<set _stripOptions[$worn.under_lower.name] to "stripUnderLower">>
	<</if>>
<</if>>

<<if !$worn.legs.cursed and !_otherOutfits.legs and $worn.legs.name isnot "naked">>
	<<set _stripOptions[$worn.legs.name] to "stripLegs">>
<</if>>

<<if !$worn.feet.cursed and !_otherOutfits.feet and $worn.feet.name isnot "naked">>
	<<set _stripOptions[$worn.feet.name] to "stripFeet">>
<</if>>

<<if !$worn.neck.cursed and !_otherOutfits.neck and $worn.neck.name isnot "naked">>
	<<set _stripOptions[$worn.neck.name] to "stripNeck">>
<</if>>

<<if !$worn.over_head.cursed and !_otherOutfits.over_head and $worn.over_head.name isnot "naked">>
	<<set _stripOptions[$worn.over_head.name] to "stripOverHead">>
<</if>>

<<if !$worn.head.cursed and !_otherOutfits.head and $worn.head.name isnot "naked">>
	<<set _stripOptions[$worn.head.name] to "stripHead">>
<</if>>

<<if !$worn.face.cursed and !_otherOutfits.face and $worn.face.name isnot "naked">>
	<<set _stripOptions[$worn.face.name] to "stripFace">>
<</if>>

<<if !$worn.hands.cursed and !_otherOutfits.hands and $worn.hands.name isnot "naked">>
	<<set _stripOptions[$worn.hands.name] to "stripHands">>
<</if>>

<<if Object.keys(_stripOptions).length gt 0>>
	Remove<<if $location isnot "tower">> and hide<</if>> your...

	<<listbox "$storeActions">>
		<<optionsfrom _stripOptions>>
	<</listbox>>
	<<link [[Confirm|$passage]]>>
		<<set $eventskip to 1>>
		<<switch $storeActions>>
			<<case "stripOverOutfit">><<set $action_unclad_over_outfit to 1>>
			<<case "stripOverUpper">><<set $action_unclad_over_upper to 1>>
			<<case "stripOverLower">><<set $action_unclad_over_lower to 1>>
			<<case "stripOutfit">><<set $action_unclad_outfit to 1>>
			<<case "stripUpper">><<set $action_unclad_upper to 1>>
			<<case "stripLower">><<set $action_unclad_lower to 1>>
			<<case "stripUnderOutfit">><<set $action_unclad_under_outfit to 1>>
			<<case "stripUnderUpper">><<set $action_unclad_under_upper to 1>>
			<<case "stripUnderLower">><<set $action_unclad_under_lower to 1>>
			<<case "stripLegs">><<set $action_unclad_legs to 1>>
			<<case "stripFeet">><<set $action_unclad_feet to 1>>
			<<case "stripNeck">><<set $action_unclad_neck to 1>>
			<<case "stripOverHead">><<set $action_unclad_over_head to 1>>
			<<case "stripHead">><<set $action_unclad_head to 1>>
			<<case "stripFace">><<set $action_unclad_face to 1>>
			<<case "stripHands">><<set $action_unclad_hands to 1>>
			<<default>>
		<</switch>>
	<</link>>
<</if>>

<<exposure>>

<</widget>>


code:
:: Widgets updateClothes [widget]
<<widget "updateClothes">>

<<set _equip to setup.clothes_all_slots>>
<<set _skip to ["integrity","integrity_max","colour","accessory_colour", "exposed", "vagina_exposed", "anus_exposed", "anal_shield", "one_piece", "skirt_down", "state", "state_top","name_cap","iconFile","accIcon","notuck","skirt","description","colour_options","accessory_colour_options","fabric_strength","integrity_max","bustresize","sleeve_img","breast_img","exposed_base","vagina_exposed_base","anus_exposed_base","state_top_base","state_base",,"word","femininity","strap","cost","shop"]>>
<<set _remap_colours to {"light-pink":"light pink", "blue-steel":"blue steel"}>>

<<for _i to 0; _i lt _equip.length; _i++>>
	<<set _worn to $worn[_equip[_i]]>>
	<<set _default to setup.clothes[_equip[_i]][clothesIndex(_equip[_i],_worn)]>>
	<<set _keys to Object.keys(_default)>>
	<<for _j to 0; _j lt _keys.length; _j++>>
		<<if _skip.includes(_keys[_j])>>
			<<continue>>
		<</if>>
		<<if _keys[_j] is "outfitPrimary">>
			<<if _worn[_keys[_j]] is undefined and _default[_keys[_j]] isnot undefined>>
				<<set _worn[_keys[_j]] to clone(_default[_keys[_j]])>>
				<<if _worn.one_piece is "broken">>
					<<if _equip[_i] is "upper">>
						<<set _worn[_keys[_j]].lower to "broken">>
					<<elseif _equip[_i] is "under_upper">>
						<<set _worn[_keys[_j]].under_lower to "broken">>
					<</if>>
				<</if>>
			<</if>>
			<<continue>>
		<</if>>
		<<if _keys[_j] is "outfitSecondary">>
			<<if _worn[_keys[_j]] is undefined and _default[_keys[_j]] isnot undefined>>
				<<set _worn[_keys[_j]] to clone(_default[_keys[_j]])>>
				<<if _worn.one_piece is "broken">>
					<<set _worn[_keys[_j]][1] to "broken">>
				<</if>>
			<</if>>
			<<continue>>
		<</if>>
		<<set _worn[_keys[_j]] to clone(_default[_keys[_j]])>>
	<</for>>
	<<set _worn.colour to _remap_colours[_worn.colour] || _worn.colour>>
	<<set _worn.accessory_colour to _remap_colours[_worn.accessory_colour] || _worn.accessory_colour>>
	<!--Fix for 0.2.21.x issue-->
	<<if _worn.colour_combat isnot undefined and _default.colour_options.length is 0>>
		<<set _worn.colour to 0>>
	<</if>>
	<<if _worn.accessory_colour_combat isnot undefined and _default.colour_options.length is 0>>
		<<set _worn.accessory_colour to 0>>
	<</if>>
	<!--end of fix-->
	<<if _equip[_i] is "genitals">>
		<<continue>>
	<</if>>
	<<if _worn.name is "Crop top">>
		<<set _worn.name to "crop top">>
	<</if>>

	<<set _carried to $carried[_equip[_i]]>>
	<<set _default to setup.clothes[_equip[_i]][clothesIndex(_equip[_i],_carried)]>>
	<<set _keys to Object.keys(_default)>>
	<<for _j to 0; _j lt _keys.length; _j++>>
		<<if _skip.includes(_keys[_j])>>
			<<continue>>
		<</if>>
		<<if _keys[_j] is "outfitPrimary">>
			<<if _carried[_keys[_j]] is undefined and _default[_keys[_j]] isnot undefined>>
				<<set _carried[_keys[_j]] to clone(_default[_keys[_j]])>>
				<<if _carried.one_piece is "broken">>
					<<if _equip[_i] is "upper">>
						<<set _carried[_keys[_j]].lower to "broken">>
					<<elseif _equip[_i] is "under_upper">>
						<<set _carried[_keys[_j]].under_lower to "broken">>
					<</if>>
				<</if>>
			<</if>>
			<<continue>>
		<</if>>
		<<if _keys[_j] is "outfitSecondary">>
			<<if _carried[_keys[_j]] is undefined and _default[_keys[_j]] isnot undefined>>
				<<set _carried[_keys[_j]] to clone(_default[_keys[_j]])>>
				<<if _carried.one_piece is "broken">>
					<<set _carried[_keys[_j]][1] to "broken">>
				<</if>>
			<</if>>
			<<continue>>
		<</if>>
		<<set _carried[_keys[_j]] to clone(_default[_keys[_j]])>>
	<</for>>
	<<set _carried.colour to _remap_colours[_carried.colour] || _carried.colour>>
	<<set _carried.accessory_colour to _remap_colours[_carried.accessory_colour] || _carried.accessory_colour>>
	<!--Fix for 0.2.21.x issue-->
	<<if _carried.colour_combat isnot undefined and _default.colour_options.length is 0>>
		<<set _carried.colour to 0>>
	<</if>>
	<<if _carried.accessory_colour_combat isnot undefined and _default.colour_options.length is 0>>
		<<set _carried.accessory_colour to 0>>
	<</if>>
	<!--end of fix-->
	<<if _carried.name is "Crop top">>
		<<set _carried.name to "crop top">>
	<</if>>
	<<for _j to 0; _j lt $wardrobe[_equip[_i]].length; _j++>>
		<<set _wardrobe to $wardrobe[_equip[_i]][_j]>>
		<<set _default to setup.clothes[_equip[_i]][clothesIndex(_equip[_i],_wardrobe)]>>
		<<set _keys to Object.keys(_default)>>
		<<for _k to 0; _k lt _keys.length; _k++>>
			<<if _skip.includes(_keys[_k])>>
				<<continue>>
			<</if>>
			<<if _keys[_k] is "outfitPrimary">>
				<<if _wardrobe[_keys[_k]] is undefined and _default[_keys[_k]] isnot undefined>>
					<<set _wardrobe[_keys[_k]] to clone(_default[_keys[_k]])>>
					<<if _wardrobe.one_piece is "broken">>
						<<if _equip[_i] is "upper">>
							<<set _wardrobe[_keys[_k]].lower to "broken">>
						<<elseif _equip[_i] is "under_upper">>
							<<set _wardrobe[_keys[_k]].under_lower to "broken">>
						<</if>>
					<</if>>
				<</if>>
				<<continue>>
			<</if>>
			<<if _keys[_k] is "outfitSecondary">>
				<<if _wardrobe[_keys[_k]] is undefined and _default[_keys[_k]] isnot undefined>>
					<<set _wardrobe[_keys[_k]] to clone(_default[_keys[_k]])>>
					<<if _wardrobe.one_piece is "broken">>
						<<set _wardrobe[_keys[_k]][1] to "broken">>
					<</if>>
				<</if>>
				<<continue>>
			<</if>>
			<<set _wardrobe[_keys[_k]] to clone(_default[_keys[_k]])>>
		<</for>>
		<<set _wardrobe.colour to _remap_colours[_wardrobe.colour] || _wardrobe.colour>>
		<<set _wardrobe.accessory_colour to _remap_colours[_wardrobe.accessory_colour] || _wardrobe.accessory_colour>>
		<!--Fix for 0.2.21.x issue-->
		<<if _wardrobe.colour_combat isnot undefined and _default.colour_options.length is 0>>
			<<set _wardrobe.colour to 0>>
		<</if>>
		<<if _wardrobe.accessory_colour_combat isnot undefined and _default.colour_options.length is 0>>
			<<set _wardrobe.accessory_colour to 0>>
		<</if>>
		<!--end of fix-->
	<</for>>
<</for>>
<<for _i to 0; _i lt $outfit.length; _i++>>
	<<if $outfit[_i].upper is "Crop top">>
		<<set $outfit[_i].upper to "crop top">>
	<</if>>
<</for>>

<</widget>>

<!--New isolated wardrobes also need updates to the `clothesReturnLocation` function in ingame.js-->
<<widget "wardrobesUpdate">>
<<set _default to {
	face:[],
	feet:[],
	hands:[],
	head:[],
	legs:[],
	lower:[],
	neck:[],
	over_head:[],
	over_lower:[],
	over_upper:[],
	under_lower:[],
	under_upper:[],
	upper:[],
	unlocked: false,
	shopSend: false,
	transfer: true,
	isolated: false,
	locationRequirement:[],
	space:5
}>>
<<set _defaultExtended to {
	face:[],
	feet:[],
	hands:[],
	head:[],
	legs:[],
	lower:[],
	neck:[],
	over_head:[],
	over_lower:[],
	over_upper:[],
	under_lower:[],
	under_upper:[],
	upper:[],
	unlocked: false,
	shopSend: true,
	transfer: true,
	isolated: false,
	locationRequirement:[],
	space:40
}>>
<<if $wardrobes is undefined>>
	<<set $wardrobes to {
		shopReturn:"wardrobe",
		wardrobe:{
			NOTE:"DO NOT USE THIS OBJECT TO STORE CLOTHES",
			unlocked: true,
			shopSend: true,
			name: "Orphanage"
		},
		changingRoom:clone(_default),
		edensCabin:clone(_default),
		asylum:clone(_default),
		alexFarm:clone(_defaultExtended),
		stripClub:clone(_default),
		brothel:clone(_default),
		schoolBoys:clone(_default),
		schoolGirls:clone(_default),
		prison: clone(_default)
	}>>

	<<set $wardrobes.changingRoom.name to "Beach changing room">>
	<<set $wardrobes.changingRoom.unlocked to true>>

	<<set $wardrobes.edensCabin.name to "Eden's Cabin">>
	<<set $wardrobes.edensCabin.space to 10>>
	<<if $syndromeeden>>
		<<set $wardrobes.edensCabin.unlocked to true>>
	<</if>>

	<<set $wardrobes.asylum.locationRequirement.push("asylum")>>
	<<set $wardrobes.asylum.name to "Asylum">>
	<<set $wardrobes.asylum.transfer to false>>
	<<set $wardrobes.asylum.isolated to true>>

	<<set $wardrobes.alexFarm.name to "Alex's Farm">>
	<<if $farm_stage gte 7>>
		<<set $wardrobes.alexFarm.unlocked to true>>
	<</if>>

	<<set $wardrobes.stripClub.name to "Strip Club">>
	<<set $wardrobes.stripClub.space to 10>>
	<<if $stripclubdancingintro>>
		<<set $wardrobes.stripClub.unlocked to true>>
	<</if>>

	<<set $wardrobes.brothel.name to "Brothel">>
	<<set $wardrobes.brothel.space to 10>>
	<<if $brotheljob>>
		<<set $wardrobes.brothel.unlocked to true>>
	<</if>>

	<<set $wardrobes.schoolBoys.name to "Schools boy's locker">>
	<<set $wardrobes.schoolBoys.unlocked to true>>
	<<set $wardrobes.schoolBoys.under_lower.push(setup.clothes.under_lower[7])>>
	<<set $wardrobes.schoolBoys.under_lower.last().colour to "blue">>

	<<set $wardrobes.schoolGirls.name to "Schools girl's locker">>
	<<set $wardrobes.schoolGirls.unlocked to true>>
	<<set $wardrobes.schoolGirls.under_lower.push(setup.clothes.under_lower[6])>>
	<<set $wardrobes.schoolGirls.under_lower.last().colour to "blue">>
	<<set $wardrobes.schoolGirls.under_upper.push(setup.clothes.under_upper[2])>>
	<<set $wardrobes.schoolGirls.under_upper.last().colour to "blue">>

	<<set $wardrobes.prison.name to "Prison Locker">>
	<<set $wardrobes.prison.transfer to false>>
	<<set $wardrobes.prison.isolated to true>>

	<<for _label, _value range $worn>>
		<<set $worn[_label].lastTaken to "wardrobe">>
	<</for>>
	<<if $carried isnot undefined>>
		<<for _label, _value range $carried>>
			<<set $worn[_label].lastTaken to "wardrobe">>
		<</for>>
	<</if>>
	<<if $store isnot undefined>>
		<<for _label, _value range $store>>
			<<set $store[_label].forEach(item => {
				item.lastTaken = "wardrobe"
			})>>
		<</for>>
	<</if>>
<</if>>
<<if $wardrobes.prison.name is "Prison Locker">>
	<<set $wardrobes.prison.name to "Prison locker">>
<</if>>

<<if $objectVersion.wardrobes lt 2>>
	<<set _equip to setup.clothes_all_slots>>
	<<for $_i to 0; $_i lt _equip.length; $_i++>>
		<<if $wardrobe[_equip[$_i]] is undefined>>
			<<continue>>
		<</if>>
		<<for $_j to $wardrobe[_equip[$_i]].length - 1; $_j gte 0; $_j-->>
			<<if $wardrobe[_equip[$_i]][$_j].temp>>
				<<run console.log($wardrobe[_equip[$_i]][$_j])>>
				<<run $wardrobe[_equip[$_i]].deleteAt($_j)>>
			<</if>>
		<</for>>
		<<for $_j to $wardrobes.prison[_equip[$_i]].length - 1; $_j gte 0; $_j-->>
			<<if $wardrobes.prison[_equip[$_i]][$_j].temp>>
				<<run $wardrobes.prison[_equip[$_i]].deleteAt($_j)>>
			<</if>>
		<</for>>
		<<for $_j to $wardrobes.asylum[_equip[$_i]].length - 1; $_j gte 0; $_j-->>
			<<if $wardrobes.asylum[_equip[$_i]][$_j].temp>>
				<<run $wardrobes.asylum[_equip[$_i]].deleteAt($_j)>>
			<</if>>
		<</for>>
	<</for>>
<</if>>

<<if $objectVersion.wardrobes lt 4>>
	<<run clothesDataTrimmerLoop()>>
<</if>>

<</widget>>


code:
:: Widgets Wardrobe [widget]

<<widget "wardrobewear">>
<<if $wardrobes[$wardrobe_location] is undefined>>
	A wardrobe error occured, please report. The default wardrobe will be shown in place of the intended wardrobe.

	wardrobe_location: <<print $wardrobe_location>>

	passage: <<print $passage>>

	<<wardrobeSelection true>>
<</if>>
<<if $wardrobe_location is "wardrobe">>
	<<set _selectedWardrobe to $wardrobe>>
<<else>>
	<<set _selectedWardrobe to $wardrobes[$wardrobe_location]>>
<</if>>

<<if $runWardrobeSanityChecker is true>>
	<<wardrobeSanityCheck>>
	<<set $runWardrobeSanityChecker to false>>
<</if>>
<<if $clothingShop.stolenClothes gt 0>>
	<<set $clothingShop.stolenClothes to 0>>
	You place the clothes you recently stole from the shop in your wardrobe.

<</if>>
<<if $cultBoutique.stolenClothes gt 0>>
	<<set $cultBoutique.stolenClothes to 0>>
	You place the clothes you recently stole from the shop in your wardrobe.

<</if>>
<<if $wear is "strip">>
	You remove your clothing.

	<<undress $wardrobe_location>>
<</if>>
<<wearoutfit>>
<<if $randomWear>>
	<<randomWear>>
<</if>>
<<set _equip to ["over_upper", "over_lower", "upper", "lower", "under_upper", "under_lower", "over_head", "head", "face", "neck", "hands", "legs", "feet"]>>
<<set _slimePrevent to ["upper", "lower", "under_upper", "under_lower"]>>
<<set _towelCheck to ["upper", "lower"]>>
<<set _equipSkip to {"over_upper":false, "over_lower":false, "upper":false, "lower":false, "under_upper":false, "under_lower":false, "over_head":false, "head":false, "face":false, "neck":false, "hands":false, "legs":false, "feet":false}>>
<<for _ie to 0; _ie lt _equip.length;_ie++>>
	<<unset _outfitPieceIds>>
	<<if _equipSkip[_equip[_ie]] is true>>
		<<continue>>
	<</if>>
	<<unset _wearId>><<unset _item>>
	<<switch _equip[_ie]>>
	<<case "over_upper">>
		<<set _wearId to $wear_over_upper>>
	<<case "over_lower">>
		<<set _wearId to $wear_over_lower>>
	<<case "upper">>
		<<set _wearId to $wear_upper>>
	<<case "lower">>
		<<set _wearId to $wear_lower>>
	<<case "under_upper">>
		<<set _wearId to $wear_under_upper>>
	<<case "under_lower">>
		<<set _wearId to $wear_under_lower>>
	<<case "over_head">>
		<<set _wearId to $wear_over_head>>
	<<case "head">>
		<<set _wearId to $wear_head>>
	<<case "face">>
		<<set _wearId to $wear_face>>
	<<case "neck">>
		<<set _wearId to $wear_neck>>
	<<case "hands">>
		<<set _wearId to $wear_hands>>
	<<case "legs">>
		<<set _wearId to $wear_legs>>
	<<case "feet">>
		<<set _wearId to $wear_feet>>
	<</switch>>
	<<if _wearId is undefined>>
		<<continue>>
	<</if>>
	<<if _wearId is "none">>
		<<continue>>
	<</if>>
	<<if $wardrobeOption is "wear" or _wearId is "strip" or _wearId is "towel" or _wearId is "large_towel">>
		/*Checks for cursed equip*/
		<<unset _cursedPrevent>>
		<<set _wornOutfitPrimary to $worn[_equip[_ie]].outfitPrimary>>
		<<if $worn[_equip[_ie]].cursed is 1>>
			You try to remove the <<print $worn[_equip[_ie]].name>>, but fail. <<print "<<cursedtext "+$worn[_equip[_ie]].name+">>">>

			<<set _cursedPrevent to true>>
		<</if>>
		<<if _wornOutfitPrimary isnot undefined>>
			<<for _labelWW, _valueWW range _wornOutfitPrimary>>
				<<if $worn[_labelWW].cursed is 1>>
					<<print "<<cursedtext "+$worn[_labelWW].name+">>">>
					<<set _cursedPrevent to true>>
				<</if>>
			<</for>>
		<</if>>
		<<if _cursedPrevent is true>>
			<<continue>>
		<</if>>
		/*Strips equip and puts it in the wardrobe*/
		<<if _wearId is "strip" and $worn[_equip[_ie]].name isnot "naked">>
			You remove the <<print $worn[_equip[_ie]].name>>.
			<<generalUndress $wardrobe_location _equip[_ie]>>

			<<if _wornOutfitPrimary isnot undefined>>
				<<for _labelWW, _valueWW range _wornOutfitPrimary>>
					<<if _valueWW isnot "broken" and $worn[_labelWW].name isnot "naked">>
						You remove the <<print $worn[_labelWW].name>>.
						<<generalUndress $wardrobe_location _labelWW>>
					<</if>>
				<</for>>
			<</if>>
			<<continue>>
		<</if>>
		<<unset _wornOutfitPrimary>>
		/*Strips equip, puts it in the wardrobe and equips a towl*/
		<<if _wearId is "towel" and _towelCheck.includes(_equip[_ie])>>
			<<generalUndress $wardrobe_location _equip[_ie]>>
			<<set $worn[_equip[_ie]] to clone(setup.clothes[_equip[_ie]][3])>><<set $worn[_equip[_ie]].colour to clone($worn[_equip[_ie]].colour_options.random())>>
			<<if _equip[_ie] is "upper">>
				You tie a towel around your chest.
			<<else>>
				You tie a towel around your waist.
			<</if>>

			<<continue>>
		<</if>>
		<<if _wearId is "large_towel" and _equip[_ie] is "upper">>
			<<generalUndress $wardrobe_location "upper">><<generalUndress $wardrobe_location "lower">>
			<<set $worn.upper to clone(setup.clothes.upper[14])>><<set $worn.upper.colour to clone($worn.upper.colour_options.random())>>
			<<set $worn.lower to clone(setup.clothes.lower[15])>><<set $worn.lower.colour to clone($worn.upper.colour)>>
			You tie a large towel around your chest.

			<<continue>>
		<</if>>
	<</if>>
	/*Find the item to equip*/
	<<if _wearId gte 0>>
		<<set _item to _selectedWardrobe[_equip[_ie]][_wearId]>>
	<</if>>
	/*Prevent equip when the ear slime doesn't allow it*/
	<<if _wearId gte 0 and _slimePrevent.includes(_equip[_ie]) and $corruption_slime gte 80 and $wardrobeOption is "wear">>
		<<if $willpower lt 800 and _item.reveal lt 500 and !_item.type.includesAny("school", "event")>>
			You were unable to equip your _item.name as the slime in your ear did not permit it.

			<<continue>>
		<</if>>
	<</if>>
	/*Finds any outfit pieces and records the Ids*/
	<<set _outfitPrimary to _item.outfitPrimary>>
	<<if _outfitPrimary isnot undefined>>
		<<set _outfitPieceIds to {}>>
		<<for _labelWW, _valueWW range _outfitPrimary>>
			<<if _valueWW isnot "broken">>
				<<for _j to 0; _j lt _selectedWardrobe[_labelWW].length; _j++>>
					<<if _selectedWardrobe[_labelWW][_j].name is _valueWW and _item.colour is _selectedWardrobe[_labelWW][_j].colour and _item.accessory_colour is _selectedWardrobe[_labelWW][_j].accessory_colour>>
						<<if _selectedWardrobe[_labelWW][_j].outfitSecondary[1] isnot _item.name>>
							<<continue>>
						<</if>>
						<<set _matched to 0>>
						<<if _selectedWardrobe[_labelWW][_j].colour isnot "custom">>
							<<set _matched++>>
						<<elseif _item.colourCustom isnot undefined and _selectedWardrobe[_labelWW][_j].colourCustom isnot undefined>>
							<<if _item.colourCustom is _selectedWardrobe[_labelWW][_j].colourCustom>>
								<<set _matched++>>
							<</if>>
						<</if>>
						<<if _selectedWardrobe[_labelWW][_j].accessory_colour isnot "custom">>
							<<set _matched++>>
						<<elseif _item.accessory_colourCustom isnot undefined and _selectedWardrobe[_labelWW][_j].accessory_colourCustom isnot undefined>>
							<<if _item.accessory_colourCustom is _selectedWardrobe[_labelWW][_j].accessory_colourCustom>>
								<<set _matched++>>
							<</if>>
						<</if>>
						<<if _matched is 2>>
							<<set _outfitPieceIds[clone(_labelWW)] to clone(_j)>>
							<<set _equipSkip[_labelWW] to true>>
							<<break>>
						<</if>>
					<</if>>
				<</for>>
			<</if>>
		<</for>>
		<<if Object.keys(_outfitPieceIds).length is 0>>
			<<unset _outfitPieceIds>>
		<</if>>
	<</if>>
	<<unset _outfitPrimary>>
	<<if $wardrobeOption is "delete" and _wearId gte 0>>
		/*Delete the relating items*/
		<<if _outfitPieceIds isnot undefined>>
			<<for _labelWW, _valueWW range _outfitPieceIds>>
				<<set _selectedWardrobe[_labelWW].deleteAt(_valueWW)>>
			<</for>>
		<</if>>
		You discard the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>>.
		<<set _selectedWardrobe[_equip[_ie]].deleteAt(_wearId)>>

		<<continue>>
	<</if>>
	<<if $wardrobeOption is "repair" and _wearId gte 0>>
		/*Repair the relating items*/
		<<if _outfitPieceIds isnot undefined>>
			<<for _labelWW, _valueWW range _outfitPieceIds>>
				<<set _selectedWardrobe[_labelWW][_valueWW].integrity = clothingData(_labelWW,_selectedWardrobe[_labelWW][_valueWW],'integrity_max')>>
				<<pass 15>>
			<</for>>
		<</if>>
		<<set _selectedWardrobe[_equip[_ie]][_wearId].integrity = clothingData(_equip[_ie],_selectedWardrobe[_equip[_ie]][_wearId],'integrity_max')>>
		<<pass 1>>
		You repair the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>>.

		<<continue>>
	<</if>>
	<<if $wardrobeOption is "seperateOutfits" and _wearId gte 0>>
		<<if _outfitPieceIds isnot undefined>>
			<<for _labelWW, _valueWW range _outfitPieceIds>>
				<<set _selectedWardrobe[_labelWW][_valueWW].outfitSecondary[1] to "broken">>
				<<set _selectedWardrobe[_labelWW][_valueWW].one_piece to "broken">>
			<</for>>
			<<set _selectedWardrobe[_equip[_ie]][_wearId].outfitPrimary[_labelWW] to "broken">>
			<<set _selectedWardrobe[_equip[_ie]][_wearId].one_piece to "broken">>
			You cut up the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>>.
			<<pass 10>>

		<</if>>
		<<continue>>
	<</if>>
	<<if $wardrobeOption is "transfer" and _wearId gte 0 and _wardrobeTransfer isnot $wardrobe_location and _wardrobeTransfer isnot undefined>>
		<<unset _slotsFull>>
		/*Set the target wardrobe*/
		<<if _wardrobeTransfer is "wardrobe" or $wardrobes[_wardrobeTransfer] is undefined>>
			<<set _wardrobeTransferObject to $wardrobe>>
		<<else>>
			<<set _wardrobeTransferObject to $wardrobes[_wardrobeTransfer]>>
		<</if>>
		/*Make sure there is enough space*/
		<<if _wardrobeTransferObject[_equip[_ie]].length gt _wardrobeTransferObject.space>>
			<<set _slotsFull to true>>
		<</if>>
		<<if _outfitPieceIds isnot undefined>>
			<<for _labelWW, _valueWW range _outfitPieceIds>>
				<<if _wardrobeTransferObject[_labelWW].length gt _wardrobeTransferObject.space>>
					<<set _slotsFull to true>>
				<</if>>
			<</for>>
		<</if>>

		<<if !_slotsFull>>
			You transfered the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>> to the <<print $wardrobes[_wardrobeTransfer].name>> storage.
			/*Transfer everything*/
			<<run transferClothing(_equip[_ie],_wearId,_wardrobeTransfer)>>
			<<if _outfitPieceIds isnot undefined>>
				<<for _labelWW, _valueWW range _outfitPieceIds>>
					<<run transferClothing(_labelWW,_valueWW,_wardrobeTransfer)>>
				<</for>>
			<</if>>
		<<else>>
			You were unable to transfer the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>> to the <<print $wardrobes[_wardrobeTransfer].name>> wardrobe due to lack of space there.
		<</if>>
	<</if>>
	<<if $wardrobeOption is "wear" and _wearId gte 0>>
		/*Equip the relating items*/
		<<generalUndress $wardrobe_location _equip[_ie]>>
		<<if _outfitPieceIds isnot undefined>>
			<<for _labelWW, _valueWW range _outfitPieceIds>>
				<<generalUndress $wardrobe_location `clone(_labelWW)`>>
				<<set $worn[clone(_labelWW)] to clone(_selectedWardrobe[clone(_labelWW)][clone(_valueWW)])>>
				<<set $worn[clone(_labelWW)].lastTaken to clone($wardrobe_location)>>
				<<set _selectedWardrobe[_labelWW].deleteAt(_valueWW)>>
				<<resetClothingState _labelWW>>
			<</for>>
		<</if>>
		<<set $worn[_equip[_ie]] to clone(_selectedWardrobe[_equip[_ie]][_wearId])>>
		<<set $worn[_equip[_ie]].lastTaken to clone($wardrobe_location)>>
		<<resetClothingState _equip[_ie]>>
		You put on the <<print _selectedWardrobe[_equip[_ie]][_wearId].name>>.
		<<set _selectedWardrobe[_equip[_ie]].deleteAt(_wearId)>>

	<</if>>
<</for>>
<<if $wear is "dry">><<set $wear to 0>>
	<<set $upperwet to 0>><<set $lowerwet to 0>><<set $underlowerwet to 0>><<set $underupperwet to 0>><<set $upperwetstage to 0>><<set $lowerwetstage to 0>>
	You squeeze the water from your clothes.
	<<effectswater>>

<</if>>
<<set $wear to 0>>
<<set $wear_over_upper to "none">>
<<set $wear_over_lower to "none">>
<<set $wear_upper to "none">>
<<set $wear_lower to "none">>
<<set $wear_under_upper to "none">>
<<set $wear_under_lower to "none">>
<<set $wear_over_head to "none">>
<<set $wear_head to "none">>
<<set $wear_face to "none">>
<<set $wear_neck to "none">>
<<set $wear_hands to "none">>
<<set $wear_legs to "none">>
<<set $wear_feet to "none">>
<<set $wear_outfit to "none">>
<<exposure>>
<</widget>>

<<widget "wardrobe">>

Don't look here.

<<unset $tempDisable>>

<<clotheson>>
 /*Fixes perma pulled aside clothes introduced by 0.2.3.0 bug.*/
<<temperature>>

Warmth:
<<warmthscale>>

	<<warmth_description>>

<<if $upperwet gte 1 or $lowerwet gte 1 or $underlowerwet gte 1 or $underupperwet gte 1>>

	<<link "Dry your clothes">>
		<<set $wear to "dry">>
		<<updatewardrobe>>
		<<if $upperwet lt 1 and $lowerwet lt 1 and $underlowerwet lt 1 and $underupperwet lt 1>>
			<<remove ".wardrobe-dry">>
		<</if>>
	<</link>>

<</if>>

	<<link "Strip all">>
		<<set $wear to "strip">>
		<<updatewardrobe>>
	<</link>>

 |

	<<link "Wear random clothes">>
		<<set $randomWear to true>>
		<<updatewardrobe>>
	<</link>>

 |

	<<link Configure>><<toggleclass "#randomClothingConfigure" "hidden">><</link>>

 |

	<<if $randomEquipConfigure is undefined>>
		<<set $randomEquipConfigure to {face: true, feet: true, head: true, hands: true, legs: true, lower: true, neck: true, under_lower: true, under_upper: true, upper: true}>>
	<</if>>
	<<set _equip to ["upper", "lower", "under_upper", "under_lower","head", "face", "neck", "hands", "legs", "feet"]>>
	<<for _slot range _equip>>
		<<print '<<checkbox "$randomEquipConfigure.'+_slot+'" false true '+($randomEquipConfigure[_slot] is true ? "checked" : "")+'>>'>> <<print _slot.replace("_"," ")>>

	<</for>>

<<if $location is "home" or $location is "town">>
	<<if $tailorMonthlyService is "repair">>
		__Wardrobe Repair Crate__
		There is a small crate ready for sending clothes to be repaired.

		<<link [[Add outfits and send|Wardrobe Repair Crate]]>>
			<<set $wardrobeReturnLink to $passage>>
			<<set $crateContents to "outfits">>
		<</link>>

		<<link [[Add all items and send|Wardrobe Repair Crate]]>>
			<<set $wardrobeReturnLink to $passage>>
			<<set $crateContents to "all">>
		<</link>>

		<<link [[Cancel the request|$passage]]>><<set $tailorMonthlyService to 1>><</link>>

	<<elseif $tailorMonthlyService is "discard">>
		__Wardrobe Sale Crate__
		There is a small crate ready for sending clothes to be sold.

		<<link [[Add outfits and send|Wardrobe Sale Crate]]>>
			<<set $wardrobeReturnLink to $passage>>
			<<set $crateContents to "outfits">>
		<</link>>

		<<link [[Add all items and send|Wardrobe Sale Crate]]>>
			<<set $wardrobeReturnLink to $passage>>
			<<set $crateContents to "all">>
		<</link>>

		<<link [[Cancel the request|$passage]]>><<set $tailorMonthlyService to 1>><</link>>

	<</if>>
	<<if $wardrobeRepair is undefined>>
	<<elseif $wardrobeRepair.timeLeft is 0>>
		The clothes sent to the tailor have been repaired and added back into your wardrobe.
		<<wardrobeGetRepairedClothes>>

	<</if>>
<</if>>

__Clothing sets__

<<listoutfits>>

__Clothing__

<<if $newWardrobeStyle>>
	<<dynamic "wardrobeLinks" "wardrobeLinks">>
	<<dynamic "wardrobeContents" "wardrobeList">>
<<else>>

		<<oldWardrobeListDisplay>>

<</if>>

<<set $upperoff to 0>>
<<set $loweroff to 0>>
<<set $underloweroff to 0>>
<<set $underupperoff to 0>>
<<exposure>>

<<run $(document).on('mousedown', '.wardrobe-action a', (e) => {
	let target = $(e.currentTarget).parent();
	target.addClass('notransition action-flash');
	setTimeout(() => { target.removeClass('notransition action-flash') }, 100);
})>>
<</widget>>

<<widget "wardrobeContents">>
	<<if $lastWardrobeSlot is "NewOutfit">>
		<<wardrobeNewOutfit>>
	<<else>>
		<<wardrobeList $lastWardrobeSlot>>
	<</if>>
<</widget>>

<<widget "wardrobeLinks">>
<<set _wardrobeLinks=[
	{ id: 'over_head', label: 'Over Head', disabled: !$debug },
	{ id: 'over_upper', label: 'Over Upper', disabled: !$debug },
	{ id: 'over_lower', label: 'Over Lower', disabled: !$debug },
	{ id: 'head', label: 'Head' },
	{ id: 'face', label: 'Face' },
	{ id: 'neck', label: 'Neck' },
	{ id: 'upper', label: 'Upper' },
	{ id: 'lower', label: 'Lower' },
	{ id: 'under_upper', label: 'Under Upper' },
	{ id: 'under_lower', label: 'Under Lower' },
	{ id: 'hands', label: 'Hands' },
	{ id: 'legs', label: 'Legs' },
	{ id: 'feet', label: 'Feet' },
	{ id: 'NewOutfit', label: 'New Outfit' },
]>>
<<for _i = 0; _i < _wardrobeLinks.length; _i++>>
	<<set _wardrobeLink=_wardrobeLinks[_i]>>
	<<if !_wardrobeLink.disabled>>
		 $lastWardrobeSlot = id"
		>_wardrobeLink.label<<if _i < _wardrobeLinks.length - 1>> | <</if>>
	<</if>>
<</for>>
<</widget>>

<<widget "wardrobeClothingOptions">>

<<if $wardrobeOption is undefined or $wardrobeOption is 0>><<set $wardrobeOption to "wear">><</if>>
<<if $wardrobeRepeat isnot true or ($wardrobeOption is "repair" and $location isnot "home")>><<set $wardrobeOption to "wear">><</if>>

<<radiobutton "$wardrobeOption" "wear" autocheck>> Wear |
<<radiobutton "$wardrobeOption" "delete" autocheck>> Discard |
<<if $sewingKit is 1 and $location is "home">>
	<<radiobutton "$wardrobeOption" "repair" autocheck>> Repair |
<</if>>
<<radiobutton "$wardrobeOption" "seperateOutfits" autocheck>> Separate Outfits |
<<if $multipleWardrobes is "all" and !$wardrobes[$wardrobe_location].isolated>>
	<<radiobutton "$wardrobeOption" "transfer" autocheck>> Transfer:
	<<set _options to {}>>
	<<for _label, _value range $wardrobes>>
		<<if _value.unlocked and _label isnot $wardrobe_location and !$wardrobes[_label].isolated>>
			<<set _options[_value.name] to _label>>
		<</if>>
	<</for>>
	<<listbox '_wardrobeTransfer' autoselect>>
		<<optionsfrom _options>>
	<</listbox>>
	|
<</if>>

<<checkbox "$wardrobeRepeat" false true autocheck>> Repeat Actions

<<if $wardrobeOption is "delete" and $wardrobeRepeat is true>>

Discard On Repeat

<<else>>

<</if>>
<</widget>>

<<widget "wardrobeNewOutfit">>

Add new set:

Name: <input id="outfitName" type="text" value="Custom" maxlength="30" onfocus="V.tempDisable = true;">

Type: Everyday <<radiobutton "$outfit_type" 0 checked>> | Sleep<<radiobutton "$outfit_type" "sleep">> | Swimming<<radiobutton "$outfit_type" "swim">>

	Save Clothes Colours in Set
	<<checkbox "_saveColor" false true autocheck>>

<<if $multipleWardrobes>>

		Make clothes set unique to this wardrobe
		<<checkbox "_saveLocation" false true autocheck>>

<</if>>

	<<link "Add current clothes as new set">>
		<>
		<<set $outfit.push(
			{index: $outfit.length,
			name: $outfit_name,
			over_upper: clone($worn.over_upper.name),
			over_lower: clone($worn.over_lower.name),
			upper: clone($worn.upper.name),
			lower: clone($worn.lower.name),
			under_upper: clone($worn.under_upper.name),
			under_lower: clone($worn.under_lower.name),
			over_head: clone($worn.over_head.name),
			head: clone($worn.head.name),
			face: clone($worn.face.name),
			neck: clone($worn.neck.name),
			hands: clone($worn.hands.name),
			legs: clone($worn.legs.name),
			feet: clone($worn.feet.name),
			type: ["normal"]
			},
		)>>

		<<if $outfit_name is "" or $outfit_name is "Custom">><<print '<<set $outfit_name to "Custom ' + $outfit.length + '">>'>><</if>>
		<<set $outfit.last().name to $outfit_name>>
		<<if $outfit_type>>
			<<set $outfit.last().type[0] to $outfit_type>>
		<</if>>

		<<if _saveColor>>
			<<set _equip to ["over_upper", "over_lower", "upper", "lower", "under_upper", "under_lower", "over_head", "head", "face", "neck", "hands", "legs", "feet"]>>
			<<set _colors to {}>>
			<<for _ie to 0; _ie lt _equip.length; _ie++>>
				<<set _colors[_equip[_ie]] to [clone($worn[_equip[_ie]].colour),clone($worn[_equip[_ie]].accessory_colour)]>>
				<<if $worn[_equip[_ie]].colour is "custom" or $worn[_equip[_ie]].accessory_colour is "custom">>
					<<run _colors[_equip[_ie]+"custom"] to [clone($worn[_equip[_ie]].colourCustom),clone($worn[_equip[_ie]].accessory_colourCustom)]>>
				<</if>>
			<</for>>
			<<set $outfit.last().colors to clone(_colors)>>
		<<else>>
			<<set $outfit.last().colors to false>>
		<</if>>
		<<if _saveLocation>>
			<<set $outfit.last().location to $wardrobe_location>>
		<</if>>
		<<updatewardrobe "outfits">>
	<</link>>

<</widget>>

<<widget "wardrobeintegrity">>
<<set _war_int to $args[0]>>
<<if _selectedWardrobe[_war_int][_i].integrity gt ((clothingData(_war_int,_selectedWardrobe[_war_int][_i],'integrity_max') / 10) * 9)>>
<<elseif _selectedWardrobe[_war_int][_i].integrity gt ((clothingData(_war_int,_selectedWardrobe[_war_int][_i],'integrity_max') / 10) * 5)>>
(frayed)
<<elseif _selectedWardrobe[_war_int][_i].integrity gt ((clothingData(_war_int,_selectedWardrobe[_war_int][_i],'integrity_max') / 10) * 2)>>
(torn)
<<else>>
(tattered)
<</if>>
<</widget>>

<<widget "wardrobeList">>
<<wardrobeClothingOptions>>
<<set _wardrobe_list to $args[0]>>
<<set _errorPrevent to false>>
<<switch _wardrobe_list>>
	<<case "over_head">><<set _wear to "wear_over_head">>
	<<case "head">><<set _wear to "wear_head">>
	<<case "face">><<set _wear to "wear_face">>
	<<case "neck">><<set _wear to "wear_neck">>
	<<case "over_upper">><<set _wear to "wear_over_upper">>
	<<case "over_lower">><<set _wear to "wear_over_lower">>
	<<case "upper">><<set _wear to "wear_upper">>
	<<case "lower">><<set _wear to "wear_lower">>
	<<case "under_upper">><<set _wear to "wear_under_upper">>
	<<case "under_lower">><<set _wear to "wear_under_lower">>
	<<case "hands">><<set _wear to "wear_hands">>
	<<case "legs">><<set _wear to "wear_legs">>
	<<case "feet">><<set _wear to "wear_feet">>
	<<default>><<set _errorPrevent to true>>
<</switch>>
<<set _outfitTypes to ["upper","lower","under_upper","under_lower"]>>
<<set _loweroutfitCheck to ["lower","under_lower"]>>
<<if _errorPrevent isnot true>>
	__<<print _wardrobe_list[0].toUpperCase() + _wardrobe_list.substring(1)>>__ _selectedWardrobe[_wardrobe_list].length / _selectedWardrobe.space
	<<if _wardrobe_list is "upper">>(Outfits will also take a lower slot)<</if>>
	<<if _wardrobe_list is "under_upper">>(Outfits will also take an under lower slot)<</if>>

	Order by:
	/*Undefined error for unknown reason*/
	/*<a @onclick="`wikifier('wardrobeListReorder', '`+ $lastWardrobeSlot + `', 'name');`">Name |*/

Name
 |

Colour
 |

Lewd
 |

Integrity
 |
	<<if _outfitTypes.includes(_wardrobe_list)>>

Outfit Status
 |
	<</if>>

	Inverse Order by:

Name
 |

Colour
 |

Lewd
 |

Integrity
 |
	<<if _outfitTypes.includes(_wardrobe_list)>>

Outfit Status
 |
	<</if>>

	Currently equipped:
	<<if $worn[_wardrobe_list].name isnot "naked">>
		<<set _wornItem to $worn[_wardrobe_list]>>
		<<set _wornItemData to setup.clothes[_wardrobe_list][clothesIndex(_wardrobe_list,_wornItem)]>>
		<<clothingicon _wornItem _wardrobe_list>>
		<<print _wornItemData.name_cap>>
		<<if _wornItem.colour isnot 0>>
			(_wornItem.colour)
		<</if>>
		<<if _wornItem.outfitPrimary isnot undefined>>
			<<set _keys to Object.keys(_wornItem.outfitPrimary)>>
			<<set _broken to 0>>
			<<for _j to 0; _j lt _keys.length; _j++>>
				<<if _wornItem.outfitPrimary[_keys[_j]] is "broken">>
					<<set _broken++>>
				<</if>>
			<</for>>
			<<if _broken is 0>>
					(Outfit)
			<<elseif _broken lt _keys.length>>
					(Partly Broken)
			<<else>>
					(Broken)
			<</if>>
		<</if>>
		<<if _wornItem.outfitSecondary isnot undefined>>
			<<if _wornItem.outfitSecondary[1] is "broken">>
				(Broken)
			<<else>>
				(Outfit)
			<</if>>
		<</if>>
		<<if _wornItem.integrity gt ((clothingData(_wardrobe_list,_wornItem,'integrity_max') / 10) * 9)>>
		<<elseif _wornItem.integrity gt ((clothingData(_wardrobe_list,_wornItem,'integrity_max') / 10) * 5)>>
			(frayed)
		<<elseif _wornItem.integrity gt ((clothingData(_wardrobe_list,_wornItem,'integrity_max') / 10) * 2)>>
			(torn)
		<<else>>
			(tattered)
		<</if>>
		Extra Info

			<<if _wornItem.plural is 1>><<integrity `clothingData(_wardrobe_list,_wornItem,'integrity_max')` "cap">><<else>>A <<integrity `clothingData(_wardrobe_list,_wornItem,'integrity_max')`>><</if>>
			and <<reveal _wornItem.reveal>> <<print _wornItem.name>>.

			<<if _wornItem.gender is "m">>For boys ♂.<<elseif _wornItem.gender is "f">>For girls ♀.<</if>>
			<<print _wornItemData.description>>

			<<warmth _wornItem.warmth>>

			<<set _temp_choice to $worn[_wardrobe_list]>>
			<<shoptraits>>

		<<if _wardrobe_list is "upper" and $worn.lower.name isnot "naked" and _wornItem.outfitPrimary is undefined and !_wornItemData.notuck>>
			<<if $upperTucked>>
				<<link "Untuck">>
					<<set $upperTucked = 0>>
					<<updatewardrobe>>
				<</link>>
			<<else>>
				<<link "Tuck in">>
					<<set $upperTucked = 1>>
					<<updatewardrobe>>
				<</link>>
			<</if>>

		<</if>>
		<<if (_wornItem.hood and _wornItem.outfitSecondary) or (_wornItem.outfitPrimary and Object.keys(_wornItem.outfitPrimary).some(x => $worn[x].hood))>>

			<<if $hoodDown>>
				<<link "Pull hood up">>
					<<set $hoodDown = 0>>
					<<updatewardrobe>>
				<</link>>
			<<else>>
				<<link "Pull hood down">>
					<<set $hoodDown = 1>>
					<<updatewardrobe>>
				<</link>>
			<</if>>

		<</if>>
	<<else>>
		nothing

	<</if>>

	<<if $worn[_wardrobe_list].name isnot "naked">>

<<wearlink_norefresh "Strip" 'strip'>>

	<</if>>
	<<if _wardrobe_list is "upper">>

<<wearlink_norefresh "Large towel" 'large_towel'>>

	<</if>>
	<<if _wardrobe_list is "upper" or _wardrobe_list is "lower" >>

<<wearlink_norefresh "Towel" 'towel'>>

	<</if>>

	<<for _i to 0; _i lt _selectedWardrobe[_wardrobe_list].length; _i++>>
		<<set _item to _selectedWardrobe[_wardrobe_list][_i]>>
		<<set _itemData to setup.clothes[_wardrobe_list][clothesIndex(_wardrobe_list,_item)]>>
		<<if _item.outfitSecondary isnot undefined>>
			<<if _item.outfitSecondary[1] isnot "broken">>
				<<continue>>
			<</if>>
		<</if>>

		<<clothingicon _item _wardrobe_list>><<wearlink_norefresh _itemData.name_cap _i>>
		<<if _item.gender is "m">>
			| ♂ |
		<<elseif _item.gender is "f">>
			| ♀ |
		<<else>>
			|
		<</if>>
		<<if _item.colour isnot 0>>
			(_item.colour)
		<</if>>
		<<if _item.outfitPrimary isnot undefined>>
			<<set _keys to Object.keys(_item.outfitPrimary)>>
			<<set _broken to 0>>
			<<for _j to 0; _j lt _keys.length; _j++>>
				<<if _item.outfitPrimary[_keys[_j]] is "broken">>
					<<set _broken++>>
				<</if>>
			<</for>>
			<<if _broken is 0>>
				(Outfit)
			<<elseif _broken lt _keys.length>>
				(Partly Broken)
			<<else>>
				(Broken)
			<</if>>
		<</if>>
		<<if _item.outfitSecondary isnot undefined>>
			(Broken)
		<</if>>
		<<wardrobeintegrity _wardrobe_list>> |
		<<reveal _item.reveal>>

	<</for>>

<<else>>
	An error occured to 'widget "wardrobeList"', please report if you did not edit the save data manually in any way.
<</if>>

<<temperature>>
<</widget>>

<<widget "wearlink_norefresh">>
	<<capture $args[1] $args[2]>>
		<<link $args[0]>>
			<<if $args[2]>>
				<<set V[$args[2]] = $args[1]>>
			<<else>>
				<<set V[_wear] = $args[1]>>
			<</if>>
			<<updatewardrobe undefined $args[2]>>
		<</link>>
	<</capture>>
<</widget>>

<<widget "updatewardrobe">>
	<<if window.scrollY > 130>>
		<<run $('#action-popup, #wardrobewear').html(new Wikifier(null, "<<wardrobewear>>").output)>>
		<<run $('#action-popup').css('transform', 'translateY(0)'); setTimeout(() => { $('#action-popup').css('transform', 'translateY(-100%)') }, 3200);>>
	<<else>>
		<<run $('#wardrobewear').html(new Wikifier(null, "<<wardrobewear>>").output)>>
	<</if>>
	<<run $('#wardrobewear').addClass('notransition flash'); setTimeout(() => { $('#wardrobewear').removeClass('notransition flash') }, 100);>>
	<<updatesidebarimg>>
	<<updatesidebardescription>>
	<<updateallure>>
	<<updatewarmthscale>>
	<<updatewarmthdescription>>
	<<if $args[0] == "outfits">>
		<<replace "#listoutfits">><<listoutfits>><</replace>>
	<</if>>
	<<replace '#clotheson'>><<clotheson>><</replace>>
	<<if $('#wardrobeList')[0]>><<replace '#wardrobeList'>><<wardrobeContents>><</replace>><</if>>
	<<if $('#oldWardrobeListDisplay')[0]>>
		<<if $args[1]>>
			<<set $_slot to $args[1].slice(5)>>
			<<switch $_slot>>
				<<case "upper">>
					<<replace '#clothingBox-upper'>>
						<<oldWardrobeList "upper" "outfits">>
						<<oldWardrobeList "upper" "non-outfits">>
					<</replace>>
					<<replace '#clothingBox-lower'>>
						<<oldWardrobeList "lower">>
					<</replace>>
				<<case "under_upper">>
					<<replace '#clothingBox-under_upper'>>
						<<oldWardrobeList "under_upper" "outfits">>
						<<oldWardrobeList "under_upper" "non-outfits">>
					<</replace>>
					<<replace '#clothingBox-under_lower'>>
						<<oldWardrobeList "under_lower">>
					<</replace>>
				<<default>>
					<<replace `'#clothingBox-' + $_slot`>><<oldWardrobeList $_slot>><</replace>>
			<</switch>>
		<<else>>
			<<replace '#oldWardrobeListDisplay'>><<oldWardrobeListDisplay>><</replace>>
		<</if>>
	<</if>>
	<<exposure>>
	<<run $('#wardrobeExits').html(new Wikifier(null, "<<wardrobeExits>>").output)>>
	<<numberify ".passage">>
	<<run updateMoment()>>
<</widget>>

<<widget "oldWardrobeListDisplay">>
<<wardrobeClothingOptions>>
<<if $worn.lower.name isnot "naked" and $worn.upper.outfitPrimary is undefined and !setup.clothes.upper[clothesIndex('upper', $worn.upper)].notuck>>
	<<if $upperTucked>>
		<<link [["Untuck " + $worn.upper.name|$passage]]>><<set $upperTucked = 0>><</link>>
	<<else>>
		<<link [["Tuck " + $worn.upper.name + " in " + $worn.lower.name|$passage]]>><<set $upperTucked = 1>><</link>>
	<</if>>

<</if>>
<<if ($worn.head.hood and $worn.head.outfitSecondary) or ($worn.upper.outfitPrimary and Object.keys($worn.upper.outfitPrimary).some(x => $worn[x].hood))>>

	<<if $hoodDown>>
		<<link [["Pull the hood on your " + $worn.upper.name + " up"|$passage]]>><<set $hoodDown = 0>><</link>>
	<<else>>
		<<link [["Pull the hood on your " + $worn.upper.name + " down"|$passage]]>><<set $hoodDown = 1>><</link>>
	<</if>>

<</if>>

<<if $debug is 1>>
	<<oldWardrobeList "over_upper">>
	<<oldWardrobeList "over_lower">>
<</if>>

	<<oldWardrobeList "upper" "outfits">>
	<<oldWardrobeList "upper" "non-outfits">>

	<<oldWardrobeList "lower">>

	<<oldWardrobeList "under_upper" "outfits">>
	<<oldWardrobeList "under_upper" "non-outfits">>

	<<oldWardrobeList "under_lower">>

<<if $debug is 1>>
	<<oldWardrobeList "over_head">>
<</if>>

<<oldWardrobeList "head">>

<<oldWardrobeList "face">>

<<oldWardrobeList "neck">>

<<oldWardrobeList "hands">>

<<oldWardrobeList "legs">>

<<oldWardrobeList "feet">>

<<wardrobeNewOutfit>>
<</widget>>

<<widget "oldWardrobeList">>
<<set _wardrobe_list to $args[0]>>
<<set _showType to $args[1]>>
<<switch _wardrobe_list>>
	<<case "over_head">><<set _wear to "wear_over_head">>
	<<case "head">><<set _wear to "wear_head">>
	<<case "face">><<set _wear to "wear_face">>
	<<case "neck">><<set _wear to "wear_neck">>
	<<case "over_upper">><<set _wear to "wear_over_upper">>
	<<case "over_lower">><<set _wear to "wear_over_lower">>
	<<case "upper">><<set _wear to "wear_upper">>
	<<case "lower">><<set _wear to "wear_lower">>
	<<case "under_upper">><<set _wear to "wear_under_upper">>
	<<case "under_lower">><<set _wear to "wear_under_lower">>
	<<case "hands">><<set _wear to "wear_hands">>
	<<case "legs">><<set _wear to "wear_legs">>
	<<case "feet">><<set _wear to "wear_feet">>
<</switch>>

__<<print _wardrobe_list[0].toUpperCase() + _wardrobe_list.substring(1) + (_showType is "outfits" ? " Outfits" : "")>>__ _selectedWardrobe[_wardrobe_list].length / _selectedWardrobe.space

<<if $worn[_wardrobe_list].name isnot "naked">>

<<wearlink_norefresh "Strip" 'strip' _wear>>

<</if>>
<<if _wardrobe_list is "upper" and _showType is "outfits">>

<<wearlink_norefresh "Large towel" 'large_towel' _wear>>

<</if>>
<<if (_wardrobe_list is "upper" or _wardrobe_list is "lower") and _showType isnot "outfits">>

<<wearlink_norefresh "Towel" 'towel' _wear>>

<</if>>
<<for _i to 0; _i lt _selectedWardrobe[_wardrobe_list].length; _i++>>
	<<set _item to _selectedWardrobe[_wardrobe_list][_i]>>
	<<if _item.outfitSecondary isnot undefined>>
		<<if _item.outfitSecondary[1] isnot "broken">>
			<<continue>>
		<</if>>
	<</if>>
	<<if (_item.outfitPrimary isnot undefined and _showType is "non-outfits") or (_item.outfitPrimary is undefined and _showType is "outfits")>>
		<<continue>>
	<</if>>

/*<<clothingicon _item>>*/<<wearlink_norefresh setup.clothes[_wardrobe_list][clothesIndex(_wardrobe_list,_item)].name_cap _i _wear>>
	<<if _selectedWardrobe[_wardrobe_list][_i].colour isnot 0>>
		(_item.colour)
	<</if>>
	<<wardrobeintegrity _wardrobe_list>>

<</for>>

<</widget>>

<<widget "wardrobeListReorder">>
<<if $args[0] and $args[1]>>
	<<set _slot to $args[0]>>
	<<set _orderType to $args[1]>>
	<<set _descending to $args[2]>>

	<<set _wardrobeItems to clone(_selectedWardrobe[_slot])>>
	<<set _newWardrobeItems to []>>
	<<switch _orderType>>
	<<case "name">>
		<<set _itemNames to []>>
		<<for _i to 0; _i lt _wardrobeItems.length; _i++>>
			<<run _itemNames.pushUnique(_wardrobeItems[_i].name)>>
		<</for>>
		<<if _descending>>
			<<set _sortedItemNames to _itemNames.sort(function(a, b){return b.localeCompare(a)})>>
		<<else>>
			<<set _sortedItemNames to _itemNames.sort()>>
		<</if>>

		<<for _i to 0; _i lt _sortedItemNames.length; _i++>>
			<<for _j to 0; _j lt _wardrobeItems.length; _j++>>
				<<if _wardrobeItems[_j].name is _sortedItemNames[_i]>>
					<<run _newWardrobeItems.push(clone(_wardrobeItems[_j]))>>
				<</if>>
			<</for>>
		<</for>>
	<<case "color">>
		<<set _itemColors to []>>
		<<for _i to 0; _i lt _wardrobeItems.length; _i++>>
			<<run _itemColors.pushUnique(_wardrobeItems[_i].colour)>>
		<</for>>
		<<if _descending>>
			<<set _sortedItemColors to _itemColors.sort(function(a, b){
				if(a === 0){
					return 0;
				}
				if(b === 0){
					return 0;
				}
				return b.localeCompare(a);
			})>>
		<<else>>
			<<set _sortedItemColors to _itemColors.sort()>>
		<</if>>

		<<for _i to 0; _i lt _sortedItemColors.length; _i++>>
			<<for _j to 0; _j lt _wardrobeItems.length; _j++>>
				<<if _wardrobeItems[_j].colour is _sortedItemColors[_i]>>
					<<run _newWardrobeItems.push(clone(_wardrobeItems[_j]))>>
				<</if>>
			<</for>>
		<</for>>
	<<case "integrity">>
		<<set _itemIntegrity to []>>
		<<for _i to 0; _i lt _wardrobeItems.length; _i++>>
			<<run _itemIntegrity.pushUnique((_wardrobeItems[_i].integrity / clothingData(_slot,_wardrobeItems[_i],'integrity_max')))>>
		<</for>>
		<<if _descending>>
			<<set _sortedItemIntegrity to _itemIntegrity.sort()>>
		<<else>>
			<<set _sortedItemIntegrity to _itemIntegrity.sort(function(a, b){return b-a})>>
		<</if>>

		<<for _i to 0; _i lt _sortedItemIntegrity.length; _i++>>
			<<for _j to 0; _j lt _wardrobeItems.length; _j++>>
				<<if (_wardrobeItems[_j].integrity / clothingData(_slot,_wardrobeItems[_j],'integrity_max')) is _sortedItemIntegrity[_i]>>
					<<run _newWardrobeItems.push(clone(_wardrobeItems[_j]))>>
				<</if>>
			<</for>>
		<</for>>
	<<case "outfit">>
		<<if _descending>>
			<<set _status to ["broken",0,1]>>
		<<else>>
			<<set _status to [1,0,"broken"]>>
		<</if>>
		<<for _i to 0; _i lt _status.length; _i++>>
			<<for _j to 0; _j lt _wardrobeItems.length; _j++>>
				<<if _wardrobeItems[_j].one_piece is _status[_i]>>
					<<run _newWardrobeItems.push(clone(_wardrobeItems[_j]))>>
				<</if>>
			<</for>>
		<</for>>
	<<case "lewd">>
		<<set _itemReveal to []>>
		<<for _i to 0; _i lt _wardrobeItems.length; _i++>>
			<<run _itemReveal.pushUnique(_wardrobeItems[_i].reveal)>>
		<</for>>
		<<if _descending>>
			<<set _sortedItemReveal to _itemReveal.sort()>>
		<<else>>
			<<set _sortedItemReveal to _itemReveal.sort(function(a, b){return b-a})>>
		<</if>>
		<<for _i to 0; _i lt _sortedItemReveal.length; _i++>>
			<<for _j to 0; _j lt _wardrobeItems.length; _j++>>
				<<if _wardrobeItems[_j].reveal is _sortedItemReveal[_i]>>
					<<run _newWardrobeItems.push(clone(_wardrobeItems[_j]))>>
				<</if>>
			<</for>>
		<</for>>
	<</switch>>

	<<if _newWardrobeItems isnot []>>
		<<set _selectedWardrobe[_slot] to clone(_newWardrobeItems)>>
	<</if>>
	<<run Dynamic.render()>>
<</if>>
<</widget>>

<<widget "wardrobeSanityCheck">>
/*Fixes invisible outfit bottoms caused by bugs in previous versions*/
<<set $lastWardrobeSanityCheck to $saveVersions.last()>>
/*Update _equip as required*/
<<set _equip to ["lower", "under_lower", "head"]>>
<<for _slot range _equip>>
	<<set $_itemIndex to {}>>
	<<for $_i to 0; $_i lt _selectedWardrobe[_slot].length; $_i++>>
		<<if _selectedWardrobe[_slot][$_i].outfitSecondary is undefined>>
			<<continue>>
		<</if>>
		<<if _selectedWardrobe[_slot][$_i].outfitSecondary[1] is "broken">>
			<<continue>>
		<</if>>

		/*Prep*/
		<<set $_markBroken to true>>
		<<set $_found to false>>
		<<set $_item to _selectedWardrobe[_slot][$_i]>>
		<<set $_outfitSecondary to _selectedWardrobe[_slot][$_i].outfitSecondary>>
		<<if $_itemIndex[$_outfitSecondary[0]] is undefined>>
			<<set $_itemIndex[$_outfitSecondary[0]] to []>>
		<</if>>

		/*Look for a primary piece that matches*/
		<<for $_j to 0; $_j lt _selectedWardrobe[$_outfitSecondary[0]].length; $_j++>>
			<<if _selectedWardrobe[$_outfitSecondary[0]][$_j].name isnot $_outfitSecondary[1]>>
				<<continue>>
			<</if>>
			<<if $_itemIndex[$_outfitSecondary[0]].includes($_j)>>
				<<continue>>
			<</if>>

			<<if _selectedWardrobe[$_outfitSecondary[0]][$_j].colour is $_item.colour and _selectedWardrobe[$_outfitSecondary[0]][$_j].accessory_colour is $_item.accessory_colour>>
				<<if $_item.colour isnot "custom" and $_item.accessory_colour isnot "custom">>
					<<set $_markBroken to false>>
					<<run $_itemIndex[$_outfitSecondary[0]].push(clone($_j))>>
					<<break>>
				<<elseif $_item.colourCustom is _selectedWardrobe[$_outfitSecondary[0]][$_j].colourCustom and $_item.accessory_colourCustom is _selectedWardrobe[$_outfitSecondary[0]][$_j].accessory_colourCustom>>
					<<set $_markBroken to false>>
					<<run $_itemIndex[$_outfitSecondary[0]].push(clone($_j))>>
					<<break>>
				<</if>>
			<</if>>
		<</for>>
		<<if $_markBroken is true>>
			/*Mark as broken*/
			<<set _selectedWardrobe[_slot][$_i].outfitSecondary[1] to "broken">>
			<<set _selectedWardrobe[_slot][$_i].one_piece to "broken">>
			<<set _selectedWardrobe[_slot][$_i].set to clone(_slot)>>
			<<set _selectedWardrobe[_slot][$_i].sanityCheck to true>>
		<</if>>
	<</for>>
<</for>>
<</widget>>

<<widget "wardrobeGetRepairedClothes">>
<<set _equip to ["over_upper","over_lower","upper","lower","under_upper","under_lower","over_head","head","face","neck","hands","legs","feet"]>>
<<set _takenAway to 0>>
<<for $_i to 0; $_i lt _equip.length; $_i++>>
	<<if $wardrobeRepair[_equip[$_i]] is undefined>>
		<<continue>>
	<</if>>
	<<for $_j to 0; $_j lt $wardrobeRepair[_equip[$_i]].length; $_j++>>
		<<if _selectedWardrobe[_equip[$_i]].length gte _selectedWardrobe.space>>
			<<set _takenAway++>>
			<<continue>>
		<</if>>
		<<generalSend "wardrobe" _equip[$_i] `$wardrobeRepair[_equip[$_i]][$_j][0]` `$wardrobeRepair[_equip[$_i]][$_j][1]` `$wardrobeRepair[_equip[$_i]][$_j][3]`>>
		<<if $wardrobeRepair[_equip[$_i]][$_j][2] isnot undefined and $wardrobeRepair[_equip[$_i]][$_j][2] isnot null>>
			/*colourCustom*/
			<<set _selectedWardrobe[_equip[$_i]].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>>
			<<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined>>
				<<for $_label, $_value range _selectedWardrobe[_equip[$_i]].last().outfitPrimary>>
					<<if _selectedWardrobe[$_label].last().name is $_value>>
						<<set _selectedWardrobe[$_label].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
		<<if $wardrobeRepair[_equip[$_i]][$_j][4] isnot undefined and $wardrobeRepair[_equip[$_i]][$_j][4] isnot null>>
			/*accessory_colourCustom*/
			<<set _selectedWardrobe[_equip[$_i]].last().accessory_colourCustom to $wardrobeRepair[_equip[$_i]][$_j][4]>>
			<<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined>>
				<<for $_label, $_value range _selectedWardrobe[_equip[$_i]].last().outfitPrimary>>
					<<if _selectedWardrobe[$_label].last().name is $_value>>
						<<set _selectedWardrobe[$_label].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
	<</for>>
<</for>>
<<if _takenAway gt 0>>

	The driver thanks you for the donation of _takenAway items due to you not having enough space.
<</if>>
<<unset $wardrobeRepair>>
<</widget>>

<<widget "randomWear">>
<<set $wardrobeOption to "wear">>
<<set $_equip to []>>
<<set _equipped to []>>
<<for $_label, $_value range $randomEquipConfigure>>
	<<if $_value>>
		<<generalUndress $wardrobe_location $_label>>
		<<run $_equip.push($_label)>>
	<</if>>
<</for>>
<<for _i to 0; _i lt $_equip.length;_i++>>
	<<if !_equipped.includes($_equip[_i]) and $worn[$_equip[_i]].name is "naked" and _selectedWardrobe[$_equip[_i]].length gt 0>>
		<<set _ids to []>>

		<<for _j to 0; _j lt _selectedWardrobe[$_equip[_i]].length; _j++>>
			<<if _selectedWardrobe[$_equip[_i]][_j].outfitSecondary is undefined>>
			<<elseif _selectedWardrobe[$_equip[_i]][_j].outfitSecondary[1] isnot "broken">>
				<<continue>>
			<</if>>
			<<run _ids.push(_j)>>
		<</for>>
		<<set _id to _ids.pluck()>>
		<<if _id>>
			<<run _equipped.pushUnique($_equip[_i])>>
			<<if _selectedWardrobe[$_equip[_i]][_id].outfitPrimary isnot undefined>>
				<<for $_label, $_value range _selectedWardrobe[$_equip[_i]][_id].outfitPrimary>>
					<<if $_value isnot "broken">>
						<<run _equipped.pushUnique($_label)>>
					<</if>>
				<</for>>
			<</if>>
			<<print `<<set $wear_` + $_equip[_i] + ` to ` + clone(_id) + `>>`>>
		<</if>>
		<<unset _id>>
	<</if>>
<</for>>
<<unset $randomWear>>
<</widget>>

<<widget "warmth_description">>
<<switch $body_temperature_outside>>
<<case "hot">>
	You'll be far too hot outside.
<<case "warm">>
	You'll be too warm outside.
<<case "cold">>
	You'll be cold outside.
<<case "chilly">>
	You'll be a bit chilly outside.
<<default>>
	You'll be a comfortable temperature outside.
<</switch>>

$warmth warmth versus $chill chill

Comfortable warmth range: <<print ($chill + 1)>> - <<print Math.trunc(($chill * 1.3) + 69)>>
<</widget>>

<<widget "wardrobeSelection">>
<<if !$multipleWardrobes or !$wardrobes[$wardrobe_location]>>
	<<set $wardrobe_location to "wardrobe">>
<<elseif $forceWardrobeLocation>>
	<<set $wardrobe_location to $forceWardrobeLocation>>
<<elseif $multipleWardrobes is "isolated" and !$wardrobes[$wardrobe_location].isolated>>
	<<set $wardrobe_location to "wardrobe">>
<</if>>
<<if $debug and $multipleWardrobes and !$args[0]>>

Debug:
		<<for _label, _value range $wardrobes>>
			<<if _value.unlocked is undefined>>
			<<elseif $wardrobe_location is _label>>
				<<print _value.name>> |
			<<else>>
				<<capture _label>>
					<<link [[_value.name|$passage]]>><<set $forceWardrobeLocation to _label>><</link>> |
				<</capture>>
			<</if>>
		<</for>>

<</if>>
<</widget>>

<<widget "wardrobeExits">>
	<<switch $passage>>
		<<case "Wardrobe">>
			<<link [[Close wardrobe|Bedroom]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>
		<<case "Changing Room">>
			<<if $exposed lte 1>>
				<<link[[Leave|Beach]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				You can't go out like this!

			<</if>>
		<<case "Sydney Beach Changing Room">>
			<<if $exposed lte 1>>
				<<link[[Leave|Sydney Beach Swimsuit]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				You can't go out like this!

			<</if>>
		<<case "Sydney Beach Changing Room Leave">>
			<<if $exposed lte 1>>
				<<link[[Leave|Sydney Beach Leave]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				You can't go out like this!

			<</if>>
		<<case "Eden Wardrobe">>
			<<if $exhibitionism gte 75 or $loveInterest.primary is "Eden" or $loveInterest.secondary is "Eden">>
				<<link [[Done|Eden Cabin]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>
			<<elseif $exhibitionism gte 55>>
				<<if $exposed lte 1>>
				<<link [[Done|Eden Cabin]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
				You can't remain undressed like this!

				<</if>>
			<<else>>
				<<if $exposed lte 0>>
				<<link [[Done|Eden Cabin]]>><<pass 1>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
				You can't remain undressed like this!

				<</if>>
			<</if>>
		<<case "Eden Night Wardrobe">>
			<<if $exhibitionism gte 75 or $loveInterest.primary is "Eden" or $loveInterest.secondary is "Eden">>
				<<link [[Done|Eden Cabin Bed]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>
			<<elseif $exhibitionism gte 55>>
				<<if $exposed lte 1>>
				<<link [[Done|Eden Cabin Bed]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
				You can't remain undressed like this!

				<</if>>
			<<else>>
				<<if $exposed lte 0>>
				<<link [[Done|Eden Cabin Bed]]>><<pass 1>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
				You can't remain undressed like this!

				<</if>>
			<</if>>
		<<case "Asylum Wardrobe">>
			<<if $exhibitionism lte 54>>
				<<if $exposed lte 0>>
					<<link [[Done|Asylum Cell]]>><<pass 1>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<<elseif $exhibitionism gte 75>>
				<<link [[Done|Asylum Cell]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				<<if $exposed lte 1>>
					<<link [[Done|Asylum Cell]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<</if>>
		<<case "Farm Wardrobe">>
			<<if $exhibitionism lte 54>>
				<<if $exposed lte 0>>
					<<link [[Done|Farm Bedroom]]>><<pass 1>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<<elseif $exhibitionism gte 75>>
				<<link [[Done|Farm Bedroom]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				<<if $exposed lte 1>>
					<<link [[Done|Farm Bedroom]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<</if>>
		<<case "Strip Club Wardrobe">>
			<<if $exhibitionism lte 14>>
				<<if $exposed lte 0>>
					<<link [[Step away|Strip Club Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't go out like this!

				<</if>>
			<<elseif $exhibitionism gte 55>>
				<<link [[Step away|Strip Club Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				<<if $exposed lte 1>>
					<<link [[Step away|Strip Club Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't go out like this!

				<</if>>
			<</if>>
		<<case "Brothel Wardrobe">>
			<<if $exhibitionism lte 14>>
				<<if $exposed lte 0>>
					<<link [[Step away|Brothel Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't go out like this!

				<</if>>
			<<elseif $exhibitionism gte 55>>
				<<link [[Step away|Brothel Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				<<if $exposed lte 1>>
					<<link [[Step away|Brothel Dressing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't go out like this!

				<</if>>
			<</if>>
		<<case "School Boy Wardrobe">>
			<<if $exposed gte 2 and $exhibitionism lt 75>>
				You can't go out like this!

			<<else>>
				<<link [[Leave|School Boy Changing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<</if>>
		<<case "School Girl Wardrobe">>
			<<if $exposed gte 2 and $exhibitionism lt 75>>
				You can't go out like this!

			<<else>>
				<<link [[Leave|School Girl Changing Room]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<</if>>
		<<case "Farm Assault Wardrobe">>
			<<if $exhibitionism lte 54>>
				<<if $exposed lte 0>>
					<<link [[Done|Farm Assault Intro]]>><<pass 1>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<<elseif $exhibitionism gte 75>>
				<<link [[Done|Farm Assault Intro]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

			<<else>>
				<<if $exposed lte 1>>
					<<link [[Done|Farm Assault Intro]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>

				<<else>>
					You can't remain undressed like this!

				<</if>>
			<</if>>
		<<case "Prison Wardrobe">>
			<<link [[Close|Prison Cell]]>><<unset $saveColor>><<unset $wardrobeRepeat>><<unset $tempDisable>><<set $delete_outfit to "none">><<unset $forceWardrobeLocation>><</link>>
		<<case "Cult Wardrobe">>
			<<link [[Back|Cult Bedroom]]>><</link>>
	<</switch>>
<</widget>>

:: Wardrobe
<<effects>>
<<set $wardrobe_location to "wardrobe">>
<<wardrobeSelection>>
You look in your wardrobe.

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Changing Room
<<effects>><<location "changingroom">>
<<set $wardrobe_location to "changingRoom">>
<<wardrobeSelection>>
You are in a small wooden changing room.

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Eden Wardrobe
<<effects>>
You look through the cupboard containing your clothes. There's an old dressing screen for privacy.

<<set $wardrobe_location to "edensCabin">>
<<wardrobeSelection>>

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Asylum Wardrobe

<<effects>>
You look through the cupboard containing your clothes.

<<set $wardrobe_location to "asylum">>
<<wardrobeSelection>>

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Farm Wardrobe
<<effects>>
You look through the rustic wardrobe.

<<set $wardrobe_location to "alexFarm">>
<<wardrobeSelection>>

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Strip Club Wardrobe
<<effects>>
<<set $wardrobe_location to "stripClub">>
<<wardrobeSelection>>

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Brothel Wardrobe
<<effects>>
<<set $wardrobe_location to "brothel">>
<<wardrobeSelection>>

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: School Boy Wardrobe

<<effects>><<set $outside to 0>><<set $location to "pool">>
<<set $wardrobe_location to "schoolBoys">>
<<wardrobeSelection>>
You stand in front of your open locker.

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: School Girl Wardrobe

<<effects>><<set $outside to 0>><<set $location to "pool">>
<<set $wardrobe_location to "schoolGirls">>
<<wardrobeSelection>>
You stand in front of your open locker.

<<wardrobewear>>

<<wardrobeExits>>

<<wardrobe>>

:: Wardrobe Sale Crate

Are you prepared to add all your
<<if $crateContents is "all">>
	clothes
<<else>>
	outfits
<</if>>
to the crate and send them to be sold? Might be best to go shopping shortly after.

<<set _value to 0>>
<<for _label, _items range $wardrobe>>
	<<for _i to 0; _i lt _items.length; _i++>>
		<<if setup.clothes[_label][clothesIndex(_label,_items[_i])].shop.length is 0>>
			<<continue>>
		<</if>>
		<<if _items[_i].outfitSecondary isnot undefined>>
			<<continue>>
		<</if>>
		<<if _items[_i].outfitPrimary is undefined and $crateContents is "outfits">>
			<<continue>>
		<</if>>
		<<set _value += Math.floor(getClothingCost(_items[_i], _label) * (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max')) / 3)>>
	<</for>>
<</for>>
It will earn you <<printmoney `_value + 5000`>>.

<<link [[Yes|Wardrobe Sale Crate Result]]>><</link>>

<<link [[No|$wardrobeReturnLink]]>>
	<<unset $wardrobeReturnLink>>
	<<unset $crateContents>>
<</link>>

:: Wardrobe Sale Crate Result

<<set $tailorMonthlyService to 30>>
<<set _value to 0>>
<<set _equip to ["over_upper","over_lower","upper","lower","under_upper","under_lower","over_head","head","face","neck","hands","legs","feet"]>>
<<for $_i to 0; $_i lt _equip.length; $_i++>>
	<<set _toDelete to []>>
	<<for $_j to 0; $_j lt $wardrobe[_equip[$_i]].length; $_j++>>
		<<if setup.clothes[_equip[$_i]][clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])].shop.length is 0>>
			<<continue>>
		<</if>>
		<<if $wardrobe[_equip[$_i]][$_j].outfitSecondary isnot undefined>>
			<<run _toDelete.push(clone($_j))>>
			<<continue>>
		<</if>>
		<<if $wardrobe[_equip[$_i]][$_j].outfitPrimary is undefined and $crateContents is "outfits">>
			<<continue>>
		<</if>>
		<<set _value += Math.floor(getClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max')) / 3)>>
		<<run _toDelete.push(clone($_j))>>
	<</for>>
	<<for $_j to $wardrobe[_equip[$_i]].length; $_j gte 0; $_j-->>
		<<if _toDelete.includes($_j)>>
			<<run $wardrobe[_equip[$_i]].deleteAt($_j)>>
		<</if>>
	<</for>>
<</for>>
The driver takes the crate away, leaving <<printmoney `_value + 5000`>> in its place.
<<set $money += Math.floor(_value + 5000)>>

<<link [[Continue|$wardrobeReturnLink]]>>
	<<unset $wardrobeReturnLink>>
	<<unset $crateContents>>
<</link>>

:: Wardrobe Repair Crate

Are you prepared to add all your
<<if $crateContents is "all">>
	clothes
<<else>>
	outfits
<</if>>
to the crate and send them to be repaired? Might be best to go shopping shortly after.

<<set _value to 0>>
<<for _label, _items range $wardrobe>>
	<<for _i to 0; _i lt _items.length; _i++>>
		<<if _items[_i].outfitSecondary isnot undefined>>
			<<continue>>
		<</if>>
		<<if _items[_i].outfitPrimary is undefined and $crateContents is "outfits">>
			<<continue>>
		<</if>>
		<<set _value += Math.floor(getClothingCost(_items[_i],_label) * (1 - (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max'))) * 1.25)>>
	<</for>>
<</for>>
It will cost you
<<if _value gt 5000>>
	<<printmoney `_value - 5000`>>.
<<else>>
	nothing.
<</if>>

<<if $money gte _value>>
	<<link [[Yes|Wardrobe Repair Crate Result]]>><</link>>
<<else>>
	Not enough money.
<</if>>

<<link [[No|$wardrobeReturnLink]]>>
	<<unset $wardrobeReturnLink>>
	<<unset $crateContents>>
<</link>>

:: Wardrobe Repair Crate Result

<<set $tailorMonthlyService to 30>>
<<set $wardrobeRepair to {timeLeft: 1}>>
<<set _equip to ["over_upper","over_lower","upper","lower","under_upper","under_lower","over_head","head","face","neck","hands","legs","feet"]>>
<<set _value to 0>>
<<for $_i to 0; $_i lt _equip.length; $_i++>>
	<<set _toDelete to []>>
	<<for $_j to 0; $_j lt $wardrobe[_equip[$_i]].length; $_j++>>
		<<if $wardrobe[_equip[$_i]][$_j].outfitSecondary isnot undefined>>
			<<run _toDelete.push(clone($_j))>>
			<<continue>>
		<</if>>
		<<if $wardrobe[_equip[$_i]][$_j].outfitPrimary is undefined and $crateContents is "outfits">>
			<<continue>>
		<</if>>
		<<set _value += Math.floor(getClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * (1 - ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max'))) * 1.25)>>

		<<if $wardrobeRepair[_equip[$_i]] is undefined>>
			<<set $wardrobeRepair[_equip[$_i]] to []>>
		<</if>>
		<<set _itemStats to [
				clone(clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])),
				clone($wardrobe[_equip[$_i]][$_j].colour),
				clone($wardrobe[_equip[$_i]][$_j].colourCustom),
				clone($wardrobe[_equip[$_i]][$_j].accessory_colour),
				clone($wardrobe[_equip[$_i]][$_j].accessory_colourCustom)
			]>>
		<<run $wardrobeRepair[_equip[$_i]].push(clone(_itemStats))>>
		<<run _toDelete.push(clone($_j))>>
	<</for>>
	<<for $_j to $wardrobe[_equip[$_i]].length; $_j gte 0; $_j-->>
		<<if _toDelete.includes($_j)>>
			<<run $wardrobe[_equip[$_i]].deleteAt($_j)>>
		<</if>>
	<</for>>
<</for>>
<<if _value gt 5000>>
	<<set $money -= _value - 5000>>
	The driver takes <<printmoney `_value - 5000`>> and the crate away.
<<else>>
	The driver takes the crate away.
<</if>>

<<link [[Continue|$wardrobeReturnLink]]>>
	<<unset $wardrobeReturnLink>>
	<<unset $crateContents>>
<</link>>