Add village resources view to dashboard

This commit is contained in:
2020-04-16 13:07:26 +03:00
parent 29b55158d6
commit fc75b007c8
14 changed files with 180 additions and 56 deletions

View File

@ -0,0 +1,32 @@
import { Args, Command } from '../Common';
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
import { GoToPageAction } from '../Action/GoToPageAction';
import { path } from '../utils';
import { Task } from '../Storage/TaskQueue';
import { TaskController, registerTask } from './TaskController';
import { grabVillageList } from '../Page/VillageBlock';
import { StoreVillageState } from '../Action/StoreVillageState';
@registerTask
export class GrabVillageState extends TaskController {
async run(task: Task) {
const args: Args = { ...task.args, taskId: task.id };
const actions: Array<Command> = [];
const villages = grabVillageList();
for (let village of villages) {
actions.push(
new Command(GoToPageAction.name, {
...args,
path: path('/dorf1.php', { newdid: village.id }),
})
);
actions.push(new Command(StoreVillageState.name, args));
}
actions.push(new Command(CompleteTaskAction.name, args));
this.scheduler.scheduleActions(actions);
}
}