diff --git a/src/Action/UpgradeResourceToLevel.ts b/src/Action/UpgradeResourceToLevel.ts index 9eed6c8..03f95b7 100644 --- a/src/Action/UpgradeResourceToLevel.ts +++ b/src/Action/UpgradeResourceToLevel.ts @@ -2,10 +2,10 @@ import { ActionController, registerAction } from './ActionController'; import { ActionError, taskError, TryLaterError } from '../Errors'; import { grabResourceSlots } from '../Page/SlotBlock'; import { UpgradeBuildingTask } from '../Task/UpgradeBuildingTask'; -import { ResourceSlot } from '../Game'; import { aroundMinutes, getNumber } from '../utils'; import { Args } from '../Queue/Args'; import { Task } from '../Queue/TaskProvider'; +import { ResourceSlot } from '../Core/Slot'; @registerAction export class UpgradeResourceToLevel extends ActionController { diff --git a/src/ControlPanel.ts b/src/ControlPanel.ts index cc3b510..c36fee5 100644 --- a/src/ControlPanel.ts +++ b/src/ControlPanel.ts @@ -14,7 +14,7 @@ import Vuex from 'vuex'; import DashboardApp from './DashboardView/Dashboard.vue'; import { ConsoleLogger, Logger } from './Logger'; import { DataStorage } from './DataStorage'; -import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetectors'; +import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetector'; import { ExecutionStorage } from './Storage/ExecutionStorage'; import { VillageState } from './VillageState'; import { Task } from './Queue/TaskProvider'; diff --git a/src/Core/Slot.ts b/src/Core/Slot.ts new file mode 100644 index 0000000..64c8627 --- /dev/null +++ b/src/Core/Slot.ts @@ -0,0 +1,35 @@ +import { ResourceType } from './ResourceType'; + +export interface Slot { + readonly buildId: number; + readonly level: number; + readonly isReady: boolean; + readonly isUnderConstruction: boolean; + readonly isMaxLevel: boolean; +} + +export interface ResourceSlot extends Slot { + readonly type: ResourceType; +} + +export const ResourceSlotDefaults: ResourceSlot = { + type: ResourceType.Lumber, + buildId: 0, + level: 0, + isReady: false, + isUnderConstruction: false, + isMaxLevel: false, +}; + +export interface BuildingSlot extends Slot { + readonly buildTypeId: number; +} + +export const BuildingSlotDefaults: BuildingSlot = { + buildTypeId: 0, + buildId: 0, + level: 0, + isReady: false, + isUnderConstruction: false, + isMaxLevel: false, +}; diff --git a/src/Game.ts b/src/Game.ts index fad5abd..305684b 100644 --- a/src/Game.ts +++ b/src/Game.ts @@ -1,42 +1,6 @@ -import { ResourceType } from './Core/ResourceType'; - export class BuildingQueueInfo { readonly seconds: number; constructor(seconds: number) { this.seconds = seconds; } } - -export interface Slot { - readonly buildId: number; - readonly level: number; - readonly isReady: boolean; - readonly isUnderConstruction: boolean; - readonly isMaxLevel: boolean; -} - -export interface ResourceSlot extends Slot { - readonly type: ResourceType; -} - -export const ResourceSlotDefaults: ResourceSlot = { - type: ResourceType.Lumber, - buildId: 0, - level: 0, - isReady: false, - isUnderConstruction: false, - isMaxLevel: false, -}; - -export interface BuildingSlot extends Slot { - readonly buildTypeId: number; -} - -export const BuildingSlotDefaults: BuildingSlot = { - buildTypeId: 0, - buildId: 0, - level: 0, - isReady: false, - isUnderConstruction: false, - isMaxLevel: false, -}; diff --git a/src/Grabber/BuildingContractGrabber.ts b/src/Grabber/BuildingContractGrabber.ts index c6a7b04..ff30fc0 100644 --- a/src/Grabber/BuildingContractGrabber.ts +++ b/src/Grabber/BuildingContractGrabber.ts @@ -1,5 +1,5 @@ import { Grabber } from './Grabber'; -import { getBuildingPageAttributes, isBuildingPage } from '../Page/PageDetectors'; +import { getBuildingPageAttributes, isBuildingPage } from '../Page/PageDetector'; import { grabContractResources, hasContractResources } from '../Page/BuildingPage/BuildingPage'; import { ContractType } from '../Core/Contract'; diff --git a/src/Grabber/ForgePageGrabber.ts b/src/Grabber/ForgePageGrabber.ts index 40aec7d..d0b79a9 100644 --- a/src/Grabber/ForgePageGrabber.ts +++ b/src/Grabber/ForgePageGrabber.ts @@ -1,5 +1,5 @@ import { Grabber } from './Grabber'; -import { getBuildingPageAttributes, isForgePage } from '../Page/PageDetectors'; +import { getBuildingPageAttributes, isForgePage } from '../Page/PageDetector'; import { ContractType } from '../Core/Contract'; import { grabImprovementContracts, grabRemainingSeconds } from '../Page/BuildingPage/ForgePage'; import { ProductionQueue } from '../Core/ProductionQueue'; diff --git a/src/Grabber/GuildHallPageGrabber.ts b/src/Grabber/GuildHallPageGrabber.ts index e3a200e..de5529e 100644 --- a/src/Grabber/GuildHallPageGrabber.ts +++ b/src/Grabber/GuildHallPageGrabber.ts @@ -1,5 +1,5 @@ import { Grabber } from './Grabber'; -import { isGuildHallPage } from '../Page/PageDetectors'; +import { isGuildHallPage } from '../Page/PageDetector'; import { grabRemainingSeconds } from '../Page/BuildingPage/GuildHallPage'; import { ProductionQueue } from '../Core/ProductionQueue'; import { timestamp } from '../utils'; diff --git a/src/Grabber/HeroPageGrabber.ts b/src/Grabber/HeroPageGrabber.ts index 36236ed..b9fca52 100644 --- a/src/Grabber/HeroPageGrabber.ts +++ b/src/Grabber/HeroPageGrabber.ts @@ -2,7 +2,7 @@ import { Grabber } from './Grabber'; import { grabVillageList } from '../Page/VillageBlock'; import { HeroStorage } from '../Storage/HeroStorage'; import { grabHeroAttributes, grabHeroVillage } from '../Page/HeroPage'; -import { isHeroPage } from '../Page/PageDetectors'; +import { isHeroPage } from '../Page/PageDetector'; export class HeroPageGrabber extends Grabber { grab(): void { diff --git a/src/Grabber/MarketPageGrabber.ts b/src/Grabber/MarketPageGrabber.ts index b2de2ed..6146a2f 100644 --- a/src/Grabber/MarketPageGrabber.ts +++ b/src/Grabber/MarketPageGrabber.ts @@ -1,5 +1,5 @@ import { Grabber } from './Grabber'; -import { isMarketSendResourcesPage } from '../Page/PageDetectors'; +import { isMarketSendResourcesPage } from '../Page/PageDetector'; import { grabIncomingMerchants, grabMerchantsInfo } from '../Page/BuildingPage/MarketPage'; export class MarketPageGrabber extends Grabber { diff --git a/src/Page/BuildingPageController.ts b/src/Page/BuildingPageController.ts index 7f2a486..f52d310 100644 --- a/src/Page/BuildingPageController.ts +++ b/src/Page/BuildingPageController.ts @@ -15,7 +15,7 @@ import { isForgePage, isGuildHallPage, isMarketSendResourcesPage, -} from './PageDetectors'; +} from './PageDetector'; import { createTrainTroopButtons } from './BuildingPage/TrooperPage'; import { createSendResourcesButton } from './BuildingPage/MarketPage'; import { createResearchButtons } from './BuildingPage/ForgePage'; diff --git a/src/Page/PageDetectors.ts b/src/Page/PageDetector.ts similarity index 100% rename from src/Page/PageDetectors.ts rename to src/Page/PageDetector.ts diff --git a/src/Page/SlotBlock.ts b/src/Page/SlotBlock.ts index 87353b8..e5331d0 100644 --- a/src/Page/SlotBlock.ts +++ b/src/Page/SlotBlock.ts @@ -1,6 +1,6 @@ import { elClassId, getNumber } from '../utils'; -import { BuildingSlot, ResourceSlot } from '../Game'; import { numberToResourceType } from '../Core/ResourceType'; +import { BuildingSlot, ResourceSlot } from '../Core/Slot'; interface SlotElement { el: HTMLElement; diff --git a/src/Storage/VillageStorage.ts b/src/Storage/VillageStorage.ts index c88fe65..62ce431 100644 --- a/src/Storage/VillageStorage.ts +++ b/src/Storage/VillageStorage.ts @@ -6,7 +6,12 @@ import { VillageSettings, VillageSettingsDefaults } from '../Core/Village'; import { ProductionQueue } from '../Core/ProductionQueue'; import { getNumber } from '../utils'; import { Task, uniqTaskId } from '../Queue/TaskProvider'; -import { BuildingSlot, BuildingSlotDefaults, ResourceSlot, ResourceSlotDefaults } from '../Game'; +import { + BuildingSlot, + BuildingSlotDefaults, + ResourceSlot, + ResourceSlotDefaults, +} from '../Core/Slot'; const RESOURCES_KEY = 'resources'; const CAPACITY_KEY = 'capacity';