bitburner-src/src/Programs/Program.ts

27 lines
597 B
TypeScript
Raw Normal View History

export interface IPlayer {
2021-09-05 01:09:30 +02:00
hacking_skill: number;
sourceFiles: any[];
}
export interface IProgramCreate {
2021-09-05 01:09:30 +02:00
level: number;
req(p: IPlayer): boolean; // Function that indicates whether player meets requirements
time: number;
tooltip: string;
}
export class Program {
2021-09-05 01:09:30 +02:00
name = "";
create: IProgramCreate | null;
2021-09-05 01:09:30 +02:00
constructor(name: string, create: IProgramCreate | null) {
this.name = name;
this.create = create;
}
2021-09-05 01:09:30 +02:00
htmlID(): string {
2021-09-09 05:47:34 +02:00
const name = this.name.endsWith(".exe") ? this.name.slice(0, -".exe".length) : this.name;
2021-09-05 01:09:30 +02:00
return "create-program-" + name;
}
}