code:
/** @param {App.Entity.SlaveState} slave */
App.UI.SlaveInteract.cheatEditSlave = function(slave) {
	const el = new DocumentFragment();
	if (!V.tempSlave) {
		V.tempSlave = clone(slave);
	}

	App.UI.DOM.appendNewElement("h1", el, `Cheat edit ${slave.slaveName}`);

	el.append(App.Desc.longSlave(V.tempSlave));

	const tabBar = new App.UI.Tabs.TabBar("CheatEditJS");
	tabBar.addTab("Profile", "profile", App.StartingGirls.profile(V.tempSlave, true));
	tabBar.addTab("Physical", "physical", App.StartingGirls.physical(V.tempSlave, true));
	tabBar.addTab("Upper", "upper", App.StartingGirls.upper(V.tempSlave, true));
	tabBar.addTab("Lower", "lower", App.StartingGirls.lower(V.tempSlave, true));
	if (V.tempSlave.womb.length > 0) {
		tabBar.addTab(V.tempSlave.womb.length > 1 ? 'Fetuses' : 'Fetus', "fetuses", analyzePregnancies(V.tempSlave, true));
	}
	tabBar.addTab("Genes", "genes", genes());
	tabBar.addTab("Mental", "mental", App.StartingGirls.mental(V.tempSlave, true));
	tabBar.addTab("Skills", "skills", App.StartingGirls.skills(V.tempSlave, true));
	tabBar.addTab("Stats", "stats", App.StartingGirls.stats(V.tempSlave, true));
	tabBar.addTab("Porn", "porn", porn());
	tabBar.addTab("Relationships", "family", App.Intro.editFamily(V.tempSlave, true));
	tabBar.addTab("Body Mods", "body-mods", App.UI.bodyModification(V.tempSlave, true));
	tabBar.addTab("Salon", "salon", App.UI.salon(V.tempSlave, true));
	if (V.seeExtreme) {
		tabBar.addTab("Extreme", "extreme", extreme());
	}
	tabBar.addTab("Finalize", "finalize", finalize());
	el.append(tabBar.render());

	return el;

	function genes() {
		const el = new DocumentFragment();
		App.UI.DOM.appendNewElement("h2", el, "Genetic mods");
		el.append(App.UI.SlaveInteract.geneticMods(V.tempSlave, true));
		App.UI.DOM.appendNewElement("h2", el, "Genetic quirks");
		el.append(App.UI.SlaveInteract.geneticQuirks(V.tempSlave, true));
		return el;
	}

	function finalize() {
		const el = new DocumentFragment();
		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link(
			"Cancel",
			() => {
				delete V.tempSlave;
			},
			[],
			"Slave Interact"
		));
		App.Utils.showSlaveChanges(V.tempSlave, getSlave(V.AS), (val) => App.UI.DOM.appendNewElement("div", el, val), " ");
		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link(
			"Apply cheat edits",
			() => {
				SlaveDatatypeCleanup(V.tempSlave);
				V.slaves[V.slaveIndices[slave.ID]] = V.tempSlave;
				ibc.recalculate_coeff_id(slave.ID);
				delete V.tempSlave;
			},
			[],
			"Cheat Edit JS Apply"
		));
		return el;
	}

	function extreme() {
		const el = new DocumentFragment();
		const options = new App.UI.OptionsGroup();
		options.addOption("Fuckdoll", "fuckdoll", V.tempSlave)
			.addValue("Not a Fuckdoll", 0).addCallback(() => {
				V.tempSlave.clothes = "no clothing";
				V.tempSlave.shoes = "none";
			})
			.addValue("Barely a Fuckdoll", 15).addCallback(() => beginFuckdoll(V.tempSlave))
			.addValue("Slight Fuckdoll", 25).addCallback(() => beginFuckdoll(V.tempSlave))
			.addValue("Basic Fuckdoll", 45).addCallback(() => beginFuckdoll(V.tempSlave))
			.addValue("Intermediate Fuckdoll", 65).addCallback(() => beginFuckdoll(V.tempSlave))
			.addValue("Advanced Fuckdoll", 85).addCallback(() => beginFuckdoll(V.tempSlave))
			.addValue("Total Fuckdoll", 100).addCallback(() => beginFuckdoll(V.tempSlave))
			.showTextBox();
		el.append(options.render());
		return el;
	}

	function porn() {
		const el = new DocumentFragment();
		const porn = V.tempSlave.porn;
		const options = new App.UI.OptionsGroup();
		let option;
		const {him, he} = getPronouns(V.tempSlave);
		options.addOption(`Studio outputting porn of ${him}`, "feed", porn)
			.addValue("off", 0).off()
			.addValue("on", 1).on();
		options.addOption(`Viewer count`, "viewerCount", porn).showTextBox();
		options.addOption(`Spending`, "spending", porn).showTextBox();

		option = options.addOption(`Porn ${he} is known for`, "fameType", porn).addValue("None", "none").pulldown();
		for (const genre of App.Porn.getAllGenres()) {
			option.addValue(genre.uiName(), genre.fameName);
		}

		if (porn.fameType !== "none") {
			options.addOption(`Prestige level`, "prestige", porn)
				.addValueList([
					["Not", 0],
					["Some", 1],
					["Recognized", 2],
					["World renowned", 3],
				]);
			options.addOption(`Prestige Description`, "prestigeDesc", porn)
				.addValue("Disable", 0).off()
				.showTextBox();
		}

		option = options.addOption(`Porn the studio focuses on`, "focus", porn).addValue("None", "none").pulldown();
		for (const genre of App.Porn.getAllGenres()) {
			option.addValue(genre.uiName(), genre.focusName);
		}

		for (const genre of App.Porn.getAllGenres()) {
			options.addOption(`Fame level for ${genre.fameName}`, genre.fameVar, porn.fame).addValue("None", "none").showTextBox();
		}

		el.append(options.render());
		return el;
	}
};


