mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 23:22:29 +01:00
Add getMoneySources
This commit is contained in:
parent
d0fe28f8fb
commit
ae5fc168bf
@ -54,6 +54,7 @@ export const RamCostConstants: Record<string, number> = {
|
|||||||
ScriptCodingContractBaseRamCost: 10,
|
ScriptCodingContractBaseRamCost: 10,
|
||||||
ScriptSleeveBaseRamCost: 4,
|
ScriptSleeveBaseRamCost: 4,
|
||||||
ScriptClearTerminalCost: 0.2,
|
ScriptClearTerminalCost: 0.2,
|
||||||
|
ScriptGetMoneySourcesCost: 1.0,
|
||||||
|
|
||||||
ScriptSingularityFn1RamCost: 2,
|
ScriptSingularityFn1RamCost: 2,
|
||||||
ScriptSingularityFn2RamCost: 3,
|
ScriptSingularityFn2RamCost: 3,
|
||||||
@ -528,6 +529,7 @@ export const RamCosts: RamCostTree<Omit<NSFull, "args" | "enums">> = {
|
|||||||
wget: 0,
|
wget: 0,
|
||||||
getFavorToDonate: RamCostConstants.ScriptGetFavorToDonate,
|
getFavorToDonate: RamCostConstants.ScriptGetFavorToDonate,
|
||||||
getPlayer: RamCostConstants.ScriptSingularityFn1RamCost / 4,
|
getPlayer: RamCostConstants.ScriptSingularityFn1RamCost / 4,
|
||||||
|
getMoneySources: RamCostConstants.ScriptGetMoneySourcesCost,
|
||||||
mv: 0,
|
mv: 0,
|
||||||
tail: 0,
|
tail: 0,
|
||||||
toast: 0,
|
toast: 0,
|
||||||
|
@ -61,7 +61,14 @@ import { NetscriptCorporation } from "./NetscriptFunctions/Corporation";
|
|||||||
import { NetscriptFormulas } from "./NetscriptFunctions/Formulas";
|
import { NetscriptFormulas } from "./NetscriptFunctions/Formulas";
|
||||||
import { NetscriptStockMarket } from "./NetscriptFunctions/StockMarket";
|
import { NetscriptStockMarket } from "./NetscriptFunctions/StockMarket";
|
||||||
import { NetscriptGrafting } from "./NetscriptFunctions/Grafting";
|
import { NetscriptGrafting } from "./NetscriptFunctions/Grafting";
|
||||||
import { NS, RecentScript as IRecentScript, BasicHGWOptions, ProcessInfo } from "./ScriptEditor/NetscriptDefinitions";
|
import {
|
||||||
|
NS,
|
||||||
|
RecentScript as IRecentScript,
|
||||||
|
BasicHGWOptions,
|
||||||
|
ProcessInfo,
|
||||||
|
MoneySource as IMoneySource,
|
||||||
|
MoneySources as IMoneySources,
|
||||||
|
} from "./ScriptEditor/NetscriptDefinitions";
|
||||||
import { NetscriptSingularity } from "./NetscriptFunctions/Singularity";
|
import { NetscriptSingularity } from "./NetscriptFunctions/Singularity";
|
||||||
|
|
||||||
import { dialogBoxCreate } from "./ui/React/DialogBox";
|
import { dialogBoxCreate } from "./ui/React/DialogBox";
|
||||||
@ -1828,6 +1835,51 @@ const base: InternalAPI<NS> = {
|
|||||||
Object.assign(data.jobs, Player.jobs);
|
Object.assign(data.jobs, Player.jobs);
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
getMoneySources: () => (): IMoneySources => {
|
||||||
|
const sinceInstall: IMoneySource = {
|
||||||
|
bladeburner: Player.moneySourceA.bladeburner,
|
||||||
|
casino: Player.moneySourceA.casino,
|
||||||
|
class: Player.moneySourceA.class,
|
||||||
|
codingcontract: Player.moneySourceA.codingcontract,
|
||||||
|
corporation: Player.moneySourceA.corporation,
|
||||||
|
crime: Player.moneySourceA.crime,
|
||||||
|
gang: Player.moneySourceA.gang,
|
||||||
|
hacking: Player.moneySourceA.hacking,
|
||||||
|
hacknet: Player.moneySourceA.hacknet,
|
||||||
|
hacknet_expenses: Player.moneySourceA.hacknet_expenses,
|
||||||
|
hospitalization: Player.moneySourceA.hospitalization,
|
||||||
|
infiltration: Player.moneySourceA.infiltration,
|
||||||
|
sleeves: Player.moneySourceA.sleeves,
|
||||||
|
stock: Player.moneySourceA.stock,
|
||||||
|
total: Player.moneySourceA.total,
|
||||||
|
work: Player.moneySourceA.work,
|
||||||
|
servers: Player.moneySourceA.servers,
|
||||||
|
other: Player.moneySourceA.other,
|
||||||
|
augmentations: Player.moneySourceA.augmentations,
|
||||||
|
};
|
||||||
|
const sinceStart: IMoneySource = {
|
||||||
|
bladeburner: Player.moneySourceB.bladeburner,
|
||||||
|
casino: Player.moneySourceB.casino,
|
||||||
|
class: Player.moneySourceB.class,
|
||||||
|
codingcontract: Player.moneySourceB.codingcontract,
|
||||||
|
corporation: Player.moneySourceB.corporation,
|
||||||
|
crime: Player.moneySourceB.crime,
|
||||||
|
gang: Player.moneySourceB.gang,
|
||||||
|
hacking: Player.moneySourceB.hacking,
|
||||||
|
hacknet: Player.moneySourceB.hacknet,
|
||||||
|
hacknet_expenses: Player.moneySourceB.hacknet_expenses,
|
||||||
|
hospitalization: Player.moneySourceB.hospitalization,
|
||||||
|
infiltration: Player.moneySourceB.infiltration,
|
||||||
|
sleeves: Player.moneySourceB.sleeves,
|
||||||
|
stock: Player.moneySourceB.stock,
|
||||||
|
total: Player.moneySourceB.total,
|
||||||
|
work: Player.moneySourceB.work,
|
||||||
|
servers: Player.moneySourceB.servers,
|
||||||
|
other: Player.moneySourceB.other,
|
||||||
|
augmentations: Player.moneySourceB.augmentations,
|
||||||
|
};
|
||||||
|
return { sinceInstall: sinceInstall, sinceStart: sinceStart };
|
||||||
|
},
|
||||||
atExit: (ctx) => (f) => {
|
atExit: (ctx) => (f) => {
|
||||||
if (typeof f !== "function") {
|
if (typeof f !== "function") {
|
||||||
throw helpers.makeRuntimeErrorMsg(ctx, "argument should be function");
|
throw helpers.makeRuntimeErrorMsg(ctx, "argument should be function");
|
||||||
|
40
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
40
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -61,6 +61,35 @@ interface Player {
|
|||||||
entropy: number;
|
entropy: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
|
interface MoneySource {
|
||||||
|
bladeburner: number;
|
||||||
|
casino: number;
|
||||||
|
class: number;
|
||||||
|
codingcontract: number;
|
||||||
|
corporation: number;
|
||||||
|
crime: number;
|
||||||
|
gang: number;
|
||||||
|
hacking: number;
|
||||||
|
hacknet: number;
|
||||||
|
hacknet_expenses: number;
|
||||||
|
hospitalization: number;
|
||||||
|
infiltration: number;
|
||||||
|
sleeves: number;
|
||||||
|
stock: number;
|
||||||
|
total: number;
|
||||||
|
work: number;
|
||||||
|
servers: number;
|
||||||
|
other: number;
|
||||||
|
augmentations: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
|
interface MoneySources {
|
||||||
|
sinceInstall: MoneySource;
|
||||||
|
sinceStart: MoneySource;
|
||||||
|
}
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export interface Multipliers {
|
export interface Multipliers {
|
||||||
/** Multiplier to hacking skill */
|
/** Multiplier to hacking skill */
|
||||||
@ -6692,6 +6721,17 @@ export interface NS {
|
|||||||
*/
|
*/
|
||||||
getPlayer(): Player;
|
getPlayer(): Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the sources of income for this run.
|
||||||
|
* @remarks
|
||||||
|
* RAM cost: 1.0 GB
|
||||||
|
*
|
||||||
|
* Returns an object with information on the income sources for this run
|
||||||
|
*
|
||||||
|
* @returns Money sources
|
||||||
|
*/
|
||||||
|
getMoneySources(): MoneySources;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add callback function when the script dies
|
* Add callback function when the script dies
|
||||||
* @remarks
|
* @remarks
|
||||||
|
Loading…
Reference in New Issue
Block a user