mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 04:05:46 +01:00
migrate some of formulas
This commit is contained in:
parent
0bee743b47
commit
37845c57c0
@ -3,7 +3,7 @@ v1.0.0 Migration Guide
|
||||
|
||||
In v1.0.0 a few API have been broken.
|
||||
|
||||
migrated:
|
||||
migrated (only for ns2):
|
||||
|
||||
* bladeburner.getActionTime will return milliseconds instead of seconds.
|
||||
* getHackTime will return milliseconds instead of seconds.
|
||||
@ -12,6 +12,7 @@ migrated:
|
||||
* hackAnalyzePercent renamed to hackAnalyze
|
||||
* hackAnalyzePercent will return decimal instead of percentage
|
||||
* hackChance (not formulas.basic.hackChance) renamed to hackAnalyzeChance
|
||||
* formulas.basic is split into formulas.skills and formulas.hacking
|
||||
|
||||
not migrated (require manual changes sometimes):
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,9 +30,11 @@ import {
|
||||
import { Programs } from "../Programs/Programs";
|
||||
|
||||
export interface INetscriptFormulas {
|
||||
basic: {
|
||||
skills: {
|
||||
calculateSkill(exp: any, mult?: any): any;
|
||||
calculateExp(skill: any, mult?: any): any;
|
||||
};
|
||||
hacking: {
|
||||
hackChance(server: any, player: any): any;
|
||||
hackExp(server: any, player: any): any;
|
||||
hackPercent(server: any, player: any): any;
|
||||
@ -72,7 +74,7 @@ export function NetscriptFormulas(
|
||||
}
|
||||
};
|
||||
return {
|
||||
basic: {
|
||||
skills: {
|
||||
calculateSkill: function (exp: any, mult: any = 1): any {
|
||||
checkFormulasAccess("basic.calculateSkill");
|
||||
return calculateSkill(exp, mult);
|
||||
@ -81,6 +83,8 @@ export function NetscriptFormulas(
|
||||
checkFormulasAccess("basic.calculateExp");
|
||||
return calculateExp(skill, mult);
|
||||
},
|
||||
},
|
||||
hacking: {
|
||||
hackChance: function (server: any, player: any): any {
|
||||
checkFormulasAccess("basic.hackChance");
|
||||
return calculateHackingChance(server, player);
|
||||
|
@ -8,6 +8,15 @@ const changes: [RegExp, string][] = [
|
||||
[/ns.bladeburner.getActionTime/g, "((...a)=>ns.bladeburner.getActionTime(...a)/1000)"],
|
||||
[/ns.hackAnalyzePercent/g, "((...a)=>ns.hackAnalyze(...a)*100)"],
|
||||
[/ns.hackChance/g, "ns.hackAnalyzeChance"],
|
||||
[/formulas.basic.calculateSkill/g, "formulas.skills.calculateSkill"],
|
||||
[/formulas.basic.calculateExp/g, "formulas.skills.calculateExp"],
|
||||
[/formulas.basic.hackChance/g, "formulas.hacking.hackChance"],
|
||||
[/formulas.basic.hackExp/g, "formulas.hacking.hackExp"],
|
||||
[/formulas.basic.hackPercent/g, "formulas.hacking.hackPercent"],
|
||||
[/formulas.basic.growPercent/g, "formulas.hacking.growPercent"],
|
||||
[/formulas.basic.hackTime/g, "formulas.hacking.hackTime"],
|
||||
[/formulas.basic.growTime/g, "formulas.hacking.growTime"],
|
||||
[/formulas.basic.weakenTime/g, "formulas.hacking.weakenTime"],
|
||||
];
|
||||
function hasChanges(code: string): boolean {
|
||||
for (const change of changes) {
|
||||
|
Loading…
Reference in New Issue
Block a user