code:
:: MOD_Edit Child Cheat Datatype Cleanup New [nobr]

<<set $nextButton = "Continue", $nextLink = "Child Interact">>
/* Cancel Option Check */
<<if $tempSlave == "unset">>
	<<unset $tempSlave>>
	<<goto "Child Interact">>
<</if>>

<<if $customEvalCode>>
	<<if $customEvalCode.charAt(0) != "(" || $nextLink == ")">> /* second condition is only there for sanityCheck */
		<<set $customEvalCode = "(" + $customEvalCode + ")">>
	<</if>>
	<<if typeof eval($customEvalCode) === "function">>
		<<run (eval($customEvalCode))($tempSlave)>>
	<</if>>
<</if>>
<<unset $customEvalCode>>

<<run SlaveDatatypeCleanup($tempSlave)>>
<<set $rep = Number($rep) || 0>>
<<set $cash = Number($cash) || 0>>
<<set $week = Number($week) || 1>>
<<set $tempSlave.preg = Number($tempSlave.preg) || 0>>
<<set $tempSlave.pregType = Number($tempSlave.pregType) || 0>>
<<if $tempSlave.broodmother == 0>>
	<<set WombInit($tempSlave)>> /* just to make sure */
	<<set $tempSlave.womb.length = 0>> /* simple way to delete all fetuses */
	<<set WombImpregnate($tempSlave, $tempSlave.pregType, $tempSlave.pregSource, $tempSlave.preg)>> /* recreates fetuses */
<<else>>
	<<set WombNormalizePreg($tempSlave)>>
<</if>>
<<set $tempSlave.pregWeek = Number($tempSlave.pregWeek) || Math.max($tempSlave.preg, 0)>>
<<if $tempSlave.preg <= 0>>
	<<set $tempSlave.pregKnown = 0>>
<<elseif $tempSlave.preg > 0>>
	<<set $tempSlave.pregKnown = 1>>
