Merge pull request #1764 from danielyxie/dev

few bugfix
This commit is contained in:
hydroflame 2021-11-22 11:36:34 -05:00 committed by GitHub
commit d6cbca94bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 106 additions and 83 deletions

28
dist/bitburner.d.ts vendored

@ -756,7 +756,7 @@ export declare interface CodingContract {
* @param opts - Optional parameters for configuring function behavior.
* @returns True if the solution was correct, false otherwise. If the returnReward option is configured, then the function will instead return a string. If the contract is successfully solved, the string will contain a description of the contracts reward. Otherwise, it will be an empty string.
*/
attempt(answer: string[] | number, fn: string, host?: string, opts?: CodingAttemptOptions): boolean | string;
attempt(answer: string[] | number, filename: string, host?: string, opts?: CodingAttemptOptions): boolean | string;
/**
* Get the type of a coding contract.
@ -770,7 +770,7 @@ export declare interface CodingContract {
* @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.
* @returns Name describing the type of problem posed by the Coding Contract.
*/
getContractType(fn: string, host?: string): string;
getContractType(filename: string, host?: string): string;
/**
* Get the description.
@ -783,7 +783,7 @@ export declare interface CodingContract {
* @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.
* @returns Contracts text description.
*/
getDescription(fn: string, host?: string): string;
getDescription(filename: string, host?: string): string;
/**
* Get the input data.
@ -794,11 +794,11 @@ export declare interface CodingContract {
* Note that this is not the same as the contracts description.
* This is just the data that the contract wants you to act on in order to solve
*
* @param fn - Filename of the contract.
* @param filename - Filename of the contract.
* @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.
* @returns The specified contracts data;
*/
getData(fn: string, host?: string): string;
getData(filename: string, host?: string): string;
/**
* Get the number of attempt remaining.
@ -811,7 +811,7 @@ export declare interface CodingContract {
* @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.
* @returns How many attempts are remaining for the contract;
*/
getNumTriesRemaining(fn: string, host?: string): number;
getNumTriesRemaining(filename: string, host?: string): number;
}
/**
@ -1962,7 +1962,7 @@ export declare interface NS extends Singularity {
* @param growthAmount - Multiplicative factor by which the server is grown. Decimal form..
* @returns The amount of grow calls needed to grow the specified server by the specified amount
*/
growthAnalyze(host: string, growthAmount: number): number;
growthAnalyze(host: string, growthAmount: number, cores?: number): number;
/**
* Calculate the security increase for a number of thread.
@ -2019,9 +2019,10 @@ export declare interface NS extends Singularity {
* @remarks
* RAM cost: 0 GB
*
* @param format - format of the message
* @param msg - Value to be printed.
*/
tprintf(msg: any): void;
tprintf(format: string, ...values: any[]): void;
/**
* Clears the scripts logs.
@ -2424,12 +2425,7 @@ export declare interface NS extends Singularity {
* @param destination - Host of the destination server, which is the server to which the file will be copied.
* @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.
*/
scp(
files: string[],
source: string,
// tslint:disable-next-line:unified-signatures
destination: string,
): Promise<boolean>;
scp(files: string | string[], source: string, destination: string): Promise<boolean>;
/**
* List files on a server.
@ -2775,7 +2771,7 @@ export declare interface NS extends Singularity {
* RAM cost: 0.3 GB
* @returns info about a running script
*/
getRunningScript(fn: string | number, hostname: string, ...args: (string | number)[]): RunningScript;
getRunningScript(filename: string | number, hostname: string, ...args: (string | number)[]): RunningScript;
/**
* Get cost of purchasing a server.
@ -4329,7 +4325,7 @@ export declare interface Singularity {
*
* @returns True if the installation was successful.
*/
installBackdoor(): Promise<boolean>;
installBackdoor(): Promise<void>;
}
/**

@ -4689,7 +4689,7 @@
},
{
"kind": "Content",
"text": ", fn: "
"text": ", filename: "
},
{
"kind": "Content",
@ -4741,7 +4741,7 @@
}
},
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
@ -4771,7 +4771,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "getContractType(fn: "
"text": "getContractType(filename: "
},
{
"kind": "Content",
@ -4807,7 +4807,7 @@
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
@ -4826,11 +4826,11 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!CodingContract#getData:member(1)",
"docComment": "/**\n * Get the input data.\n *\n * @remarks\n *\n * RAM cost: 5 GB\n *\n * Get the data associated with the specific Coding Contract. Note that this is not the same as the contracts description. This is just the data that the contract wants you to act on in order to solve\n *\n * @param fn - Filename of the contract.\n *\n * @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.\n *\n * @returns The specified contracts data;\n */\n",
"docComment": "/**\n * Get the input data.\n *\n * @remarks\n *\n * RAM cost: 5 GB\n *\n * Get the data associated with the specific Coding Contract. Note that this is not the same as the contracts description. This is just the data that the contract wants you to act on in order to solve\n *\n * @param filename - Filename of the contract.\n *\n * @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.\n *\n * @returns The specified contracts data;\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "getData(fn: "
"text": "getData(filename: "
},
{
"kind": "Content",
@ -4866,7 +4866,7 @@
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
@ -4889,7 +4889,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "getDescription(fn: "
"text": "getDescription(filename: "
},
{
"kind": "Content",
@ -4925,7 +4925,7 @@
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
@ -4948,7 +4948,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "getNumTriesRemaining(fn: "
"text": "getNumTriesRemaining(filename: "
},
{
"kind": "Content",
@ -4984,7 +4984,7 @@
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
@ -12899,7 +12899,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "getRunningScript(fn: "
"text": "getRunningScript(filename: "
},
{
"kind": "Content",
@ -12944,7 +12944,7 @@
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterName": "filename",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
@ -13963,6 +13963,14 @@
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", cores?: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
@ -13978,8 +13986,8 @@
],
"isOptional": false,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
"startIndex": 7,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 1,
@ -13997,6 +14005,13 @@
"startIndex": 3,
"endIndex": 4
}
},
{
"parameterName": "cores",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
}
}
],
"name": "growthAnalyze"
@ -15390,15 +15405,15 @@
"excerptTokens": [
{
"kind": "Content",
"text": "scp(\n files: "
"text": "scp(files: "
},
{
"kind": "Content",
"text": "string[]"
"text": "string | string[]"
},
{
"kind": "Content",
"text": ",\n source: "
"text": ", source: "
},
{
"kind": "Content",
@ -15406,7 +15421,7 @@
},
{
"kind": "Content",
"text": ",\n // tslint:disable-next-line:unified-signatures\n destination: "
"text": ", destination: "
},
{
"kind": "Content",
@ -15414,7 +15429,7 @@
},
{
"kind": "Content",
"text": ",\n ): "
"text": "): "
},
{
"kind": "Reference",
@ -16143,15 +16158,23 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#tprintf:member(1)",
"docComment": "/**\n * Prints a raw value or a variable to the Terminal.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param msg - Value to be printed.\n */\n",
"docComment": "/**\n * Prints a raw value or a variable to the Terminal.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param format - format of the message\n *\n * @param msg - Value to be printed.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "tprintf(msg: "
"text": "tprintf(format: "
},
{
"kind": "Content",
"text": "any"
"text": "string"
},
{
"kind": "Content",
"text": ", ...values: "
},
{
"kind": "Content",
"text": "any[]"
},
{
"kind": "Content",
@ -16168,18 +16191,25 @@
],
"isOptional": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "msg",
"parameterName": "format",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"parameterName": "values",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
],
"name": "tprintf"
@ -21232,7 +21262,7 @@
},
{
"kind": "Content",
"text": "<boolean>"
"text": "<void>"
},
{
"kind": "Content",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -9,7 +9,7 @@ Attemps a coding contract.
<b>Signature:</b>
```typescript
attempt(answer: string[] | number, fn: string, host?: string, opts?: CodingAttemptOptions): boolean | string;
attempt(answer: string[] | number, filename: string, host?: string, opts?: CodingAttemptOptions): boolean | string;
```
## Parameters
@ -17,7 +17,7 @@ attempt(answer: string[] | number, fn: string, host?: string, opts?: CodingAttem
| Parameter | Type | Description |
| --- | --- | --- |
| answer | string\[\] \| number | Solution for the contract. |
| fn | string | Filename of the contract. |
| filename | string | |
| host | string | Host of the server containing the contract. Optional. Defaults to current server if not provided. |
| opts | [CodingAttemptOptions](./bitburner.codingattemptoptions.md) | Optional parameters for configuring function behavior. |

@ -9,14 +9,14 @@ Get the type of a coding contract.
<b>Signature:</b>
```typescript
getContractType(fn: string, host?: string): string;
getContractType(filename: string, host?: string): string;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | string | Filename of the contract. |
| filename | string | |
| host | string | Host of the server containing the contract. Optional. Defaults to current server if not provided. |
<b>Returns:</b>

@ -9,14 +9,14 @@ Get the input data.
<b>Signature:</b>
```typescript
getData(fn: string, host?: string): string;
getData(filename: string, host?: string): string;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | string | Filename of the contract. |
| filename | string | Filename of the contract. |
| host | string | Host of the server containing the contract. Optional. Defaults to current server if not provided. |
<b>Returns:</b>

@ -9,14 +9,14 @@ Get the description.
<b>Signature:</b>
```typescript
getDescription(fn: string, host?: string): string;
getDescription(filename: string, host?: string): string;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | string | Filename of the contract. |
| filename | string | |
| host | string | Host of the server containing the contract. Optional. Defaults to current server if not provided. |
<b>Returns:</b>

@ -9,14 +9,14 @@ Get the number of attempt remaining.
<b>Signature:</b>
```typescript
getNumTriesRemaining(fn: string, host?: string): number;
getNumTriesRemaining(filename: string, host?: string): number;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | string | Filename of the contract. |
| filename | string | |
| host | string | Host of the server containing the contract. Optional. Defaults to current server if not provided. |
<b>Returns:</b>

@ -16,9 +16,9 @@ export interface CodingContract
| Method | Description |
| --- | --- |
| [attempt(answer, fn, host, opts)](./bitburner.codingcontract.attempt.md) | Attemps a coding contract. |
| [getContractType(fn, host)](./bitburner.codingcontract.getcontracttype.md) | Get the type of a coding contract. |
| [getData(fn, host)](./bitburner.codingcontract.getdata.md) | Get the input data. |
| [getDescription(fn, host)](./bitburner.codingcontract.getdescription.md) | Get the description. |
| [getNumTriesRemaining(fn, host)](./bitburner.codingcontract.getnumtriesremaining.md) | Get the number of attempt remaining. |
| [attempt(answer, filename, host, opts)](./bitburner.codingcontract.attempt.md) | Attemps a coding contract. |
| [getContractType(filename, host)](./bitburner.codingcontract.getcontracttype.md) | Get the type of a coding contract. |
| [getData(filename, host)](./bitburner.codingcontract.getdata.md) | Get the input data. |
| [getDescription(filename, host)](./bitburner.codingcontract.getdescription.md) | Get the description. |
| [getNumTriesRemaining(filename, host)](./bitburner.codingcontract.getnumtriesremaining.md) | Get the number of attempt remaining. |

@ -9,14 +9,14 @@ Get general info about a running script.
<b>Signature:</b>
```typescript
getRunningScript(fn: string | number, hostname: string, ...args: (string | number)[]): RunningScript;
getRunningScript(filename: string | number, hostname: string, ...args: (string | number)[]): RunningScript;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | string \| number | |
| filename | string \| number | |
| hostname | string | |
| args | (string \| number)\[\] | |

@ -9,7 +9,7 @@ Calculate the number of grow thread needed to grow a server by a certain multipl
<b>Signature:</b>
```typescript
growthAnalyze(host: string, growthAmount: number): number;
growthAnalyze(host: string, growthAmount: number, cores?: number): number;
```
## Parameters
@ -18,6 +18,7 @@ growthAnalyze(host: string, growthAmount: number): number;
| --- | --- | --- |
| host | string | Hostname of the target server. |
| growthAmount | number | Multiplicative factor by which the server is grown. Decimal form.. |
| cores | number | |
<b>Returns:</b>

@ -59,7 +59,7 @@ export interface NS extends Singularity
| [getPurchasedServerLimit()](./bitburner.ns.getpurchasedserverlimit.md) | Returns the maximum number of servers you can purchase. |
| [getPurchasedServerMaxRam()](./bitburner.ns.getpurchasedservermaxram.md) | Returns the maximum RAM that a purchased server can have. |
| [getPurchasedServers(hostnameMode)](./bitburner.ns.getpurchasedservers.md) | Returns an array with either the hostnames or IPs of all of the servers you have purchased. |
| [getRunningScript(fn, hostname, args)](./bitburner.ns.getrunningscript.md) | Get general info about a running script. |
| [getRunningScript(filename, hostname, args)](./bitburner.ns.getrunningscript.md) | Get general info about a running script. |
| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. |
| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Get the income of a script. |
| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | Get all the logs of a script. |
@ -80,7 +80,7 @@ export interface NS extends Singularity
| [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. |
| [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. |
| [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. |
| [growthAnalyze(host, growthAmount)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow thread needed to grow a server by a certain multiplier. |
| [growthAnalyze(host, growthAmount, cores)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow thread needed to grow a server by a certain multiplier. |
| [growthAnalyzeSecurity(threads)](./bitburner.ns.growthanalyzesecurity.md) | Calculate the security increase for a number of thread. |
| [hack(host, opts)](./bitburner.ns.hack.md) | Steal a servers money. |
| [hackAnalyze(host)](./bitburner.ns.hackanalyze.md) | Get the percent of money stolen with a single thread. |
@ -119,7 +119,7 @@ export interface NS extends Singularity
| [tFormat(milliseconds, milliPrecision)](./bitburner.ns.tformat.md) | Format time to readable string |
| [toast(msg, variant)](./bitburner.ns.toast.md) | Queue a toast (bottom-right notification). |
| [tprint(msg)](./bitburner.ns.tprint.md) | Prints a value or a variable to the Terminal. |
| [tprintf(msg)](./bitburner.ns.tprintf.md) | Prints a raw value or a variable to the Terminal. |
| [tprintf(format, values)](./bitburner.ns.tprintf.md) | Prints a raw value or a variable to the Terminal. |
| [tryWritePort(port, data)](./bitburner.ns.trywriteport.md) | Attempt to write to a port. |
| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Format a string with an array of arguments. |
| [weaken(host, opts)](./bitburner.ns.weaken.md) | Reduce a server security level. |

@ -9,19 +9,14 @@ Copy file between servers.
<b>Signature:</b>
```typescript
scp(
files: string[],
source: string,
// tslint:disable-next-line:unified-signatures
destination: string,
): Promise<boolean>;
scp(files: string | string[], source: string, destination: string): Promise<boolean>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| files | string\[\] | Filename or an array of filenames of script/literature files to copy. |
| files | string \| string\[\] | Filename or an array of filenames of script/literature files to copy. |
| source | string | Host of the source server, which is the server from which the file will be copied. This argument is optional and if its omitted the source will be the current server. |
| destination | string | Host of the destination server, which is the server to which the file will be copied. |

@ -9,14 +9,15 @@ Prints a raw value or a variable to the Terminal.
<b>Signature:</b>
```typescript
tprintf(msg: any): void;
tprintf(format: string, ...values: any[]): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| msg | any | Value to be printed. |
| format | string | format of the message |
| values | any\[\] | |
<b>Returns:</b>

@ -9,11 +9,11 @@ Run the backdoor command in the terminal.
<b>Signature:</b>
```typescript
installBackdoor(): Promise<boolean>;
installBackdoor(): Promise<void>;
```
<b>Returns:</b>
Promise&lt;boolean&gt;
Promise&lt;void&gt;
True if the installation was successful.

@ -22,7 +22,7 @@ interface IServerProps {
function ServerAccordion(props: IServerProps): React.ReactElement {
const server = GetServer(props.hostname);
if (server === null) throw new Error("server should not be null");
if (server === null) throw new Error(`server '${props.hostname}' should not be null`);
let totalSize = 0;
for (const f of server.scripts) {
totalSize += f.code.length;
@ -100,8 +100,8 @@ interface IProps {
export function FileDiagnosticModal(props: IProps): React.ReactElement {
const keys: string[] = [];
for (const key in GetAllServers()) {
keys.push(key);
for (const key of GetAllServers()) {
keys.push(key.hostname);
}
return (

@ -192,7 +192,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
powerful upgrades that will enhance your abilities.
<br />
Reputation: <Reputation reputation={props.faction.playerReputation} /> Favor:{" "}
<Favor favor={props.faction.favor} />
<Favor favor={Math.floor(props.faction.favor)} />
</Typography>
<Box display="flex">
<Tooltip

@ -286,7 +286,7 @@ export const RamCosts: IMap<any> = {
getTeamSize: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setTeamSize: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedPopulation: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedCommunities: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityCommunities: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityChaos: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCity: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
switchCity: RamCostConstants.ScriptBladeburnerApiBaseRamCost,