merge dev

This commit is contained in:
Olivier Gagnon
2021-09-04 15:11:17 -04:00
64 changed files with 664 additions and 505 deletions
@@ -125,6 +125,12 @@ export function prestigeAugmentation() {
this.resleeves = [];
let numSleeves = Math.min(3, SourceFileFlags[10] + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant;
if(this.sleeves.length > numSleeves) this.sleeves.length = numSleeves;
for(let i = this.sleeves.length; i < numSleeves; i++) {
this.sleeves.push(new Sleeve(this));
}
for (let i = 0; i < this.sleeves.length; ++i) {
if (this.sleeves[i] instanceof Sleeve) {
if (this.sleeves[i].shock >= 100) {
@@ -178,55 +184,16 @@ export function prestigeAugmentation() {
}
export function prestigeSourceFile() {
var homeComp = this.getHomeComputer();
this.currentServer = homeComp.ip;
this.homeComputer = homeComp.ip;
this.numPeopleKilled = 0;
this.karma = 0;
//Reset stats
this.hacking_skill = 1;
this.strength = 1;
this.defense = 1;
this.dexterity = 1;
this.agility = 1;
this.charisma = 1;
this.hacking_exp = 0;
this.strength_exp = 0;
this.defense_exp = 0;
this.dexterity_exp = 0;
this.agility_exp = 0;
this.charisma_exp = 0;
this.money = new Decimal(1000);
this.city = CityName.Sector12;
this.location = "";
this.companyName = "";
this.jobs = {};
this.purchasedServers = [];
this.factions = [];
this.factionInvitations = [];
this.queuedAugmentations = [];
this.augmentations = [];
this.resleeves = [];
this.prestigeAugmentation();
// Duplicate sleeves are reset to level 1 every Bit Node (but the number of sleeves you have persists)
this.sleeves.length = SourceFileFlags[10] + this.sleevesFromCovenant;
for (let i = 0; i < this.sleeves.length; ++i) {
if (this.sleeves[i] instanceof Sleeve) {
this.sleeves[i].prestige(this);
} else {
this.sleeves[i] = new Sleeve(this);
this.sleeves[i] = new Sleeve(this);
}
if(this.bitNodeN === 10) {
for (let i = 0; i < this.sleeves.length; i++) {
this.sleeves[i].shock = Math.max(25, this.sleeves[i].shock);
this.sleeves[i].sync = Math.max(25, this.sleeves[i].sync);
}
}
@@ -235,38 +202,8 @@ export function prestigeSourceFile() {
characterMenuHeader.click(); characterMenuHeader.click();
}
this.isWorking = false;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = "";
this.className = "";
this.crimeType = "";
this.workHackExpGainRate = 0;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = 0;
this.workMoneyGainRate = 0;
this.workHackExpGained = 0;
this.workStrExpGained = 0;
this.workDefExpGained = 0;
this.workDexExpGained = 0;
this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0;
this.workMoneyGained = 0;
this.timeWorked = 0;
this.lastUpdate = new Date().getTime();
this.hacknetNodes.length = 0;
this.hashManager.prestige();
// Gang
this.gang = null;
resetGangs();
@@ -280,15 +217,10 @@ export function prestigeSourceFile() {
// BitNode 3: Corporatocracy
this.corporation = 0;
// Statistics trackers
this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
this.scriptProdSinceLastAug = 0;
this.moneySourceA.reset();
this.moneySourceB.reset();
this.playtimeSinceLastBitnode = 0;
this.augmentations = [];
this.updateSkillLevels();
this.hp = this.max_hp;
}
export function receiveInvite(factionName) {
@@ -668,7 +600,7 @@ export function work(numCycles) {
You are currently working as a {position} at {this.companyName} (Current Company Reputation: {Reputation(companyRep)})<br /><br />
You have been working for {convertTimeMsToTimeElapsedString(this.timeWorked)}<br /><br />
You have earned: <br /><br />
{Money(this.workMoneyGained)} ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
<Money money={this.workMoneyGained} /> ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
{Reputation(this.workRepGained)} ({ReputationRate(this.workRepGainRate * CYCLES_PER_SEC)}) reputation for this company <br /><br />
{numeralWrapper.formatExp(this.workHackExpGained)} ({`${numeralWrapper.formatExp(this.workHackExpGainRate * CYCLES_PER_SEC)} / sec`}) hacking exp <br /><br />
{numeralWrapper.formatExp(this.workStrExpGained)} ({`${numeralWrapper.formatExp(this.workStrExpGainRate * CYCLES_PER_SEC)} / sec`}) strength exp <br />
@@ -694,7 +626,7 @@ export function finishWork(cancelled, sing=false) {
let content = <>
You earned a total of: <br />
{Money(this.workMoneyGained)}<br />
<Money money={this.workMoneyGained} /><br />
{Reputation(this.workRepGained)} reputation for the company <br />
{numeralWrapper.formatExp(this.workHackExpGained)} hacking exp <br />
{numeralWrapper.formatExp(this.workStrExpGained)} strength exp <br />
@@ -796,7 +728,7 @@ export function workPartTime(numCycles) {
You are currently working as a {position} at {this.companyName} (Current Company Reputation: {Reputation(companyRep)})<br /><br />
You have been working for {convertTimeMsToTimeElapsedString(this.timeWorked)}<br /><br />
You have earned: <br /><br />
{Money(this.workMoneyGained)} ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
<Money money={this.workMoneyGained} /> ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
{Reputation(this.workRepGained)} ({Reputation(`${numeralWrapper.formatExp(this.workRepGainRate * CYCLES_PER_SEC)} / sec`)}) reputation for this company <br /><br />
{numeralWrapper.formatExp(this.workHackExpGained)} ({`${numeralWrapper.formatExp(this.workHackExpGainRate * CYCLES_PER_SEC)} / sec`}) hacking exp <br /><br />
{numeralWrapper.formatExp(this.workStrExpGained)} ({`${numeralWrapper.formatExp(this.workStrExpGainRate * CYCLES_PER_SEC)} / sec`}) strength exp <br />
@@ -817,7 +749,7 @@ export function finishWorkPartTime(sing=false) {
const content = <>
You worked for {convertTimeMsToTimeElapsedString(this.timeWorked)}<br /><br />
You earned a total of: <br />
{Money(this.workMoneyGained)}<br />
<Money money={this.workMoneyGained} /><br />
{Reputation(this.workRepGained)} reputation for the company <br />
{numeralWrapper.formatExp(this.workHackExpGained)} hacking exp <br />
{numeralWrapper.formatExp(this.workStrExpGained)} strength exp <br />
@@ -981,7 +913,7 @@ export function workForFaction(numCycles) {
(Current Faction Reputation: {Reputation(faction.playerReputation)}). <br />
You have been doing this for {convertTimeMsToTimeElapsedString(this.timeWorked)}<br /><br />
You have earned: <br /><br />
{Money(this.workMoneyGained)} ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
<Money money={this.workMoneyGained} /> ({MoneyRate(this.workMoneyGainRate * CYCLES_PER_SEC)}) <br /><br />
{Reputation(this.workRepGained)} ({ReputationRate(this.workRepGainRate * CYCLES_PER_SEC)}) reputation for this faction <br /><br />
{numeralWrapper.formatExp(this.workHackExpGained)} ({numeralWrapper.formatExp(this.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp <br /><br />
{numeralWrapper.formatExp(this.workStrExpGained)} ({numeralWrapper.formatExp(this.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp <br />
@@ -1004,7 +936,7 @@ export function finishFactionWork(cancelled, sing=false) {
dialogBoxCreate(<>
You worked for your faction {faction.name} for a total of {convertTimeMsToTimeElapsedString(this.timeWorked)} <br /><br />
You earned a total of: <br />
{Money(this.workMoneyGained)}<br />
<Money money={this.workMoneyGained} /><br />
{Reputation(this.workRepGained)} reputation for the faction <br />
{numeralWrapper.formatExp(this.workHackExpGained)} hacking exp <br />
{numeralWrapper.formatExp(this.workStrExpGained)} strength exp <br />
@@ -1384,7 +1316,7 @@ export function takeClass(numCycles) {
ReactDOM.render(<>
You have been {className} for {convertTimeMsToTimeElapsedString(this.timeWorked)}<br /><br />
This has cost you: <br />
{Money(-this.workMoneyGained)} ({MoneyRate(this.workMoneyLossRate * CYCLES_PER_SEC)}) <br /><br />
<Money money={-this.workMoneyGained} /> ({MoneyRate(this.workMoneyLossRate * CYCLES_PER_SEC)}) <br /><br />
You have gained: <br />
{numeralWrapper.formatExp(this.workHackExpGained)} ({numeralWrapper.formatExp(this.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp <br />
{numeralWrapper.formatExp(this.workStrExpGained)} ({numeralWrapper.formatExp(this.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp <br />
@@ -1409,7 +1341,7 @@ export function finishClass(sing=false) {
if (!sing) {
dialogBoxCreate(<>
After {this.className} for {convertTimeMsToTimeElapsedString(this.timeWorked)}, <br />
you spent a total of {Money(this.workMoneyGained * -1)}. <br /><br />
you spent a total of <Money money={-this.workMoneyGained} />. <br /><br />
You earned a total of: <br />
{numeralWrapper.formatExp(this.workHackExpGained)} hacking exp <br />
{numeralWrapper.formatExp(this.workStrExpGained)} strength exp <br />
@@ -1543,7 +1475,7 @@ export function finishCrime(cancelled) {
dialogBoxCreate(<>
Crime successful!<br /><br />
You gained:<br />
{Money(this.workMoneyGained)}<br />
<Money money={this.workMoneyGained} /><br />
{numeralWrapper.formatExp(this.workHackExpGained)} hacking experience <br />
{numeralWrapper.formatExp(this.workStrExpGained)} strength experience<br />
{numeralWrapper.formatExp(this.workDefExpGained)} defense experience<br />
@@ -1664,7 +1596,7 @@ export function hospitalize() {
dialogBoxCreate(<>
You were in critical condition! You were taken to the hospital where
luckily they were able to save your life. You were charged&nbsp;
{Money(cost)}
<Money money={cost} />
</>);
}
@@ -254,6 +254,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
costText: null,
buyButton: null,
};
if(playerRef === null) return elems;
if (!routing.isOn(Page.Resleeves)) { return elems; }
@@ -334,7 +335,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
const cost: number = resleeve.getCost();
elems.costPanel = createElement("div", { class: "resleeve-panel", width: "20%" });
elems.costText = createElement("p", {
innerHTML: `It costs ${renderToStaticMarkup(Money(cost))} ` +
innerHTML: `It costs ${renderToStaticMarkup(<Money money={cost} player={playerRef} />)} ` +
`to purchase this Sleeve.`,
});
elems.buyButton = createElement("button", {
@@ -343,7 +344,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
clickListener: () => {
if(playerRef == null) throw new Error("playerRef is null in buyButton.click()");
if (purchaseResleeve(resleeve, playerRef)) {
dialogBoxCreate((<>You re-sleeved for {Money(cost)}!</>), false);
dialogBoxCreate((<>You re-sleeved for <Money money={cost} />!</>), false);
} else {
dialogBoxCreate(`You cannot afford to re-sleeve into this body`, false);
}
@@ -2,6 +2,7 @@
* Module for handling the UI for purchasing Sleeve Augmentations
* This UI is a popup, not a full page
*/
import React from 'react';
import { Sleeve } from "./Sleeve";
import { findSleevePurchasableAugs } from "./SleeveHelpers";
@@ -102,7 +103,7 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
innerHTML:
[
`<h2>${aug.name}</h2><br>`,
`Cost: ${renderToStaticMarkup(Money(aug.startingCost))}<br><br>`,
`Cost: ${renderToStaticMarkup(<Money money={aug.startingCost} player={p} />)}<br><br>`,
`${info}`,
].join(" "),
padding: "2px",
+5 -2
View File
@@ -1,6 +1,7 @@
/**
* Module for handling the Sleeve UI
*/
import React from 'react';
import { createSleevePurchaseAugsPopup } from "./SleeveAugmentationsUI";
import { Sleeve } from "./Sleeve";
import { SleeveTaskType } from "./SleeveTaskTypesEnum";
@@ -202,6 +203,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
currentEarningsInfo: null,
totalEarningsButton: null,
}
if(playerRef === null) return elems;
if (!routing.isOn(Page.Sleeves)) { return elems; }
@@ -223,13 +225,14 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
class: "std-button",
innerText: "Travel",
clickListener: () => {
if(playerRef === null) return;
const popupId = "sleeve-travel-popup";
const popupArguments: HTMLElement[] = [];
popupArguments.push(createPopupCloseButton(popupId, { class: "std-button" }));
popupArguments.push(createElement("p", {
innerHTML: "Have this sleeve travel to a different city. This affects " +
"the gyms and universities at which this sleeve can study. " +
`Traveling to a different city costs ${renderToStaticMarkup(Money(CONSTANTS.TravelCost))}. ` +
`Traveling to a different city costs ${renderToStaticMarkup(<Money money={CONSTANTS.TravelCost} player={playerRef} />)}. ` +
"It will also CANCEL the sleeve's current task (setting it to idle)",
}));
for (const cityName in Cities) {
@@ -346,7 +349,7 @@ function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems): void {
if (sleeve.currentTask === SleeveTaskType.Crime) {
const data = [
[`Money`, Money(parseFloat(sleeve.currentTaskLocation)), `(on success)`],
[`Money`, <Money money={parseFloat(sleeve.currentTaskLocation)} />, `(on success)`],
[`Hacking Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.hack), `(2x on success)`],
[`Strength Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.str), `(2x on success)`],
[`Defense Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.def), `(2x on success)`],
@@ -75,7 +75,7 @@ export function CovenantPurchasesRoot(props: IProps): React.ReactElement {
<PopupCloseButton popup={PopupId} text={"Close"} />
<p>
Would you like to purchase an additional Duplicate Sleeve from The Covenant
for {Money(purchaseCost())}?
for <Money money={purchaseCost()} player={props.p} />?
</p>
<br />
<p>
@@ -79,7 +79,7 @@ export class CovenantSleeveMemoryUpgrade extends React.Component<IProps, IState>
} else if (this.state.amt > maxMemory) {
purchaseBtnContent = <>Memory cannot exceed 100?</>;
} else {
purchaseBtnContent = <>Purchase {this.state.amt} memory - {Money(cost)}?</>;
purchaseBtnContent = <>Purchase {this.state.amt} memory - <Money money={cost} player={this.props.p} />?</>;
}
return (
@@ -7,7 +7,7 @@ import { StatsTable } from "../../../ui/React/StatsTable";
export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
return (<>
{StatsTable([
['Money ', Money(sleeve.earningsForTask.money)],
['Money ', <Money money={sleeve.earningsForTask.money} />],
['Hacking Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.hack)],
['Strength Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.str)],
['Defense Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.def)],
@@ -17,7 +17,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
], 'Earnings for Current Task:')}
<br />
{StatsTable([
['Money: ', Money(sleeve.earningsForPlayer.money)],
['Money: ', <Money money={sleeve.earningsForPlayer.money} />],
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.hack)],
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.str)],
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.def)],
@@ -27,7 +27,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
], 'Total Earnings for Host Consciousness:')}
<br />
{StatsTable([
['Money: ', Money(sleeve.earningsForSleeves.money)],
['Money: ', <Money money={sleeve.earningsForSleeves.money} />],
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.hack)],
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.str)],
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.def)],