Split utils functions into set of helper modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { GrabError } from '../../Errors';
|
||||
import { getNumber, trimPrefix, uniqId } from '../../utils';
|
||||
import { Resources } from '../../Core/Resources';
|
||||
import { getNumber, trimPrefix } from '../../Helpers/Convert';
|
||||
import { uniqId } from '../../Helpers/Identity';
|
||||
|
||||
export function clickBuildButton(typeId: number) {
|
||||
const section = jQuery(`#contract_building${typeId}`);
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { elClassId, getNumber, uniqId } from '../../utils';
|
||||
import { Resources } from '../../Core/Resources';
|
||||
import { grabResourcesFromList } from './BuildingPage';
|
||||
import { GrabError } from '../../Errors';
|
||||
import { elClassId, getNumber } from '../../Helpers/Convert';
|
||||
import { uniqId } from '../../Helpers/Identity';
|
||||
|
||||
interface ResearchClickHandler {
|
||||
(resources: Resources, unitId: number): void;
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { getNumber, uniqId } from '../../utils';
|
||||
import { Resources } from '../../Core/Resources';
|
||||
import { grabResourcesFromList } from './BuildingPage';
|
||||
import { GrabError } from '../../Errors';
|
||||
import { getNumber } from '../../Helpers/Convert';
|
||||
import { uniqId } from '../../Helpers/Identity';
|
||||
|
||||
interface CelebrationClickHandler {
|
||||
(resources: Resources, id: number): void;
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import { getNumber, uniqId } from '../../utils';
|
||||
import { Resources, ResourcesInterface } from '../../Core/Resources';
|
||||
import { Coordinates } from '../../Core/Village';
|
||||
import { IncomingMerchant, MerchantsInfo } from '../../Core/Market';
|
||||
import { grabResourcesFromList } from './BuildingPage';
|
||||
import { getNumber } from '../../Helpers/Convert';
|
||||
import { uniqId } from '../../Helpers/Identity';
|
||||
|
||||
interface SendResourcesClickHandler {
|
||||
(resources: Resources, crd: Coordinates): void;
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { Resources } from '../../Core/Resources';
|
||||
import { GrabError } from '../../Errors';
|
||||
import { elClassId, getNumber, uniqId } from '../../utils';
|
||||
import { grabResourcesFromList } from './BuildingPage';
|
||||
import { elClassId, getNumber } from '../../Helpers/Convert';
|
||||
import { uniqId } from '../../Helpers/Identity';
|
||||
|
||||
export function createTrainTroopButtons(
|
||||
onClickHandler: (troopId: number, resources: Resources, count: number) => void
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import { notify } from '../utils';
|
||||
import { UpgradeBuildingTask } from '../Task/UpgradeBuildingTask';
|
||||
import { Scheduler } from '../Scheduler';
|
||||
import { TrainTroopTask } from '../Task/TrainTroopTask';
|
||||
@@ -23,6 +22,7 @@ import { ForgeImprovementTask } from '../Task/ForgeImprovementTask';
|
||||
import { createCelebrationButtons } from './BuildingPage/GuildHallPage';
|
||||
import { CelebrationTask } from '../Task/CelebrationTask';
|
||||
import { VillageController } from '../VillageController';
|
||||
import { notify } from '../Helpers/Browser';
|
||||
|
||||
export class BuildingPageController {
|
||||
private scheduler: Scheduler;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { GrabError } from '../Errors';
|
||||
import { getNumber } from '../utils';
|
||||
import { ResourceMapping, ResourceType } from '../Core/ResourceType';
|
||||
import { HeroAllResources, HeroAttributes, HeroResourceType } from '../Core/Hero';
|
||||
import { getNumber } from '../Helpers/Convert';
|
||||
|
||||
export function grabHeroAttributes(): HeroAttributes {
|
||||
const healthElement = jQuery('#attributes .attribute.health .powervalue .value');
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { elClassId, getNumber, parseLocation } from '../utils';
|
||||
import { FORGE_ID, GUILD_HALL_ID, MARKET_ID } from '../Core/Buildings';
|
||||
import { elClassId, getNumber } from '../Helpers/Convert';
|
||||
import { parseLocation } from '../Helpers/Browser';
|
||||
|
||||
export interface BuildingPageAttributes {
|
||||
buildTypeId: number;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { GrabError } from '../Errors';
|
||||
import { getNumber } from '../utils';
|
||||
import { Resources } from '../Core/Resources';
|
||||
import { ResourceType } from '../Core/ResourceType';
|
||||
import { ResourceStorage } from '../Core/ResourceStorage';
|
||||
import { getNumber } from '../Helpers/Convert';
|
||||
|
||||
export function grabVillageResources(): Resources {
|
||||
const lumber = grabResource(ResourceType.Lumber);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { elClassId, getNumber } from '../utils';
|
||||
import { numberToResourceType } from '../Core/ResourceType';
|
||||
import { BuildingSlot, ResourceSlot } from '../Core/Slot';
|
||||
import { elClassId, getNumber } from '../Helpers/Convert';
|
||||
|
||||
interface SlotElement {
|
||||
el: HTMLElement;
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import { GrabError } from '../Errors';
|
||||
import { getNumber, parseLocation } from '../utils';
|
||||
import { Resources } from '../Core/Resources';
|
||||
import { Coordinates, Village, VillageList } from '../Core/Village';
|
||||
import { BuildingQueueInfo } from '../Core/BuildingQueueInfo';
|
||||
import { getNumber } from '../Helpers/Convert';
|
||||
import { parseLocation } from '../Helpers/Browser';
|
||||
|
||||
function getVillageListItems() {
|
||||
const $elements = jQuery('#sidebarBoxVillagelist ul li a');
|
||||
|
Reference in New Issue
Block a user