v1.0.0 changes

This commit is contained in:
Olivier Gagnon 2021-11-09 23:42:36 -05:00
parent b503b8374a
commit c87e9bdf84
9 changed files with 154 additions and 18 deletions

24
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -3,6 +3,65 @@
Changelog
=========
v1.0.0 - 2021-11-10 Breaking the API :( (blame hydroflame)
-----------------------------------------------------------
** Announcement **
* Several API breaks have been implemented, a guide was written to help players migrate.
* Everyone gets 10 free neuroflux level.
** Netscript **
* Fix a bug that would cause RAM to not get recalculated.
* New function: hackAnalyzeSecurity
* New function: growthAnalyzeSecurity
* New function: weakenAnalyze
** Script Editor **
* Sometimes warn you about unawaited infinite loops.
* ns1 functions are now correctly colors in Monokai.
** Programs **
* Formulas.exe is a new program that lets you use the formulas API.
** Corporations **
* Real Estate takes up a tiny bit of room.
* Dividends are now taxes exponentially in certain bitnodes.
* UI displays how many level of each corporation upgrade.
* Fix exploit with going public.
* Employee salary no longer increase.
** Documentation **
* The documentation is now autogenerated into .md files.
It is usable but not yet linked to readthedocs. It's on github.
** Misc. **
* Favor is not internall floating point. Meaning I don't have to save an extra variable.
* Manually starting a Bladeburner action cancels unfocused action.
* Updated description of gang territory to be clearer.
* Hacknet expenses and profit are in different categories.
* Fixed favor equation.
* Toast messages aren't hidden behind work in progress screen.
* Fix bug that made infiltration checkmark look off by one.
* Fix some inconsistency with running files that start or don't start with /
* Can't tail the same window twice.
* Added recovery mode. Hopefully no one will ever have to use it.
* Fix readthedocs
* Programs now give int exp based on time not program.
* Many sing. functions now give int exp.
* Active Scripts page now displays some arguments next to script name.
* Fixed some invisible black text.
* Button colors can be edited.
* Added 2 new colors in the theme editor: background primary and background secondary.
* infiltration uses key instead of keycode so it should work better on non-american keyboards.
* nerf noodle bar.
v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community)
-----------------------------------------------------------

@ -32,4 +32,6 @@ not migrated (require manual changes sometimes):
Upon loading v1.0.0 the game will apply some rules to change everything.
The game never changes a file before making a backup called `BACKUP_filename.ext`, then,
in the script it will change whatever it thinks it should change.
But will prefix the modified line with the original line.
But will prefix the modified line with the original line.
A file called `v1_DETECTED_CHANGES.txt` will point out every file with some possible problem.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
{
"name": "bitburner",
"license": "SEE LICENSE IN license.txt",
"version": "0.58.0",
"version": "1.0.0",
"main": "electron-main.js",
"author": {
"name": "Daniel Xie"

@ -116,7 +116,7 @@ export const CONSTANTS: {
LatestUpdate: string;
} = {
VersionString: "1.0.0",
VersionNumber: 1,
VersionNumber: 2,
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,

@ -18,6 +18,8 @@ import { dialogBoxCreate } from "./ui/React/DialogBox";
import { Reviver, Generic_toJSON, Generic_fromJSON } from "./utils/JSONReviver";
import { save } from "./db";
import { v1APIBreak } from "./utils/v1APIBreak";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { PlayerOwnedAugmentation } from "./Augmentation/PlayerOwnedAugmentation";
/* SaveObject.js
* Defines the object used to save/load games
@ -209,6 +211,22 @@ function evaluateVersionCompatibility(ver: string | number): void {
}
}
v1APIBreak();
ver = 1;
}
if (typeof ver === "number") {
if (ver < 2) {
// Give 10 neuroflux because v1 API break.
const nf = Player.augmentations.find((a) => a.name === AugmentationNames.NeuroFluxGovernor);
if (nf) {
nf.level += 10;
} else {
const nf = new PlayerOwnedAugmentation(AugmentationNames.NeuroFluxGovernor);
nf.level = 10;
Player.augmentations.push(nf);
}
Player.reapplyAllAugmentations(true);
Player.reapplyAllSourceFiles();
}
}
}

@ -1,6 +1,29 @@
import { Player } from "../Player";
import { Script } from "../Script/Script";
import { GetAllServers } from "../Server/AllServers";
const detect: [string, string][] = [
["getHackTime", "returns milliseconds"],
["getGrowTime", "returns milliseconds"],
["getWeakenTime", "returns milliseconds"],
["getActionTime", "returns milliseconds"],
["hackAnalyzePercent", "renamed 'hackAnalyze' and returns decimal"],
["hackChance", "renamed 'hackAnalyzeChance'"],
["basic.calculateSkill", "renamed 'skills.calculateSkill'"],
["basic.calculateExp", "renamed 'skills.calculateExp'"],
["basic.hackChance", "renamed 'hacking.hackChance'"],
["basic.hackExp", "renamed 'hacking.hackExp'"],
["basic.hackPercent", "renamed 'hacking.hackPercent'"],
["basic.growPercent", "renamed 'hacking.growPercent'"],
["basic.hackTime", "renamed 'hacking.hackTime'"],
["basic.growTime", "renamed 'hacking.growTime'"],
["basic.weakenTime", "renamed 'hacking.weakenTime'"],
["write", "needs to be awaited"],
["scp", "needs to be awaited"],
["sleep", "Can no longer be called simultenaously."],
["hacking_skill", "renamed 'hacking'"],
];
const changes: [RegExp, string][] = [
[/ns.getHackTime/g, "((...a)=>ns.getHackTime(...a)/1000)"],
[/ns.getGrowTime/g, "((...a)=>ns.getGrowTime(...a)/1000)"],
@ -48,6 +71,40 @@ function convert(code: string): string {
export function v1APIBreak(): void {
console.log("Running v1 api migration");
interface IFileLine {
file: string;
line: number;
}
let txt = "";
for (const server of GetAllServers()) {
for (const change of detect) {
const s: IFileLine[] = [];
for (const script of server.scripts) {
const lines = script.code.split("\n");
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes(change[0])) {
s.push({
file: script.filename,
line: i + 1,
});
}
}
}
if (s.length === 0) continue;
txt += `// Detected change ${change[0]}, reason: ${change[1]}` + "\n";
for (const fl of s) {
txt += `${fl.file}:${fl.line}` + "\n";
}
}
}
if (txt !== "") {
const home = Player.getHomeComputer();
home.writeToTextFile("v1_DETECTED_CHANGES.txt", txt);
}
for (const server of GetAllServers()) {
const backups: Script[] = [];
for (const script of server.scripts) {