Rewrite hero resource action

try to detect hero village before balancing
This commit is contained in:
2020-04-11 13:46:10 +03:00
parent 8e8b358b91
commit 2d9c3f94e7
12 changed files with 279 additions and 76 deletions

View File

@ -3,24 +3,20 @@ import { Task } from '../Storage/TaskQueue';
import { TaskController, registerTask } from './TaskController';
import { GoToPageAction } from '../Action/GoToPageAction';
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
import { GrabVillageResourcesAction } from '../Action/GrabVillageResourcesAction';
import { BalanceHeroResourcesAction } from '../Action/BalanceHeroResourcesAction';
import { path } from '../utils';
import { GoToHeroVillageAction } from '../Action/GoToHeroVillageAction';
@registerTask
export class BalanceHeroResourcesTask 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'),
}),
new Command(GrabVillageResourcesAction.name, args),
new Command(GoToPageAction.name, {
...args,
path: path('/hero.php'),
}),
new Command(GoToHeroVillageAction.name, args),
new Command(BalanceHeroResourcesAction.name, args),
new Command(CompleteTaskAction.name, args),
]);