code:
package classes.Scenes.Places {
	import classes.*;
	import classes.internals.Utils;
	import classes.GlobalFlags.*;
	import classes.Scenes.Inventory;

	public class Cabin extends BaseContent {

		public function Cabin() {
		}

		public function enterCabin():void {
			menu();
			clearOutput();
			outputText(images.showImage("location-cabin"));
			outputText("[bu: Your Cabin]\n")
			outputText("You are in your cabin. Behind you is a door leading back to your camp. Next to the door is a window to let the sunlight in.");

			if (hasBed) {
				outputText("[pg]Your bed is located in one of the corners. It's constructed with a wood frame and a mattress is laid on the frame. It's covered with a sheet. A pillow leans against the headboard. ");
				if (bedBears > 0) bedBearDesc();
				if (inventory.itemStorageDirectGet().length > 0) {
					var chests:int = 0;
					if (player.hasKeyItem("Camp - Chest")) chests++;
					if (player.hasKeyItem("Camp - Murky Chest")) chests++;
					if (player.hasKeyItem("Camp - Ornate Chest")) chests++;
					outputText("Your storage " + (chests == 1 ? "chest is" : "chests are") + " located in front of your bed.")
				}
			}
			if (hasNightstand) {
				outputText("[pg]A nightstand is situated next to your bed.");
				if (flags[kFLAGS.BENOIT_CLOCK_BOUGHT] > 0) outputText(" An alarm clock rests on your nightstand. It's currently set to go off at " + flags[kFLAGS.BENOIT_CLOCK_ALARM] + "am.");

				if (player.hasKeyItem(Inventory.STORAGE_JEWELRY_BOX) && !hasDresser) {
					outputText(" A jewelry box sits on your nightstand.");
				}
			}
			if (hasDresser) {
				outputText("[pg]Your dresser is standing near the wall opposite from your bed. ");
				if (player.hasKeyItem("Equipment Storage - Jewelry Box")) outputText("Your jewelry box is stored inside your dresser.");
			}
			if (hasTable) {
				outputText("[pg]A table is located right next to the window. ");
				if (hasTableChair1 && !hasTableChair2) outputText("A chair is set near the table.");
				if (hasTableChair1 && hasTableChair2) outputText("Two chairs are set at opposite sides of the table.");
			}
			if (hasBookshelf) {
				var books:Number = numberOfBooks();
				outputText("[pg]Placed in the corner opposite the door is a bookshelf. It currently holds " + num2Text(books) + " book");
				if (books > 1) outputText("s");
				outputText(".");
			}
			if (hasDesk) {
				if (hasBookshelf) outputText("[pg]A desk is located right next to your bookshelf.");
				else outputText("[pg]Placed in the corner opposite the door is a desk.");
				outputText(" It has a drawer to store supplies for writing and studying.");
				if (hasDeskChair) outputText(" A nicely constructed chair is tucked under the desk. It provides a place for you to sit and study.");
			}
			game.akky.locationDesc("Cabin", true, false);
			outputText("[pg]What would you like to do?");

			//Build menu
			if (hasBookshelf) addButton(0, "Bookshelf", menuStudy).hint("Take a look at the books you currently have in your bookshelf. This includes your codex.");
			else addButton(0, "Codex", camp.codex.accessCodexMenu).hint("Read up on some of the oddities of Mareth.");

			if (hasNightstand && flags[kFLAGS.BENOIT_CLOCK_BOUGHT] > 0) addButton(1, "Set Alarm", menuAlarm).hint("You can use this clock to adjust your wake-up time.");
			addButton(2, "Inventory", inventory.inventoryMenu).hint("View or use your items.");
			addButton(3, "Storage", inventory.stash).hint("You stash provides safe (or safe-ish) storage for many different kinds of items.");
			addButton(4, "Furniture", menuFurniture).hint("Create some new furniture for your cabin or just take a look at the building materials you have stashed.");
			if (camp.petsCount() > 0) addButton(5, "Pets", cabinPetsMenu).hint("Check up on any pets you have and interact with them.")
			if (hasBed && (player.hasItem(useables.TELBEAR) || bedBears > 0)) addButton(6, "TeddyBear", cabinBearMenu);
			waitButton(9);
			addButton(14, "Exit Cabin", playerMenu).hint("Go back to the exterior part of your camp.");
		}

		private function waitButton(pos:int = 9):void {
			addButton(pos, "Wait", camp.doWait).hint("Wait for four hours.[pg]Shift-click to wait until the night comes."); //You can wait/rest/sleep in cabin.
			if (player.fatigue > 30 || player.hp100 <= 90) addButton(pos, "Rest", camp.rest);
			if (game.time.hours >= 21 || game.time.hours < 6) addButton(pos, "Sleep", camp.doSleep).hint("Turn yourself in for the night");
		}

		public const BEDBEARS_MAX:int = 10;

		public function get bedBears():int { return boundInt(0, flags[kFLAGS.BED_BEARS], BEDBEARS_MAX); }

		public function set bedBears(bears:int):void { flags[kFLAGS.BED_BEARS] = boundInt(0, bears, BEDBEARS_MAX); }

		public function bedBearDesc():void {
			var desc:String = "";
			switch (bedBears) {
				case 0:
					desc = "Your bed has no teddy bears. ";
					break;
				case 1:
					desc = "Your teddy bear is tucked in, safe and sound. ";
					break;
				case 2:
					desc = "A pair of teddy bears are cuddled together on the bed. ";
					break;
				case 3: case 4: case 5:
					desc = "Several bears add a childish touch to the bed. ";
					break;
				case 6: case 7: case 8: case 9:
					desc = "Your bed is positively covered in teddy bears. ";
					break;
				case 10: default:
					desc = "Your teddy bear harem lounges around the bed, leaving almost no room for you to sleep. ";
			}
			outputText(desc);
		}

		public function cabinBearMenu():void {
			clearOutput();
			if (bedBears > 0) bedBearDesc();
			if (player.hasItem(useables.TELBEAR)) {
				if (bedBears == 0) outputText("Would you like your teddy bear to make your bed its home?");
				else if (bedBears == BEDBEARS_MAX) outputText("[pg]There's no room for more bears.");
				else outputText("[pg]Would you like to give your sleeping " + Utils.pluralize(bedBears, "companion") + " a new friend?");
			}
			menu();
			if (player.hasItem(useables.TELBEAR) && bedBears < BEDBEARS_MAX) {
				addNextButton("Yes", cabinBearAdd).hint(bedBears == 0 ? "A battlefield is no place for a teddy." : (bedBears == 1 ? "You don't want the bear getting lonely while you're away." : "You have plenty of cuddles to go around."));
				addNextButton("No", enterCabin).hint(bedBears == 0 ? "No soldier left behind." : (bedBears == 1 ? "The first bear might get jealous." : "There are enough bears for now."));
			}
			if (bedBears > 0) addNextButton("Take", cabinBearTake).hint((bedBears == 1 && !player.hasItem(useables.TELBEAR)) ? "You could use its company." : "Take " + Utils.pluralize(bedBears, "the", "a") + " bear with you.").disableIf(player.roomInExistingStack(useables.TELBEAR) < 0 && player.emptySlot() < 0, "There's no room in your inventory.");
			addNextButton("Snuggle", cabinBearSnuggle).hint("You just want to cuddle for the moment.");
			addButton(14, "Back", enterCabin);
		}

		public function cabinBearAdd():void {
			clearOutput();
			player.consumeItem(useables.TELBEAR);
			bedBears++;
			outputText("You place the teddy bear on your bed, tucking it in under your sheet.");
			doNext(cabinBearMenu);
		}

		public function cabinBearTake():void {
			clearOutput();
			inventory.takeItem(useables.TELBEAR, null, null, null, false);
			bedBears--;
			outputText("You pick " + Utils.pluralize(bedBears, "the", "a") + " bear up off your bed.");
			doNext(cabinBearMenu);
		}

		public function cabinBearSnuggle():void {
			clearOutput();
			switch (bedBears) {
				case 0: case 1:
					outputText("You get onto your bed and hold the bear tightly to your body, pressing your face against the top of its head as you squeeze your worries away, rocking from side to side without releasing your embrace. With a contented sigh, you smile softly at the teddy bear and get back off your bed" + (bedBears == 0 ? ", taking the bear with you." : ", tucking the bear back in under the sheet."));
					break;
				case 2:
					outputText("You get onto your bed and pull both bears tightly to your body, hugging one in each arm as you press your face between theirs, rocking from side to side without releasing your embrace. With a contented sigh, you smile softly at the teddy bears and get back off your bed, leaving the bears snuggled together.");
					break;
				case 3: case 4: case 5: case 6: case 7: case 8: case 9:
					outputText("You climb in amongst the numerous bears, gathering them into a fuzzy cuddle pile with you at the center. Burying your face in the warm fluff, you squeeze the bears tightly against your body and immerse yourself in the sensation until you're fully satisfied. With a contented sigh, you smile softly at the teddy bears and get back out of bed.");
					break;
				case 10: default:
					outputText("With your bed properly loaded with cuddly bears, you leap into the pile to join them. Snuggled on all sides by the fuzzy battalion, all sense of hostility in the world fades away. Within the comfort and security of your fuzz-fort, there is only peace. You wrap your arms around as many bears as you can grasp and squeeze them tightly one last time before getting back up to resume your day.");
			}
			doNext(enterCabin);
		}

		public function cabinPetsMenu():void {
			clearOutput();
			outputText("From here you can interact with any pets in your cabin.");
			menu();
			//Akky
			if (game.akky.isOwned()) {
				game.akky.menuButton(cabinPetsMenu, 0, "Cabin");
			}
			addButton(14, "Back", enterCabin);
		}

		private function numberOfBooks():Number {
			var books:Number = 0
			books++ //Your codex counts.
			if (player.hasKeyItem("Dangerous Plants")) books++;
			if (player.hasKeyItem("Traveler's Guide")) books++;
			if (player.hasKeyItem("Hentai Comic")) books++;
			if (player.hasKeyItem("Yoga Guide")) books++;
			if (player.hasKeyItem("Carpenter's Toolbox")) books++; //Carpenter's Guide is bundled in your toolbox!
			if (player.hasKeyItem("Izma's Book - Combat Manual")) books++;
			if (player.hasKeyItem("Izma's Book - Etiquette Guide")) books++;
			if (player.hasKeyItem("Izma's Book - Porn")) books++;

			return books;
		}

		private function menuAlarm():void {
			clearOutput();
			outputText("Set the hour you want your alarm clock to wake you at.");
			menu();
			addButton(0, "6am", setAlarm, 6);
			addButton(1, "7am", setAlarm, 7);
			addButton(2, "8am", setAlarm, 8);
			addButton(3, "9am", setAlarm, 9);
			addButton(4, "Back", enterCabin);
		}

		private function setAlarm(timeSet:int = 6):void {
			clearOutput();
			outputText("Alarm has been set to go off at " + timeSet + "am.");
			flags[kFLAGS.BENOIT_CLOCK_ALARM] = timeSet;
			doNext(enterCabin);
		}

		private function menuStudy():void {
			clearOutput();
			menu();
			outputText("Your bookshelf currently holds the following books:[pg]Codex - describing some of the oddities of Mareth.\n")
			addButton(0, "Codex", camp.codex.accessCodexMenu).hint("Read up on some of the oddities of Mareth.");

			if (player.hasKeyItem("Dangerous Plants")) {
				outputText("Dangerous Plants - a book introducing to some of Mareth's weird fauna.\n");
				addButton(1, "Dangerous Plants", readDPlants).hint("This is a book titled 'Dangerous Plants'. As explained by the title, this tome is filled with information on all manner of dangerous plants from this realm.");
			}
			if (player.hasKeyItem("Traveler's Guide")) {
				outputText("Traveler's Guide - a very basic summary of the dos and don'ts of Mareth.\n");
				addButton(2, "Traveler's Guide", readTGuide).hint("This traveler's guide is more of a pamphlet than an actual book, but it still contains some useful information on avoiding local pitfalls.");
			}
			if (player.hasKeyItem("Hentai Comic")) {
				outputText("Hentai Comic - an atypical piece of erotic art, unlike anything you saw back in Ingram.\n");
				addButton(3, "Hentai Book", readHComic).hint("This oddly drawn comic book is filled with images of fornication, sex, and overly large eyeballs.");
			}
			if (player.hasKeyItem("Yoga Guide")) {
				outputText("Yoga Guide - a Yoga instruction book for those with unusual body shapes.\n");
				addButton(4, "Yoga Guide", readYGuide).hint("This leather-bound book is titled 'Yoga for Non-Humanoids.' It contains numerous illustrations of centaurs, nagas and various other oddly-shaped beings in a variety of poses.");
			}
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				outputText("Carpenter's Manual - your trusty aid in the construction of new stuff.\n");
				addButtonDisabled(5, "Carpenter's Manual", "You really don't see any reason to read in this unless you are actively constructing something.");
			}
			if (player.hasKeyItem("Izma's Book - Combat Manual")) {
				outputText("Combat Manual - an instruction booklet on combat you bought of Izma.\n");
				addButton(6, "C.Manual", studyCombatManual);
			}
			if (player.hasKeyItem("Izma's Book - Etiquette Guide")) {
				outputText("Etiquette Guide - instructions on how to be a nice Marethian. Bought from Izma\n");
				addButton(7, "E.Guide", studyEtiquetteGuide);
			}
			if (player.hasKeyItem("Izma's Book - Porn")) {
				outputText("Porn - masturbatory aid bought from Izma.\n");
				addButton(8, "Porn", studyPorn);
			}
			outputText("\nWhich of your books would you like to study?");
			addButton(14, "Back", enterCabin);
		}
		private function readLocation():int {
			if (hasDesk && hasDeskChair) return 2;
			else if (hasBed) return 1;
			else return 0;
		}
		private const STAND:int = 0;
		private const BED:int = 1;
		private const DESK:int = 2;

		private function readDPlants():void {
			clearOutput();
			outputText("You reach into your bookshelf and procure the book labeled 'Dangerous Plants' from it. While you are quite sure you still remember most of it, perhaps another reading will still be fruitful?");
			outputText("[pg]You consider yourself fortunate to be quite literate in this day and age. It certainly comes in handy with this book. Obviously written by well-informed--but woman-starved--men, the narrative drearily states the various types of poisonous and carnivorous plants in the world. One entry that really grabs you is the chapter on 'Violation Plants'. The chapter drones on about an entire classification of specially bred plants whose purpose is to torture or feed off a human being without permanently injuring and killing them. Most of these plants attempt to try breeding with humans and are too insensitive to the intricacies of human reproduction to be of any value, save giving the person no end of hell. These plants range from massive shambling horrors to small plant-animal hybrids that attach themselves to people. As you finish the book, you cannot help but shiver at the many unnatural types of plants out there and wonder what sick bastard created such monstrosities.");

			outputText("[pg]Silently, you close the book after you have finished reading. While you don't think you learned anything new, it still felt good to read a well-formulated book once in a while.");

			//we get a very slow int gain from this
			dynStats("int", 0.1);
			doNext(camp.returnToCampUseOneHour);
		}

		private function readTGuide():void {
			clearOutput();
			outputText("For some reason, you decide to take another look at the Traveler's Guide.[pg]")
			outputText("The crazy merchant said you might not need this and he was right. Written at a simple level, this was obviously intended for a city-dweller who never left the confines of their walls. Littered with childish illustrations and silly phrases, the book is informative in the sense that it does tell a person what they need and what to do, but naively downplays the dangers of the forest and from bandits. Were it not so cheap, you would be pissed at the merchant. However, he is right in the fact that giving this to some idiot ignorant of the dangers of the road saves time from having to answer a bunch of stupid questions.");

			outputText("[pg]You sign and wonder why you read this thing again....At least it didn't take much of your time.");
			menu();
			addButton(0, "Next", enterCabin);
		}

		private function readHComic():void {
			clearOutput();
			outputText("As you reach towards the bookshelf to retrieve your Hentai Comic from it, it occurs to you that you never even placed it there, but still have it on your person. You wonder why? Perhaps it will be of use during your travels?[pg]");

			outputText("You peruse the erotic book. The story is one of a group of sisters who are all impossibly heavy-chested and equally horny getting into constant misadventures trying to satisfy their lust. While the comic was entertaining and erotic to the highest degree, you cannot help but laugh at how over-the-top the story and all of the characters are. Were the world as it was in the book, nothing would get done as humanity would be fucking like jackrabbits in heat for the rest of their lives. While certainly a tempting proposition, everyone gets worn out sometime.");
			outputText("[pg]Since you still remembered at least some of the content, the effects were somewhat diminished this time.");

			outputText("[pg]Once you are done, you put the Hentai Comic back into your [inv].")
			//less stat changes than when we first bought the book; it has the same effects as Izma's Porn anyway.
			dynStats("lib", 1, "lus", 15);
			doNext(camp.returnToCampUseOneHour);
		}

		private function readYGuide():void {
			clearOutput();
			outputText("As you reach towards the bookshelf to retrieve your Yoga Guide from it, it occurs to you that you never even placed it there, but still have it on your person. You wonder why? Perhaps it will be of use during your travels?[pg]");

			if (flags[kFLAGS.COTTON_UNUSUAL_YOGA_BOOK_TRACKER] == 1) {
				outputText("After the first few pages, you must admit that you don't quite understand anything presented in this book. Perhaps it requires the reader to already be familiar with the basics of Yoga?[pg]");
				outputText("Maybe you should just bring it to Cotton at the Gym?");
			} else if (flags[kFLAGS.COTTON_UNUSUAL_YOGA_BOOK_TRACKER] == 3) {
				//TODO: maybe refine it a bit more?
				if (flags[kFLAGS.TIMES_HAD_YOGA] == 0) {
					outputText("While Cotton was able to learn something from this book, you are still struggling to make sense of it at all. It doesn't help that you didn't even engage in Yoga yet. Maybe you should pay Cotton a visit at the gym?");
				} else if (flags[kFLAGS.TIMES_HAD_YOGA] == 1) {
					outputText("Now that you had your first Yoga session, you are finally able understand some parts of this book. While it's not enough to actually perform yoga yourself, it's a start. You have a feeling that more Yoga lessons will help get a better grasp at what this book tries to teach.\n");
				} else if ((flags[kFLAGS.TIMES_HAD_YOGA] >= 2) && (flags[kFLAGS.TIMES_HAD_YOGA] < 5)) {
					outputText("Since you had a few Yoga lessons by now, you can perform some of the easier forms presented in the book by yourself. You are certain that you will master all the poses shown in the book if you keep visiting yoga sessions.[pg]");

					//same tone-gain as yoga, same fatigue but the speed gain is half
					player.modTone(52, 1);
					player.changeFatigue(20);
					dynStats("spe", 0.5);

				} else if (flags[kFLAGS.TIMES_HAD_YOGA] >= 5) {
					outputText("After your many Yoga sessions with Cotton, you can now master even the most difficult poses presented in the book. After about an hour of intensive Yoga, you allow yourself some rest.[pg]")

					//same tone-gain as yoga, same fatigue and we even get a tiny bit of extra speed
					player.modTone(52, 1);
					player.changeFatigue(20);
					dynStats("spe", 1.1);
				}
			}

			doNext(camp.returnToCampUseOneHour);
		}

		private function studyCombatManual():void {
			clearOutput();
			outputText("You take the book titled 'Combat Manual' from the bookshelf");
			switch (readLocation()) {
				case DESK:
					outputText(" and sit down on the chair while you lay the book on the desk");
					break;
				case BED:
					outputText(" and sit down on the bed");
					break;
				case STAND:
			}
			outputText(". You open the book and study its content.[pg]");
			//(One of the following random effects happens)
			var choice:Number = rand(3);
			if (choice == 0) {
				outputText("You learn a few new guarding stances that seem rather promising.");
				//(+2 Toughness)
				dynStats("tou", 2);
			} else if (choice == 1) {
				outputText("After a quick skim you reach the end of the book. You don't learn any new fighting moves, but the refresher on the overall mechanics and flow of combat and strategy helped.");
				//(+2 Intelligence)
				dynStats("int", 2);
			} else {
				outputText("Your read-through of the manual has given you insight into how to put more of your weight behind your strikes without leaving yourself open. Very useful.");
				//(+2 Strength)
				dynStats("str", 2);
			}
			outputText("[pg]Finished learning what you can from the old rag, you close the book and put it back on your bookshelf.");
			doNext(camp.returnToCampUseOneHour);
		}

		private function studyEtiquetteGuide():void {
			clearOutput();
			outputText("You take the book titled 'Etiquette Guide' from the bookshelf");
			switch (readLocation()) {
				case DESK:
					outputText(" and sit down on the chair while you lay the book on the desk");
					break;
				case BED:
					outputText(" and sit down on the bed");
					break;
				case STAND:
				default:
					outputText("");
			}
			outputText(". You open the book and study its content.[pg]");

			outputText("You peruse the strange book in an attempt to refine your manners, though you're almost offended by the stereotypes depicted within. Still, the book has some good ideas on how to maintain chastity and decorum in the face of lewd advances.[pg]");
			//(-2 Libido, -2 Corruption)
			dynStats("lib", -2, "cor", -2);

			outputText("After reading through the frilly book, you carefully put the book back on your bookshelf.");
			doNext(camp.returnToCampUseOneHour);
		}

		private function studyPorn():void {
			clearOutput();
			outputText("You take the book that's clearly labeled as porn from your bookshelf. You look around to make sure you have complete privacy.[pg]");

			outputText("You wet your lips as you flick through the pages of the book and admire the rather... detailed illustrations inside. A bee-girl getting gangbanged by imps, a minotaur getting sucked off by a pair of goblins... the artist certainly has a dirty mind. As you flip the pages you notice the air around you heating up a bit; you attribute this to weather until you finish and close the book.[pg]");
			//(+2! Libido and lust gain)
			dynStats("lib", 2, "lus", (20 + player.lib / 10));
			outputText("Your mind is already filled with sexual desires. You put the pornographic book back in your bookshelf.");

			doNext(camp.returnToCampUseOneHour);
		}

		public function get hasBed():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_BED] > 0; }
		public function get hasNightstand():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_NIGHTSTAND] > 0; }
		public function get hasDresser():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_DRESSER] > 0; }
		public function get hasTable():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_TABLE] > 0; }
		public function get hasTableChair1():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_CHAIR1] > 0; }
		public function get hasTableChair2():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_CHAIR2] > 0; }
		public function get hasBookshelf():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_BOOKSHELF] > 0; }
		public function get hasDesk():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_DESK] > 0; }
		public function get hasDeskChair():Boolean { return flags[kFLAGS.CAMP_CABIN_FURNITURE_DESKCHAIR] > 0; }

		private function menuFurniture():void {
			menu();
			clearOutput();
			outputText("What furniture would you like to construct?[pg]");
			camp.cabinProgress.checkMaterials();
			if (!hasBed && !hasTable && !hasBookshelf && !hasDesk) {
				outputText("\nYour cabin is empty.[pg]");
			}
			if (hasBed && hasNightstand && hasDresser && hasTable && hasTableChair1 && hasTableChair2 && hasBookshelf && hasDesk && hasDeskChair) {
				outputText("\nYou have constructed all available furniture![pg]");
			}
			if (!hasBed) addButton(0, "Bed", constructFurnitureBedPrompt);
			if (hasBed && !hasNightstand) addButton(1, "Nightstand", constructFurnitureNightstandPrompt);
			if (hasBed && !hasDresser) addButton(2, "Dresser", constructFurnitureDresserPrompt);
			if (!hasTable) addButton(3, "Table", constructFurnitureTablePrompt);
			if (hasTable && (!hasTableChair1 || !hasTableChair2)) addButton(4, "Chair", constructFurnitureChairPrompt);
			if (!hasBookshelf) addButton(5, "Bookshelf", constructFurnitureBookshelfPrompt);
			if (!hasDesk) addButton(6, "Desk", constructFurnitureDeskPrompt);
			if (hasDesk && !hasDeskChair) addButton(7, "Desk Chair", constructFurnitureChairForDeskPrompt);
			addButton(14, "Back", enterCabin);
		}

		//CONSTRUCT FURNITURE
		//Bed
		private function constructFurnitureBedPrompt():void {
			clearOutput();
			outputText("Would you like to construct a bed? (Cost: 45 nails and 25 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 45 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 25) {
					doYesNo(constructFurnitureBed, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureBed():void {
			clearOutput();
			outputText("You take the carpentry manual from your toolbox and flip pages until you reach instructions on constructing a bed. After mulling it over for a bit, you decide on a model usable by 2 people, since - considering the nature of this world - you might need that extra space. You read over the instructions again, then decide to begin.[pg]");
			outputText("You pick up some wooden planks and start constructing a bed frame. After putting the frame together you fixate it with nails.[pg]");
			outputText("Next, you add a wooden slab to hold the mattress.\n Once you are happy with how the bed turned out, you go and get your bedroll from outside. You manage to convert it to a mattress, a sheet, and a pillow with little difficulty.\nAll in all, it took you two hours to finish the construction of your bed.[pg]");
			outputText("[b: Your new bed is ready to be used! (HP and Fatigue recovery from sleeping is increased by 50%!)][pg]");

			player.addKeyValue("Carpenter's Toolbox", 1, -45);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 25;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_BED] = 1;
			player.changeFatigue(40);
			doNext(camp.returnToCampUseTwoHours);
		}

		//Nightstand
		private function constructFurnitureNightstandPrompt():void {
			clearOutput();
			outputText("Would you like to construct a nightstand? (Cost: 20 nails and 10 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 20 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 10) {
					doYesNo(constructFurnitureNightstand, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureNightstand():void {
			clearOutput();
			outputText("You pick up your carpentry manual and search for instructions for building a nightstand. There seem to be a few variants and you decide on one with few drawers below the table top.[pg]");
			outputText("First you lengthen some wood using the measures from the book. Next you put the pieces together and drive in a couple nail with firm hammer-strokes. Finally, you use some old paint you found in the toolbox to give the nightstand a bit more polished look.[pg]");
			outputText("The paint dries relatively quickly and it only took you one hour to finish your nightstand![pg]");
			outputText("[b: You have finished construction of your new nightstand!][pg]");
			player.addKeyValue("Carpenter's Toolbox", 1, -20);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 10;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_NIGHTSTAND] = 1;
			player.changeFatigue(20);
			doNext(camp.returnToCampUseOneHour);
		}

		//Dresser
		private function constructFurnitureDresserPrompt():void {
			clearOutput();
			outputText("Would you like to construct a dresser? (Cost: 50 nails and 30 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 50 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 30) {
					doYesNo(constructFurnitureDresser, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureDresser():void {
			clearOutput();
			outputText("Deciding to construct a better storage for some of your clothes, you take the carpentry manual in hand and begin look for a suitable piece of furniture. Eventually, you find a simple but practical dresser and decide to construct it.[pg]");
			outputText("You begin by getting some wood to the right lengths, after which you piece it together and fix it in place with nails. Once you are done with that part, you try to create a few drawers, but your first attempt doesn't turn out right. You have sufficient wood for another try though, and the the next drawer you create fits just right. After creating two more, you add a handles to them and place them in their slots on the dresser.[pg]");
			outputText("Finally, you use a bit of paint you found in the toolbox to give your new construction a slightly less crude look.[pg]");
			outputText("Fortunately, the paint dries rather quick. Then again, it was quite dry to begin with. It took you two hours, but now your dresser is complete.[pg]");
			outputText("[b: You have finished construction of your new dresser!]\n(You can store some undergarments inside of it.)[pg]");

			player.addKeyValue("Carpenter's Toolbox", 1, -50);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 30;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_DRESSER] = 1;
			player.changeFatigue(60);
			doNext(camp.returnToCampUseOneHour);
		}

		//Table
		private function constructFurnitureTablePrompt():void {
			clearOutput();
			outputText("Would you like to construct a table? (Cost: 20 nails and 15 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 20 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 15) {
					doYesNo(constructFurnitureTable, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureTable():void {
			clearOutput();
			outputText("Making a table seems fairly easy, ");
			if (hasDesk) {
				outputText("and you already made a desk, ");
			}
			outputText("so you think about skipping the instructions for a moment, but then you decide to take a look into the carpentry manual anyway.[pg]");
			outputText("Starting out, you pick up a few suitable pieces of wood from your stash and bring them to the right length. You then nail the future table-legs to the future table-top. When that is done, you conclude your work by painting your new table with some paint you found in your toolbox.[pg]");
			outputText("The paint dries quickly and after a total of one hour, your table is complete.[pg]");
			outputText("[b: You have finished construction of your new table!][pg]");
			player.addKeyValue("Carpenter's Toolbox", 1, -20);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 15;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_TABLE] = 1;
			player.changeFatigue(50);
			doNext(camp.returnToCampUseOneHour);
		}

		//Chair
		private function constructFurnitureChairPrompt():void {
			clearOutput();
			outputText("Would you like to construct a chair? (Cost: 40 nails and 10 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 40 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 10) {
					doYesNo(constructFurnitureChair, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureChair():void {
			clearOutput();
			outputText("With your mind set on creating a chair, you study your carpentry manual to learn how to go about doing just that.[pg]");
			outputText("At first you pick a few pieces of wood and adjust their length for their new purpose. After aligning them as is befitting for a chair, you drive some nails into place with firm hammer-strokes. As a finishing touch, you paint it with some old paint you found in your toolbox.[pg]");
			outputText("After a short drying period, your chair is finally finished and it only took you one hour to complete it.[pg]");
			outputText("[b: You have finished construction of your new chair!][pg]");
			player.addKeyValue("Carpenter's Toolbox", 1, -40);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 10;
			if (flags[kFLAGS.CAMP_CABIN_FURNITURE_CHAIR1] >= 1) {
				flags[kFLAGS.CAMP_CABIN_FURNITURE_CHAIR2] = 1;
			} else {
				outputText("[b: Of course, you could construct another chair.][pg]");
				flags[kFLAGS.CAMP_CABIN_FURNITURE_CHAIR1] = 1;
			}
			player.changeFatigue(20);
			doNext(camp.returnToCampUseOneHour);
		}

		//Bookshelf
		private function constructFurnitureBookshelfPrompt():void {
			clearOutput();
			outputText("Would you like to construct a bookshelf? (Cost: 75 nails and 25 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 75 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 25) {
					doYesNo(constructFurnitureBookshelf, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureBookshelf():void {
			clearOutput();
			outputText("A place to put books in a semblance of order would be nice. With that in mind, you begin flicking through the carpenter's manual, looking for instructions on creating a bookshelf.[pg]");
			outputText("Once you have gathered a suitable amount of wood from your stack, you begin adjusting them to the necessary lengths. You align the pieces, then seal them together with a couple nails. Eventually, you use some old paint you found in your toolbox to give a smoother look.[pg]");
			outputText("The paint dries rather quickly and after only two hours your bookshelf is finished! The new creation can hold three rows of books but you doubt you'll be able to fill it. Books seems to be a rare commodity in Mareth.[pg]");
			outputText("[b: You have finished constructing your new bookshelf!]/n(The Codex menu is now accessed through your new bookshelf.)[pg]");
			if (player.hasKeyItem("Dangerous Plants") || player.hasKeyItem("Traveler's Guide") || player.hasKeyItem("Hentai Comic") || player.hasKeyItem("Yoga Guide")) {
				outputText("You take some time to place the books you already own in it. There is still quite a lot of empty space though.[pg]");
			}
			player.addKeyValue("Carpenter's Toolbox", 1, -75);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 25;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_BOOKSHELF] = 1;
			player.changeFatigue(50);
			doNext(camp.returnToCampUseOneHour);
		}

		//Desk
		private function constructFurnitureDeskPrompt():void {
			clearOutput();
			outputText("Would you like to construct a desk? (Cost: 60 nails and 20 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 60 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 20) {
					doYesNo(constructFurnitureDesk, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureDesk():void {
			clearOutput();
			player.addKeyValue("Carpenter's Toolbox", 1, -60);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 20;
			outputText("Making a desk seems fairly easy, ");
			if (hasTable) {
				outputText("and you already made a table, ");
			}
			outputText("so you think about skipping the instructions for a moment, but then you decide to take a look into the carpentry manual anyway.[pg]");
			outputText("Starting out, you pick up a few suitable pieces of wood from your stash and bring them to the right length. You then nail the future table-legs to the future desk-top. When that is done, you continue your work by painting your new desk with some paint you found in your toolbox.[pg]");
			outputText("Since you want your desk to have a drawer, you fashion one out of a bit of wood, then paint it as well, after nailing it together that is.[pg]")
			outputText("Once the paint is dry you are done. It only took you two hours from start to finish.[pg]");
			outputText("[b: You have finished construction of your new desk!][pg]");
			flags[kFLAGS.CAMP_CABIN_FURNITURE_DESK] = 1;
			player.changeFatigue(60);
			doNext(camp.returnToCampUseTwoHours);
		}

		//Chair for Desk
		private function constructFurnitureChairForDeskPrompt():void {
			clearOutput();
			outputText("Would you like to construct a chair? (Cost: 40 nails and 10 wood.)[pg]");
			camp.cabinProgress.checkMaterials();
			if (player.hasKeyItem("Carpenter's Toolbox")) {
				if (player.keyItemv1("Carpenter's Toolbox") >= 40 && flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] >= 10) {
					doYesNo(constructFurnitureChairForDesk, menuFurniture);
				} else {
					camp.cabinProgress.errorNotEnough();
					doNext(playerMenu);
				}
			} else {
				camp.cabinProgress.errorNotHave();
				doNext(playerMenu);
			}
		}

		private function constructFurnitureChairForDesk():void {
			clearOutput();
			outputText("With your mind set on creating a chair, you study your carpentry manual to learn how to go about doing just that.[pg]");
			outputText("At first you pick a few pieces of wood and adjust their length for their new purpose. After aligning them as is befitting for a chair, you drive some nails into place with firm hammer-strokes. As a finishing touch, you paint it with some old point you found in your toolbox.[pg]");
			outputText("After a short drying period, your chair is finally finished and it only took you one hour to complete it.[pg]");
			outputText("[b: You have finished construction of your new chair!][pg]");
			player.addKeyValue("Carpenter's Toolbox", 1, -40);
			flags[kFLAGS.CAMP_CABIN_WOOD_RESOURCES] -= 10;
			flags[kFLAGS.CAMP_CABIN_FURNITURE_DESKCHAIR] = 1;
			player.changeFatigue(20);
			doNext(camp.returnToCampUseOneHour);
		}
	}
}