diff --git a/src/005-passages/interactPassages.js b/src/005-passages/interactPassages.js index 558124e4cbbe9e5c2e629fa08cc21842a891a34f..8cfacc014dbde432a6e7525243780c01377f0011 100644 --- a/src/005-passages/interactPassages.js +++ b/src/005-passages/interactPassages.js @@ -99,3 +99,12 @@ new App.DomPassage( return App.UI.SlaveInteract.exportSlave(getSlave(V.AS)); }, ["jump-from-safe"] ); + +new App.DomPassage( + "Cheat Edit JS", + () => { + V.nextButton = "Cancel"; + V.nextLink = "Slave Interact"; + return App.UI.SlaveInteract.cheatEditSlave(getSlave(V.AS)); + }, ["jump-from-safe"] +); diff --git a/src/cheats/cheatEditSlave.js b/src/cheats/cheatEditSlave.js new file mode 100644 index 0000000000000000000000000000000000000000..fa3350726f543b3f117e81a28f5589ed5dc3c88d --- /dev/null +++ b/src/cheats/cheatEditSlave.js @@ -0,0 +1,88 @@ +/** @param {App.Entity.SlaveState} slave */ +App.UI.SlaveInteract.cheatEditSlave = function(slave) { + const el = new DocumentFragment(); + const r = []; + const {His} = getPronouns(slave); + const tempSlave = clone(slave); + + /* get all prosthetics that are ready for this slave */ + if (V.adjustProstheticsCompleted > 0) { + V.adjustProsthetics = V.adjustProsthetics.filter(function(p) { + if (p.workLeft <= 0 && p.slaveID === V.AS) { + addProsthetic(tempSlave, p.id); + V.adjustProstheticsCompleted--; + return false; + } + return true; + }); + } + + App.UI.tabBar.handlePreSelectedTab(V.tabChoice.RemoteSurgery); + App.UI.DOM.appendNewElement("h1", el, "The Remote Surgery"); + r.push(`${tempSlave.slaveName} is lying strapped down on the table in your`); + if (V.surgeryUpgrade === 1) { + r.push(`heavily upgraded and customized`); + } + r.push(`remote surgery. The surgical equipment reads`); + if (tempSlave.health.health < -20) { + r.push(App.UI.DOM.makeElement("span", `SLAVE UNHEALTHY, SURGERY NOT RECOMMENDED.`, "red")); + } else if (tempSlave.health.health <= 20) { + r.push(App.UI.DOM.makeElement("span", `SLAVE HEALTHY, SURGERY SAFE.`, "yellow")); + } else { + r.push(App.UI.DOM.makeElement("span", `SLAVE HEALTHY, SURGERY ENCOURAGED.`, "green")); + } + if (V.PC.skill.medicine >= 100) { + r.push(`The remote surgery mechanisms that allow a surgeon to be brought in by telepresence are inactive, and the autosurgery is ready for your control inputs. Surgery on your slaves is a challenge and a pleasure you wouldn't dream of sharing.`); + } + App.Events.addNode(el, r, "div", "scene-intro"); + if (tempSlave.indentureRestrictions >= 1) { + App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["yellow", "note"]); + } + + // TODO: move me + /** + * + * @param {string} id + * @param {Node} element + * @returns {HTMLSpanElement} + */ + function makeSpanIded(id, element) { + const span = document.createElement("span"); + span.id = id; + span.append(element); + return span; + } + + const tabCaptions = { + "hairAndFace": 'Hair and Face', + "upper": 'Upper', + "lower": 'Lower', + "structural": 'Structural', + "exotic": 'Exotic', + "extreme": 'Extreme', + }; + + const tabBar = App.UI.DOM.appendNewElement("div", el, '', "tab-bar"); + tabBar.append( + App.UI.tabBar.tabButton('hair-and-face', tabCaptions.hairAndFace), + App.UI.tabBar.tabButton('upper', tabCaptions.upper), + App.UI.tabBar.tabButton('lower', tabCaptions.lower), + App.UI.tabBar.tabButton('structural', tabCaptions.structural), + App.UI.tabBar.tabButton('exotic', tabCaptions.exotic), + ); + if (V.seeExtreme) { + tabBar.append(App.UI.tabBar.tabButton('extreme', tabCaptions.extreme)); + } + + el.append(App.UI.tabBar.makeTab('hair-and-face', makeSpanIded("content-hair-and-face", App.UI.surgeryPassageHairAndFace(tempSlave, true)))); + el.append(App.UI.tabBar.makeTab('upper', makeSpanIded("content-upperr", App.UI.surgeryPassageUpper(tempSlave, true)))); + el.append(App.UI.tabBar.makeTab('lower', makeSpanIded("content-lower", App.UI.surgeryPassageLower(tempSlave, true)))); + el.append(App.UI.tabBar.makeTab('structural', makeSpanIded("content-structural", App.UI.surgeryPassageStructural(tempSlave, true)))); + el.append(App.UI.tabBar.makeTab('exotic', makeSpanIded("content-exotic", App.UI.surgeryPassageExotic(tempSlave, true)))); + + if (V.seeExtreme) { + el.append(App.UI.tabBar.makeTab('extreme', makeSpanIded("content-extreme", App.UI.surgeryPassageExtreme(tempSlave, true)))); + } + + return el; +}; diff --git a/src/interaction/siNavigation.js b/src/interaction/siNavigation.js index 78190796d7458d67357bb7ebd0f9da227c2155db..68ca74ac55efb290bd894be3421d681fe6e38ae9 100644 --- a/src/interaction/siNavigation.js +++ b/src/interaction/siNavigation.js @@ -12,6 +12,7 @@ App.UI.SlaveInteract.navigation = function(slave) { if (V.cheatMode) { linkArray.push(App.UI.DOM.passageLink("Cheat Edit Slave", "MOD_Edit Slave Cheat", () => { V.cheater = 1; })); linkArray.push(App.UI.DOM.passageLink("Cheat Edit Slave Alternative", "MOD_Edit Slave Cheat New", () => { V.cheater = 1; })); + linkArray.push(App.UI.DOM.passageLink("Cheat Edit Slave JS", "Cheat Edit JS", () => { V.cheater = 1; })); App.UI.DOM.appendNewElement("div", p, App.UI.DOM.generateLinksStrip(linkArray), "note"); }