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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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