diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 9d9eef719..098c9dade 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -156,6 +156,7 @@ const singularity: IMap = { getUpgradeHomeCoresCost: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 2), workForCompany: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost), applyToCompany: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost), + quitJob: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost), getCompanyRep: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 3), getCompanyFavor: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 3), getCompanyFavorGain: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 4), diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 9b3e7acc0..c4d4241ec 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -947,6 +947,12 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript } return res; }, + quitJob: (_ctx: NetscriptContext) => + function (_companyName: unknown): void { + _ctx.helper.checkSingularityAccess(); + const companyName = _ctx.helper.string("companyName", _companyName); + player.quitJob(companyName); + }, getCompanyRep: (_ctx: NetscriptContext) => function (_companyName: unknown): number { _ctx.helper.checkSingularityAccess(); diff --git a/src/PersonObjects/IPlayer.ts b/src/PersonObjects/IPlayer.ts index 1341e8c33..05f1f63b0 100644 --- a/src/PersonObjects/IPlayer.ts +++ b/src/PersonObjects/IPlayer.ts @@ -248,7 +248,7 @@ export interface IPlayer { queryStatFromString(str: string): number; getIntelligenceBonus(weight: number): number; getCasinoWinnings(): number; - quitJob(company: string): void; + quitJob(company: string, sing?: boolean): void; hasJob(): boolean; createHacknetServer(): HacknetServer; startCreateProgramWork(programName: string, time: number, reqLevel: number): void; diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index c3d5b8447..e09d8dba3 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -258,7 +258,7 @@ export class PlayerObject implements IPlayer { queryStatFromString: (str: string) => number; getIntelligenceBonus: (weight: number) => number; getCasinoWinnings: () => number; - quitJob: (company: string) => void; + quitJob: (company: string, sing?: boolean) => void; hasJob: () => boolean; process: (router: IRouter, numCycles?: number) => void; createHacknetServer: () => HacknetServer; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index ce336e1a1..ed5711457 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -1869,7 +1869,7 @@ export function getNextCompanyPosition( return entryPosType; } -export function quitJob(this: IPlayer, company: string): void { +export function quitJob(this: IPlayer, company: string, _sing = false): void { if (this.isWorking == true && this.workType.includes("Working for Company") && this.companyName == company) { this.finishWork(true); } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 0a3b34757..f3a2f7fad 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1800,6 +1800,18 @@ export interface Singularity { */ workForCompany(companyName?: string, focus?: boolean): boolean; + /** + * Quit jobs by company. + * @remarks + * RAM cost: 3 GB * 16/4/1 + * + * + * This function will finish work with the company provided and quit any jobs. + * + * @param companyName - Name of the company. + */ + quitJob(companyName?: string): void; + /** * Apply for a job at a company. * @remarks