Hacking factions no longer have hacking level requirements since the servers they need to hack already have requirements, formatting and styling in sleeves.

This commit is contained in:
Olivier Gagnon 2021-03-15 23:40:28 -04:00
parent 4892f0bd79
commit 3ec54bcdd8
4 changed files with 114 additions and 45 deletions

@ -2021,7 +2021,7 @@ export function checkForFactionInvitations() {
if (bitrunnersServer == null) { if (bitrunnersServer == null) {
console.error("Could not find BitRunners Server"); console.error("Could not find BitRunners Server");
} else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked && } 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); invitedFactions.push(bitrunnersFac);
} }
@ -2031,7 +2031,7 @@ export function checkForFactionInvitations() {
if (blackhandServer == null) { if (blackhandServer == null) {
console.error("Could not find The Black Hand Server"); console.error("Could not find The Black Hand Server");
} else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked && } 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); invitedFactions.push(theblackhandFac);
} }
@ -2041,7 +2041,7 @@ export function checkForFactionInvitations() {
if (nitesecServer == null) { if (nitesecServer == null) {
console.error("Could not find NiteSec Server"); console.error("Could not find NiteSec Server");
} else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked && } 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); invitedFactions.push(nitesecFac);
} }
@ -2185,7 +2185,7 @@ export function checkForFactionInvitations() {
if (cybersecServer == null) { if (cybersecServer == null) {
console.error("Could not find CyberSec Server"); console.error("Could not find CyberSec Server");
} else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked && } else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked &&
!cybersecFac.alreadyInvited && this.hacking_skill >= 50) { !cybersecFac.alreadyInvited) {
invitedFactions.push(cybersecFac); invitedFactions.push(cybersecFac);
} }

