Add task for building upgrade
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
export default abstract class Action {
|
||||
abstract async run();
|
||||
abstract async run(args);
|
||||
}
|
||||
|
10
src/Action/GoToBuildingAction.ts
Normal file
10
src/Action/GoToBuildingAction.ts
Normal 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;
|
||||
}
|
||||
}
|
17
src/Action/UpgradeBuildingAction.ts
Normal file
17
src/Action/UpgradeBuildingAction.ts
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user