fix some bugs

This commit is contained in:
Olivier Gagnon 2021-10-03 21:33:48 -04:00
parent 1a749505e7
commit ab2ffb112f
13 changed files with 85 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -122,11 +122,22 @@ function WarehouseRoot(props: IProps): React.ReactElement {
</>
);
}
console.log(division.products);
for (const prodName in division.products) {
const prod = division.products[prodName];
if (prod === undefined) continue;
breakdown = (
<>
{breakdown}
{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}
</>
);
}
return (
<Paper>
<Box display="flex" alignItems="center">
<Tooltip title={props.warehouse.sizeUsed !== 0 ? breakdown : ""}>
<Tooltip title={props.warehouse.sizeUsed !== 0 ? <Typography>{breakdown}</Typography> : ""}>
<Typography color={props.warehouse.sizeUsed >= props.warehouse.size ? "error" : "primary"}>
Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "}
{numeralWrapper.formatBigNumber(props.warehouse.size)}

@ -420,7 +420,6 @@ function processAllHacknetServerEarnings(player: IPlayer, numCycles: number): nu
if (hserver instanceof Server) throw new Error(`player nodes shoud not be Server`);
hserver.updateHashRate(player.hacknet_node_money_mult);
const h = hserver.process(numCycles);
hserver.totalHashesGenerated += h;
hashes += h;
}

@ -77,8 +77,12 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
// Process this Hacknet Server in the game loop. Returns the number of hashes generated
process(numCycles = 1): number {
const seconds = (numCycles * CONSTANTS.MilliPerCycle) / 1000;
this.onlineTimeSeconds += seconds;
return this.hashRate * seconds;
const hashes = this.hashRate * seconds;
this.totalHashesGenerated += hashes;
return hashes;
}
upgradeCache(levels: number): void {

@ -84,8 +84,8 @@ Cities[CityName.Chongqing].asciiArt = `
[world stock exchange] F |
\\ o 78 [kuaigong international]
\\ /
38 o----x--x------x------A---------
/ 39 | 41
38 o----x--x------x------A------G--
/ 39 | 41 [church]
37 o + 79 o--x--x-C-0
/ | /
/ x-----+-----x-----0 [hospital]

@ -29,6 +29,7 @@ export enum LocationName {
// Chongqing locations
ChongqingKuaiGongInternational = "KuaiGong International",
ChongqingSolarisSpaceSystems = "Solaris Space Systems",
ChongqingChurchOfTheMachineGod = "Church of the Machine God",
// Sector 12
Sector12AlphaEnterprises = "Alpha Enterprises",

@ -440,4 +440,9 @@ export const LocationsMetadata: IConstructorParams[] = [
name: LocationName.WorldStockExchange,
types: [LocationType.StockMarket],
},
{
city: CityName.Chongqing,
name: LocationName.ChongqingChurchOfTheMachineGod,
types: [LocationType.Special],
},
];

@ -109,6 +109,51 @@ export function SpecialLocation(props: IProps): React.ReactElement {
return <Button onClick={handleResleeving}>Re-Sleeve</Button>;
}
function renderCotMG(): React.ReactElement {
// prettier-ignore
const symbol = <Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>
{" `` "}<br />
{" -odmmNmds: "}<br />
{" `hNmo:..-omNh. "}<br />
{" yMd` `hNh "}<br />
{" mMd oNm "}<br />
{" oMNo .mM/ "}<br />
{" `dMN+ -mM+ "}<br />
{" -mMNo -mN+ "}<br />
{" .+- :mMNo/mN/ "}<br />
{":yNMd. :NMNNN/ "}<br />
{"-mMMMh. /NMMh` "}<br />
{" .dMMMd. /NMMMy` "}<br />
{" `yMMMd. /NNyNMMh` "}<br />
{" `sMMMd. +Nm: +NMMh. "}<br />
{" oMMMm- oNm: /NMMd. "}<br />
{" +NMMmsMm- :mMMd. "}<br />
{" /NMMMm- -mMMd. "}<br />
{" /MMMm- -mMMd. "}<br />
{" `sMNMMm- .mMmo "}<br />
{" `sMd:hMMm. ./. "}<br />
{" `yMy` `yNMd` "}<br />
{" `hMs` oMMy "}<br />
{" `hMh sMN- "}<br />
{" /MM- .NMo "}<br />
{" +MM: :MM+ "}<br />
{" sNNo-.`.-omNy` "}<br />
{" -smNNNNmdo- "}<br />
{" `..` "}</Typography>
return (
<>
<Typography>
A decrepit altar stands in the middle of a dilapidated church.
<br />
<br />A symbol is carved in the altar.
</Typography>
<br />
{symbol}
</>
);
}
switch (props.loc.name) {
case LocationName.NewTokyoVitaLife: {
return renderResleeving();
@ -122,6 +167,9 @@ export function SpecialLocation(props: IProps): React.ReactElement {
case LocationName.NewTokyoNoodleBar: {
return renderNoodleBar();
}
case LocationName.ChongqingChurchOfTheMachineGod: {
return renderCotMG();
}
default:
console.error(`Location ${props.loc.name} doesn't have any special properties`);
return <></>;

@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
import { EventEmitter } from "../../utils/EventEmitter";
import { Modal } from "../../ui/React/Modal";
import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
export const AlertEvents = new EventEmitter<[string | JSX.Element]>();
@ -41,7 +42,9 @@ export function AlertManager(): React.ReactElement {
<>
{alerts.length > 0 && (
<Modal open={true} onClose={close}>
<Box>
<Typography>{alerts[0].text}</Typography>
</Box>
</Modal>
)}
</>

@ -6,6 +6,6 @@ export function dialogBoxCreate(txt: string | JSX.Element): void {
if (typeof txt !== "string") {
AlertEvents.emit(txt);
} else {
AlertEvents.emit(<pre dangerouslySetInnerHTML={{ __html: txt }} />);
AlertEvents.emit(<span dangerouslySetInnerHTML={{ __html: txt }} />);
}
}

@ -147,10 +147,10 @@ function LogWindow(props: IProps): React.ReactElement {
</Box>
</Paper>
<Paper>
<Box maxHeight="25vh" overflow="scroll">
<Box maxHeight="25vh" overflow="scroll" sx={{ overflowWrap: "break-word" }}>
{props.script.logs.map(
(line: string, i: number): JSX.Element => (
<Typography key={i} style={{ whiteSpace: "pre-line" }}>
<Typography key={i}>
{line}
<br />
</Typography>