diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.js b/src/PersonObjects/Player/PlayerObjectGeneralMethods.js index 2cf3d7ac1..050de0318 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.js +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.js @@ -2021,7 +2021,7 @@ export function checkForFactionInvitations() { if (bitrunnersServer == null) { console.error("Could not find BitRunners Server"); } else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked && - !bitrunnersFac.alreadyInvited && this.hacking_skill >= 500 && homeComp.maxRam >= 128) { + !bitrunnersFac.alreadyInvited && homeComp.maxRam >= 128) { invitedFactions.push(bitrunnersFac); } @@ -2031,7 +2031,7 @@ export function checkForFactionInvitations() { if (blackhandServer == null) { console.error("Could not find The Black Hand Server"); } else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked && - !theblackhandFac.alreadyInvited && this.hacking_skill >= 350 && homeComp.maxRam >= 64) { + !theblackhandFac.alreadyInvited && homeComp.maxRam >= 64) { invitedFactions.push(theblackhandFac); } @@ -2041,7 +2041,7 @@ export function checkForFactionInvitations() { if (nitesecServer == null) { console.error("Could not find NiteSec Server"); } else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked && - !nitesecFac.alreadyInvited && this.hacking_skill >= 200 && homeComp.maxRam >= 32) { + !nitesecFac.alreadyInvited && homeComp.maxRam >= 32) { invitedFactions.push(nitesecFac); } @@ -2185,7 +2185,7 @@ export function checkForFactionInvitations() { if (cybersecServer == null) { console.error("Could not find CyberSec Server"); } else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked && - !cybersecFac.alreadyInvited && this.hacking_skill >= 50) { + !cybersecFac.alreadyInvited) { invitedFactions.push(cybersecFac); } diff --git a/src/PersonObjects/Sleeve/SleeveUI.ts b/src/PersonObjects/Sleeve/SleeveUI.ts index de15d2f60..dc5683296 100644 --- a/src/PersonObjects/Sleeve/SleeveUI.ts +++ b/src/PersonObjects/Sleeve/SleeveUI.ts @@ -39,6 +39,10 @@ import { removeChildrenFromElement } from "../../../utils/uiHelpers/removeChildr import { removeElement } from "../../../utils/uiHelpers/removeElement"; import { removeElementById } from "../../../utils/uiHelpers/removeElementById"; +import { EarningsTableElement } from "./ui/EarningsTableElement"; +import { StatsElement } from "./ui/StatsElement"; +import * as ReactDOM from "react-dom"; + // Object that keeps track of all DOM elements for the UI for a single Sleeve interface ISleeveUIElems { container: HTMLElement | null; @@ -94,7 +98,7 @@ export function createSleevesPage(p: IPlayer) { UIElems.info = createElement("p", { class: "sleeves-page-info", - innerHTML: "Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your " + + innerHTML: "

Sleeves

Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your " + "consciousness has been copied. In other words, these Synthoids contain " + "a perfect duplicate of your mind.

" + "Sleeves can be used to perform different tasks synchronously.