<</if>>

/* Dependency Check */

<<if $tempSlave.indenture == -1>>
	<<set $tempSlave.indentureRestrictions = 0>>
<<elseif $tempSlave.indenture < -1>>
	<<set $tempSlave.indenture = -1>>
	<<print "Indenture was smaller than -1, reset to Fulltime Slave">>

<<elseif $tempSlave.indentureRestrictions < 0>>
	<<set $tempSlave.indentureRestrictions = 0>>
	<<print "Indenture restriction was smaller than 0, reset to no restrictions">>

<<elseif $tempSlave.indentureRestrictions > 2>>
	<<set $tempSlave.indentureRestrictions = 2>>
	<<print "Indenture restrictions was larger than 2, reset to full restrictions">>

<</if>>
<<if $tempSlave.weekAcquired < 0>>
	<<set $tempSlave.weekAcquired = 0>>
	<<print "Week Acquired was negative reset to 0">>

<</if>>
<<if ($tempSlave.relationshipTarget == $tempSlave.ID) && ($tempSlave.relationship > 0)>>
	<<set $tempSlave.relationshipTarget = 0>>
	<<set $tempSlave.relationship = -1>>
	<<print "The Slave was in a relation with $himself, reset to emotional Slut">>

<</if>>
<<if ($tempSlave.rivalryTarget == $tempSlave.ID) && ($tempSlave.rivalry > 0)>>
	<<set $tempSlave.rivalryTarget = 0>>
	<<set $tempSlave.rivalry = 0>>
	<<print "Slave was $his own rival, reset to no rivalry">>

<</if>>
<<if $tempSlave.actualAge < 0>>
	<<print "Slave's actual age is set too low, reset to existing actual age">>

	<<set $tempSlave.actualAge = $activeSlave.actualAge>>
<</if>>
<<if $tempSlave.physicalAge < 0>>
	<<print "Slave's physical Age is set too low, reset to existing physical age">>

	<<set $tempSlave.physicalAge = $activeSlave.actualAge>>
<</if>>
<<if $tempSlave.visualAge < 0>>
	<<print "Slave's visual age is set too low, reset to existing visual age">>

	<<set $tempSlave.visualAge = $activeSlave.actualAge>>
<</if>>
<<if $tempSlave.ovaryAge < 0>>
	<<print "Slave's ovary age is set too low, reset to match physical age">>

	<<set $tempSlave.ovaryAge = $tempSlave.physicalAge>>
<</if>>
<<if $tempSlave.chem < 0>>
	<<print "Slave's DNA error is set too low, reset to 0">>

	<<set $tempSlave.chem = 0>>
<</if>>
<<if $tempSlave.face < -100>>
	<<print "Face Beauty was set too low, reset to -100">>

	<<set $tempSlave.face = -100>>
<<elseif $tempSlave.face > 100>>
	<<print "Face Beauty was set too high, reset to 100">>

	<<set $tempSlave.face = 100>>
<</if>>
<<if $tempSlave.hLength < 0>>
	<<print "Slaves Hair length was set too low, reset to 0">>

	<<set $tempSlave.hLength = 0>>
<</if>>
<<if $tempSlave.lips < 0>>
	<<print "Lips size too small, reset to 0">>

	<<set $tempSlave.lips = 0>>
<<elseif $tempSlave.lips > 100>>
	<<print "Lips size too high, reset to 100">>

	<<set $tempSlave.lips = 100>>
<</if>>
<<if $tempSlave.muscles < -100>>
	<<print "Muscle Value too low, reset to -100 (Frail)">>

	<<set $tempSlave.muscles = 0>>
<<elseif $tempSlave.muscles > 100>>
	<<print "Muscle Value too high, reset to 100 (Hugely Muscular)">>

	<<set $tempSlave.muscles = 100>>
<</if>>
<<if $tempSlave.weight < -100>>
	<<print "Weight Value too low, reset to -100 (Emaciated)">>

	<<set $tempSlave.weight = -100>>
