mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-03 20:07:34 +01:00
2.2
This commit is contained in:
parent
93aab87a16
commit
0ec4ef31ab
60
dist/bitburner.d.ts
vendored
60
dist/bitburner.d.ts
vendored
@ -4429,33 +4429,6 @@ export declare interface NS {
|
||||
*/
|
||||
getServerBaseSecurityLevel(host: string): number;
|
||||
|
||||
/**
|
||||
* @deprecated use getServerMaxRam / getServerUsedRam
|
||||
* @remarks
|
||||
* RAM cost: 0.1 GB
|
||||
*
|
||||
* Returns an array with two elements that gives information about a server’s memory (RAM).
|
||||
* The first element in the array is the amount of RAM that the server has total (in GB).
|
||||
* The second element in the array is the amount of RAM that is currently being used on
|
||||
* the server (in GB).
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1:
|
||||
* var serverRam = getServerRam("helios");
|
||||
* var totalRam = serverRam[0];
|
||||
* var ramUsed = serverRam[1];
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS2:
|
||||
* const [totalRam, ramUsed] = ns.getServerRam("helios");
|
||||
* ```
|
||||
* @param host - Host of target server.
|
||||
* @returns Array with total and used memory on the specified server, in GB.
|
||||
*/
|
||||
getServerRam(host: string): [number, number];
|
||||
|
||||
/**
|
||||
* Get the maximum amount of RAM on a server.
|
||||
* @remarks
|
||||
@ -5474,11 +5447,7 @@ export declare interface OfficeAPI {
|
||||
* @param employeePosition - Position to place into. Defaults to "Unassigned".
|
||||
* @returns True if an employee was hired, false otherwise
|
||||
*/
|
||||
hireEmployee(
|
||||
divisionName: string,
|
||||
city: CityName | `${CityName}`,
|
||||
employeePosition?: CorpEmployeePosition,
|
||||
): boolean;
|
||||
hireEmployee(divisionName: string, city: CityName | `${CityName}`, employeePosition?: CorpEmployeePosition): boolean;
|
||||
/**
|
||||
* Upgrade office size.
|
||||
* @param divisionName - Name of the division
|
||||
@ -6396,26 +6365,6 @@ export declare interface Singularity {
|
||||
*/
|
||||
getAugmentationPrereq(augName: string): string[];
|
||||
|
||||
/**
|
||||
* Get the price and reputation of an augmentation.
|
||||
* @deprecated use getAugmentationPrice getAugmentationRepReq
|
||||
* @remarks
|
||||
* RAM cost: 5 GB * 16/4/1
|
||||
*
|
||||
*
|
||||
* This function returns an array with two elements that gives the cost for
|
||||
* the specified Augmentation. The first element in the returned array is the
|
||||
* reputation requirement of the Augmentation, and the second element is the
|
||||
* money cost.
|
||||
*
|
||||
* If an invalid Augmentation name is passed in for the augName argument, this
|
||||
* function will return the array [-1, -1].
|
||||
*
|
||||
* @param augName - Name of Augmentation.
|
||||
* @returns Array with first element as a reputation requirement and second element as the money cost.
|
||||
*/
|
||||
getAugmentationCost(augName: string): [number, number];
|
||||
|
||||
/**
|
||||
* Get price of an augmentation.
|
||||
* @remarks
|
||||
@ -6735,6 +6684,8 @@ export declare interface Sleeve {
|
||||
*
|
||||
* Return a person object for this sleeve
|
||||
*
|
||||
* storedCycles is the amount of Bonus Time in cycles, each translates to 200ms
|
||||
*
|
||||
* @param sleeveNumber - Index of the sleeve to retrieve information.
|
||||
* @returns Object containing information about this sleeve.
|
||||
*/
|
||||
@ -6978,9 +6929,14 @@ export declare type SleeveInfiltrateTask = { type: "INFILTRATE" };
|
||||
|
||||
/** @public */
|
||||
export declare interface SleevePerson extends Person {
|
||||
/** Number 0-100 Experience earned and shared is multiplied with shock% before sync% */
|
||||
shock: number;
|
||||
/** Number 1-100 Experience earned by this sleeve and shared with the player is multiplied with sync% after shock% */
|
||||
sync: number;
|
||||
/** Number 1-100 initial Value of sync on BN start */
|
||||
memory: number;
|
||||
/** Number of 200ms cycles which are stored as bonus time */
|
||||
storedCycles: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
|
@ -3,6 +3,179 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
v2.2.0 - Jan 2 2023 Development Reboot
|
||||
--------------------------------------
|
||||
|
||||
Dev notes
|
||||
|
||||
* The previous main developer, hydroflame, is stepping back from this project for the foreseeable future.
|
||||
To facilitate this, we've moved the repo to a new location at https://github.com/bitburner-official/bitburner-src.
|
||||
* Sorry for the large number of API breaks in this version. To ease the pain here, attempting to use any of the
|
||||
removed functions will provide an error guiding you to the new replacement function to use instead.
|
||||
|
||||
BREAKING API CHANGES:
|
||||
|
||||
* (ns2 only) ns functions use the 'this' value from ns: if you move the function to its own variable off of ns, it
|
||||
needs to be bound to ns. e.g.:
|
||||
const tprint1 = ns.tprint; // This doesn't work and will error out when calling tprint1();
|
||||
const tprint = ns.tprint.bind(ns); // This works because the 'this' value is preserved.
|
||||
The internal changes that make this necessary led to very large performance gains for running many scripts at once.
|
||||
|
||||
* ns.getPlayer no longer provides properties tor, inBladeburner, or hasCorporation. This information can be looked
|
||||
up using standlone functions: ns.hasTorRouter(), ns.bladeburner.inBladeburner(), ns.corporation.hasCorporation().
|
||||
|
||||
* Removed many functions, with replacement ways to get the same info.
|
||||
getServerRam: use getServerMaxRam and getServerUsedRam instead.
|
||||
corporation.assignJob: use setAutoJobAssignment instead.
|
||||
corporation.getEmployee: No longer available (employees are not individual objects).
|
||||
corporation.getExpandCityCost: use ns.corporation.getConstants().officeInitialCost
|
||||
corporation.getExpandIndustryCost: use getIndustryData instead.
|
||||
corporation.getIndustryTypes: use ns.corporation.getConstants().industryNames
|
||||
corporation.getMaterialNames: use ns.corporation.getConstants().materialNames
|
||||
corporation.getPurchaseWarehouseCost: use ns.corporation.getConstants().warehouseInitialCost
|
||||
corporation.getResearchNames: use ns.corporation.getConstants().researchNames
|
||||
corporation.getUnlockables: use ns.corporation.getConstants().unlockNames
|
||||
corporation.getUpgradeNames: use ns.corporation.getConstants().upgradeNames
|
||||
formulas.work.classGains: split into universityGains and gymGains
|
||||
singularity.getAugmentationCost: use getAugmentationPrice and getAugmentationRepReq instead
|
||||
sleeve.getSleeveStats: use getSleeve instead
|
||||
sleeve.getInformation: use getSleeve instead
|
||||
|
||||
* An error dialog will inform the player of the above API changes if the player tries to use one of the
|
||||
removed functions above.
|
||||
|
||||
* enums.toast was renamed ToastVariant to provide consistency with internal code.
|
||||
|
||||
* codingcontract.attempt always returns a string (empty string for a failed attempt). This may break player code
|
||||
if a direct boolean comparison (e.g. 'attemptResult === true') was being made. The string can be used directly as
|
||||
the conditional, because empty string evaluates to false as a boolean.
|
||||
|
||||
* corporation.getCorporation().divisions now returns an array of division names, instead of division objects. Use
|
||||
corporation.getDivision(name) to get the division info object.
|
||||
|
||||
DEVELOPMENT
|
||||
|
||||
* Development repo moved to https://github.com/bitburner-official/bitburner-src
|
||||
* Dev version available on web at https://bitburner-official.github.io/bitburner-src/
|
||||
* Development is active again for non-bugfix.
|
||||
* A bunch of fixes, setup, and assistance related to moving to a new repo (@hydroflame)
|
||||
|
||||
TUTORIAL
|
||||
|
||||
* Removed NS1/NS2 selection. Tutorial now only references .js files (NS1 is essentially deprecated) (@Mughur)
|
||||
* Fix Ram Text (by @jaculler)
|
||||
|
||||
NETSCRIPT
|
||||
* More enums and more types are exposed to the player instead of "magic strings"
|
||||
* Added ns.pid property to access a script's PID without a function call. (@jeek)
|
||||
* Much faster API wrapping on script launch. (@d0sboots) To support this, ns functions need to keep their "this"
|
||||
value from their parent object.
|
||||
* Expose more enums for player use under ns.enums (@Snarling)
|
||||
* tFormat: Fix display for negative time
|
||||
* ns.getPlayer: removed tor, inBladeburner, and hasCorporation properties
|
||||
* Added ns.hasTorRouter() function.
|
||||
* CODING CONTRACT
|
||||
* ns.codingcontract.attempt always returns a string. (@Snarling)
|
||||
* CORPORATION
|
||||
* Removed ns.corporation.getEmployee and ns.corporation.assignJob, due to employees no longer being objects.
|
||||
* Added ns.corporation.hasCorporation();
|
||||
* Reworked how ram costs are applied for corporation.
|
||||
* FORMULAS
|
||||
* ns.formulas.work.classGains removed, replaced with ns.formulas.work.universityGains and
|
||||
ns.formulas.work.gymGains (@Snarling)
|
||||
* Add ns.formulas.work.companyGains function (@AlexeyKozhemiakin)
|
||||
* PORTS
|
||||
* added portHandle.nextWrite() (@LJNeon)
|
||||
* Make ns.writePort synchronous (@Snarling)
|
||||
* SLEEVE
|
||||
* ns.sleeve.getSleeve added. getPlayer and getSleeve can both be used for formulas. (@Snarling)
|
||||
* getSleeve also includes storedCycles (i.e. bonusTime) (@zerbosh)
|
||||
* STOCK
|
||||
* ns.stock.getOrganization added for getting org from stock symbol (@SamuraiNinjaGuy)
|
||||
|
||||
SCRIPTS
|
||||
|
||||
* Fixed bug where zombie scripts could be created after a soft reset (@Snarling)
|
||||
* Scripts now have a maximum ram cost of 1024GB per thread.
|
||||
|
||||
SCRIPT LOGS
|
||||
|
||||
* Add ctrl-a support for selecting all text in tail window (@Snarling)
|
||||
|
||||
CORPORATION
|
||||
|
||||
* Remove corp employees as objects (by @Kelenius)
|
||||
* API access is provided automatically if the player is in BN3. (@zerbosh)
|
||||
* Happiness/Energy/Morale trend down even for productive corps (by @Snarling)
|
||||
* Typo fixes in modals to sell materials and products (by @quacksouls)
|
||||
* Reworked MP formula validation to prevent possible save corruption on invalid entry (by @Snarling)
|
||||
* Internal reorganization of Industry data (by @Snarling)
|
||||
* Added check to material buy amount (by @G4mingJon4s)
|
||||
* Check there is room to make a new product before opening popup. (by @G4mingJon4s)
|
||||
* Fix typos in research descriptions (by @quacksouls)
|
||||
|
||||
SLEEVE
|
||||
|
||||
* Fixed inconsistencies in how sleeve work rewards are handled. (by @Snarling)
|
||||
* Fix bug that prevented selecting some crimes from UI. (by @Snarling)
|
||||
* Internally shock starts at 100 and lowers to 0. Previously this was backwards.
|
||||
|
||||
STOCKMARKET
|
||||
|
||||
* Fix broken initializer when manually buying WSE access (by @Snarling)
|
||||
|
||||
TERMINAL
|
||||
|
||||
* Added changelog command to re-display the changelog dialog.
|
||||
* Connect command will connect to player owned servers from anywhere. (by @Snarling)
|
||||
|
||||
UI
|
||||
|
||||
* Improve UI performance of sidebar and character overview using memoization (@d0sboots)
|
||||
* Other UI additions / improvements (@Mughur, @d0sboots, probably others)
|
||||
* Fixed spacing of text in Trade for reputation button after Infiltration (by @PyroGenesis)
|
||||
* Fix spacing on ANSI background escape codes (by @Snarling)
|
||||
* Fix several instances where newlines were not being displayed properly (by @quacksouls)
|
||||
* SoftResetButton.tsx Tooltip changed to make more sense (by @rai68)
|
||||
* GANG: Fix Gang UI to correctly report the bonus time multiplier as 25x (by @TheMas3212)
|
||||
* Change formatting for skill levels to use localeStr (@G4mingJon4s)
|
||||
|
||||
DOC
|
||||
|
||||
* Fix incorrect examples for grow (by @quacksouls)
|
||||
* Updated limitMaterialProduction() and limitProductProduction() documentation to mention removing limits. (by @PyroGenesis)
|
||||
* Add ns documentation for possible sleeve tasks (by @Snarling)
|
||||
* Update documentation for workForFaction and workForCompany (by @quacksouls)
|
||||
* Improve CCT documentation for HammingCodes (by @quacksouls)
|
||||
* cleanup in doc of Netscript functions (by @quacksouls)
|
||||
* Various other doc fixes (by @quacksouls)
|
||||
* Update documentation for ns.args (by @Snarling)
|
||||
* De-uglify ns.print examples (by @LJNeon)
|
||||
|
||||
STATS
|
||||
|
||||
* Fix logic for increasing HP based on defense skill levels (by @mattgarretson)
|
||||
* Fix a bug where HP could be something other than max after a bitnode reset.
|
||||
|
||||
INFILTRATION
|
||||
|
||||
* Fix SlashGame scaling. (by @Snarling)
|
||||
|
||||
GANG
|
||||
|
||||
* When starting a gang, any in progress work with that faction will end. (@G4mingJon4s)
|
||||
|
||||
MISC
|
||||
|
||||
* Lots of typesafety improvements with internal code
|
||||
* Remove google analytics (@hydroflame)
|
||||
* Some error handling streamlining (by @Snarling)
|
||||
* fix: check both ts and js source now (by @Tanimodori)
|
||||
* chore: sync version in package-lock.json (by @Tanimodori)
|
||||
* Better safety when loading game for multiple save corruption issues (by @Snarling)
|
||||
* Nerf Noodle bar
|
||||
|
||||
|
||||
v2.1.0 - 2022-09-23 Remote File API
|
||||
-----------------------------------
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getServerRam](./bitburner.ns.getserverram.md)
|
||||
|
||||
## NS.getServerRam() method
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> use getServerMaxRam / getServerUsedRam
|
||||
>
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
getServerRam(host: string): [number, number];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| host | string | Host of target server. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
\[number, number\]
|
||||
|
||||
Array with total and used memory on the specified server, in GB.
|
||||
|
||||
## Remarks
|
||||
|
||||
RAM cost: 0.1 GB
|
||||
|
||||
Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB).
|
||||
|
||||
## Example 1
|
||||
|
||||
|
||||
```ts
|
||||
// NS1:
|
||||
var serverRam = getServerRam("helios");
|
||||
var totalRam = serverRam[0];
|
||||
var ramUsed = serverRam[1];
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
|
||||
```ts
|
||||
// NS2:
|
||||
const [totalRam, ramUsed] = ns.getServerRam("helios");
|
||||
```
|
||||
|
@ -108,7 +108,6 @@ export async function main(ns) {
|
||||
| [getServerMinSecurityLevel(host)](./bitburner.ns.getserverminsecuritylevel.md) | Returns the minimum security level of the target server. |
|
||||
| [getServerMoneyAvailable(host)](./bitburner.ns.getservermoneyavailable.md) | Get money available on a server. |
|
||||
| [getServerNumPortsRequired(host)](./bitburner.ns.getservernumportsrequired.md) | Returns the number of open ports required to successfully run NUKE.exe on the specified server. |
|
||||
| [getServerRam(host)](./bitburner.ns.getserverram.md) | |
|
||||
| [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. |
|
||||
| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. |
|
||||
| [getServerUsedRam(host)](./bitburner.ns.getserverusedram.md) | Get the used RAM on a server. |
|
||||
|
@ -9,11 +9,7 @@ Hire an employee.
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hireEmployee(
|
||||
divisionName: string,
|
||||
city: CityName | `${CityName}`,
|
||||
employeePosition?: CorpEmployeePosition,
|
||||
): boolean;
|
||||
hireEmployee(divisionName: string, city: CityName | `${CityName}`, employeePosition?: CorpEmployeePosition): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
@ -1,39 +0,0 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getAugmentationCost](./bitburner.singularity.getaugmentationcost.md)
|
||||
|
||||
## Singularity.getAugmentationCost() method
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> use getAugmentationPrice getAugmentationRepReq
|
||||
>
|
||||
|
||||
Get the price and reputation of an augmentation.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
getAugmentationCost(augName: string): [number, number];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| augName | string | Name of Augmentation. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
\[number, number\]
|
||||
|
||||
Array with first element as a reputation requirement and second element as the money cost.
|
||||
|
||||
## Remarks
|
||||
|
||||
RAM cost: 5 GB \* 16/4/1
|
||||
|
||||
This function returns an array with two elements that gives the cost for the specified Augmentation. The first element in the returned array is the reputation requirement of the Augmentation, and the second element is the money cost.
|
||||
|
||||
If an invalid Augmentation name is passed in for the augName argument, this function will return the array \[-1, -1\].
|
||||
|
@ -31,7 +31,6 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
|
||||
| [exportGame()](./bitburner.singularity.exportgame.md) | Backup game save. |
|
||||
| [exportGameBonus()](./bitburner.singularity.exportgamebonus.md) | Returns Backup save bonus availability. |
|
||||
| [getAugmentationBasePrice(augName)](./bitburner.singularity.getaugmentationbaseprice.md) | Get base price of an augmentation. |
|
||||
| [getAugmentationCost(augName)](./bitburner.singularity.getaugmentationcost.md) | Get the price and reputation of an augmentation. |
|
||||
| [getAugmentationPrereq(augName)](./bitburner.singularity.getaugmentationprereq.md) | Get the pre-requisite of an augmentation. |
|
||||
| [getAugmentationPrice(augName)](./bitburner.singularity.getaugmentationprice.md) | Get price of an augmentation. |
|
||||
| [getAugmentationRepReq(augName)](./bitburner.singularity.getaugmentationrepreq.md) | Get reputation requirement of an augmentation. |
|
||||
|
@ -30,3 +30,5 @@ RAM cost: 4 GB
|
||||
|
||||
Return a person object for this sleeve
|
||||
|
||||
storedCycles is the amount of Bonus Time in cycles, each translates to 200ms
|
||||
|
||||
|
@ -16,7 +16,8 @@ interface SleevePerson extends Person
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [memory](./bitburner.sleeveperson.memory.md) | number | |
|
||||
| [shock](./bitburner.sleeveperson.shock.md) | number | |
|
||||
| [sync](./bitburner.sleeveperson.sync.md) | number | |
|
||||
| [memory](./bitburner.sleeveperson.memory.md) | number | Number 1-100 initial Value of sync on BN start |
|
||||
| [shock](./bitburner.sleeveperson.shock.md) | number | Number 0-100 Experience earned and shared is multiplied with shock% before sync% |
|
||||
| [storedCycles](./bitburner.sleeveperson.storedcycles.md) | number | Number of 200ms cycles which are stored as bonus time |
|
||||
| [sync](./bitburner.sleeveperson.sync.md) | number | Number 1-100 Experience earned by this sleeve and shared with the player is multiplied with sync% after shock% |
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
## SleevePerson.memory property
|
||||
|
||||
Number 1-100 initial Value of sync on BN start
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
## SleevePerson.shock property
|
||||
|
||||
Number 0-100 Experience earned and shared is multiplied with shock% before sync%
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
|
13
markdown/bitburner.sleeveperson.storedcycles.md
Normal file
13
markdown/bitburner.sleeveperson.storedcycles.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [SleevePerson](./bitburner.sleeveperson.md) > [storedCycles](./bitburner.sleeveperson.storedcycles.md)
|
||||
|
||||
## SleevePerson.storedCycles property
|
||||
|
||||
Number of 200ms cycles which are stored as bonus time
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
storedCycles: number;
|
||||
```
|
@ -4,6 +4,8 @@
|
||||
|
||||
## SleevePerson.sync property
|
||||
|
||||
Number 1-100 Experience earned by this sleeve and shared with the player is multiplied with sync% after shock%
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
|
@ -1959,7 +1959,7 @@ export class Bladeburner {
|
||||
if (this.action.type !== ActionTypes["Idle"]) {
|
||||
let msg = "Your Bladeburner action was cancelled because you started doing something else.";
|
||||
if (this.automateEnabled) {
|
||||
msg += `<br /><br />Your automation was disabled as well. You will have to re-enable it through the Bladeburner console`;
|
||||
msg += `\n\nYour automation was disabled as well. You will have to re-enable it through the Bladeburner console`;
|
||||
this.automateEnabled = false;
|
||||
}
|
||||
if (!Settings.SuppressBladeburnerPopup) {
|
||||
|
@ -89,7 +89,7 @@ export const CONSTANTS: {
|
||||
LatestUpdate: string;
|
||||
} = {
|
||||
VersionString: "2.2.0",
|
||||
VersionNumber: 27,
|
||||
VersionNumber: 28,
|
||||
|
||||
// Speed (in ms) at which the main loop is updated
|
||||
_idleSpeed: 200,
|
||||
@ -232,22 +232,46 @@ export const CONSTANTS: {
|
||||
Donations: 41,
|
||||
|
||||
LatestUpdate: `
|
||||
v2.2.0 - 2022-12-21
|
||||
v2.2.0 - Jan 2 2023 Development Reboot
|
||||
|
||||
BREAKING CHANGES:
|
||||
Dev notes
|
||||
* The previous main developer, hydroflame, is stepping back from this project for the foreseeable future.
|
||||
To facilitate this, we've moved the repo to a new location at https://github.com/bitburner-official/bitburner-src
|
||||
* Sorry for the large number of API breaks in this version. To ease the pain here, attempting to use any of the
|
||||
removed functions will provide an error guiding you to the new replacement function to use instead.
|
||||
|
||||
BREAKING API CHANGES:
|
||||
* (ns2 only) ns functions use the 'this' value from ns: if you move the function to its own variable off of ns, it
|
||||
needs to be bound to ns. e.g.:
|
||||
const tprint1 = ns.tprint; // This doesn't work and will error out when calling tprint1();
|
||||
const tprint = ns.tprint.bind(ns); // This works because the 'this' value is preserved.
|
||||
The internal changes that make this necessary led to very large performance gains for running many scripts at once.
|
||||
* ns.getPlayer no longer provides properties tor, inBladeburner, or hasCorporation. This information can be looked
|
||||
up using standlone functions: ns.hasTorRouter(), ns.bladeburner.inBladeburner(), ns.corporation.hasCorporation().
|
||||
* (NS2 only) ns functions use the this value from ns: if you move the function to its own variable off of ns, it
|
||||
needs to be bound to ns. e.g.:
|
||||
const tprint = ns.tprint.bind(ns);
|
||||
* ns.formulas.work.classGains removed, replaced with ns.formulas.work.universityGains and ns.formulas.work.gymGains
|
||||
* ns.sleeve.getSleeveStats and ns.sleeve.getSleeveInformation removed, ns.sleeve.getSleeve added and the returned
|
||||
sleeve can be used with formulas API the same way the getPlayer return can be.
|
||||
* ns.corporation.getEmployee and ns.corporation.assignJob have been removed because employees are no longer
|
||||
represented as individual objects internally.
|
||||
* ns.codingcontract.attempt no longer returns a boolean, it returns empty string on failure or the reward string
|
||||
on success, so comparing the result directly to true/false will no longer work. The result can still be used as
|
||||
a condition directly.
|
||||
* Removed many functions, with replacement ways to get the same info.
|
||||
getServerRam: use getServerMaxRam and getServerUsedRam instead.
|
||||
corporation.assignJob: use setAutoJobAssignment instead.
|
||||
corporation.getEmployee: No longer available (employees are not individual objects).
|
||||
corporation.getExpandCityCost: use ns.corporation.getConstants().officeInitialCost
|
||||
corporation.getExpandIndustryCost: use getIndustryData instead.
|
||||
corporation.getIndustryTypes: use ns.corporation.getConstants().industryNames
|
||||
corporation.getMaterialNames: use ns.corporation.getConstants().materialNames
|
||||
corporation.getPurchaseWarehouseCost: use ns.corporation.getConstants().warehouseInitialCost
|
||||
corporation.getResearchNames: use ns.corporation.getConstants().researchNames
|
||||
corporation.getUnlockables: use ns.corporation.getConstants().unlockNames
|
||||
corporation.getUpgradeNames: use ns.corporation.getConstants().upgradeNames
|
||||
formulas.work.classGains: split into universityGains and gymGains
|
||||
singularity.getAugmentationCost: use getAugmentationPrice and getAugmentationRepReq instead
|
||||
sleeve.getSleeveStats: use getSleeve instead
|
||||
sleeve.getInformation: use getSleeve instead
|
||||
* An error dialog will inform the player of the above API changes if the player tries to use one of the
|
||||
removed functions above.
|
||||
* enums.toast was renamed ToastVariant to provide consistency with internal code.
|
||||
* codingcontract.attempt always returns a string (empty string for a failed attempt). This may break player code
|
||||
if a direct boolean comparison (e.g. 'attemptResult === true') was being made. The string can be used directly as
|
||||
the conditional, because empty string evaluates to false as a boolean.
|
||||
* corporation.getCorporation().divisions now returns an array of division names, instead of division objects. Use
|
||||
corporation.getDivision(name) to get the division info object.
|
||||
|
||||
DEVELOPMENT
|
||||
* Development repo moved to https://github.com/bitburner-official/bitburner-src
|
||||
@ -268,7 +292,7 @@ export const CONSTANTS: {
|
||||
* ns.getPlayer: removed tor, inBladeburner, and hasCorporation properties
|
||||
* Added ns.hasTorRouter() function.
|
||||
-- CODING CONTRACT
|
||||
* ns.codingcontract.attempt always returns a string (@Snarling)
|
||||
* ns.codingcontract.attempt always returns a string. (@Snarling)
|
||||
-- CORPORATION
|
||||
* Removed ns.corporation.getEmployee and ns.corporation.assignJob, due to employees no longer being objects.
|
||||
* Added ns.corporation.hasCorporation();
|
||||
@ -282,6 +306,7 @@ export const CONSTANTS: {
|
||||
* Make ns.writePort synchronous (@Snarling)
|
||||
-- SLEEVE
|
||||
* ns.sleeve.getSleeve added. getPlayer and getSleeve can both be used for formulas. (@Snarling)
|
||||
* getSleeve also includes storedCycles (i.e. bonusTime) (@zerbosh)
|
||||
-- STOCK
|
||||
* ns.stock.getOrganization added for getting org from stock symbol (@SamuraiNinjaGuy)
|
||||
|
||||
@ -294,6 +319,7 @@ export const CONSTANTS: {
|
||||
|
||||
CORPORATION
|
||||
* Remove corp employees as objects (by @Kelenius)
|
||||
* API access is provided automatically if the player is in BN3. (@zerbosh)
|
||||
* Happiness/Energy/Morale trend down even for productive corps (by @Snarling)
|
||||
* Typo fixes in modals to sell materials and products (by @quacksouls)
|
||||
* Reworked MP formula validation to prevent possible save corruption on invalid entry (by @Snarling)
|
||||
@ -311,10 +337,12 @@ export const CONSTANTS: {
|
||||
* Fix broken initializer when manually buying WSE access (by @Snarling)
|
||||
|
||||
TERMINAL
|
||||
* Added changelog command to re-display the changelog dialog.
|
||||
* Connect command will connect to player owned servers from anywhere. (by @Snarling)
|
||||
|
||||
UI
|
||||
* Improve UI performance of sidebar and character overview using memoization (@d0sboots)
|
||||
* Other UI additions / improvements (@Mughur, @d0sboots, probably others)
|
||||
* Fixed spacing of text in Trade for reputation button after Infiltration (by @PyroGenesis)
|
||||
* Fix spacing on ANSI background escape codes (by @Snarling)
|
||||
* Fix several instances where newlines were not being displayed properly (by @quacksouls)
|
||||
@ -335,6 +363,7 @@ export const CONSTANTS: {
|
||||
|
||||
STATS
|
||||
* Fix logic for increasing HP based on defense skill levels (by @mattgarretson)
|
||||
* Fix a bug where HP could be something other than max after a bitnode reset.
|
||||
|
||||
INFILTRATION
|
||||
* Fix SlashGame scaling. (by @Snarling)
|
||||
|
@ -105,7 +105,8 @@ export function removedFunction(version: string, replacement: string, replaceMsg
|
||||
return (ctx: NetscriptContext) => {
|
||||
throw helpers.makeRuntimeErrorMsg(
|
||||
ctx,
|
||||
`Function removed in ${version}. ` + replaceMsg ? replacement : `Please use ${replacement} instead.`,
|
||||
`Function removed in ${version}. ${replaceMsg ? replacement : `Please use ${replacement} instead.`}`,
|
||||
"REMOVED FUNCTION",
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -190,7 +190,6 @@ const singularity = {
|
||||
getOwnedAugmentations: SF4Cost(RamCostConstants.SingularityFn3),
|
||||
getOwnedSourceFiles: SF4Cost(RamCostConstants.SingularityFn3),
|
||||
getAugmentationsFromFaction: SF4Cost(RamCostConstants.SingularityFn3),
|
||||
getAugmentationCost: SF4Cost(RamCostConstants.SingularityFn3),
|
||||
getAugmentationPrereq: SF4Cost(RamCostConstants.SingularityFn3),
|
||||
getAugmentationPrice: SF4Cost(RamCostConstants.SingularityFn3 / 2),
|
||||
getAugmentationBasePrice: SF4Cost(RamCostConstants.SingularityFn3 / 2),
|
||||
@ -486,7 +485,6 @@ export const RamCosts: RamCostTree<NSFull> = {
|
||||
getServerMaxMoney: RamCostConstants.GetServer,
|
||||
getServerGrowth: RamCostConstants.GetServer,
|
||||
getServerNumPortsRequired: RamCostConstants.GetServer,
|
||||
getServerRam: RamCostConstants.GetServer,
|
||||
getServerMaxRam: RamCostConstants.GetServerMaxRam,
|
||||
getServerUsedRam: RamCostConstants.GetServerUsedRam,
|
||||
serverExists: RamCostConstants.GetServer,
|
||||
|
@ -72,7 +72,7 @@ import { Flags } from "./NetscriptFunctions/Flags";
|
||||
import { calculateIntelligenceBonus } from "./PersonObjects/formulas/intelligence";
|
||||
import { CalculateShareMult, StartSharing } from "./NetworkShare/Share";
|
||||
import { recentScripts } from "./Netscript/RecentScripts";
|
||||
import { ExternalAPI, InternalAPI, StampedLayer, wrapAPILayer } from "./Netscript/APIWrapper";
|
||||
import { ExternalAPI, InternalAPI, removedFunction, StampedLayer, wrapAPILayer } from "./Netscript/APIWrapper";
|
||||
import { INetscriptExtra } from "./NetscriptFunctions/Extra";
|
||||
import { ScriptDeath } from "./Netscript/ScriptDeath";
|
||||
import { getBitNodeMultipliers } from "./BitNode/BitNode";
|
||||
@ -1176,18 +1176,6 @@ export const ns: InternalAPI<NSFull> = {
|
||||
helpers.log(ctx, () => `returned ${server.numOpenPortsRequired} for '${server.hostname}'`);
|
||||
return server.numOpenPortsRequired;
|
||||
},
|
||||
getServerRam:
|
||||
(ctx) =>
|
||||
(_hostname): [number, number] => {
|
||||
const hostname = helpers.string(ctx, "hostname", _hostname);
|
||||
helpers.log(ctx, () => `getServerRam is deprecated in favor of getServerMaxRam / getServerUsedRam`);
|
||||
const server = helpers.getServer(ctx, hostname);
|
||||
helpers.log(
|
||||
ctx,
|
||||
() => `returned [${numeralWrapper.formatRAM(server.maxRam)}, ${numeralWrapper.formatRAM(server.ramUsed)}]`,
|
||||
);
|
||||
return [server.maxRam, server.ramUsed];
|
||||
},
|
||||
getServerMaxRam: (ctx) => (_hostname) => {
|
||||
const hostname = helpers.string(ctx, "hostname", _hostname);
|
||||
const server = helpers.getServer(ctx, hostname);
|
||||
@ -1900,6 +1888,10 @@ export const ns: InternalAPI<NSFull> = {
|
||||
flags: Flags,
|
||||
...NetscriptExtra(),
|
||||
};
|
||||
// Object.assign to bypass ts for removedFunctions which have no documentation or ramcost
|
||||
Object.assign(ns, {
|
||||
getServerRam: removedFunction("v2.2.0", "getServerMaxRam and getServerUsedRam"),
|
||||
});
|
||||
|
||||
// add undocumented functions
|
||||
export const wrappedNS = wrapAPILayer({} as ExternalAPI<NSFull>, ns, []);
|
||||
|
@ -866,19 +866,23 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
return Math.round(getCorporation().storedCycles / 5) * 1000;
|
||||
},
|
||||
};
|
||||
// TODO: More removedFunctions entries for old getter functions replaced by getConstants
|
||||
|
||||
// TODO 3.0: Remove these removedFunctions warnings.
|
||||
Object.assign(corpFunctions, {
|
||||
assignJob: removedFunction(
|
||||
"v2.2.0",
|
||||
"Corporation employees no longer exist as separate objects.\nUse corporation.setAutoJobAssignment instead to assign employees to jobs.",
|
||||
"Removed due to employees no longer being objects. Use ns.corporation.setAutoJobAssignment instead.",
|
||||
true,
|
||||
),
|
||||
getEmployee: removedFunction(
|
||||
"v2.2.0",
|
||||
"Corporation employees no longer exist as separate objects and this function no longer has a use.",
|
||||
true,
|
||||
),
|
||||
getDivisionConstants: removedFunction("v2.2.0", "ns.corporation.getIndustryData"),
|
||||
getEmployee: removedFunction("v2.2.0", "Removed due to employees no longer being individual objects.", true),
|
||||
getExpandCityCost: removedFunction("v2.2.0", "corporation.getConstants().officeInitialCost"),
|
||||
getExpandIndustryCost: removedFunction("v2.2.0", "corporation.getIndustryData"),
|
||||
getIndustryTypes: removedFunction("v2.2.0", "corporation.getConstants().industryNames"),
|
||||
getMaterialNames: removedFunction("v2.2.0", "corporation.getConstants().materialNames"),
|
||||
getPurchaseWarehouseCost: removedFunction("v2.2.0", "corporation.getConstants().warehouseInitialCost"),
|
||||
getResearchNames: removedFunction("v2.2.0", "corporation.getConstants().researchNames"),
|
||||
getUnlockables: removedFunction("v2.2.0", "corporation.getConstants().unlockNames"),
|
||||
getUpgradeNames: removedFunction("v2.2.0", "corporation.getConstants().upgradeNames"),
|
||||
});
|
||||
return corpFunctions;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import { calculateHackingTime } from "../Hacking";
|
||||
import { Server } from "../Server/Server";
|
||||
import { netscriptCanHack } from "../Hacking/netscriptCanHack";
|
||||
import { FactionInfos } from "../Faction/FactionInfo";
|
||||
import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper";
|
||||
import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper";
|
||||
import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames";
|
||||
import { enterBitNode } from "../RedPill";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
@ -91,7 +91,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
const singularityAPI: InternalAPI<ISingularity> = {
|
||||
getOwnedAugmentations: (ctx) => (_purchased) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const purchased = !!_purchased;
|
||||
@ -118,13 +118,6 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
|
||||
return getFactionAugmentationsFiltered(faction);
|
||||
},
|
||||
getAugmentationCost: (ctx) => (_augName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const augName = helpers.string(ctx, "augName", _augName);
|
||||
const aug = getAugmentation(ctx, augName);
|
||||
const costs = aug.getCost();
|
||||
return [costs.repCost, costs.moneyCost];
|
||||
},
|
||||
getAugmentationPrereq: (ctx) => (_augName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const augName = helpers.string(ctx, "augName", _augName);
|
||||
@ -1221,4 +1214,11 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return canGetBonus();
|
||||
},
|
||||
};
|
||||
Object.assign(singularityAPI, {
|
||||
getAugmentationCost: removedFunction(
|
||||
"v2.2.0",
|
||||
"singularity.getAugmentationPrice and singularity.getAugmentationRepReq",
|
||||
),
|
||||
});
|
||||
return singularityAPI;
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ export function NetscriptSleeve(): InternalAPI<Sleeve> {
|
||||
// Removed undocumented functions added using Object.assign because typescript.
|
||||
// TODO: Remove these at 3.0
|
||||
Object.assign(sleeveFunctions, {
|
||||
getSleeveStats: removedFunction("2.2.0", "sleeve.getSleeve"),
|
||||
getSleeveInformation: removedFunction("2.2.0", "sleeve.getSleeve"),
|
||||
getSleeveStats: removedFunction("v2.2.0", "sleeve.getSleeve"),
|
||||
getInformation: removedFunction("v2.2.0", "sleeve.getSleeve"),
|
||||
});
|
||||
return sleeveFunctions;
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ function createScamUpdateText(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function createNewUpdateText(): void {
|
||||
function createNewUpdateText() {
|
||||
setTimeout(
|
||||
() =>
|
||||
dialogBoxCreate(
|
||||
@ -769,7 +769,7 @@ function createNewUpdateText(): void {
|
||||
);
|
||||
}
|
||||
|
||||
function createBetaUpdateText(): void {
|
||||
function createBetaUpdateText() {
|
||||
setTimeout(
|
||||
() =>
|
||||
dialogBoxCreate(
|
||||
|
47
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
47
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -2032,26 +2032,6 @@ export interface Singularity {
|
||||
*/
|
||||
getAugmentationPrereq(augName: string): string[];
|
||||
|
||||
/**
|
||||
* Get the price and reputation of an augmentation.
|
||||
* @deprecated use getAugmentationPrice getAugmentationRepReq
|
||||
* @remarks
|
||||
* RAM cost: 5 GB * 16/4/1
|
||||
*
|
||||
*
|
||||
* This function returns an array with two elements that gives the cost for
|
||||
* the specified Augmentation. The first element in the returned array is the
|
||||
* reputation requirement of the Augmentation, and the second element is the
|
||||
* money cost.
|
||||
*
|
||||
* If an invalid Augmentation name is passed in for the augName argument, this
|
||||
* function will return the array [-1, -1].
|
||||
*
|
||||
* @param augName - Name of Augmentation.
|
||||
* @returns Array with first element as a reputation requirement and second element as the money cost.
|
||||
*/
|
||||
getAugmentationCost(augName: string): [number, number];
|
||||
|
||||
/**
|
||||
* Get price of an augmentation.
|
||||
* @remarks
|
||||
@ -5916,33 +5896,6 @@ export interface NS {
|
||||
*/
|
||||
getServerBaseSecurityLevel(host: string): number;
|
||||
|
||||
/**
|
||||
* @deprecated use getServerMaxRam / getServerUsedRam
|
||||
* @remarks
|
||||
* RAM cost: 0.1 GB
|
||||
*
|
||||
* Returns an array with two elements that gives information about a server’s memory (RAM).
|
||||
* The first element in the array is the amount of RAM that the server has total (in GB).
|
||||
* The second element in the array is the amount of RAM that is currently being used on
|
||||
* the server (in GB).
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1:
|
||||
* var serverRam = getServerRam("helios");
|
||||
* var totalRam = serverRam[0];
|
||||
* var ramUsed = serverRam[1];
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS2:
|
||||
* const [totalRam, ramUsed] = ns.getServerRam("helios");
|
||||
* ```
|
||||
* @param host - Host of target server.
|
||||
* @returns Array with total and used memory on the specified server, in GB.
|
||||
*/
|
||||
getServerRam(host: string): [number, number];
|
||||
|
||||
/**
|
||||
* Get the maximum amount of RAM on a server.
|
||||
* @remarks
|
||||
|
@ -33,6 +33,7 @@ import {
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||
|
||||
// TODO: Does every terminal function really need its own file...?
|
||||
import { alias } from "./commands/alias";
|
||||
import { analyze } from "./commands/analyze";
|
||||
import { backdoor } from "./commands/backdoor";
|
||||
@ -73,6 +74,7 @@ import { weaken } from "./commands/weaken";
|
||||
import { wget } from "./commands/wget";
|
||||
import { hash } from "../hash/hash";
|
||||
import { apr1 } from "./commands/apr1";
|
||||
import { changelog } from "./commands/changelog";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
|
||||
export class Terminal {
|
||||
@ -793,6 +795,7 @@ export class Terminal {
|
||||
buy: buy,
|
||||
cat: cat,
|
||||
cd: cd,
|
||||
changelog: changelog,
|
||||
check: check,
|
||||
clear: () => this.clear(),
|
||||
cls: () => this.clear(),
|
||||
|
3
src/Terminal/commands/changelog.ts
Normal file
3
src/Terminal/commands/changelog.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
export const changelog = () => dialogBoxCreate("Most recent changelog info:\n\n" + CONSTANTS.LatestUpdate);
|
@ -14,6 +14,7 @@ import { Flags } from "../NetscriptFunctions/Flags";
|
||||
import { AutocompleteData } from "@nsdefs";
|
||||
import * as libarg from "arg";
|
||||
|
||||
// TODO: this shouldn't be hardcoded in two places with no typechecks to verify equivalence
|
||||
// An array of all Terminal commands
|
||||
const commands = [
|
||||
"alias",
|
||||
@ -21,6 +22,7 @@ const commands = [
|
||||
"backdoor",
|
||||
"cat",
|
||||
"cd",
|
||||
"changelog",
|
||||
"check",
|
||||
"clear",
|
||||
"cls",
|
||||
|
Loading…
Reference in New Issue
Block a user