Change line width
This commit is contained in:
@ -9,11 +9,7 @@ export function registerAction(constructor: Function) {
|
||||
actionMap[constructor.name] = constructor;
|
||||
}
|
||||
|
||||
export function createAction(
|
||||
name: string,
|
||||
state: GameState,
|
||||
scheduler: Scheduler
|
||||
): ActionController | undefined {
|
||||
export function createAction(name: string, state: GameState, scheduler: Scheduler): ActionController | undefined {
|
||||
const storedFunction = actionMap[name];
|
||||
if (storedFunction === undefined) {
|
||||
return undefined;
|
||||
|
@ -10,11 +10,7 @@ export class CheckBuildingRemainingTimeAction extends ActionController {
|
||||
if (timer.length === 1) {
|
||||
const remainingSeconds = Number(timer.attr('value'));
|
||||
if (remainingSeconds > 0) {
|
||||
throw new BuildingQueueFullError(
|
||||
task.id,
|
||||
remainingSeconds + 1,
|
||||
'Building queue is full'
|
||||
);
|
||||
throw new BuildingQueueFullError(task.id, remainingSeconds + 1, 'Building queue is full');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,7 @@ import { ActionError } from '../Errors';
|
||||
@registerAction
|
||||
export class GrabHeroAttributesAction extends ActionController {
|
||||
async run(args: Args, task: Task): Promise<any> {
|
||||
const healthElement = jQuery(
|
||||
'#attributes .attribute.health .powervalue .value'
|
||||
);
|
||||
const healthElement = jQuery('#attributes .attribute.health .powervalue .value');
|
||||
if (healthElement.length !== 1) {
|
||||
throw new ActionError(task.id, 'Health dom element not found');
|
||||
}
|
||||
@ -16,10 +14,7 @@ export class GrabHeroAttributesAction extends ActionController {
|
||||
let normalized = text.replace(/[^0-9]/g, '');
|
||||
const value = Number(normalized);
|
||||
if (isNaN(value)) {
|
||||
throw new ActionError(
|
||||
task.id,
|
||||
`Health value "${text}" (${normalized}) couldn't be converted to number`
|
||||
);
|
||||
throw new ActionError(task.id, `Health value "${text}" (${normalized}) couldn't be converted to number`);
|
||||
}
|
||||
|
||||
this.state.set('hero', { health: value });
|
||||
|
@ -6,16 +6,10 @@ import { Task } from '../Storage/TaskQueue';
|
||||
@registerAction
|
||||
export class UpgradeBuildingAction extends ActionController {
|
||||
async run(args: Args, task: Task): Promise<any> {
|
||||
const btn = jQuery(
|
||||
'.upgradeButtonsContainer .section1 button.green.build'
|
||||
);
|
||||
const btn = jQuery('.upgradeButtonsContainer .section1 button.green.build');
|
||||
|
||||
if (btn.length !== 1) {
|
||||
throw new TryLaterError(
|
||||
task.id,
|
||||
15 * 60,
|
||||
'No upgrade button, try later'
|
||||
);
|
||||
throw new TryLaterError(task.id, 15 * 60, 'No upgrade button, try later');
|
||||
}
|
||||
|
||||
btn.trigger('click');
|
||||
|
Reference in New Issue
Block a user