<<elseif $tempSlave.weight > 200 >>
	<<print "Weight Value too high, reset to 200 (Extremely Obese)">>

	<<set $tempSlave.weight = 200>>
<</if>>
<<if $tempSlave.waist < -100>>
	<<print "Waist Value too low, reset to -100 (Absurd)">>

	<<set $tempSlave.waist = -100>>
<<elseif $tempSlave.waist > 100>>
	<<print "Waist Value too high, reset to 100 (Masculine)">>

	<<set $tempSlave.waist = 100>>
<</if>>
<<if $tempSlave.height < 1>>
	<<print "Height Value too low, reset to 140 (Seriously its still a Human Being)">>

	<<set $tempSlave.height = 140>>
<</if>>
<<if $tempSlave.bellySag < 0>>
	<<print "Bellysag Value too low, reset 0">>

	<<set $tempSlave.bellySag = 0>>
<</if>>
<<if $tempSlave.boobs < 0>>
	<<print "Breasts Value too low, reset to 200">>

	<<set $tempSlave.boobs = 200>>
<</if>>
<<if $tempSlave.boobsImplant < 0>>
	<<print "Breast Implant Value too low, reset to 0">>

	<<set $tempSlave.boobsImplant = 0>>
<</if>>
<<if $tempSlave.butt < 0>>
	<<print "Butt Value too low, reset to 0">>

	<<set $tempSlave.butt = 0>>
<</if>>
<<if (ndef $tempSlave.pubertyAgeXX) || ($tempSlave.pubertyAgeXX < 0)>>
	<<print "Puberty Age was not set or set too low, reset to Arcology fertility age">>

	<<set $tempSlave.pubertyAgeXX = $fertilityAge>>
<</if>>
<<if (ndef $tempSlave.pubertyXX) && ($tempSlave.physicalAge >= $tempSlave.pubertyAgeXX)>>
	<<set $tempSlave.pubertyXX = 1>>
<<elseif (ndef $tempSlave.pubertyXX) && ($tempSlave.physicalAge < $tempSlave.pubertyAgeXX)>>
	<<set $tempSlave.pubertyXX = 0>>
<</if>>
<<if $tempSlave.dick < 0>>
	<<print "Slave dick value set too low, reset to 0 (no dick)" >>

	<<set $tempSlave.dick = 0>>
<</if>>
<<if $tempSlave.dick == 0>>
	<<set $tempSlave.dickTat = 0>>
<</if>>
<<if ($tempSlave.vagina == -1) >>
	<<set $tempSlave.labia = 0>>
	<<set $tempSlave.clit = 0>>
	<<set $tempSlave.cervixImplant = 0>>
	<<set $tempSlave.ovaries = 0>>
<</if>>
<<if ($tempSlave.clit > 0) && ($tempSlave.dick > 0 )>>
	<<print "No giant clit when dick is present, reset clit to 0 (normal)" >>

	<<set $tempSlave.clit = 0>>
<</if>>
<<if ($tempSlave.ovaries == 0) && ($tempSlave.mpreg == 0) && ($tempSlave.preg > 0)>>
	<<print "Slave has no Ovaries and no Analwomb, Pregnancy reset to 0">>

	<<run WombFlush($tempSlave)>>
<</if>>
<<if ($tempSlave.pubertyXX != 1) && ($tempSlave.physicalAge >= $tempSlave.pubertyAgeXX)>>
	<<print "Slaves physical Age is equal or higher than female Puberty Age, Puberty set to 1 (Post Puberty)" >>

	<<set $tempSlave.pubertyXX = 1>>
<</if>>
<<if ($tempSlave.ovaries == 1) && ($tempSlave.mpreg == 1)>>
	<<print "Slave has a working Vagina, Analwomb got removed" >>

	<<set $tempSlave.mpreg = 0>>
