diff --git a/markdown/bitburner.codingcontract.createdummycontract.md b/markdown/bitburner.codingcontract.createdummycontract.md index c4405a3ac..620d74695 100644 --- a/markdown/bitburner.codingcontract.createdummycontract.md +++ b/markdown/bitburner.codingcontract.createdummycontract.md @@ -9,7 +9,7 @@ Generate a dummy contract. **Signature:** ```typescript -createDummyContract(type: string): void; +createDummyContract(type: string): string; ``` ## Parameters @@ -20,7 +20,9 @@ createDummyContract(type: string): void; **Returns:** -void +string + +Filename of the contract. ## Remarks diff --git a/src/CodingContractGenerator.ts b/src/CodingContractGenerator.ts index 90c78076c..a346217bc 100644 --- a/src/CodingContractGenerator.ts +++ b/src/CodingContractGenerator.ts @@ -47,13 +47,15 @@ export function generateRandomContractOnHome(): void { serv.addContract(contract); } -export const generateDummyContract = (problemType: string): void => { +export const generateDummyContract = (problemType: string): string => { if (!CodingContractTypes[problemType]) throw new Error(`Invalid problem type: '${problemType}'`); const serv = Player.getHomeComputer(); const contractFn = getRandomFilename(serv); const contract = new CodingContract(contractFn, problemType, null); serv.addContract(contract); + + return contractFn; }; interface IGenerateContractParams { diff --git a/src/NetscriptFunctions/CodingContract.ts b/src/NetscriptFunctions/CodingContract.ts index bd7c8d86f..6b7914e32 100644 --- a/src/NetscriptFunctions/CodingContract.ts +++ b/src/NetscriptFunctions/CodingContract.ts @@ -81,7 +81,7 @@ export function NetscriptCodingContract(): InternalAPI { }, createDummyContract: (ctx) => (_type) => { const type = helpers.string(ctx, "type", _type); - generateDummyContract(type); + return generateDummyContract(type); }, getContractTypes: () => () => codingContractTypesMetadata.map((c) => c.name), }; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 0243ebe5a..8beb590da 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3577,8 +3577,9 @@ export interface CodingContract { * Generate a dummy contract on the home computer with no reward. Used to test various algorithms. * * @param type - Type of contract to generate + * @returns Filename of the contract. */ - createDummyContract(type: string): void; + createDummyContract(type: string): string; /** * List all contract types.