@ -39,6 +39,10 @@ import { removeChildrenFromElement } from "../../../utils/uiHelpers/removeChildr
import { removeElement } from "../../../utils/uiHelpers/removeElement"; import { removeElement } from "../../../utils/uiHelpers/removeElement";
import { removeElementById } from "../../../utils/uiHelpers/removeElementById"; 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 // Object that keeps track of all DOM elements for the UI for a single Sleeve
interface ISleeveUIElems { interface ISleeveUIElems {
container: HTMLElement | null; container: HTMLElement | null;
@ -94,7 +98,7 @@ export function createSleevesPage(p: IPlayer) {
UIElems.info = createElement("p", { UIElems.info = createElement("p", {
class: "sleeves-page-info", class: "sleeves-page-info",
innerHTML: "Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your " + innerHTML: "<h1>Sleeves</h1>Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your " +
"consciousness has been copied. In other words, these Synthoids contain " + "consciousness has been copied. In other words, these Synthoids contain " +
"a perfect duplicate of your mind.<br><br>" + "a perfect duplicate of your mind.<br><br>" +
"Sleeves can be used to perform different tasks synchronously.<br><br>", "Sleeves can be used to perform different tasks synchronously.<br><br>",
@ -195,7 +199,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
}); });
elems.statsPanel = createElement("div", { class: "sleeve-panel", width: "25%" }); 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", { elems.moreStatsButton = createElement("button", {
class: "std-button", class: "std-button",
innerText: "More Stats", innerText: "More Stats",
@ -323,7 +327,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
elems.taskPanel.appendChild(elems.taskProgressBar); elems.taskPanel.appendChild(elems.taskProgressBar);
elems.earningsPanel = createElement("div", { class: "sleeve-panel", width: "35%" }); elems.earningsPanel = createElement("div", { class: "sleeve-panel", width: "35%" });
elems.currentEarningsInfo = createElement("p"); elems.currentEarningsInfo = createElement("div");
elems.totalEarningsButton = createElement("button", { elems.totalEarningsButton = createElement("button", {
class: "std-button", class: "std-button",
innerText: "More Earnings Info", innerText: "More Earnings Info",
@ -375,53 +379,40 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems) { function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems) {
if (!routing.isOn(Page.Sleeves)) { return; } if (!routing.isOn(Page.Sleeves)) { return; }
elems.stats!.innerHTML = [`Hacking: ${numeralWrapper.format(sleeve.hacking_skill, "0,0")}`, ReactDOM.render(StatsElement(sleeve), elems.stats!);
`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("<br>");
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`
}
if (sleeve.currentTask === SleeveTaskType.Crime) { if (sleeve.currentTask === SleeveTaskType.Crime) {
elems.currentEarningsInfo!.innerHTML = [ const data = [
`Earnings (Pre-Synchronization):`, [`Money`, `${numeralWrapper.formatMoney(parseFloat(sleeve.currentTaskLocation))}`, `(on success)`],
`Money: ${numeralWrapper.formatMoney(parseFloat(sleeve.currentTaskLocation))} if successful`, [`Hacking Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.hack, "0.00")}`, `(2x on success)`],
`Hacking Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.hack, "0.00")} (2x if successful)`, [`Strength Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.str, "0.00")}`, `(2x on success)`],
`Strength Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.str, "0.00")} (2x if successful)`, [`Defense Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.def, "0.00")}`, `(2x on success)`],
`Defense Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.def, "0.00")} (2x if successful)`, [`Dexterity Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.dex, "0.00")}`, `(2x on success)`],
`Dexterity Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.dex, "0.00")} (2x if successful)`, [`Agility Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.agi, "0.00")}`, `(2x on success)`],
`Agility Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.agi, "0.00")} (2x if successful)`, [`Charisma Exp`, `${numeralWrapper.format(sleeve.gainRatesForTask.cha, "0.00")}`, `(2x on success)`]
`Charisma Exp: ${numeralWrapper.format(sleeve.gainRatesForTask.cha, "0.00")} (2x if successful)` ];
].join("<br>"); ReactDOM.render(EarningsTableElement('Earnings (Pre-Synchronization)', data), elems.currentEarningsInfo!)
elems.taskProgressBar!.innerText = createProgressBarText({ elems.taskProgressBar!.innerText = createProgressBarText({
progress: sleeve.currentTaskTime / sleeve.currentTaskMaxTime, progress: sleeve.currentTaskTime / sleeve.currentTaskMaxTime,
totalTicks: 25, totalTicks: 25,
}); });
} else { } else {
const lines = [ const data = [
`Earnings (Pre-Synchronization):`, [`Money:`, `${numeralWrapper.formatMoney(5 * sleeve.gainRatesForTask.money)} / s`],
`Money: ${numeralWrapper.formatMoney(5 * sleeve.gainRatesForTask.money)} / s`, [`Hacking Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.hack, "0.00")} / s`],
`Hacking Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.hack, "0.00")} / s`, [`Strength Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.str, "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`],
`Defense Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.def, "0.00")} / s`, [`Dexterity Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.dex, "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`],
`Agility Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.agi, "0.00")} / s`, [`Charisma Exp:`, `${numeralWrapper.format(5 * sleeve.gainRatesForTask.cha, "0.00")} / s`]
`Charisma Exp: ${numeralWrapper.format(5 * sleeve.gainRatesForTask.cha, "0.00")} / s`
]; ];
if (repGainText !== "") { lines.push(repGainText); } let repGainText: string = "";
elems.currentEarningsInfo!.innerHTML = lines.join("<br>"); 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 = ""; elems.taskProgressBar!.innerText = "";
} }

@ -0,0 +1,20 @@
import * as React from "react";
export function EarningsTableElement(title: string, stats: any[][]): React.ReactElement {
return (<>
{title}
<table>
<tbody>
{stats.map((stat: any[], i: number) => <tr key={i}>
{stat.map((s: any, i: number) => {
let style = {};
if(i !== 0) {
style = {textAlign: "right"};
}
return <td style={style} key={i}>{s}</td>
})}
</tr>)}
</tbody>
</table>
</>)
}

@ -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 (<>
<table>
<tbody>
<tr>
<td className="character-hp-cell">HP: </td>
<td className="character-hp-cell" style={style}>{numeralWrapper.format(sleeve.hp, "0,0")} / {numeralWrapper.format(sleeve.max_hp, "0,0")}</td>
</tr>
<tr>
<td>City: </td>
<td style={style}>{sleeve.city}</td>
</tr>
<tr>
<td className="character-hack-cell">Hacking: </td>
<td className="character-hack-cell" style={style}>{numeralWrapper.format(sleeve.hacking_skill, "0,0")}</td>
</tr>
<tr>
<td className="character-combat-cell">Strength: </td>
<td className="character-combat-cell" style={style}>{numeralWrapper.format(sleeve.strength, "0,0")}</td>
</tr>
<tr>
<td className="character-combat-cell">Defense: </td>
<td className="character-combat-cell" style={style}>{numeralWrapper.format(sleeve.defense, "0,0")}</td>
</tr>
<tr>
<td className="character-combat-cell">Dexterity: </td>
<td className="character-combat-cell" style={style}>{numeralWrapper.format(sleeve.dexterity, "0,0")}</td>
</tr>
<tr>
<td className="character-combat-cell">Agility: </td>
<td className="character-combat-cell" style={style}>{numeralWrapper.format(sleeve.agility, "0,0")}</td>
</tr>
<tr>
<td className="character-cha-cell">Charisma: </td>
<td className="character-cha-cell" style={style}>{numeralWrapper.format(sleeve.charisma, "0,0")}</td>
</tr>
<tr>
<td className="character-int-cell">Shock: </td>
<td className="character-int-cell" style={style}>{numeralWrapper.format(100 - sleeve.shock, "0,0.000")}</td>
</tr>
<tr>
<td className="character-int-cell">Sync: </td>
<td className="character-int-cell" style={style}>{numeralWrapper.format(sleeve.sync, "0,0.000")}</td>
</tr>
<tr>
<td className="character-int-cell">Memory: </td>
<td className="character-int-cell" style={style}>{numeralWrapper.format(sleeve.memory, "0")}</td>
</tr>
</tbody>
</table>
</>)
}