mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
format & lint
This commit is contained in:
parent
c9ee938bc6
commit
91a69d7d8f
@ -88,9 +88,7 @@ const Exclusive = (props: IExclusiveProps): React.ReactElement => {
|
|||||||
Certain <b>gangs</b>
|
Certain <b>gangs</b>
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
{Player.canAccessGrafting() &&
|
{Player.canAccessGrafting() && !props.aug.isSpecial && props.aug.name !== AugmentationNames.TheRedPill && (
|
||||||
!props.aug.isSpecial &&
|
|
||||||
props.aug.name !== AugmentationNames.TheRedPill && (
|
|
||||||
<li>
|
<li>
|
||||||
<b>Grafting</b>
|
<b>Grafting</b>
|
||||||
</li>
|
</li>
|
||||||
@ -209,8 +207,7 @@ export function PurchasableAugmentation(props: IPurchasableAugProps): React.Reac
|
|||||||
<>
|
<>
|
||||||
<Typography variant="h5">
|
<Typography variant="h5">
|
||||||
{props.augName}
|
{props.augName}
|
||||||
{props.augName === AugmentationNames.NeuroFluxGovernor &&
|
{props.augName === AugmentationNames.NeuroFluxGovernor && ` - Level ${aug.getLevel()}`}
|
||||||
` - Level ${aug.getLevel()}`}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography>{description}</Typography>
|
<Typography>{description}</Typography>
|
||||||
</>
|
</>
|
||||||
@ -223,9 +220,7 @@ export function PurchasableAugmentation(props: IPurchasableAugProps): React.Reac
|
|||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
color:
|
color:
|
||||||
props.owned || !props.parent.canPurchase(aug)
|
props.owned || !props.parent.canPurchase(aug) ? Settings.theme.disabled : Settings.theme.primary,
|
||||||
? Settings.theme.disabled
|
|
||||||
: Settings.theme.primary,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{aug.name}
|
{aug.name}
|
||||||
@ -233,9 +228,7 @@ export function PurchasableAugmentation(props: IPurchasableAugProps): React.Reac
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
{aug.factions.length === 1 && !props.parent.sleeveAugs && (
|
{aug.factions.length === 1 && !props.parent.sleeveAugs && <Exclusive aug={aug} />}
|
||||||
<Exclusive aug={aug} />
|
|
||||||
)}
|
|
||||||
{aug.prereqs.length > 0 && !props.parent.sleeveAugs && <PreReqs aug={aug} />}
|
{aug.prereqs.length > 0 && !props.parent.sleeveAugs && <PreReqs aug={aug} />}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -36,7 +36,7 @@ type State = {
|
|||||||
wagerInvalidHelperText: string;
|
wagerInvalidHelperText: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Blackjack extends React.Component<{},State> {
|
export class Blackjack extends React.Component<Record<string, never>, State> {
|
||||||
deck: Deck;
|
deck: Deck;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -4,7 +4,6 @@ import { Exploit } from "./Exploit";
|
|||||||
|
|
||||||
const getComputedStyle = window.getComputedStyle;
|
const getComputedStyle = window.getComputedStyle;
|
||||||
export function Unclickable(): React.ReactElement {
|
export function Unclickable(): React.ReactElement {
|
||||||
|
|
||||||
function unclickable(event: React.MouseEvent<HTMLDivElement>): void {
|
function unclickable(event: React.MouseEvent<HTMLDivElement>): void {
|
||||||
if (!event.target || !(event.target instanceof Element)) return;
|
if (!event.target || !(event.target instanceof Element)) return;
|
||||||
const display = getComputedStyle(event.target).display;
|
const display = getComputedStyle(event.target).display;
|
||||||
|
@ -153,10 +153,7 @@ export function getMaxNumberRamUpgrades(nodeObj: HacknetNode | HacknetServer, ma
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores
|
// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores
|
||||||
export function getMaxNumberCoreUpgrades(
|
export function getMaxNumberCoreUpgrades(nodeObj: HacknetNode | HacknetServer, maxLevel: number): number {
|
||||||
nodeObj: HacknetNode | HacknetServer,
|
|
||||||
maxLevel: number,
|
|
||||||
): number {
|
|
||||||
if (maxLevel == null) {
|
if (maxLevel == null) {
|
||||||
throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);
|
throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
function upgradeLevelOnClick(): void {
|
function upgradeLevelOnClick(): void {
|
||||||
const numUpgrades =
|
const numUpgrades =
|
||||||
purchaseMult === "MAX"
|
purchaseMult === "MAX" ? getMaxNumberLevelUpgrades(node, HacknetNodeConstants.MaxLevel) : purchaseMult;
|
||||||
? getMaxNumberLevelUpgrades(node, HacknetNodeConstants.MaxLevel)
|
|
||||||
: purchaseMult;
|
|
||||||
purchaseLevelUpgrade(node, numUpgrades);
|
purchaseLevelUpgrade(node, numUpgrades);
|
||||||
rerender();
|
rerender();
|
||||||
}
|
}
|
||||||
@ -128,9 +126,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
function upgradeCoresOnClick(): void {
|
function upgradeCoresOnClick(): void {
|
||||||
const numUpgrades =
|
const numUpgrades =
|
||||||
purchaseMult === "MAX"
|
purchaseMult === "MAX" ? getMaxNumberCoreUpgrades(node, HacknetNodeConstants.MaxCores) : purchaseMult;
|
||||||
? getMaxNumberCoreUpgrades(node, HacknetNodeConstants.MaxCores)
|
|
||||||
: purchaseMult;
|
|
||||||
purchaseCoreUpgrade(node, numUpgrades);
|
purchaseCoreUpgrade(node, numUpgrades);
|
||||||
rerender();
|
rerender();
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,8 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const base_increase =
|
const base_increase =
|
||||||
calculateHashGainRate(
|
calculateHashGainRate(node.level + multiplier, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money) -
|
||||||
node.level + multiplier,
|
calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||||
0,
|
|
||||||
node.maxRam,
|
|
||||||
node.cores,
|
|
||||||
Player.mults.hacknet_node_money,
|
|
||||||
) - calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
|
||||||
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
||||||
|
|
||||||
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, Player.mults.hacknet_node_level_cost);
|
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, Player.mults.hacknet_node_level_cost);
|
||||||
@ -136,8 +131,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
node.maxRam * Math.pow(2, multiplier),
|
node.maxRam * Math.pow(2, multiplier),
|
||||||
node.cores,
|
node.cores,
|
||||||
Player.mults.hacknet_node_money,
|
Player.mults.hacknet_node_money,
|
||||||
) -
|
) - calculateHashGainRate(node.level, node.ramUsed, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||||
calculateHashGainRate(node.level, node.ramUsed, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
|
||||||
|
|
||||||
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, Player.mults.hacknet_node_ram_cost);
|
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, Player.mults.hacknet_node_ram_cost);
|
||||||
upgradeRamButton = (
|
upgradeRamButton = (
|
||||||
@ -183,13 +177,8 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const base_increase =
|
const base_increase =
|
||||||
calculateHashGainRate(
|
calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, Player.mults.hacknet_node_money) -
|
||||||
node.level,
|
calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||||
0,
|
|
||||||
node.maxRam,
|
|
||||||
node.cores + multiplier,
|
|
||||||
Player.mults.hacknet_node_money,
|
|
||||||
) - calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
|
||||||
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
||||||
|
|
||||||
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, Player.mults.hacknet_node_core_cost);
|
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, Player.mults.hacknet_node_core_cost);
|
||||||
|
@ -13,20 +13,18 @@ import { Money } from "../../ui/React/Money";
|
|||||||
|
|
||||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||||
|
|
||||||
type IProps = {};
|
|
||||||
|
|
||||||
type IState = {
|
type IState = {
|
||||||
currHp: number;
|
currHp: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class HospitalLocation extends React.Component<IProps, IState> {
|
export class HospitalLocation extends React.Component<Record<string, never>, IState> {
|
||||||
/**
|
/**
|
||||||
* Stores button styling that sets them all to block display
|
* Stores button styling that sets them all to block display
|
||||||
*/
|
*/
|
||||||
btnStyle = { display: "block" };
|
btnStyle = { display: "block" };
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor() {
|
||||||
super(props);
|
super({});
|
||||||
|
|
||||||
this.getCost = this.getCost.bind(this);
|
this.getCost = this.getCost.bind(this);
|
||||||
this.getHealed = this.getHealed.bind(this);
|
this.getHealed = this.getHealed.bind(this);
|
||||||
|
@ -5,7 +5,6 @@ import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
|||||||
import { GetServer } from "../../Server/AllServers";
|
import { GetServer } from "../../Server/AllServers";
|
||||||
import { SpecialServers } from "../../Server/data/SpecialServers";
|
import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||||
|
|
||||||
|
|
||||||
import { CONSTANTS } from "../../Constants";
|
import { CONSTANTS } from "../../Constants";
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
|
|
||||||
|
@ -124,9 +124,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
<ListItemButton key={i + 1} onClick={() => setSelectedAug(k)} selected={selectedAug === k}>
|
<ListItemButton key={i + 1} onClick={() => setSelectedAug(k)} selected={selectedAug === k}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
color: canGraft(graftableAugmentations[k])
|
color: canGraft(graftableAugmentations[k]) ? Settings.theme.primary : Settings.theme.disabled,
|
||||||
? Settings.theme.primary
|
|
||||||
: Settings.theme.disabled,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{k}
|
{k}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { IPlayer } from "../../IPlayer";
|
|
||||||
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
|
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
|
||||||
import { applySleeveGains, Work, WorkType } from "./Work";
|
import { applySleeveGains, Work, WorkType } from "./Work";
|
||||||
import { ClassType } from "../../../Work/ClassWork";
|
import { ClassType } from "../../../Work/ClassWork";
|
||||||
@ -25,11 +24,7 @@ export class SleeveClassWork extends Work {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculateRates(sleeve: Sleeve): WorkStats {
|
calculateRates(sleeve: Sleeve): WorkStats {
|
||||||
return scaleWorkStats(
|
return scaleWorkStats(calculateClassEarnings(sleeve, this.classType, this.location), sleeve.shockBonus(), false);
|
||||||
calculateClassEarnings(sleeve, this.classType, this.location),
|
|
||||||
sleeve.shockBonus(),
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isGym(): boolean {
|
isGym(): boolean {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { IPlayer } from "../../IPlayer";
|
|
||||||
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
|
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
|
||||||
import { Sleeve } from "../Sleeve";
|
import { Sleeve } from "../Sleeve";
|
||||||
import { applySleeveGains, Work, WorkType } from "./Work";
|
import { applySleeveGains, Work, WorkType } from "./Work";
|
||||||
|
@ -200,9 +200,7 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
|||||||
<ProgressBar
|
<ProgressBar
|
||||||
variant="determinate"
|
variant="determinate"
|
||||||
value={
|
value={
|
||||||
(props.sleeve.currentWork.cyclesWorked /
|
(props.sleeve.currentWork.cyclesWorked / props.sleeve.currentWork.cyclesNeeded(props.sleeve)) * 100
|
||||||
props.sleeve.currentWork.cyclesNeeded(props.sleeve)) *
|
|
||||||
100
|
|
||||||
}
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
/>
|
/>
|
||||||
|
@ -243,8 +243,7 @@ const canDo: {
|
|||||||
"Commit Crime": () => true,
|
"Commit Crime": () => true,
|
||||||
"Take University Course": (sleeve: Sleeve) =>
|
"Take University Course": (sleeve: Sleeve) =>
|
||||||
[CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
|
[CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
|
||||||
"Workout at Gym": (sleeve: Sleeve) =>
|
"Workout at Gym": (sleeve: Sleeve) => [CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
|
||||||
[CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
|
|
||||||
"Perform Bladeburner Actions": () => Player.inBladeburner(),
|
"Perform Bladeburner Actions": () => Player.inBladeburner(),
|
||||||
"Shock Recovery": (sleeve: Sleeve) => sleeve.shock < 100,
|
"Shock Recovery": (sleeve: Sleeve) => sleeve.shock < 100,
|
||||||
Synchronize: (sleeve: Sleeve) => sleeve.sync < 100,
|
Synchronize: (sleeve: Sleeve) => sleeve.sync < 100,
|
||||||
@ -343,9 +342,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
|||||||
const [s1, setS1] = useState(abc[1]);
|
const [s1, setS1] = useState(abc[1]);
|
||||||
const [s2, setS2] = useState(abc[2]);
|
const [s2, setS2] = useState(abc[2]);
|
||||||
|
|
||||||
const validActions = Object.keys(canDo).filter((k) =>
|
const validActions = Object.keys(canDo).filter((k) => (canDo[k] as (sleeve: Sleeve) => boolean)(props.sleeve));
|
||||||
(canDo[k] as (sleeve: Sleeve) => boolean)(props.sleeve),
|
|
||||||
);
|
|
||||||
|
|
||||||
const detailsF = tasks[s0];
|
const detailsF = tasks[s0];
|
||||||
if (detailsF === undefined) throw new Error(`No function for task '${s0}'`);
|
if (detailsF === undefined) throw new Error(`No function for task '${s0}'`);
|
||||||
|
@ -14,7 +14,6 @@ import { joinFaction } from "./Faction/FactionHelpers";
|
|||||||
import { updateHashManagerCapacity } from "./Hacknet/HacknetHelpers";
|
import { updateHashManagerCapacity } from "./Hacknet/HacknetHelpers";
|
||||||
import { prestigeWorkerScripts } from "./NetscriptWorker";
|
import { prestigeWorkerScripts } from "./NetscriptWorker";
|
||||||
import { Player } from "./Player";
|
import { Player } from "./Player";
|
||||||
import { Router } from "./ui/GameRoot";
|
|
||||||
import { recentScripts } from "./Netscript/RecentScripts";
|
import { recentScripts } from "./Netscript/RecentScripts";
|
||||||
import { resetPidCounter } from "./Netscript/Pid";
|
import { resetPidCounter } from "./Netscript/Pid";
|
||||||
import { LiteratureNames } from "./Literature/data/LiteratureNames";
|
import { LiteratureNames } from "./Literature/data/LiteratureNames";
|
||||||
|
@ -12,11 +12,7 @@ export class Program {
|
|||||||
create: IProgramCreate | null;
|
create: IProgramCreate | null;
|
||||||
run: (args: string[], server: BaseServer) => void;
|
run: (args: string[], server: BaseServer) => void;
|
||||||
|
|
||||||
constructor(
|
constructor(name: string, create: IProgramCreate | null, run: (args: string[], server: BaseServer) => void) {
|
||||||
name: string,
|
|
||||||
create: IProgramCreate | null,
|
|
||||||
run: (args: string[], server: BaseServer) => void,
|
|
||||||
) {
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.create = create;
|
this.create = create;
|
||||||
this.run = run;
|
this.run = run;
|
||||||
|
@ -97,9 +97,7 @@ export function ProgramsRoot(): React.ReactElement {
|
|||||||
sx={{ my: 1, width: "100%" }}
|
sx={{ my: 1, width: "100%" }}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
if (!event.isTrusted) return;
|
if (!event.isTrusted) return;
|
||||||
Player.startWork(
|
Player.startWork(new CreateProgramWork({ singularity: false, programName: program.name }));
|
||||||
new CreateProgramWork({singularity: false, programName: program.name }),
|
|
||||||
);
|
|
||||||
Player.startFocusing();
|
Player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
}}
|
}}
|
||||||
|
@ -463,12 +463,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
//If the current script already exists on the server, overwrite it
|
//If the current script already exists on the server, overwrite it
|
||||||
for (let i = 0; i < server.scripts.length; i++) {
|
for (let i = 0; i < server.scripts.length; i++) {
|
||||||
if (scriptToSave.fileName == server.scripts[i].filename) {
|
if (scriptToSave.fileName == server.scripts[i].filename) {
|
||||||
server.scripts[i].saveScript(
|
server.scripts[i].saveScript(scriptToSave.fileName, scriptToSave.code, Player.currentServer, server.scripts);
|
||||||
scriptToSave.fileName,
|
|
||||||
scriptToSave.code,
|
|
||||||
Player.currentServer,
|
|
||||||
server.scripts,
|
|
||||||
);
|
|
||||||
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||||
Router.toTerminal();
|
Router.toTerminal();
|
||||||
return;
|
return;
|
||||||
|
@ -151,9 +151,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
|||||||
Player.sourceFiles.length > 0;
|
Player.sourceFiles.length > 0;
|
||||||
|
|
||||||
const canOpenAugmentations =
|
const canOpenAugmentations =
|
||||||
Player.augmentations.length > 0 ||
|
Player.augmentations.length > 0 || Player.queuedAugmentations.length > 0 || Player.sourceFiles.length > 0;
|
||||||
Player.queuedAugmentations.length > 0 ||
|
|
||||||
Player.sourceFiles.length > 0;
|
|
||||||
|
|
||||||
const canOpenSleeves = Player.sleeves.length > 0;
|
const canOpenSleeves = Player.sleeves.length > 0;
|
||||||
|
|
||||||
|
@ -784,10 +784,7 @@ export class Terminal implements ITerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const commands: {
|
const commands: {
|
||||||
[key: string]: (
|
[key: string]: (args: (string | number | boolean)[], server: BaseServer) => void;
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
) => void;
|
|
||||||
} = {
|
} = {
|
||||||
"scan-analyze": scananalyze,
|
"scan-analyze": scananalyze,
|
||||||
alias: alias,
|
alias: alias,
|
||||||
|
@ -3,10 +3,7 @@ import { BaseServer } from "../../Server/BaseServer";
|
|||||||
import { isScriptFilename } from "../../Script/isScriptFilename";
|
import { isScriptFilename } from "../../Script/isScriptFilename";
|
||||||
import { getDestinationFilepath, areFilesEqual } from "../DirectoryHelpers";
|
import { getDestinationFilepath, areFilesEqual } from "../DirectoryHelpers";
|
||||||
|
|
||||||
export function cp(
|
export function cp(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
try {
|
try {
|
||||||
if (args.length !== 2) {
|
if (args.length !== 2) {
|
||||||
Terminal.error("Incorrect usage of cp command. Usage: cp [src] [dst]");
|
Terminal.error("Incorrect usage of cp command. Usage: cp [src] [dst]");
|
||||||
|
@ -3,10 +3,7 @@ import { Player } from "../../Player";
|
|||||||
import { BaseServer } from "../../Server/BaseServer";
|
import { BaseServer } from "../../Server/BaseServer";
|
||||||
import { Server } from "../../Server/Server";
|
import { Server } from "../../Server/Server";
|
||||||
|
|
||||||
export function grow(
|
export function grow(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
Terminal.error("Incorrect usage of grow command. Usage: grow");
|
Terminal.error("Incorrect usage of grow command. Usage: grow");
|
||||||
return;
|
return;
|
||||||
|
@ -3,10 +3,7 @@ import { Player } from "../../Player";
|
|||||||
import { BaseServer } from "../../Server/BaseServer";
|
import { BaseServer } from "../../Server/BaseServer";
|
||||||
import { Server } from "../../Server/Server";
|
import { Server } from "../../Server/Server";
|
||||||
|
|
||||||
export function hack(
|
export function hack(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
Terminal.error("Incorrect usage of hack command. Usage: hack");
|
Terminal.error("Incorrect usage of hack command. Usage: hack");
|
||||||
return;
|
return;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
|
|
||||||
export function home(
|
export function home(args: (string | number | boolean)[]): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
): void {
|
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
Terminal.error("Incorrect usage of home command. Usage: home");
|
Terminal.error("Incorrect usage of home command. Usage: home");
|
||||||
return;
|
return;
|
||||||
|
@ -4,10 +4,7 @@ import { isScriptFilename } from "../../Script/isScriptFilename";
|
|||||||
import { runScript } from "./runScript";
|
import { runScript } from "./runScript";
|
||||||
import { runProgram } from "./runProgram";
|
import { runProgram } from "./runProgram";
|
||||||
|
|
||||||
export function run(
|
export function run(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
// Run a program or a script
|
// Run a program or a script
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
Terminal.error("Incorrect number of arguments. Usage: run [program/script] [-t] [num threads] [arg1] [arg2]...");
|
Terminal.error("Incorrect number of arguments. Usage: run [program/script] [-t] [num threads] [arg1] [arg2]...");
|
||||||
|
@ -7,10 +7,7 @@ import { findRunningScript } from "../../Script/ScriptHelpers";
|
|||||||
import * as libarg from "arg";
|
import * as libarg from "arg";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
export function runScript(
|
export function runScript(commandArgs: (string | number | boolean)[], server: BaseServer): void {
|
||||||
commandArgs: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (commandArgs.length < 1) {
|
if (commandArgs.length < 1) {
|
||||||
Terminal.error(
|
Terminal.error(
|
||||||
`Bug encountered with Terminal.runScript(). Command array has a length of less than 1: ${commandArgs}`,
|
`Bug encountered with Terminal.runScript(). Command array has a length of less than 1: ${commandArgs}`,
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { BaseServer } from "../../Server/BaseServer";
|
import { BaseServer } from "../../Server/BaseServer";
|
||||||
|
|
||||||
export function sudov(
|
export function sudov(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
Terminal.error("Incorrect number of arguments. Usage: sudov");
|
Terminal.error("Incorrect number of arguments. Usage: sudov");
|
||||||
return;
|
return;
|
||||||
|
@ -3,10 +3,7 @@ import { BaseServer } from "../../Server/BaseServer";
|
|||||||
import { getRamUsageFromRunningScript } from "../../Script/RunningScriptHelpers";
|
import { getRamUsageFromRunningScript } from "../../Script/RunningScriptHelpers";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
export function top(
|
export function top(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
Terminal.error("Incorrect usage of top command. Usage: top");
|
Terminal.error("Incorrect usage of top command. Usage: top");
|
||||||
return;
|
return;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { removeAlias } from "../../Alias";
|
import { removeAlias } from "../../Alias";
|
||||||
|
|
||||||
export function unalias(
|
export function unalias(args: (string | number | boolean)[]): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
): void {
|
|
||||||
if (args.length !== 1) {
|
if (args.length !== 1) {
|
||||||
Terminal.error("Incorrect usage of unalias name. Usage: unalias [alias]");
|
Terminal.error("Incorrect usage of unalias name. Usage: unalias [alias]");
|
||||||
return;
|
return;
|
||||||
|
@ -4,10 +4,7 @@ import { Terminal } from "../../Terminal";
|
|||||||
import { BaseServer } from "../../Server/BaseServer";
|
import { BaseServer } from "../../Server/BaseServer";
|
||||||
import { isScriptFilename } from "../../Script/isScriptFilename";
|
import { isScriptFilename } from "../../Script/isScriptFilename";
|
||||||
|
|
||||||
export function wget(
|
export function wget(args: (string | number | boolean)[], server: BaseServer): void {
|
||||||
args: (string | number | boolean)[],
|
|
||||||
server: BaseServer,
|
|
||||||
): void {
|
|
||||||
if (args.length !== 2) {
|
if (args.length !== 2) {
|
||||||
Terminal.error("Incorrect usage of wget command. Usage: wget [url] [target file]");
|
Terminal.error("Incorrect usage of wget command. Usage: wget [url] [target file]");
|
||||||
return;
|
return;
|
||||||
|
@ -9,7 +9,6 @@ import TextField from "@mui/material/TextField";
|
|||||||
|
|
||||||
import { KEY, KEYCODE } from "../../utils/helpers/keyCodes";
|
import { KEY, KEYCODE } from "../../utils/helpers/keyCodes";
|
||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { Router } from "../../ui/GameRoot";
|
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { determineAllPossibilitiesForTabCompletion } from "../determineAllPossibilitiesForTabCompletion";
|
import { determineAllPossibilitiesForTabCompletion } from "../determineAllPossibilitiesForTabCompletion";
|
||||||
import { tabCompletion } from "../tabCompletion";
|
import { tabCompletion } from "../tabCompletion";
|
||||||
|
@ -68,12 +68,7 @@ export const scaleWorkStats = (w: WorkStats, n: number, scaleMoney = true): Work
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const applyWorkStats = (
|
export const applyWorkStats = (target: IPerson, workStats: WorkStats, cycles: number, source: string): WorkStats => {
|
||||||
target: IPerson,
|
|
||||||
workStats: WorkStats,
|
|
||||||
cycles: number,
|
|
||||||
source: string,
|
|
||||||
): WorkStats => {
|
|
||||||
const expStats = applyWorkStatsExp(target, workStats, cycles);
|
const expStats = applyWorkStatsExp(target, workStats, cycles);
|
||||||
const gains = {
|
const gains = {
|
||||||
money: workStats.money * cycles,
|
money: workStats.money * cycles,
|
||||||
|
@ -20,11 +20,7 @@ export function calculateCost(classs: Class, location: Location): number {
|
|||||||
return classs.earnings.money * location.costMult * discount;
|
return classs.earnings.money * location.costMult * discount;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateClassEarnings(
|
export function calculateClassEarnings(person: IPerson, type: ClassType, locationName: LocationName): WorkStats {
|
||||||
person: IPerson,
|
|
||||||
type: ClassType,
|
|
||||||
locationName: LocationName,
|
|
||||||
): WorkStats {
|
|
||||||
//Find cost and exp gain per game cycle
|
//Find cost and exp gain per game cycle
|
||||||
const hashManager = Player.hashManager;
|
const hashManager = Player.hashManager;
|
||||||
const classs = Classes[type];
|
const classs = Classes[type];
|
||||||
|
@ -23,8 +23,10 @@ interface IProps {
|
|||||||
export function Money(props: IProps): React.ReactElement {
|
export function Money(props: IProps): React.ReactElement {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
if (props.forPurchase) {
|
if (props.forPurchase) {
|
||||||
if (typeof props.money !== "number") throw new Error("if value is for a purchase, money should be number, contact dev");
|
if (typeof props.money !== "number")
|
||||||
if (!Player.canAfford(props.money)) return <span className={classes.unbuyable}>{numeralWrapper.formatMoney(props.money)}</span>;
|
throw new Error("if value is for a purchase, money should be number, contact dev");
|
||||||
|
if (!Player.canAfford(props.money))
|
||||||
|
return <span className={classes.unbuyable}>{numeralWrapper.formatMoney(props.money)}</span>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<span className={classes.money}>
|
<span className={classes.money}>
|
||||||
|
@ -11,7 +11,7 @@ import { Locations } from "../Locations/Locations";
|
|||||||
import { Settings } from "../Settings/Settings";
|
import { Settings } from "../Settings/Settings";
|
||||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||||
import { Player } from "../Player";
|
import { Player } from "../Player";
|
||||||
import { Router } from "./GameRoot"
|
import { Router } from "./GameRoot";
|
||||||
import { numeralWrapper } from "./numeralFormat";
|
import { numeralWrapper } from "./numeralFormat";
|
||||||
import { Money } from "./React/Money";
|
import { Money } from "./React/Money";
|
||||||
import { MoneyRate } from "./React/MoneyRate";
|
import { MoneyRate } from "./React/MoneyRate";
|
||||||
|
Loading…
Reference in New Issue
Block a user