Reformat code
This commit is contained in:
@@ -14,7 +14,9 @@ export function clickBuildButton(typeId: number) {
|
||||
btn.trigger('click');
|
||||
}
|
||||
|
||||
export function createBuildButton(onClickHandler: (buildTypeId: number, resources: Resources) => void) {
|
||||
export function createBuildButton(
|
||||
onClickHandler: (buildTypeId: number, resources: Resources) => void
|
||||
) {
|
||||
const $els = jQuery('[id^=contract_building]');
|
||||
$els.each((idx, el) => {
|
||||
const $el = jQuery(el);
|
||||
|
@@ -28,7 +28,11 @@ export function clickCelebrationButton() {
|
||||
$btn.trigger('click');
|
||||
}
|
||||
|
||||
function createCelebrationButton($blockEl: JQuery, idx: number, onClickHandler: CelebrationClickHandler) {
|
||||
function createCelebrationButton(
|
||||
$blockEl: JQuery,
|
||||
idx: number,
|
||||
onClickHandler: CelebrationClickHandler
|
||||
) {
|
||||
const resources = grabResources($blockEl);
|
||||
|
||||
const id = uniqId();
|
||||
|
@@ -24,7 +24,10 @@ export function createSendResourcesButton(onClickHandler: SendResourcesClickHand
|
||||
getNumber(sendSelect.find('#r3').val()),
|
||||
getNumber(sendSelect.find('#r4').val())
|
||||
);
|
||||
const crd = new Coordinates(getNumber(jQuery('#xCoordInput').val()), getNumber(jQuery('#yCoordInput').val()));
|
||||
const crd = new Coordinates(
|
||||
getNumber(jQuery('#xCoordInput').val()),
|
||||
getNumber(jQuery('#yCoordInput').val())
|
||||
);
|
||||
onClickHandler(resources, crd);
|
||||
};
|
||||
|
||||
|
@@ -17,7 +17,9 @@ export function createTrainTroopButtons(
|
||||
return;
|
||||
}
|
||||
const id = uniqId();
|
||||
$el.find('.details').append(`<div style="padding: 8px 0"><a id="${id}" href="#">Обучить</a></div>`);
|
||||
$el.find('.details').append(
|
||||
`<div style="padding: 8px 0"><a id="${id}" href="#">Обучить</a></div>`
|
||||
);
|
||||
const resElement = $el.find('.resourceWrapper .resource');
|
||||
const resources = grabResourcesFromList(resElement);
|
||||
jQuery(`#${id}`).on('click', evt => {
|
||||
|
@@ -10,7 +10,12 @@ import { Resources } from '../Core/Resources';
|
||||
import { Coordinates } from '../Core/Village';
|
||||
import { SendResourcesTask } from '../Task/SendResourcesTask';
|
||||
import { EMBASSY_ID, HORSE_STABLE_ID, PALACE_ID, QUARTERS_ID } from '../Core/Buildings';
|
||||
import { BuildingPageAttributes, isForgePage, isGuildHallPage, isMarketSendResourcesPage } from './PageDetectors';
|
||||
import {
|
||||
BuildingPageAttributes,
|
||||
isForgePage,
|
||||
isGuildHallPage,
|
||||
isMarketSendResourcesPage,
|
||||
} from './PageDetectors';
|
||||
import { createTrainTroopButtons } from './BuildingPage/TrooperPage';
|
||||
import { createSendResourcesButton } from './BuildingPage/MarketPage';
|
||||
import { createResearchButtons } from './BuildingPage/ForgePage';
|
||||
@@ -25,7 +30,11 @@ export class BuildingPageController {
|
||||
private villageController: VillageController;
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(scheduler: Scheduler, attributes: BuildingPageAttributes, villageController: VillageController) {
|
||||
constructor(
|
||||
scheduler: Scheduler,
|
||||
attributes: BuildingPageAttributes,
|
||||
villageController: VillageController
|
||||
) {
|
||||
this.scheduler = scheduler;
|
||||
this.attributes = attributes;
|
||||
this.villageController = villageController;
|
||||
@@ -43,19 +52,27 @@ export class BuildingPageController {
|
||||
}
|
||||
|
||||
if (buildTypeId === QUARTERS_ID) {
|
||||
createTrainTroopButtons((troopId, res, count) => this.onScheduleTrainTroopers(troopId, res, count));
|
||||
createTrainTroopButtons((troopId, res, count) =>
|
||||
this.onScheduleTrainTroopers(troopId, res, count)
|
||||
);
|
||||
}
|
||||
|
||||
if (buildTypeId === HORSE_STABLE_ID) {
|
||||
createTrainTroopButtons((troopId, res, count) => this.onScheduleTrainTroopers(troopId, res, count));
|
||||
createTrainTroopButtons((troopId, res, count) =>
|
||||
this.onScheduleTrainTroopers(troopId, res, count)
|
||||
);
|
||||
}
|
||||
|
||||
if (buildTypeId === EMBASSY_ID && sheetId === 1) {
|
||||
createTrainTroopButtons((troopId, res, count) => this.onScheduleTrainTroopers(troopId, res, count));
|
||||
createTrainTroopButtons((troopId, res, count) =>
|
||||
this.onScheduleTrainTroopers(troopId, res, count)
|
||||
);
|
||||
}
|
||||
|
||||
if (buildTypeId === PALACE_ID && sheetId === 1) {
|
||||
createTrainTroopButtons((troopId, res, count) => this.onScheduleTrainTroopers(troopId, res, count));
|
||||
createTrainTroopButtons((troopId, res, count) =>
|
||||
this.onScheduleTrainTroopers(troopId, res, count)
|
||||
);
|
||||
}
|
||||
|
||||
if (isMarketSendResourcesPage()) {
|
||||
|
Reference in New Issue
Block a user