From 37b914844ea66781f53abd352a24e83a45baa18d Mon Sep 17 00:00:00 2001 From: ezsh <ezsh.junk@gmail.com> Date: Tue, 19 May 2020 00:42:10 +0200 Subject: [PATCH] Remove duplicated code created by git rebasing. --- src/endWeek/slaveAssignmentReport.js | 275 --------------------------- 1 file changed, 275 deletions(-) diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js index dd5a981c32b..2729de236b4 100644 --- a/src/endWeek/slaveAssignmentReport.js +++ b/src/endWeek/slaveAssignmentReport.js @@ -901,281 +901,6 @@ App.EndWeek.slaveAssignmentReport = function() { } } // for (const slave of V.slaves) - // Stud gets off based on impregnations, so we need to check and see if they actually do anyone - if (V.StudID) { - const stud = S.Stud; - let studCumLimit = V.StudCum; - for (const slave of V.slaves) { - if (studCumLimit === 0 || stud.need <= 0) { - break; - } - if (canGetPregnant(slave) && canBreed(stud, slave) && slave.ID != V.StudID) { - stud.need -= 20; - if (stud.fetish === "pregnancy") { - stud.need -= 30; - } - } - } - } - - if (V.averageDick > 0) { - V.averageDick = V.averageDick / V.slavesWithWorkingDicks; - } - V.freeSexualEnergy = V.PC.sexualEnergy - V.fuckSlaves; - const penthouseSlaves = App.Entity.facilities.penthouse.employees().length; - if (V.freeSexualEnergy > 0) { - if (V.freeSexualEnergy > penthouseSlaves / 2) { - V.freeSexualEnergy = 3; - } else if (V.freeSexualEnergy > penthouseSlaves / 4) { - V.freeSexualEnergy = 2; - } else { - V.freeSexualEnergy = 1; - } - } - - if (S.HeadGirl) { - const HGPossibleSlaves = [[], [], [], [], [], []]; - for (const slave of V.slaves) { - if (!assignmentVisible(slave) || slave.fuckdoll === 1 || slave.ID === V.Bodyguard.ID || slave.ID === V.HeadGirl.ID || slave.fetish == "mindbroken") { - continue; - } else if (Array.isArray(V.personalAttention) && V.personalAttention.some(p => p.ID === slave.ID)) { - continue; - } - - if ((V.headGirlTrainsHealth && slave.health.condition < -20)) { - HGPossibleSlaves[0].push({ID: slave.ID, training: "health"}); - continue; - } - - if (slave.health.tired < 50) { - const hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(slave.sexualFlaw)); - if ((V.headGirlTrainsParaphilias && hasParaphilia)) { - HGPossibleSlaves[1].push({ID: slave.ID, training: "paraphilia"}); - continue; - } - - if (V.headGirlTrainsFlaws || V.headGirlSoftensFlaws) { - if (slave.behavioralFlaw !== "none" || (slave.sexualFlaw !== "none" && !hasParaphilia)) { - if (V.headGirlSoftensFlaws) { - if (slave.devotion > 20) { - if ((slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") || (slave.sexualFlaw !== "none" && slave.sexualQuirk == "none" && !hasParaphilia)) { - HGPossibleSlaves[3].push({ID: slave.ID, training: "soften"}); - } else { - HGPossibleSlaves[3].push({ID: slave.ID, training: "flaw"}); - } - continue; - } - } else if (V.headGirlTrainsFlaws) { - HGPossibleSlaves[2].push({ID: slave.ID, training: "flaw"}); - continue; - } - } - } - - if ((V.headGirlTrainsObedience && slave.devotion <= 20 && slave.trust >= -20)) { - HGPossibleSlaves[4].push({ID: slave.ID, training: "obedience"}); - continue; - } - - if ((V.headGirlTrainsSkills)) { - if ((slave.skill.oral < S.HeadGirl.skill.oral)) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "oral skill"}); - } else if ((slave.skill.vaginal < S.HeadGirl.skill.vaginal) && (slave.vagina > 0) && (canDoVaginal(slave))) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "fuck skill"}); - } else if ((slave.skill.anal < S.HeadGirl.skill.anal) && (slave.anus > 0) && (canDoAnal(slave))) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "anal skill"}); - } else if ((slave.skill.whoring < S.HeadGirl.skill.whoring)) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "whore skill"}); - } else if ((slave.skill.entertainment < S.HeadGirl.skill.entertainment) && !isAmputee(slave)) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "entertain skill"}); - } - } - } - } - V.HGTrainSlavesIDs = HGPossibleSlaves.flatten().slice(0, V.HGEnergy); - } else { - V.HGTrainSlavesIDs = []; - } - - /** - * Accordion - * @version 0.7RC - * @author 000-250-006 - * - * @param array _facListArr V.args - * Multidimensional temporary array - * 0: The passage name for the facility's report - * 1: The facility name capitalized (@see todo) - * 2: max number of slaves allowed in facility - > 0 implies open - * 3: number of slaves assigned to facility - * 4: ID of the slave assigned to run the facility ("Boss") - * 5: Text title of the Boss - * - * @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object - * for deeper use in multiple locations, including streamlining reports/facilities code to one widget - * @todo Figure out if this would be better as an object rather than an array for overhead - * StoryInit also? - * @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals - * @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name - */ - - const facListArr = [ - ["Arcade Report", App.Entity.facilities.arcade], - ["Brothel Report", App.Entity.facilities.brothel], - ["Cellblock Report", App.Entity.facilities.cellblock], - ["Clinic Report", App.Entity.facilities.clinic], - ["Club Report", App.Entity.facilities.club], - ["Dairy Report", App.Entity.facilities.dairy], - ["Farmyard Report", App.Entity.facilities.farmyard], - ["Schoolroom Report", App.Entity.facilities.schoolroom], - ["Spa Report", App.Entity.facilities.spa], - ["Nursery Report", App.Entity.facilities.nursery], - ["Servants' Quarters Report", App.Entity.facilities.servantsQuarters], - ["Children Report", "Nursery Children", V.nursery, V.nurseryBabies], - ["Incubator Report", App.Entity.facilities.incubator], - ["Master Suite Report", App.Entity.facilities.masterSuite], - ["Penthouse Report", "The Penthouse"], - ["Rules Assistant Report", "Rules Assistant", V.rulesAssistantAuto], /** should be last — may reassign slaves **/ - ["Lab Report", "Lab", V.researchLab.level] - ]; - - function _getReportElementStats(ar) { - if (typeof ar[1] == "string") { - if (ar[1] === "The Penthouse") { // special case because we have to combine several facilities - return { - name: ar[1], - established: 1, - entriesNumberInitial: initialPenthouseTotalEmployeesCount, - entriesNumber: _countPenthousePopulation(), - manager: null - }; - } else { - return { - name: ar[1], - established: ar[2], - entriesNumberInitial: null, - entriesNumber: ar[3], - manager: null - }; - } - } else { - return { - name: ar[1].nameCaps, - established: ar[1].established, - entriesNumberInitial: initialEmployeesCount[ar[1].desc.baseName], - entriesNumber: ar[1].hostedSlaves, - manager: ar[1].manager - }; - } - } - - const buttonClasses = V.useAccordion > 0 ? ["buttonBar", "accordion"] : ["buttonBar"]; // Is Accordion turned on? - const disTxt = V.useAccordion > 0 ? "" : " disabled='disabled'"; // Chunk the row from our array we're working on to make reading code easier, null some text vars we'll need - for (const facSubArr of facListArr) { - const reportContent = document.createElement("div"); - App.UI.DOM.includePassage(reportContent, facSubArr[0]); - if (V.useAccordion === 1) { - reportContent.className = "accHidden"; - } - - const stats = _getReportElementStats(facSubArr); // needs to be inside the loop after the report passage to get the employees number after re-assignments - - const str = facSubArr[0].replace(/\W+/g, '-').toLowerCase(); // Normalize the passage name to use as an element ID - if (stats.established) { /** Do we have one of these facilities? */ - if (stats.entriesNumber === 0 && !stats.manager) { // Is there anyone inside the facility? - // No — it's empty, so we display the heading without a button and with a thinner bar under it - App.UI.DOM.appendNewElement("strong", res, `${stats.name} Report`); - App.UI.DOM.appendNewElement("hr", res).style.margin = "0"; - App.UI.DOM.appendNewElement("span", res, `${stats.name} is currently empty`, "gray"); - App.UI.DOM.appendNewElement("br", res); - App.UI.DOM.appendNewElement("br", res); - /** Old code: <<= '<div id="button-' + _str + '" class="unStaffed">' + _facSubArr[1] + ' is currently unstaffed</div>'>> */ - } else { - const btn = App.UI.DOM.appendNewElement("button", res, `${stats.name} Report`, buttonClasses); - btn.type = "button" + disTxt; - btn.id = `button-${str}`; - if (_.isNil(stats.entriesNumber)) { - // Yes, display the bar with information - btn.setAttribute("data-after", ''); - } else { - // Yes, display the bar with information - const diffNum = stats.entriesNumber - stats.entriesNumberInitial; - let diffText = diffNum === 0 ? "" : (diffNum > 0 ? ` (+${diffNum})` : ` (${diffNum})`); - btn.setAttribute("data-after", `${stats.entriesNumber}${diffText} slave${stats.entriesNumber !== 1 ? 's': ''} in ${stats.name}`); - } - } - res.appendChild(reportContent); - } - } - - /* IMPORTANT FOR REASONS!!! */ - // <<unset _ii>> - /** /Accordion */ - - /* release loading screen as soon as the event loop can run */ - //App.UI.EndWeekAnim.end(); - - return res; - - /** - * @param {DocumentFragment} c - */ - function _printDebugInfo(c) { - c.appendChild(document.createElement("br")); - c.appendChild(document.createTextNode("Slave services supply and demand this week:")); - - const table = App.UI.DOM.appendNewElement("table", c, null, "finance"); - table.border = "1"; - const titleRow = App.UI.DOM.appendNewElement("tr", table); - titleRow.align = "center"; - const tcl = App.UI.DOM.appendNewElement("th", titleRow, "Client's class"); - tcl.align = "right"; - App.UI.DOM.appendNewElement("th", titleRow, "Lower"); - App.UI.DOM.appendNewElement("th", titleRow, "Middle"); - App.UI.DOM.appendNewElement("th", titleRow, "Upper"); - App.UI.DOM.appendNewElement("th", titleRow, "Top"); - - /** - * - * @param {string} caption - * @param {number} [lower] - * @param {number} [middle] - * @param {number} [upper] - * @param {number} [top] - */ - function numericRow(caption, lower, middle, upper, top) { - const row = App.UI.DOM.appendNewElement("tr", table); - row.align = "right"; - App.UI.DOM.appendNewElement("td", row, caption); - App.UI.DOM.appendNewElement("td", row, lower == null ? "N/A" : commaNum(lower)); - App.UI.DOM.appendNewElement("td", row, middle == null ? "N/A" : commaNum(middle)); - App.UI.DOM.appendNewElement("td", row, upper == null ? "N/A" : commaNum(upper)); - App.UI.DOM.appendNewElement("td", row, top == null ? "N/A" : commaNum(top)); - } - - numericRow("Demand", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand); - numericRow("Brothel Supply", V.slaveJobValues.brothel.lowerClass, V.slaveJobValues.brothel.middleClass, V.slaveJobValues.brothel.upperClass, V.slaveJobValues.brothel.topClass); - if (clubSupply.lowerClass || clubSupply.middleClass) { - numericRow("Club Supply", clubSupply.lowerClass, clubSupply.middleClass); - } - if (arcadeSupply.lowerClass || arcadeSupply.middleClass || arcadeSupply.upperClass) { - numericRow("Arcade Supply", arcadeSupply.lowerClass, arcadeSupply.middleClass, arcadeSupply.upperClass); - } - numericRow("NPC Supply", V.NPCSexSupply.lowerClass, V.NPCSexSupply.middleClass, V.NPCSexSupply.upperClass, V.NPCSexSupply.topClass); - numericRow("Unsatisfied", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand) - } - - function _countPenthousePopulation() { - const fs = App.Entity.facilities; - return fs.penthouse.employeesIDs().size + fs.headGirlSuite.totalEmployeesCount + fs.armory.totalEmployeesCount - } - - function _printSlaveError(warning, slave) { - const warningLine = App.UI.DOM.appendNewElement("div", res); - App.UI.DOM.appendNewElement("span", warningLine, warning + `for ${slave.slaveName}.`, "yellow"); - warningLine.appendChild(document.createTextNode(" Report this as a bug if it reoccurs.")); - } - /** * * @param {App.Entity.SlaveState} slave -- GitLab