Merge pull request #1411 from danielyxie/dev

some bug fix
This commit is contained in:
hydroflame 2021-10-03 21:37:25 -04:00 committed by GitHub
commit 80ec07afee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 85 additions and 15 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 ( return (
<Paper> <Paper>
<Box display="flex" alignItems="center"> <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"}> <Typography color={props.warehouse.sizeUsed >= props.warehouse.size ? "error" : "primary"}>
Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "} Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "}
{numeralWrapper.formatBigNumber(props.warehouse.size)} {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`); if (hserver instanceof Server) throw new Error(`player nodes shoud not be Server`);
hserver.updateHashRate(player.hacknet_node_money_mult); hserver.updateHashRate(player.hacknet_node_money_mult);
const h = hserver.process(numCycles); const h = hserver.process(numCycles);
hserver.totalHashesGenerated += h;
hashes += 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 this Hacknet Server in the game loop. Returns the number of hashes generated
process(numCycles = 1): number { process(numCycles = 1): number {
const seconds = (numCycles * CONSTANTS.MilliPerCycle) / 1000; 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 { upgradeCache(levels: number): void {

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

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

@ -440,4 +440,9 @@ export const LocationsMetadata: IConstructorParams[] = [
name: LocationName.WorldStockExchange, name: LocationName.WorldStockExchange,
types: [LocationType.StockMarket], 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>; 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) { switch (props.loc.name) {
case LocationName.NewTokyoVitaLife: { case LocationName.NewTokyoVitaLife: {
return renderResleeving(); return renderResleeving();
@ -122,6 +167,9 @@ export function SpecialLocation(props: IProps): React.ReactElement {
case LocationName.NewTokyoNoodleBar: { case LocationName.NewTokyoNoodleBar: {
return renderNoodleBar(); return renderNoodleBar();
} }
case LocationName.ChongqingChurchOfTheMachineGod: {
return renderCotMG();
}
default: default:
console.error(`Location ${props.loc.name} doesn't have any special properties`); console.error(`Location ${props.loc.name} doesn't have any special properties`);
return <></>; return <></>;

@ -409,7 +409,6 @@ export class Sleeve extends Person {
return jobPerformance * this.company_rep_mult * favorMult; return jobPerformance * this.company_rep_mult * favorMult;
} else { } else {
console.warn(`Sleeve.getRepGain() called for invalid task type: ${this.currentTask}`);
return 0; return 0;
} }
} }

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

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

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