diff --git a/markdown/bitburner.ns.gettimesincelastaug.md b/markdown/bitburner.ns.gettimesincelastaug.md deleted file mode 100644 index 8b490176c..000000000 --- a/markdown/bitburner.ns.gettimesincelastaug.md +++ /dev/null @@ -1,23 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getTimeSinceLastAug](./bitburner.ns.gettimesincelastaug.md) - -## NS.getTimeSinceLastAug() method - -Returns the amount of time in milliseconds that have passed since you last installed Augmentations. - -**Signature:** - -```typescript -getTimeSinceLastAug(): number; -``` -**Returns:** - -number - -Time in milliseconds that have passed since you last installed Augmentations. - -## Remarks - -RAM cost: 0.05 GB - diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 314d621bd..4e218cec8 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -113,7 +113,6 @@ export async function main(ns) { | [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. | | [getServerUsedRam(host)](./bitburner.ns.getserverusedram.md) | Get the used RAM on a server. | | [getSharePower()](./bitburner.ns.getsharepower.md) | Share power has a multiplicative effect on rep/second while doing work for a faction. Share power increases incrementally for every thread of share running on your server network, but at a sharply decreasing rate. | -| [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. | | [getTotalScriptExpGain()](./bitburner.ns.gettotalscriptexpgain.md) | Get the exp gain of all scripts. | | [getTotalScriptIncome()](./bitburner.ns.gettotalscriptincome.md) | Get the income of all scripts. | | [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. | @@ -137,7 +136,6 @@ export async function main(ns) { | [moveTail(x, y, pid)](./bitburner.ns.movetail.md) | Move a tail window. This function is deprecated and will be removed in a later version. | | [mv(host, source, destination)](./bitburner.ns.mv.md) | Move a file on the target server. | | [nextPortWrite(port)](./bitburner.ns.nextportwrite.md) | Listen for a port write. | -| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number using the numeral library. This function is deprecated and will be removed in a later version. | | [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. | | [peek(portNumber)](./bitburner.ns.peek.md) | Get a copy of the data from a port without popping it. | | [print(args)](./bitburner.ns.print.md) | Prints one or more values or variables to the script’s logs. | diff --git a/markdown/bitburner.ns.nformat.md b/markdown/bitburner.ns.nformat.md deleted file mode 100644 index a5cb1150d..000000000 --- a/markdown/bitburner.ns.nformat.md +++ /dev/null @@ -1,42 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [nFormat](./bitburner.ns.nformat.md) - -## NS.nFormat() method - -> Warning: This API is now obsolete. -> -> Use alternatives: -> -> - NS APIs: ns.formatNumber, ns.formatRam, ns.formatPercent -> -> - JS built-in objects/functions: Intl.NumberFormat, Intl.PluralRules, Intl.Locale, etc. -> - -Format a number using the numeral library. This function is deprecated and will be removed in a later version. - -**Signature:** - -```typescript -nFormat(n: number, format: string): string; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| n | number | Number to format. | -| format | string | Formatting options. See http://numeraljs.com/\#format for valid formats. | - -**Returns:** - -string - -Formatted number. - -## Remarks - -RAM cost: 0 GB - -Converts a number into a string with the specified format options. See http://numeraljs.com/\#format for documentation on format strings supported. - diff --git a/package-lock.json b/package-lock.json index d4a21c73e..dab78a4b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,6 @@ "material-ui-popup-state": "^1.9.3", "monaco-vim": "^0.3.5", "notistack": "^2.0.8", - "numeral": "^2.0.6", "prop-types": "^15.8.1", "react": "^17.0.2", "react-beautiful-dnd": "^13.1.1", @@ -65,7 +64,6 @@ "@types/jest": "^29.5.5", "@types/jquery": "^3.5.22", "@types/lodash": "^4.14.199", - "@types/numeral": "^2.0.3", "@types/react": "^17.0.67", "@types/react-beautiful-dnd": "^13.1.5", "@types/react-dom": "^17.0.21", @@ -5148,12 +5146,6 @@ "@types/node": "*" } }, - "node_modules/@types/numeral": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/numeral/-/numeral-2.0.3.tgz", - "integrity": "sha512-37VDYvFbx/I+Ve1kwcDUq5+qvgNl+uy9YUZhBMJ6YWHBtr2+d6CAgdn4R81NqBlZbTpvLxJOTUhwbki7+90+qQ==", - "dev": true - }, "node_modules/@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -15063,14 +15055,6 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, - "node_modules/numeral": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", - "integrity": "sha512-qaKRmtYPZ5qdw4jWJD6bxEf1FJEqllJrwxCLIm0sQU/A7v2/czigzOb+C2uSiFsa9lBUzeH7M1oK+Q+OLxL3kA==", - "engines": { - "node": "*" - } - }, "node_modules/nwsapi": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", diff --git a/package.json b/package.json index d174271a2..e0b60f18e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "material-ui-popup-state": "^1.9.3", "monaco-vim": "^0.3.5", "notistack": "^2.0.8", - "numeral": "^2.0.6", "prop-types": "^15.8.1", "react": "^17.0.2", "react-beautiful-dnd": "^13.1.1", @@ -66,7 +65,6 @@ "@types/jest": "^29.5.5", "@types/jquery": "^3.5.22", "@types/lodash": "^4.14.199", - "@types/numeral": "^2.0.3", "@types/react": "^17.0.67", "@types/react-beautiful-dnd": "^13.1.5", "@types/react-dom": "^17.0.21", diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 092056bb1..57f7fcc66 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -602,9 +602,7 @@ export const RamCosts: RamCostTree = { formatNumber: 0, formatRam: 0, formatPercent: 0, - nFormat: 0, tFormat: 0, - getTimeSinceLastAug: RamCostConstants.GetHackTime, prompt: 0, wget: 0, getFavorToDonate: RamCostConstants.GetFavorToDonate, diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 093f2acba..da443304d 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -97,7 +97,6 @@ import { ScriptDeath } from "./Netscript/ScriptDeath"; import { getBitNodeMultipliers } from "./BitNode/BitNode"; import { assert, assertArray, assertString, assertObject } from "./utils/TypeAssertion"; import { escapeRegExp } from "lodash"; -import numeral from "numeral"; import { clearPort, peekPort, portHandle, readPort, tryWritePort, writePort, nextPortWrite } from "./NetscriptPort"; import { FilePath, resolveFilePath } from "./Paths/FilePath"; import { hasScriptExtension } from "./Paths/ScriptFilePath"; @@ -106,7 +105,7 @@ import { ContentFilePath } from "./Paths/ContentFile"; import { hasContractExtension } from "./Paths/ContractFilePath"; import { getRamCost } from "./Netscript/RamCostGenerator"; import { getEnumHelper } from "./utils/EnumHelper"; -import { setDeprecatedProperties, deprecationWarning } from "./utils/DeprecationHelper"; +import { deprecationWarning } from "./utils/DeprecationHelper"; import { ServerConstants } from "./Server/data/Constants"; import { assertFunctionWithNSContext } from "./Netscript/TypeAssertion"; import { Router } from "./ui/GameRoot"; @@ -1637,30 +1636,11 @@ export const ns: InternalAPI = { const multStart = helpers.number(ctx, "multStart", _multStart); return formatPercent(n, fractionalDigits, multStart); }, - // Todo: Remove function for real though in 2.4. Until then it just directly wraps numeral. - nFormat: (ctx) => (_n, _format) => { - deprecationWarning( - "ns.nFormat", - "Use ns.formatNumber, ns.formatRam, ns.formatPercent, or JS built-in objects/functions (e.g., Intl namespace) instead. " + - "Check the NS API documentation for details.", - ); - const n = helpers.number(ctx, "n", _n); - const format = helpers.string(ctx, "format", _format); - return numeral(n).format(format); - }, tFormat: (ctx) => (_milliseconds, _milliPrecision) => { const milliseconds = helpers.number(ctx, "milliseconds", _milliseconds); const milliPrecision = !!_milliPrecision; return convertTimeMsToTimeElapsedString(milliseconds, milliPrecision); }, - getTimeSinceLastAug: () => () => { - deprecationWarning( - "ns.getTimeSinceLastAug()", - "Use `Date.now() - ns.getResetInfo().lastAugReset` instead. Please note that ns.getResetInfo().lastAugReset does NOT return the " + - "same value as ns.getTimeSinceLastAug(). Check the NS API documentation for details.", - ); - return Player.playtimeSinceLastAug; - }, alert: (ctx) => (_message) => { const message = helpers.string(ctx, "message", _message); dialogBoxCreate(message, { html: true, canBeDismissedEasily: true }); @@ -1769,23 +1749,6 @@ export const ns: InternalAPI = { entropy: Player.entropy, karma: Player.karma, }; - setDeprecatedProperties(data, { - playtimeSinceLastAug: { - identifier: "ns.getPlayer().playtimeSinceLastAug", - message: "Use ns.getResetInfo().lastAugReset instead. This is a static timestamp instead of an elapsed time.", - value: Player.playtimeSinceLastAug, - }, - playtimeSinceLastBitnode: { - identifier: "ns.getPlayer().playtimeSinceLastBitnode", - message: "Use ns.getResetInfo().lastNodeReset instead. This is a static timestamp instead of an elapsed time.", - value: Player.playtimeSinceLastBitnode, - }, - bitNodeN: { - identifier: "ns.getPlayer().bitNodeN", - message: "Use ns.getResetInfo().currentNode instead", - value: Player.bitNodeN, - }, - }); return data; }, getMoneySources: () => () => ({ @@ -1870,6 +1833,14 @@ export const ns: InternalAPI = { // Removed functions setRemovedFunctions(ns, { getServerRam: { version: "2.2.0", replacement: "getServerMaxRam and getServerUsedRam" }, + nFormat: { + version: "3.0.0", + replacement: "ns.formatNumber, ns.formatRam, ns.formatPercent, or JS built-in objects/functions", + }, + getTimeSinceLastAug: { + version: "3.0.0", + replacement: "Date.now() - ns.getResetInfo().lastAugReset", + }, }); export function NetscriptFunctions(ws: WorkerScript): NSFull { diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index e3fd3ba41..6630e3257 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -7,7 +7,6 @@ import { Warehouse } from "../Corporation/Warehouse"; import { Division } from "../Corporation/Division"; import { Corporation, CorporationPromise } from "../Corporation/Corporation"; import { omit } from "lodash"; -import { setDeprecatedProperties } from "../utils/DeprecationHelper"; import { Corporation as NSCorporation, Division as NSDivision, @@ -711,13 +710,6 @@ export function NetscriptCorporation(): InternalAPI { divisions: [...corporation.divisions.keys()], valuation: corporation.valuation, }; - setDeprecatedProperties(data, { - state: { - identifier: "ns.corporation.getCorporation().state", - message: "Use ns.corporation.getCorporation().nextState instead.", - value: corporation.state.nextName, - }, - }); return data; }, hasUnlock: (ctx) => (_unlockName) => { diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 37284f6c9..bff00f809 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -7962,14 +7962,6 @@ export interface NS { */ getScriptExpGain(script: string, host: string, ...args: ScriptArg[]): number; - /** - * Returns the amount of time in milliseconds that have passed since you last installed Augmentations. - * - * @remarks RAM cost: 0.05 GB - * @returns Time in milliseconds that have passed since you last installed Augmentations. - */ - getTimeSinceLastAug(): number; - /** * Format a string. * @@ -8057,29 +8049,6 @@ export interface NS { */ formatPercent(n: number, fractionalDigits?: number, suffixStart?: number): string; - /** - * Format a number using the numeral library. This function is deprecated and will be removed in a later version. - * - * @deprecated - * - * Use alternatives: - * - * - NS APIs: ns.formatNumber, ns.formatRam, ns.formatPercent - * - * - JS built-in objects/functions: Intl.NumberFormat, Intl.PluralRules, Intl.Locale, etc. - * - * @remarks - * RAM cost: 0 GB - * - * Converts a number into a string with the specified format options. - * See http://numeraljs.com/#format for documentation on format strings supported. - * - * @param n - Number to format. - * @param format - Formatting options. See http://numeraljs.com/#format for valid formats. - * @returns Formatted number. - */ - nFormat(n: number, format: string): string; - /** * Format time to a readable string. * @remarks diff --git a/src/utils/APIBreaks/2.6.1.ts b/src/utils/APIBreaks/2.6.1.ts index c7692f407..3a580d1e7 100644 --- a/src/utils/APIBreaks/2.6.1.ts +++ b/src/utils/APIBreaks/2.6.1.ts @@ -2,19 +2,20 @@ import { APIBreakInfo } from "./APIBreak"; export const breakInfos261: APIBreakInfo[] = [ { - brokenFunctions: ["ns.bladeburner.getCurrentAction"], + brokenAPIs: [{ name: "ns.bladeburner.getCurrentAction" }], info: "ns.bladeburner.getCurrentAction:\n" + 'When not performing a bladeburner action, previously returned {type: "Idle", name: ""}, now returns null.\n' + "Because of this change, the null case now needs to be dealt with prior to accessing properties on the return of getCurrentAction, including destructuring.\n" + "Additionally, any existing code for filtering out the Idle case will need to be adjusted.\n\n" + "See https://github.com/bitburner-official/bitburner-src/issues/1249 or PR https://github.com/bitburner-official/bitburner-src/pull/1248 for more details.", + showPopUp: true, }, { - brokenFunctions: [ - "ns.bladeburner.getActionCountRemaining", - "ns.bladeburner.getActionEstimatedSuccessChance", - "ns.bladeburner.getActionTime", + brokenAPIs: [ + { name: "ns.bladeburner.getActionCountRemaining" }, + { name: "ns.bladeburner.getActionEstimatedSuccessChance" }, + { name: "ns.bladeburner.getActionTime" }, ], info: "ns.bladeburner.getActionCountRemaining:\n" + @@ -25,5 +26,6 @@ export const breakInfos261: APIBreakInfo[] = [ 'Previously returned -1 when called with type "Idle" and name "". This is no longer valid usage and will result in an error.\n\n' + "See the related changes for ns.bladeburner.getCurrentAction, which were shown earlier in these API break details.\n" + "In most cases, the fixes for ns.bladeburner.getCurrentAction will fix this group of issues as well.", + showPopUp: true, }, ]; diff --git a/src/utils/APIBreaks/3.0.0.ts b/src/utils/APIBreaks/3.0.0.ts new file mode 100644 index 000000000..837721b44 --- /dev/null +++ b/src/utils/APIBreaks/3.0.0.ts @@ -0,0 +1,63 @@ +import { APIBreakInfo } from "./APIBreak"; + +export const breakInfos300: APIBreakInfo[] = [ + { + brokenAPIs: [{ name: "ns.nFormat" }], + info: + "ns.nFormat() was removed.\n" + + "Use ns.formatNumber, ns.formatRam, ns.formatPercent, or JS built-in objects/functions (e.g., Intl.NumberFormat, " + + "Intl.PluralRules, Intl.Locale) instead.", + showPopUp: true, + }, + { + brokenAPIs: [ + { + name: "ns.getTimeSinceLastAug", + migration: { + searchValue: "ns.getTimeSinceLastAug()", + replaceValue: "(Date.now() - ns.getResetInfo().lastAugReset)", + }, + }, + { + name: "ns.getPlayer().playtimeSinceLastAug", + migration: { + searchValue: "ns.getPlayer().playtimeSinceLastAug", + replaceValue: "(Date.now() - ns.getResetInfo().lastAugReset)", + }, + }, + { + name: "ns.getPlayer().playtimeSinceLastBitnode", + migration: { + searchValue: "ns.getPlayer().playtimeSinceLastBitnode", + replaceValue: "(Date.now() - ns.getResetInfo().lastNodeReset)", + }, + }, + { + name: "ns.getPlayer().bitNodeN", + migration: { + searchValue: "ns.getPlayer().bitNodeN", + replaceValue: "ns.getResetInfo().currentNode", + }, + }, + { + name: "ns.corporation.getCorporation().state", + migration: { + searchValue: "ns.corporation.getCorporation().state", + replaceValue: "ns.corporation.getCorporation().nextState", + }, + }, + ], + info: + "ns.getTimeSinceLastAug was removed.\n" + + 'It has been automatically replaced with "Date.now() - ns.getResetInfo().lastAugReset".\n\n' + + "ns.getPlayer().playtimeSinceLastAug was removed.\n" + + 'It has been automatically replaced with "Date.now() - ns.getResetInfo().lastAugReset".\n\n' + + "ns.getPlayer().playtimeSinceLastBitnode was removed.\n" + + 'It has been automatically replaced with "Date.now() - ns.getResetInfo().lastNodeReset".\n\n' + + "ns.getPlayer().bitNodeN was removed.\n" + + 'It has been automatically replaced with "ns.getResetInfo().currentNode"\n\n' + + "ns.corporation.getCorporation().state was removed.\n" + + 'It has been automatically replaced with "ns.corporation.getCorporation().nextState"', + showPopUp: false, + }, +]; diff --git a/src/utils/APIBreaks/APIBreak.ts b/src/utils/APIBreaks/APIBreak.ts index 8eef9d0ed..640b93f2e 100644 --- a/src/utils/APIBreaks/APIBreak.ts +++ b/src/utils/APIBreaks/APIBreak.ts @@ -10,7 +10,8 @@ import { Terminal } from "../../Terminal"; import { pluralize } from "../I18nUtils"; // Temporary until fixing alerts manager to store alerts outside of react scope -const dialogBoxCreate = (text: string) => setTimeout(() => dialogBoxCreateOriginal(text), 2000); +const dialogBoxCreate = (text: string) => + setTimeout(() => dialogBoxCreateOriginal(text, { html: false, canBeDismissedEasily: false }), 2000); /** For a single server, map of script filepath to an array of line numbers where impacted functions were detected */ type ScriptImpactMap = Map; @@ -20,44 +21,74 @@ type ImpactMap = Map; export interface APIBreakInfo { /** The API functions impacted by the API break */ - brokenFunctions: string[]; + brokenAPIs: { + name: string; + migration?: { + /** We may need to use a custom search value instead of name */ + searchValue: string | RegExp; + replaceValue: string; + }; + }[]; /** Info that should be shown to the player, alongside the list of impacted scripts */ info: string; + /** If broken APIs can be safely migrated, we can skip displaying the notification popup */ + showPopUp: boolean; } -function getImpactedLines(script: Script, brokenFunctions: string[]): number[] | null { +function detectImpactAndMigrateLines(script: Script, brokenFunctions: APIBreakInfo["brokenAPIs"]): number[] | null { const impactedLines: number[] = []; - script.content.split("\n").forEach((line, i) => { + const lines = script.content.split("\n"); + for (let i = 0; i < lines.length; ++i) { for (const brokenFunction of brokenFunctions) { - if (line.includes(brokenFunction)) return impactedLines.push(i + 1); + if (!lines[i].includes(brokenFunction.name)) { + continue; + } + impactedLines.push(i + 1); + if (brokenFunction.migration) { + lines[i] = lines[i].replaceAll(brokenFunction.migration.searchValue, brokenFunction.migration.replaceValue); + } } - }); + } + script.content = lines.join("\n"); return impactedLines.length ? impactedLines : null; } -/** Returns a map keyed by all ser */ -function getImpactMap(brokenFunctions: string[]): ImpactMap | null { +/** Returns a map keyed by hostname */ +function detectImpactAndMigrate(brokenFunctions: APIBreakInfo["brokenAPIs"]): ImpactMap | null { const returnMap = new Map(); for (const server of GetAllServers()) { const impactedScripts = new Map(); for (const [filename, script] of server.scripts) { - const impactedLines = getImpactedLines(script, brokenFunctions); - if (impactedLines) impactedScripts.set(filename, impactedLines); + const impactedLines = detectImpactAndMigrateLines(script, brokenFunctions); + if (impactedLines) { + impactedScripts.set(filename, impactedLines); + } + } + if (impactedScripts.size) { + returnMap.set(server.hostname, impactedScripts); } - if (impactedScripts.size) returnMap.set(server.hostname, impactedScripts); } return returnMap.size ? returnMap : null; } /** Show the player a dialog for their API breaks, and save an info file for the player to review later */ export function showAPIBreaks(version: string, ...breakInfos: APIBreakInfo[]) { - const details = []; + const details: { + text: string; + showPopUp: boolean; + }[] = []; + let numberOfPopUps = 0; for (const breakInfo of breakInfos) { - const impactMap = getImpactMap(breakInfo.brokenFunctions); - if (!impactMap) continue; - details.push( - breakInfo.info + - `\n\nUsage of the following functions may have been affected:\n${breakInfo.brokenFunctions.join("\n")}\n\n` + + const impactMap = detectImpactAndMigrate(breakInfo.brokenAPIs); + if (!impactMap) { + continue; + } + details.push({ + text: + breakInfo.info + + `\n\nUsage of the following functions may have been affected:\n${breakInfo.brokenAPIs + .map((func) => func.name) + .join("\n")}\n\n` + [...impactMap] .map( ([hostname, scriptImpactMap]) => @@ -72,14 +103,22 @@ export function showAPIBreaks(version: string, ...breakInfos: APIBreakInfo[]) { .join("\n"), ) .join("\n\n"), - ); + showPopUp: breakInfo.showPopUp, + }); + if (breakInfo.showPopUp) { + ++numberOfPopUps; + } + } + if (!details.length) { + return; } - if (!details.length) return; const textFileName = resolveTextFilePath(`APIBreakInfo-${version}.txt`); - if (!textFileName) throw new Error("Version string created an invalid API break file name"); + if (!textFileName) { + throw new Error("Version string created an invalid API break file name"); + } Player.getHomeComputer().writeToTextFile( textFileName, - `API BREAK INFO FOR ${version}\n\n${details.join("\n\n\n\n")}`, + `API BREAK INFO FOR ${version}\n\n${details.map((detail) => detail.text).join("\n\n\n\n")}`, ); Terminal.warn(`AN API BREAK FROM VERSION ${version} MAY HAVE AFFECTED SOME OF YOUR SCRIPTS.`); Terminal.warn(`INFORMATION ABOUT THIS POTENTIAL IMPACT HAS BEEN LOGGED IN ${textFileName} ON YOUR HOME COMPUTER.`); @@ -88,7 +127,12 @@ export function showAPIBreaks(version: string, ...breakInfos: APIBreakInfo[]) { "The following dialog boxes will provide details of the potential impact to your scripts.\n" + `A file with these details has also been saved on your home computer under filename ${textFileName}.`, ); - details.forEach((detail, i) => { - dialogBoxCreate(`API BREAK VERSION ${version} DETAILS ${i + 1} of ${details.length}\n\n${detail}`); - }); + let popUpIndex = 0; + for (const detail of details) { + if (!detail.showPopUp) { + continue; + } + dialogBoxCreate(`API BREAK VERSION ${version} DETAILS ${popUpIndex + 1} of ${numberOfPopUps}\n\n${detail.text}`); + ++popUpIndex; + } } diff --git a/src/utils/SaveDataMigrationUtils.ts b/src/utils/SaveDataMigrationUtils.ts index bc2ead554..e12eab109 100644 --- a/src/utils/SaveDataMigrationUtils.ts +++ b/src/utils/SaveDataMigrationUtils.ts @@ -30,6 +30,7 @@ import { exportMaterial } from "../Corporation/Actions"; import { getGoSave, loadGo } from "../Go/SaveLoad"; import { showAPIBreaks } from "./APIBreaks/APIBreak"; import { breakInfos261 } from "./APIBreaks/2.6.1"; +import { breakInfos300 } from "./APIBreaks/3.0.0"; /** Function for performing a series of defined replacements. See 0.58.0 for usage */ function convert(code: string, changes: [RegExp, string][]): string { @@ -545,4 +546,7 @@ Error: ${e}`, } if (found) Terminal.error("Filenames with whitespace found and corrected, see console for details."); } + if (ver < 44) { + showAPIBreaks("3.0.0", ...breakInfos300); + } }