allbuild commit e9254edf

This commit is contained in:
Olivier Gagnon 2022-07-21 15:09:55 -04:00
parent e9254edf5d
commit 2d522ea1e6
17 changed files with 26 additions and 175 deletions

4
dist/bitburner.d.ts vendored

@ -4614,7 +4614,7 @@ export declare interface NS {
* RAM cost: 0 GB
*
* Retrieves data from a URL and downloads it to a file on the specified server.
* The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt).
* The data can only be downloaded to a script (.script or .js) or a text file (.txt).
* If the file already exists, it will be overwritten by this command.
* Note that it will not be possible to download data from many websites because they
* do not allow cross-origin resource sharing (CORS).
@ -4758,7 +4758,7 @@ export declare interface NS {
* ]);
* tprint(data);
*
* // example.ns
* // example.js
* export async function main(ns) {
* const data = ns.flags([
* ['delay', 0], // a default number means this flag is a number

4
dist/main.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

@ -270,8 +270,7 @@ export const achievements: IMap<Achievement> = {
NS2: {
...achievementData["NS2"],
Icon: "ns2",
Condition: () =>
Player.getHomeComputer().scripts.some((s) => s.filename.endsWith(".js") || s.filename.endsWith(".ns")),
Condition: () => Player.getHomeComputer().scripts.some((s) => s.filename.endsWith(".js")),
},
FROZE: {
...achievementData["FROZE"],

@ -163,8 +163,6 @@ const singularity = {
installBackdoor: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost),
getDarkwebProgramCost: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
getDarkwebPrograms: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
getStats: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
getCharacterInformation: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
hospitalize: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
isBusy: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
stopAction: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 2),

@ -13,9 +13,7 @@ import { RunningScript } from "../Script/RunningScript";
import {
AugmentationStats,
CharacterInfo,
CrimeStats,
PlayerSkills,
Singularity as ISingularity,
SourceFileLvl,
} from "../ScriptEditor/NetscriptDefinitions";
@ -674,62 +672,6 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
}
return false;
},
getStats: (_ctx: NetscriptContext) =>
function (): PlayerSkills {
_ctx.helper.checkSingularityAccess();
_ctx.log(() => `getStats is deprecated, please use getplayer`);
return {
hacking: player.hacking,
strength: player.strength,
defense: player.defense,
dexterity: player.dexterity,
agility: player.agility,
charisma: player.charisma,
intelligence: player.intelligence,
};
},
getCharacterInformation: (_ctx: NetscriptContext) =>
function (): CharacterInfo {
_ctx.helper.checkSingularityAccess();
_ctx.log(() => `getCharacterInformation is deprecated, please use getplayer`);
return {
bitnode: player.bitNodeN,
city: player.city,
factions: player.factions.slice(),
hp: player.hp,
jobs: Object.keys(player.jobs),
jobTitles: Object.values(player.jobs),
maxHp: player.max_hp,
mult: {
agility: player.mults.agility,
agilityExp: player.mults.agility_exp,
charisma: player.charisma,
charismaExp: player.charisma_exp,
companyRep: player.mults.company_rep,
crimeMoney: player.mults.crime_money,
crimeSuccess: player.mults.crime_success,
defense: player.mults.defense,
defenseExp: player.mults.defense_exp,
dexterity: player.mults.dexterity,
dexterityExp: player.mults.dexterity_exp,
factionRep: player.mults.faction_rep,
hacking: player.mults.hacking,
hackingExp: player.mults.hacking_exp,
strength: player.mults.strength,
strengthExp: player.mults.strength_exp,
workMoney: player.mults.work_money,
},
tor: player.hasTorRouter(),
hackingExp: player.hacking_exp,
strengthExp: player.strength_exp,
defenseExp: player.defense_exp,
dexterityExp: player.dexterity_exp,
agilityExp: player.agility_exp,
charismaExp: player.charisma_exp,
};
},
hospitalize: (_ctx: NetscriptContext) =>
function (): void {
_ctx.helper.checkSingularityAccess();
@ -1213,6 +1155,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
throw _ctx.helper.makeRuntimeErrorMsg(`Invalid crime: '${crimeRoughName}'`);
}
_ctx.log(() => `Attempting to commit ${crime.name}...`);
const crimeTime = crime.commit(player, 1, workerScript);
if (focus) {
player.startFocusing();
Router.toWork();
@ -1220,7 +1163,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
player.stopFocusing();
Router.toTerminal();
}
return crime.commit(player, 1, workerScript);
return crimeTime;
},
getCrimeChance: (_ctx: NetscriptContext) =>
function (_crimeRoughName: unknown): number {

@ -566,7 +566,7 @@ function createAndAddWorkerScript(
// Start the script's execution
let scriptExecution: Promise<void> | null = null; // Script's resulting promise
if (workerScript.name.endsWith(".js") || workerScript.name.endsWith(".ns")) {
if (workerScript.name.endsWith(".js")) {
scriptExecution = startNetscript2Script(player, workerScript);
} else {
scriptExecution = startNetscript1Script(workerScript);

@ -29,7 +29,7 @@ import { HacknetServer } from "../Hacknet/HacknetServer";
import { ISkillProgress } from "./formulas/skill";
import { PlayerAchievement } from "../Achievements/Achievements";
import { IPerson } from "./IPerson";
import { Work } from "src/Work/Work";
import { Work } from "../Work/Work";
import { Multipliers } from "./Multipliers";
export interface IPlayer extends IPerson {

@ -15,6 +15,7 @@ export function process(this: IPlayer, cycles = 1): void {
}
}
export function finish(this: IPlayer, cancelled: boolean): void {
console.error("finishing");
if (this.currentWork === null) return;
this.currentWork.finish(this, cancelled);
this.currentWork = null;

@ -1,4 +1,4 @@
export const validScriptExtensions: Array<string> = [`.js`, `.script`, `.ns`];
export const validScriptExtensions: Array<string> = [`.js`, `.script`];
export function isScriptFilename(f: string): boolean {
return validScriptExtensions.some((ext) => f.endsWith(ext));

@ -657,27 +657,6 @@ export interface NodeStats {
totalProduction: number;
}
/**
* Short summary of the players skills.
* @public
*/
export interface PlayerSkills {
/** Hacking level */
hacking: number;
/** Strength level */
strength: number;
/** Defense level */
defense: number;
/** Dexterity level */
dexterity: number;
/** Agility level */
agility: number;
/** Charisma level */
charisma: number;
/** Intelligence level */
intelligence: number;
}
/**
* @public
*/
@ -718,42 +697,6 @@ export interface CharacterMult {
workMoney: number;
}
/**
* @public
*/
export interface CharacterInfo {
/** Current BitNode number */
bitnode: number;
/** Name of city you are currently in */
city: string;
/** Array of factions you are currently a member of */
factions: string[];
/** Current health points */
hp: number;
/** Array of all jobs */
jobs: string[];
/** Array of job positions for all companies you are employed at. Same order as 'jobs' */
jobTitles: string[];
/** Maximum health points */
maxHp: number;
/** Boolean indicating whether or not you have a tor router */
tor: boolean;
/** Object with many of the player's multipliers from Augmentations/Source Files */
mult: CharacterMult;
/** total hacking exp */
hackingExp: number;
/** total strength exp */
strengthExp: number;
/** total defense exp */
defenseExp: number;
/** total dexterity exp */
dexterityExp: number;
/** total agility exp */
agilityExp: number;
/** total charisma exp */
charismaExp: number;
}
/**
* @public
*/
@ -2216,35 +2159,6 @@ export interface Singularity {
*/
installAugmentations(cbScript?: string): void;
/**
* Returns an object with the Players stats.
* @deprecated use getPlayer
*
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
*
* @example
* ```ts
* res = getStats();
* print('My charisma level is: ' + res.charisma);
* ```
* @returns Object with the Players stats.
*/
getStats(): PlayerSkills;
/**
* Returns an object with various information about your character.
* @deprecated use getPlayer
*
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
*
* @returns Object with various information about your character.
*/
getCharacterInformation(): CharacterInfo;
/**
* Hospitalize the player.
* @remarks
@ -6407,7 +6321,7 @@ export interface NS {
* RAM cost: 0 GB
*
* Retrieves data from a URL and downloads it to a file on the specified server.
* The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt).
* The data can only be downloaded to a script (.script, .js) or a text file (.txt).
* If the file already exists, it will be overwritten by this command.
* Note that it will not be possible to download data from many websites because they
* do not allow cross-origin resource sharing (CORS).
@ -6540,7 +6454,7 @@ export interface NS {
* ]);
* tprint(data);
*
* // example.ns
* // example.js
* export async function main(ns) {
* const data = ns.flags([
* ['delay', 0], // a default number means this flag is a number

@ -436,7 +436,7 @@ export function Root(props: IProps): React.ReactElement {
function infLoop(newCode: string): void {
if (editorRef.current === null || currentScript === null) return;
if (!currentScript.fileName.endsWith(".ns") && !currentScript.fileName.endsWith(".js")) return;
if (!currentScript.fileName.endsWith(".js")) return;
const awaitWarning = checkInfiniteLoop(newCode);
if (awaitWarning !== -1) {
const newDecorations = editorRef.current.deltaDecorations(decorations, [
@ -531,7 +531,7 @@ export function Root(props: IProps): React.ReactElement {
const textFile = new TextFile(scriptToSave.fileName, scriptToSave.code);
server.textFiles.push(textFile);
} else {
dialogBoxCreate("Invalid filename. Must be either a script (.script, .js, or .ns) or a text file (.txt)");
dialogBoxCreate("Invalid filename. Must be either a script (.script or .js) or a text file (.txt)");
return;
}
@ -618,7 +618,7 @@ export function Root(props: IProps): React.ReactElement {
const textFile = new TextFile(currentScript.fileName, currentScript.code);
server.textFiles.push(textFile);
} else {
dialogBoxCreate("Invalid filename. Must be either a script (.script, .js, or .ns) or a text file (.txt)");
dialogBoxCreate("Invalid filename. Must be either a script (.script or .js) or a text file (.txt)");
return;
}

@ -314,7 +314,7 @@ export function areFilesEqual(f0: string, f1: string): boolean {
}
export function areImportsEquals(f0: string, f1: string): boolean {
if (!f0.endsWith(".ns") && !f0.endsWith(".js")) f0 = f0 + ".js";
if (!f1.endsWith(".ns") && !f1.endsWith(".js")) f1 = f1 + ".js";
if (!f0.endsWith(".js")) f0 = f0 + ".js";
if (!f1.endsWith(".js")) f1 = f1 + ".js";
return areFilesEqual(f0, f1);
}

@ -52,7 +52,7 @@ const TemplatedHelpTexts: IMap<(command: string) => string[]> = {
return [
`Usage: ${command} [file ...] | [glob]`,
` `,
`Opens up the specified file(s) in the Script Editor. Only scripts (.js, .ns, .script) or text files (.txt) `,
`Opens up the specified file(s) in the Script Editor. Only scripts (.js, or .script) or text files (.txt) `,
`can be edited using the Script Editor. If a file does not exist a new one will be created`,
` `,
`If provided a glob as the only argument, ${command} can spider directories and open all matching `,
@ -472,7 +472,7 @@ export const HelpTexts: IMap<string[]> = {
"Usage: wget [url] [target file]",
" ",
"Retrieves data from a URL and downloads it to a file on the current server. The data can only ",
"be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, ",
"be downloaded to a script (.script or .js) or a text file (.txt). If the file already exists, ",
"it will be overwritten by this command.",
" ",
"Note that it will not be possible to download data from many websites because they do not allow ",

@ -25,11 +25,10 @@ export function cat(
!filename.endsWith(".lit") &&
!filename.endsWith(".txt") &&
!filename.endsWith(".script") &&
!filename.endsWith(".js") &&
!filename.endsWith(".ns")
!filename.endsWith(".js")
) {
terminal.error(
"Only .msg, .txt, .lit, .script, .js, and .ns files are viewable with cat (filename must end with .msg, .txt, .lit, .script, .js, or .ns)",
"Only .msg, .txt, .lit, .script and .js files are viewable with cat (filename must end with .msg, .txt, .lit, .script or .js)",
);
return;
}
@ -55,7 +54,7 @@ export function cat(
txt.show();
return;
}
} else if (filename.endsWith(".script") || filename.endsWith(".js") || filename.endsWith(".ns")) {
} else if (filename.endsWith(".script") || filename.endsWith(".js")) {
const script = terminal.getScript(player, relative_filename);
if (script != null) {
dialogBoxCreate(`${script.filename}<br /><br />${script.code}`);

@ -17,7 +17,7 @@ interface EditorParameters {
}
function isNs2(filename: string): boolean {
return filename.endsWith(".ns") || filename.endsWith(".js");
return filename.endsWith(".js");
}
const newNs2Template = `/** @param {NS} ns */
@ -137,7 +137,7 @@ export function commonEditor(
}
throw new Error(
`Invalid file. Only scripts (.script, .ns, .js), or text files (.txt) can be edited with ${command}`,
`Invalid file. Only scripts (.script or .js), or text files (.txt) can be edited with ${command}`,
);
});

@ -85,9 +85,6 @@ export function runScript(
terminal.print(
`Running script with ${numThreads} thread(s), pid ${runningScript.pid} and args: ${JSON.stringify(args)}.`,
);
if (runningScript.filename.endsWith(".ns")) {
terminal.warn(".ns files are deprecated, please rename everything to .js");
}
if (tailFlag) {
LogBoxEvents.emit(runningScript);
}