Improvements
This commit is contained in:
@ -1,7 +0,0 @@
|
||||
import Action from './Action';
|
||||
|
||||
export default class GoToMainAction extends Action {
|
||||
async run(): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
8
src/Action/GoToResourceFieldsAction.ts
Normal file
8
src/Action/GoToResourceFieldsAction.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import Action from './Action';
|
||||
|
||||
export default class GoToResourceFieldsAction extends Action {
|
||||
static NAME = 'go_to_resource_fields';
|
||||
async run(): Promise<any> {
|
||||
window.location.assign('/dorf1.php');
|
||||
}
|
||||
}
|
14
src/Action/StoreRemainingBuildTimeAction.ts
Normal file
14
src/Action/StoreRemainingBuildTimeAction.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import Action from './Action';
|
||||
import { Args } from '../Common';
|
||||
|
||||
export default class StoreRemainingBuildTimeAction extends Action {
|
||||
static NAME = 'store_remaining_build_time';
|
||||
|
||||
async run(args: Args): Promise<any> {
|
||||
const timer = jQuery('.buildDuration .timer');
|
||||
// if (timer.length === 1) {
|
||||
// const remainingSeconds = +timer.val();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,19 +1,26 @@
|
||||
import Action from './Action';
|
||||
import { Args } from '../Common';
|
||||
import { TryLaterError } from '../Errors';
|
||||
import Scheduler from '../Scheduler';
|
||||
|
||||
export default class UpgradeBuildingAction extends Action {
|
||||
static NAME = 'upgrade_building';
|
||||
private scheduler: Scheduler;
|
||||
|
||||
constructor(scheduler: Scheduler) {
|
||||
super();
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
|
||||
async run(args: Args): Promise<any> {
|
||||
const btn = jQuery(
|
||||
'.upgradeButtonsContainer .section1 button.green.build'
|
||||
);
|
||||
if (btn.length === 1) {
|
||||
this.scheduler.completeCurrentTask();
|
||||
btn.trigger('click');
|
||||
} else {
|
||||
console.log('NO UPGRADE BUTTON');
|
||||
throw new TryLaterError(60);
|
||||
throw new TryLaterError(60, 'No upgrade button, try later');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user