Add multiple village support
This commit is contained in:
@ -3,18 +3,24 @@ import { Task } from '../Storage/TaskQueue';
|
||||
import { TaskController, registerTask } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { TrainTrooperAction } from '../Action/TrainTrooperAction';
|
||||
import { GrabVillageResourcesAction } from '../Action/GrabVillageResourcesAction';
|
||||
import { BalanceHeroResourcesAction } from '../Action/BalanceHeroResourcesAction';
|
||||
import { path } from '../utils';
|
||||
|
||||
@registerTask
|
||||
export class BalanceHeroResourcesTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.cmd.args, taskId: task.id };
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Command(GoToPageAction.name, { ...args, path: '/dorf1.php' }),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/dorf1.php'),
|
||||
}),
|
||||
new Command(GrabVillageResourcesAction.name, args),
|
||||
new Command(GoToPageAction.name, { ...args, path: 'hero.php' }),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/hero.php'),
|
||||
}),
|
||||
new Command(BalanceHeroResourcesAction.name, args),
|
||||
new Command(CompleteTaskAction.name, args),
|
||||
]);
|
||||
|
@ -6,17 +6,21 @@ import { GrabHeroAttributesAction } from '../Action/GrabHeroAttributesAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { SendOnAdventureAction } from '../Action/SendOnAdventureAction';
|
||||
import { ClickButtonAction } from '../Action/ClickButtonAction';
|
||||
import { path } from '../utils';
|
||||
|
||||
@registerTask
|
||||
export class SendOnAdventureTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.cmd.args, taskId: task.id };
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Command(GoToPageAction.name, { ...args, path: 'hero.php' }),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/hero.php'),
|
||||
}),
|
||||
new Command(GrabHeroAttributesAction.name, args),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: '/hero.php?t=3',
|
||||
path: path('/hero.php', { t: 3 }),
|
||||
}),
|
||||
new Command(SendOnAdventureAction.name, args),
|
||||
new Command(ClickButtonAction.name, {
|
||||
|
@ -4,13 +4,17 @@ import { TaskController, registerTask } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { TrainTrooperAction } from '../Action/TrainTrooperAction';
|
||||
import { path } from '../utils';
|
||||
|
||||
@registerTask
|
||||
export class TrainTroopTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.cmd.args, taskId: task.id };
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Command(GoToPageAction.name, { ...args, path: '/build.php?id=' + args.buildId }),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId }),
|
||||
}),
|
||||
new Command(TrainTrooperAction.name, args),
|
||||
new Command(CompleteTaskAction.name, args),
|
||||
]);
|
||||
|
@ -5,17 +5,21 @@ import { TaskController, registerTask } from './TaskController';
|
||||
import { GoToPageAction } from '../Action/GoToPageAction';
|
||||
import { CheckBuildingRemainingTimeAction } from '../Action/CheckBuildingRemainingTimeAction';
|
||||
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
|
||||
import { path } from '../utils';
|
||||
|
||||
@registerTask
|
||||
export class UpgradeBuildingTask extends TaskController {
|
||||
async run(task: Task) {
|
||||
const args: Args = { ...task.cmd.args, taskId: task.id };
|
||||
const args: Args = { ...task.args, taskId: task.id };
|
||||
this.scheduler.scheduleActions([
|
||||
new Command(GoToPageAction.name, { ...args, path: '/dorf1.php' }),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: path('/dorf1.php', { newdid: args.villageId }),
|
||||
}),
|
||||
new Command(CheckBuildingRemainingTimeAction.name, args),
|
||||
new Command(GoToPageAction.name, {
|
||||
...args,
|
||||
path: '/build.php?id=' + args.id,
|
||||
path: path('/build.php', { newdid: args.villageId, id: args.buildId }),
|
||||
}),
|
||||
new Command(UpgradeBuildingAction.name, args),
|
||||
new Command(CompleteTaskAction.name, args),
|
||||
|
Reference in New Issue
Block a user