Add task for building upgrade

This commit is contained in:
2020-03-29 12:27:42 +03:00
parent 5c69dd6a90
commit b525ff0e27
13 changed files with 217 additions and 44 deletions

View File

@ -1,3 +1,3 @@
export default abstract class Action {
abstract async run();
abstract async run(args);
}

View File

@ -0,0 +1,10 @@
import Action from './Action';
export default class GoToBuildingAction extends Action {
static NAME = 'go_to_building';
async run(args): Promise<any> {
window.location.assign('/build.php?id=' + args.id);
return null;
}
}

View File

@ -0,0 +1,17 @@
import Action from './Action';
export default class UpgradeBuildingAction extends Action {
static NAME = 'upgrade_building';
async run(args): Promise<any> {
const btn = jQuery(
'.upgradeButtonsContainer .section1 button.green.build'
);
if (btn.length === 1) {
btn.trigger('click');
} else {
console.log('NO UPGRADE BUTTON');
}
return null;
}
}