mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 20:37:05 +02:00
API: Standardize "nextCompletion" promise in tasks (#2687)
This commit is contained in:
@@ -8,7 +8,7 @@ import { Money } from "../ui/React/Money";
|
||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||
import { Player } from "@player";
|
||||
import { calculateClassEarnings as calculateClassEarningsRate } from "./Formulas";
|
||||
import { Work, WorkType } from "./Work";
|
||||
import { PlayerBaseWork, WorkType } from "./Work";
|
||||
import { applyWorkStats, newWorkStats, sumWorkStats, WorkStats } from "./WorkStats";
|
||||
import { findEnumMember } from "../utils/helpers/enum";
|
||||
import { isMember } from "../utils/EnumHelper";
|
||||
@@ -78,8 +78,8 @@ interface ClassWorkParams {
|
||||
singularity: boolean;
|
||||
}
|
||||
|
||||
export const isClassWork = (w: Work | null): w is ClassWork => w !== null && w.type === WorkType.CLASS;
|
||||
export class ClassWork extends Work {
|
||||
export const isClassWork = (w: PlayerBaseWork | null): w is ClassWork => w !== null && w.type === WorkType.CLASS;
|
||||
export class ClassWork extends PlayerBaseWork {
|
||||
classType: ClassType;
|
||||
location: LocationName;
|
||||
earnings = newWorkStats();
|
||||
@@ -110,7 +110,7 @@ export class ClassWork extends Work {
|
||||
return false;
|
||||
}
|
||||
|
||||
finish(cancelled: boolean, suppressDialog?: boolean): void {
|
||||
finish(__cancelled: boolean, suppressDialog?: boolean): void {
|
||||
if (!this.singularity && !suppressDialog) {
|
||||
dialogBoxCreate(
|
||||
<>
|
||||
@@ -129,6 +129,7 @@ export class ClassWork extends Work {
|
||||
</>,
|
||||
);
|
||||
}
|
||||
this.resolveNextCompletion();
|
||||
}
|
||||
|
||||
APICopy() {
|
||||
@@ -137,6 +138,7 @@ export class ClassWork extends Work {
|
||||
cyclesWorked: this.cyclesWorked,
|
||||
classType: this.classType,
|
||||
location: this.location,
|
||||
nextCompletion: this.nextCompletion,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user