Improve build tasks
This commit is contained in:
@ -1,29 +1,27 @@
|
||||
import { BuildBuildingAction } from '../Action/BuildBuildingAction';
|
||||
import { CheckBuildingRemainingTimeAction } from '../Action/CheckBuildingRemainingTimeAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { path } from '../utils';
|
||||
import { TaskController, registerTask } from './TaskController';
|
||||
import { Action } from '../Queue/ActionQueue';
|
||||
import { Args } from '../Queue/Args';
|
||||
import { TaskController, registerTask, ActionDefinition } from './TaskController';
|
||||
import { Task } from '../Queue/TaskProvider';
|
||||
|
||||
@registerTask
|
||||
export class BuildBuildingTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Action(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
}),
|
||||
new Action(CheckBuildingRemainingTimeAction.name, args),
|
||||
new Action(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId, category: args.categoryId }),
|
||||
}),
|
||||
new Action(BuildBuildingAction.name, args),
|
||||
new Action(CompleteTaskAction.name, args),
|
||||
]);
|
||||
defineActions(task: Task): Array<ActionDefinition> {
|
||||
const args = task.args;
|
||||
return [
|
||||
[
|
||||
GoToPageAction.name,
|
||||
{
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
},
|
||||
],
|
||||
[
|
||||
GoToPageAction.name,
|
||||
{
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId, category: args.categoryId }),
|
||||
},
|
||||
],
|
||||
[BuildBuildingAction.name],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
import { TaskController, registerTask, ActionDefinition } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { TrainTrooperAction } from '../Action/TrainTrooperAction';
|
||||
import { path } from '../utils';
|
||||
import { Action } from '../Queue/ActionQueue';
|
||||
import { Args } from '../Queue/Args';
|
||||
import { Task } from '../Queue/TaskProvider';
|
||||
import { ResearchAction } from '../Action/ResearchAction';
|
||||
import { ForgeImprovementAction } from '../Action/ForgeImprovementAction';
|
||||
|
||||
@registerTask
|
||||
export class ResearchTask extends TaskController {
|
||||
export class ForgeImprovementTask extends TaskController {
|
||||
defineActions(task: Task): Array<ActionDefinition> {
|
||||
const args = task.args;
|
||||
|
||||
@ -19,6 +15,6 @@ export class ResearchTask extends TaskController {
|
||||
id: args.buildId || undefined,
|
||||
};
|
||||
|
||||
return [[GoToPageAction.name, { ...args, path: path('/build.php', pathArgs) }], [ResearchAction.name]];
|
||||
return [[GoToPageAction.name, { ...args, path: path('/build.php', pathArgs) }], [ForgeImprovementAction.name]];
|
||||
}
|
||||
}
|
@ -1,29 +1,27 @@
|
||||
import { UpgradeBuildingAction } from '../Action/UpgradeBuildingAction';
|
||||
import { TaskController, registerTask } from './TaskController';
|
||||
import { TaskController, registerTask, ActionDefinition } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CheckBuildingRemainingTimeAction } from '../Action/CheckBuildingRemainingTimeAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { path } from '../utils';
|
||||
import { Action } from '../Queue/ActionQueue';
|
||||
import { Args } from '../Queue/Args';
|
||||
import { Task } from '../Queue/TaskProvider';
|
||||
|
||||
@registerTask
|
||||
export class UpgradeBuildingTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Action(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
}),
|
||||
new Action(CheckBuildingRemainingTimeAction.name, args),
|
||||
new Action(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId }),
|
||||
}),
|
||||
new Action(UpgradeBuildingAction.name, args),
|
||||
new Action(CompleteTaskAction.name, args),
|
||||
]);
|
||||
defineActions(task: Task): Array<ActionDefinition> {
|
||||
const args = task.args;
|
||||
return [
|
||||
[
|
||||
GoToPageAction.name,
|
||||
{
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
},
|
||||
],
|
||||
[
|
||||
GoToPageAction.name,
|
||||
{
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId }),
|
||||
},
|
||||
],
|
||||
[UpgradeBuildingAction.name],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user