Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
rderfler
2022-05-06 22:44:24 -04:00
85 changed files with 2207 additions and 1622 deletions
+32 -10
View File
@@ -1800,6 +1800,18 @@ export interface Singularity {
*/
workForCompany(companyName?: string, focus?: boolean): boolean;
/**
* Quit jobs by company.
* @remarks
* RAM cost: 3 GB * 16/4/1
*
*
* This function will finish work with the company provided and quit any jobs.
*
* @param companyName - Name of the company.
*/
quitJob(companyName?: string): void;
/**
* Apply for a job at a company.
* @remarks
@@ -2340,13 +2352,13 @@ export interface Singularity {
* @example
* ```ts
* // NS1
* getDarkwebProgramsAvailable();
* getDarkwebPrograms();
* // returns ['BruteSSH.exe', 'FTPCrack.exe'...etc]
* ```
* @example
* ```ts
* // NS2
* ns.getDarkwebProgramsAvailable();
* ns.getDarkwebPrograms();
* // returns ['BruteSSH.exe', 'FTPCrack.exe'...etc]
* ```
* @returns - a list of programs available for purchase on the dark web, or [] if Tor has not
@@ -5325,9 +5337,10 @@ export interface NS {
* If no host is defined, it will kill all scripts, where the script is running.
*
* @param host - IP or hostname of the server on which to kill all scripts.
* @param safetyguard - Skips the script that calls this function
* @returns True if any scripts were killed, and false otherwise.
*/
killall(host?: string): boolean;
killall(host?: string, safetyguard?: boolean): boolean;
/**
* Terminates the current script immediately.
@@ -6140,7 +6153,7 @@ export interface NS {
* Returns 0 if the script does not exist.
*
* @param script - Filename of script. This is case-sensitive.
* @param host - Host of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server.
* @param host - Host of target server the script is located on. This is optional, if it is not specified then the function will use the current server as the target server.
* @returns Amount of RAM (in GB) required to run the specified script on the target server, and 0 if the script does not exist.
*/
getScriptRam(script: string, host?: string): number;
@@ -7058,22 +7071,27 @@ interface CorporationInfo {
interface Employee {
/** Name of the employee */
name: string;
/** Morale */
/** Morale of the employee */
mor: number;
/** Happiness */
/** Happiness of the employee */
hap: number;
/** Energy */
/** Energy of the employee */
ene: number;
/** Intelligence of the employee */
int: number;
/** Charisma of the employee */
cha: number;
/** Experience of the employee */
exp: number;
/** Creativity of the employee */
cre: number;
/** Efficiency of the employee */
eff: number;
/** Salary */
/** Salary of the employee */
sal: number;
/** City */
/** Current Location (city) */
loc: string;
/** Current job */
/** Current job position */
pos: string;
}
@@ -7125,6 +7143,8 @@ interface Material {
sell: number;
/** cost to buy material */
cost: number;
/** Sell cost, can be "MP+5" */
sCost: string | number;
}
/**
@@ -7216,6 +7236,8 @@ interface Division {
cities: string[];
/** Products developed by this division */
products: string[];
/** Whether the industry this division is in is capable of making products */
makesProducts: boolean;
}
/**
+28 -26
View File
@@ -544,11 +544,14 @@ export function Root(props: IProps): React.ReactElement {
// this is duplicate code with saving later.
if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) {
//Make sure filename + code properly follow tutorial
if (currentScript.fileName !== "n00dles.script") {
dialogBoxCreate("Leave the script name as 'n00dles.script'!");
if (currentScript.fileName !== "n00dles.script" && currentScript.fileName !== "n00dles.js") {
dialogBoxCreate("Don't change the script name for now.");
return;
}
if (currentScript.code.replace(/\s/g, "").indexOf("while(true){hack('n00dles');}") == -1) {
const cleanCode = currentScript.code.replace(/\s/g, "");
const ns1 = "while(true){hack('n00dles');}";
const ns2 = `exportasyncfunctionmain(ns){while(true){awaitns.hack('n00dles');}}`;
if (cleanCode.indexOf(ns1) == -1 && cleanCode.indexOf(ns2) == -1) {
dialogBoxCreate("Please copy and paste the code from the tutorial!");
return;
}
@@ -692,7 +695,7 @@ export function Root(props: IProps): React.ReactElement {
const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName);
if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex as number].code) {
PromptEvent.emit({
txt: "Do you want to save changes to " + closingScript.fileName + "?",
txt: `Do you want to save changes to ${closingScript.fileName} on ${closingScript.hostname}?`,
resolve: (result: boolean | string) => {
if (result) {
// Save changes
@@ -855,22 +858,31 @@ export function Root(props: IProps): React.ReactElement {
)}
</Tooltip>
{filteredOpenScripts.map(({ fileName, hostname }, index) => {
const editingCurrentScript =
currentScript?.fileName === filteredOpenScripts[index].fileName &&
currentScript?.hostname === filteredOpenScripts[index].hostname;
const externalScript = hostname !== "home";
const colorProps = editingCurrentScript
? {
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
: {
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
};
if (externalScript) {
colorProps.color = Settings.theme.info;
}
const iconButtonStyle = {
maxWidth: `${tabIconWidth}px`,
minWidth: `${tabIconWidth}px`,
minHeight: "38.5px",
maxHeight: "38.5px",
...(currentScript?.fileName === filteredOpenScripts[index].fileName
? {
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
: {
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
...colorProps,
};
const scriptTabText = `${hostname}:~/${fileName} ${dirty(index)}`;
@@ -905,17 +917,7 @@ export function Root(props: IProps): React.ReactElement {
maxWidth: `${tabTextWidth}px`,
minHeight: "38.5px",
overflow: "hidden",
...(currentScript?.fileName === filteredOpenScripts[index].fileName
? {
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
: {
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
...colorProps,
}}
>
<span style={{ overflow: "hidden", direction: "rtl", textOverflow: "ellipsis" }}>