<</if>>
<<if ($tempSlave.pubertyXX == 0) && ($tempSlave.preg > 0)>>
	<<print "Slave is not fertile (Pre-Puberty) and has no Anal Womb, pregnancy aborted!">>

	<<run WombFlush($tempSlave)>>
<</if>>
<<if $tempSlave.balls < 0>>
	<<print "Slave Balls Value set too low, reset to 0 (No Balls)">>

	<<set $tempSlave.balls = 0>>
<</if>>
<<if $tempSlave.foreskin < 0>>
	<<print "Slave Foreskin Value set too low, reset to 0 (None)">>

	<<set $tempSlave.foreskin = 0>>
<</if>>
<<if $tempSlave.scrotum < 0>>
	<<print "Slave Scrotum Value set too low, reset to 0 (No Scrotum)">>

	<<set $tempSlave.scrotum = 0>>
<</if>>
<<if (ndef $tempSlave.pubertyAgeXY) || ($tempSlave.pubertyAgeXY < 0)>>
	<<print "XY Puberty Age was not set or set too low, reset to Arcology Puberty Age">>

	<<set $tempSlave.pubertyAgeXY = $potencyAge>>
<</if>>
<<if (ndef $tempSlave.pubertyXY) && ($tempSlave.physicalAge >= $tempSlave.pubertyAgeXY)>>
	<<set $tempSlave.pubertyXY = 1>>
<<elseif (ndef $tempSlave.pubertyXY) && ($tempSlave.physicalAge < $tempSlave.pubertyAgeXY)>>
	<<set $tempSlave.pubertyXY = 0>>
<</if>>
<<if ($tempSlave.physicalAge >= $tempSlave.pubertyAgeXY) && ($tempSlave.pubertyXY != 1)>>
	<<print "Slaves physical Age is equal or higher than male Puberty Age, Puberty set to 1 (Post Puberty)" >>

	<<set $tempSlave.pubertyXY = 1>>
<</if>>
<<if $tempSlave.skill.oral < 0>>
	<<print "Oral Skill Value set too low, reset to 0">>

	<<set $tempSlave.skill.oral = 0>>
<<elseif $tempSlave.skill.oral > 100>>
	<<print "Oral Skill Value set too high, reset to 100">>

	<<set $tempSlave.skill.oral = 100>>
<</if>>
<<if $tempSlave.skill.vaginal < 0>>
	<<print "Vaginal Skill Value too low, reset to 0">>

	<<set $tempSlave.skill.vaginal = 0>>
<<elseif $tempSlave.skill.vaginal > 100>>
	<<print "Vaginal Skill Value too high, reset to 100">>

	<<set $tempSlave.skill.vaginal = 100>>
<</if>>
<<if $tempSlave.skill.anal < 0>>
	<<print "Anal Skill Value set too low, reset to 0">>

	<<set $tempSlave.skill.anal = 0>>
<<elseif $tempSlave.skill.anal > 100>>
	<<print "Anal Skill Value set too high, reset to 100">>

	<<set $tempSlave.skill.anal = 100>>
<</if>>
<<if $tempSlave.skill.whoring < 0>>
	<<print "Whoring Skill Value set too low, reset to 0">>

	<<set $tempSlave.skill.whoring = 0>>
<<elseif $tempSlave.skill.whoring > 100>>
	<<print "Whoring Skill Value set too high, reset to 100">>

	<<set $tempSlave.skill.whoring = 100>>
<</if>>
<<if $tempSlave.skill.entertainment < 0>>
	<<print "Entertainment Skill Value set too low, reset to 0">>

	<<set $tempSlave.skill.entertainment = 0>>
<<elseif $tempSlave.skill.entertainment > 100>>
	<<print "Entertainment Skill Value set too high, reset to 100">>

	<<set $tempSlave.skill.entertainment = 100>>
<</if>>
<<if $tempSlave.intelligence < -100>>
	<<print "Slave Intelligence Value set too low, reset to -100">>

	<<set $tempSlave.intelligence = -100>>
