Improve resources to level task
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Args, Command } from '../Command';
|
||||
import { Task } from '../Queue/TaskQueue';
|
||||
import { TaskController, registerTask } from './TaskController';
|
||||
import { TaskController, registerTask, ActionDefinition } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { path } from '../utils';
|
||||
@ -8,15 +8,10 @@ import { UpgradeResourceToLevel } from '../Action/UpgradeResourceToLevel';
|
||||
|
||||
@registerTask
|
||||
export class ResourcesToLevel extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
}),
|
||||
new Command(UpgradeResourceToLevel.name, args),
|
||||
new Command(CompleteTaskAction.name, args),
|
||||
]);
|
||||
defineActions(task: Task): Array<ActionDefinition> {
|
||||
return [
|
||||
[GoToPageAction.name, { path: path('/dorf1.php', { newdid: task.args.villageId }) }],
|
||||
[UpgradeResourceToLevel.name, {}],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user