build dev

This commit is contained in:
Olivier Gagnon 2021-09-18 12:13:20 -04:00
parent e1a22016b5
commit e087420519
12 changed files with 1509 additions and 1431 deletions

985
dist/engine.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1780
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -587,13 +587,15 @@ export function work(numCycles) {
this.workRepGainRate = this.getWorkRepGain();
this.processWorkEarnings(numCycles);
const comp = Companies[this.companyName];
influenceStockThroughCompanyWork(comp, this.workRepGainRate, numCycles);
// If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (overMax || this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) {
return this.finishWork(false);
return true;
}
const comp = Companies[this.companyName];
influenceStockThroughCompanyWork(comp, this.workRepGainRate, numCycles);
return false;
}
export function finishWork(cancelled, sing = false) {
@ -711,7 +713,9 @@ export function workPartTime(numCycles) {
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (overMax || this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) {
return this.finishWorkPartTime();
return true;
}
return false;
}
export function finishWorkPartTime(sing = false) {
@ -877,8 +881,10 @@ export function workForFaction(numCycles) {
//If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours
if (overMax || this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) {
return this.finishFactionWork(false);
this.finishFactionWork(false);
return true;
}
return false;
}
export function finishFactionWork(cancelled, sing = false) {
@ -1211,7 +1217,9 @@ export function createProgramWork(numCycles) {
if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) {
this.finishCreateProgramWork(false);
return true;
}
return false;
}
export function finishCreateProgramWork(cancelled) {
@ -1314,6 +1322,7 @@ export function startClass(costMult, expMult, className) {
export function takeClass(numCycles) {
this.timeWorked += CONSTANTS._idleSpeed * numCycles;
this.processWorkEarnings(numCycles);
return false;
}
//The 'sing' argument defines whether or not this function was called
@ -1403,7 +1412,11 @@ export function startCrime(crimeType, hackExp, strExp, defExp, dexExp, agiExp, c
export function commitCrime(numCycles) {
this.timeWorked += CONSTANTS._idleSpeed * numCycles;
if (this.timeWorked >= this.timeNeededToCompleteWork) this.finishCrime(false);
if (this.timeWorked >= this.timeNeededToCompleteWork) {
this.finishCrime(false);
return true;
}
return false;
}
export function finishCrime(cancelled) {

@ -176,7 +176,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
}
function clickStats(): void {
props.router.toCharacterInfo();
props.router.toStats();
if (flashStats) iTutorialNextStep();
}

@ -34,6 +34,8 @@ import { initSpecialServerIps } from "./Server/SpecialServerIps";
import { initSymbolToStockMap, processStockPrices } from "./StockMarket/StockMarket";
import { Terminal } from "./Terminal";
import { Sleeve } from "./PersonObjects/Sleeve/Sleeve";
import { Locations } from "./Locations/Locations";
import { LocationName } from "./Locations/data/LocationNames";
import { Money } from "./ui/React/Money";
import { Hashes } from "./ui/React/Hashes";
@ -80,17 +82,29 @@ const Engine = {
// Working
if (Player.isWorking) {
if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCycles);
if (Player.workForFaction(numCycles)) {
Router.toFaction();
}
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
Player.createProgramWork(numCycles);
if (Player.createProgramWork(numCycles)) {
Router.toTerminal();
}
} else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
Player.takeClass(numCycles);
if (Player.takeClass(numCycles)) {
Router.toCity();
}
} else if (Player.workType == CONSTANTS.WorkTypeCrime) {
Player.commitCrime(numCycles);
if (Player.commitCrime(numCycles)) {
Router.toLocation(Locations[LocationName.Slums]);
}
} else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {
Player.workPartTime(numCycles);
if (Player.workPartTime(numCycles)) {
Router.toCity();
}
} else {
Player.work(numCycles);
if (Player.work(numCycles)) {
Router.toCity();
}
}
}
@ -278,7 +292,6 @@ const Engine = {
} else {
Player.work(numCyclesOffline);
}
Player.focus = false;
} else {
for (let i = 0; i < Player.factions.length; i++) {
const facName = Player.factions[i];

@ -14,6 +14,8 @@ import { StatsTable } from "./React/StatsTable";
import { Money } from "./React/Money";
import { use } from "./Context";
import Typography from "@mui/material/Typography";
function LastEmployer(): React.ReactElement {
const player = use.Player();
if (player.companyName) {
@ -162,7 +164,7 @@ function CurrentBitNode(): React.ReactElement {
return <></>;
}
export function CharacterInfo(): React.ReactElement {
export function CharacterStats(): React.ReactElement {
const player = use.Player();
const setRerender = useState(false)[1];
function rerender(): void {

@ -53,7 +53,7 @@ import { TutorialRoot } from "../Tutorial/ui/TutorialRoot";
import { ActiveScriptsRoot } from "../ui/ActiveScripts/ActiveScriptsRoot";
import { FactionsRoot } from "../Faction/ui/FactionsRoot";
import { FactionRoot } from "../Faction/ui/FactionRoot";
import { CharacterInfo } from "./CharacterInfo";
import { CharacterStats } from "./CharacterStats";
import { TravelAgencyRoot } from "../Locations/ui/TravelAgencyRoot";
import { StockMarketRoot } from "../StockMarket/ui/StockMarketRoot";
import { BitverseRoot } from "../BitNode/ui/BitverseRoot";
@ -100,7 +100,7 @@ export let Router: IRouter = {
toBladeburner: () => {
throw new Error("Router called before initialization");
},
toCharacterInfo: () => {
toStats: () => {
throw new Error("Router called before initialization");
},
toCity: () => {
@ -179,7 +179,6 @@ function determineStartPage(player: IPlayer): Page {
export function GameRoot({ player, engine, terminal }: IProps): React.ReactElement {
const classes = useStyles();
const [page, setPage] = useState(determineStartPage(player));
const contentRef = useRef<HTMLDivElement>(null);
const [faction, setFaction] = useState<Faction>(
player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction),
);
@ -199,7 +198,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
toActiveScripts: () => setPage(Page.ActiveScripts),
toAugmentations: () => setPage(Page.Augmentations),
toBladeburner: () => setPage(Page.Bladeburner),
toCharacterInfo: () => setPage(Page.Stats),
toStats: () => setPage(Page.Stats),
toCorporation: () => setPage(Page.Corporation),
toCreateProgram: () => setPage(Page.CreateProgram),
toDevMenu: () => setPage(Page.DevMenu),
@ -256,6 +255,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
useEffect(() => {
filename = "";
code = "";
window.scrollTo(0, 0);
});
return (
@ -273,21 +273,13 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
) : (
<Box display="flex" flexDirection="row" width="100%">
<SidebarRoot player={player} router={Router} page={page} />
<Box
ref={contentRef}
className={classes.root}
flexGrow={1}
display="block"
width="100%"
px={1}
height="100vh"
>
<Box className={classes.root} flexGrow={1} display="block" width="100%" px={1} height="100vh">
{page === Page.Terminal ? (
<TerminalRoot terminal={terminal} router={Router} player={player} />
) : page === Page.Sleeves ? (
<SleeveRoot player={player} />
) : page === Page.Stats ? (
<CharacterInfo />
<CharacterStats />
) : page === Page.CreateScript ? (
<ScriptEditorRoot filename={filename} code={code} player={player} router={Router} />
) : page === Page.ActiveScripts ? (

@ -13,9 +13,11 @@ import Paper from "@mui/material/Paper";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import IconButton from "@mui/material/IconButton";
import Collapse from "@mui/material/Collapse";
import Fab from "@mui/material/Fab";
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
import SaveAltIcon from "@mui/icons-material/SaveAlt";
import { colors } from "./Theme";
import { Settings } from "../../Settings/Settings";
@ -222,9 +224,9 @@ export function CharacterOverview({ save }: IProps): React.ReactElement {
<TableRow>
<TableCell align="center" colSpan={2} classes={{ root: classes.cellNone }}>
<Button color={Settings.AutosaveInterval !== 0 ? "primary" : "secondary"} onClick={save}>
SAVE
</Button>
<IconButton onClick={save}>
<SaveAltIcon color={Settings.AutosaveInterval !== 0 ? "primary" : "error"} />
</IconButton>
</TableCell>
</TableRow>
</TableBody>

@ -13,12 +13,16 @@ import Switch from "@mui/material/Switch";
import Select, { SelectChangeEvent } from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import Button from "@mui/material/Button";
import IconButton from "@mui/material/IconButton";
import Box from "@mui/material/Box";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import Link from "@mui/material/Link";
import Tooltip from "@mui/material/Tooltip";
import DownloadIcon from "@mui/icons-material/Download";
import UploadIcon from "@mui/icons-material/Upload";
import { FileDiagnosticModal } from "../../Diagnostic/FileDiagnosticModal";
import { ConfirmationModal } from "./ConfirmationModal";
@ -461,8 +465,16 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
<Button onClick={() => setDeleteOpen(true)}>Delete Game</Button>
</Box>
<Box>
<Button onClick={() => props.export()}>Export Game</Button>
<Button onClick={() => props.import()}>Import Game</Button>
<Tooltip title={<Typography>export</Typography>}>
<IconButton onClick={() => props.export()}>
<DownloadIcon color="primary" />
</IconButton>
</Tooltip>
<Tooltip title={<Typography>import</Typography>}>
<IconButton onClick={() => props.import()}>
<UploadIcon color="primary" />
</IconButton>
</Tooltip>
</Box>
<Box>
<Tooltip

@ -50,7 +50,7 @@ export interface IRouter {
toAugmentations(): void;
toBitVerse(flume: boolean, quick: boolean): void;
toBladeburner(): void;
toCharacterInfo(): void;
toStats(): void;
toCity(): void; // travel ? city ?
toCorporation(): void;
toCreateProgram(): void;

@ -337,13 +337,18 @@ export function WorkInProgressRoot(): React.ReactElement {
% complete. <br />
If you cancel, your work will be saved and you can come back to complete the program later.
</p>
<button className="work-button" onClick={() => player.finishCreateProgramWork(true)}>
<button
className="work-button"
onClick={() => {
player.finishCreateProgramWork(true);
router.toTerminal();
}}
>
Cancel work on creating program
</button>
</div>
);
}
setTimeout(() => router.toCity(), 50);
return <></>;
}