<<elseif $tempSlave.intelligence > 100>>
	<<print "Slave Intelligence Value set too high, reset to 100">>

	<<set $tempSlave.intelligence = 100>>
<</if>>
<<if $tempSlave.intelligenceImplant < 0>>
	<<print "Slave intelligenceImplant Value set too low, reset to 0">>

	<<set $tempSlave.intelligenceImplant = 0>>
<<elseif $tempSlave.intelligenceImplant > 30>>
	<<print "Slave intelligenceImplant Value set too high, reset to 30">>

	<<set $tempSlave.intelligenceImplant = 30>>
<</if>>
<<if $tempSlave.fetishStrength < 0>>
	<<print "Fetish Strength set too low, reset to 0">>

	<<set $tempSlave.fetishStrength = 0>>
<<elseif $tempSlave.fetishStrength > 100>>
	<<print "Fetish Strength set too high, reset to 100">>

	<<set $tempSlave.fetishStrength = 100>>
<</if>>
<<if $tempSlave.energy < 0>>
	<<print "Sex Drive was set too low, reset to 0">>

	<<set $tempSlave.energy = 0>>
<<elseif $tempSlave.energy > 100>>
	<<print "Sex Drive was set too high, reset to 100">>

	<<set $tempSlave.energy = 100>>
<</if>>
<<if $tempSlave.counter.penetrative < 0>>
	<<print "Penetrative sex Count was set too low, reset to 0">>

	<<set $tempSlave.counter.penetrative = 0>>
<</if>>
<<if $tempSlave.counter.oral < 0>>
	<<print "Oral sex Count set too low, reset to 0">>

	<<set $tempSlave.counter.oral = 0>>
<</if>>
<<if $tempSlave.counter.vaginal < 0>>
	<<print "Vaginal sex Count set too low, reset to 0">>

	<<set $tempSlave.counter.vaginal = 0>>
<</if>>
<<if $tempSlave.counter.anal < 0>>
	<<print "Anal sex Count set too low, reset to 0">>

	<<set $tempSlave.counter.anal = 0>>
<</if>>
<<if $tempSlave.counter.publicUse < 0>>
	<<print "Public sex Count set too low, reset 0">>

	<<set $tempSlave.counter.publicUse = 0>>
<</if>>
<<if $tempSlave.counter.mammary < 0>>
	<<print "Titjobs Count set too low, reset to 0">>

	<<set $tempSlave.counter.mammary = 0>>
<</if>>
<<if $tempSlave.counter.birthsTotal < 0>>
	<<print "Total birth Count set too low, reset to 0">>

	<<set $tempSlave.counter.birthsTotal = 0>>
<</if>>
<<if $tempSlave.prestige < 0>>
	<<print "Prestige set too low, reset to 0">>

	<<set $tempSlave.prestige = 0>>
<<elseif $tempSlave.prestige > 3>>
	<<print "Prestige set too high, reset to 3">>

	<<set $tempSlave.prestige = 3>>
<</if>>
<<if $tempSlave.lactation > 0 && $tempSlave.lactationDuration == 0>>
	<<set $tempSlave.lactationDuration = 2>>
<<elseif $tempSlave.lactation == 0 && $tempSlave.lactationDuration > 0>>
	<<set $tempSlave.lactationDuration = 0>>
<</if>>
<<run SetBellySize($tempSlave)>>

You perform the dark rituals, pray to the dark gods, and sell your soul for the power to change and mold slaves to your will.

This slave has been changed forever and you have lost a bit of your soul, YOU CHEATER!

<<set $activeSlave = clone($tempSlave)>>
<<unset $tempSlave>>
<<set _escn = $cribs.findIndex(function(s) { s.ID === $activeSlave.ID; })>>
<<if def _escn>>
	<<set $cribs[_escn] = clone($activeSlave)>>
<</if>>
<<run ibc.recalculate_coeff_id($activeSlave.ID)>>

repo_name: Pecanus/fc

license: mit