API: Standardize "nextCompletion" promise in tasks (#2687)

This commit is contained in:
catloversg
2026-04-28 13:49:53 +07:00
committed by GitHub
parent ee3014b029
commit 36e1adf2d2
72 changed files with 1750 additions and 364 deletions
+6 -4
View File
@@ -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,
};
}