", @@ -195,7 +199,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems { }); elems.statsPanel = createElement("div", { class: "sleeve-panel", width: "25%" }); - elems.stats = createElement("p", { class: "sleeve-stats-text" }); + elems.stats = createElement("div", { class: "sleeve-stats-text" }); elems.moreStatsButton = createElement("button", { class: "std-button", innerText: "More Stats", @@ -323,7 +327,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems { elems.taskPanel.appendChild(elems.taskProgressBar); elems.earningsPanel = createElement("div", { class: "sleeve-panel", width: "35%" }); - elems.currentEarningsInfo = createElement("p"); + elems.currentEarningsInfo = createElement("div"); elems.totalEarningsButton = createElement("button", { class: "std-button", innerText: "More Earnings Info", @@ -375,53 +379,40 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems { function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems) { if (!routing.isOn(Page.Sleeves)) { return; } - elems.stats!.innerHTML = [`Hacking: ${numeralWrapper.format(sleeve.hacking_skill, "0,0")}`, - `Strength: ${numeralWrapper.format(sleeve.strength, "0,0")}`, - `Defense: ${numeralWrapper.format(sleeve.defense, "0,0")}`, - `Dexterity: ${numeralWrapper.format(sleeve.dexterity, "0,0")}`, - `Agility: ${numeralWrapper.format(sleeve.agility, "0,0")}`, - `Charisma: ${numeralWrapper.format(sleeve.charisma, "0,0")}`, - `HP: ${numeralWrapper.format(sleeve.hp, "0,0")} / ${numeralWrapper.format(sleeve.max_hp, "0,0")}`, - `City: ${sleeve.city}`, - `Shock: ${numeralWrapper.format(100 - sleeve.shock, "0,0.000")}`, - `Sync: ${numeralWrapper.format(sleeve.sync, "0,0.000")}`, - `Memory: ${numeralWrapper.format(sleeve.memory, "0")}`].join("
"); - - let repGainText: string = ""; - if (sleeve.currentTask === SleeveTaskType.Company || sleeve.currentTask === SleeveTaskType.Faction) { - const repGain: number = sleeve.getRepGain(playerRef!); - repGainText = `Reputation: ${numeralWrapper.format(5 * repGain, "0.00")} / s` - } + ReactDOM.render(StatsElement(sleeve), elems.stats!); if (sleeve.currentTask === SleeveTaskType.Crime) { - elems.currentEarningsInfo!.innerHTML = [ - `Earnings (Pre-Synchronization):`, - `Money: ${numeralWrapper.formatMoney(parseFloat(sleeve.currentTaskLocation))} if successful`, - `Hacking Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.hack, "0.00")} (2x if successful)`, - `Strength Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.str, "0.00")} (2x if successful)`, - `Defense Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.def, "0.00")} (2x if successful)`, - `Dexterity Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.dex, "0.00")} (2x if successful)`, - `Agility Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.agi, "0.00")} (2x if successful)`, - `Charisma Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.cha, "0.00")} (2x if successful)` - ].join("
"); + const data = [ + [`Money`, `${numeralWrapper.formatMoney(parseFloat(sleeve.currentTaskLocation))}`, `(on success)`], + [`Hacking Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.hack, "0.00")}`, `(2x on success)`], + [`Strength Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.str, "0.00")}`, `(2x on success)`], + [`Defense Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.def, "0.00")}`, `(2x on success)`], + [`Dexterity Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.dex, "0.00")}`, `(2x on success)`], + [`Agility Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.agi, "0.00")}`, `(2x on success)`], + [`Charisma Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.cha, "0.00")}`, `(2x on success)`] + ]; + ReactDOM.render(EarningsTableElement('Earnings (Pre-Synchronization)', data), elems.currentEarningsInfo!) elems.taskProgressBar!.innerText = createProgressBarText({ progress: sleeve.currentTaskTime / sleeve.currentTaskMaxTime, totalTicks: 25, }); } else { - const lines = [ - `Earnings (Pre-Synchronization):`, - `Money: ${numeralWrapper.formatMoney(5 * sleeve.gainRatesForTask.money)} / s`, - `Hacking Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.hack, "0.00")} / s`, - `Strength Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.str, "0.00")} / s`, - `Defense Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.def, "0.00")} / s`, - `Dexterity Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.dex, "0.00")} / s`, - `Agility Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.agi, "0.00")} / s`, - `Charisma Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.cha, "0.00")} / s` + const data = [ + [`Money:`, `${numeralWrapper.formatMoney(5 * sleeve.gainRatesForTask.money)} / s`], + [`Hacking Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.hack, "0.00")} / s`], + [`Strength Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.str, "0.00")} / s`], + [`Defense Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.def, "0.00")} / s`], + [`Dexterity Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.dex, "0.00")} / s`], + [`Agility Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.agi, "0.00")} / s`], + [`Charisma Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.cha, "0.00")} / s`] ]; - if (repGainText !== "") { lines.push(repGainText); } - elems.currentEarningsInfo!.innerHTML = lines.join("
"); + let repGainText: string = ""; + if (sleeve.currentTask === SleeveTaskType.Company || sleeve.currentTask === SleeveTaskType.Faction) { + const repGain: number = sleeve.getRepGain(playerRef!); + data.push([`Reputation:`, `${numeralWrapper.format(5 * repGain, "0.00")} / s`]); + } + ReactDOM.render(EarningsTableElement('Earnings (Pre-Synchronization)', data), elems.currentEarningsInfo!) elems.taskProgressBar!.innerText = ""; } diff --git a/src/PersonObjects/Sleeve/ui/EarningsTableElement.tsx b/src/PersonObjects/Sleeve/ui/EarningsTableElement.tsx new file mode 100644 index 000000000..08aa317cd --- /dev/null +++ b/src/PersonObjects/Sleeve/ui/EarningsTableElement.tsx @@ -0,0 +1,20 @@ +import * as React from "react"; + +export function EarningsTableElement(title: string, stats: any[][]): React.ReactElement { + return (<> + {title} + + + {stats.map((stat: any[], i: number) => + {stat.map((s: any, i: number) => { + let style = {}; + if(i !== 0) { + style = {textAlign: "right"}; + } + return + })} + )} + +
{s}
+ ) +} diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx new file mode 100644 index 000000000..19bbcbf4e --- /dev/null +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -0,0 +1,58 @@ +import { Sleeve } from "../Sleeve"; +import { numeralWrapper } from "../../../ui/numeralFormat"; +import * as React from "react"; + +export function StatsElement(sleeve: Sleeve): React.ReactElement { + let style = {}; + style = { textAlign: "right" }; + return (<> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HP: {numeralWrapper.format(sleeve.hp, "0,0")} / {numeralWrapper.format(sleeve.max_hp, "0,0")}
City: {sleeve.city}
Hacking: {numeralWrapper.format(sleeve.hacking_skill, "0,0")}
Strength: {numeralWrapper.format(sleeve.strength, "0,0")}
Defense: {numeralWrapper.format(sleeve.defense, "0,0")}
Dexterity: {numeralWrapper.format(sleeve.dexterity, "0,0")}
Agility: {numeralWrapper.format(sleeve.agility, "0,0")}
Charisma: {numeralWrapper.format(sleeve.charisma, "0,0")}
Shock: {numeralWrapper.format(100 - sleeve.shock, "0,0.000")}
Sync: {numeralWrapper.format(sleeve.sync, "0,0.000")}
Memory: {numeralWrapper.format(sleeve.memory, "0")}
+ ) +}