diff --git a/src/Container.ts b/src/Container.ts index 0f19f95..0837200 100644 --- a/src/Container.ts +++ b/src/Container.ts @@ -86,7 +86,10 @@ export class Container { this._grabberManager = this._grabberManager || (() => { - return new GrabberManager(this.villageFactory); + return new GrabberManager( + this.villageFactory, + new ConsoleLogger(GrabberManager.name) + ); })(); return this._grabberManager; } diff --git a/src/ControlPanel.ts b/src/ControlPanel.ts index ecdbb7b..2e7e00b 100644 --- a/src/ControlPanel.ts +++ b/src/ControlPanel.ts @@ -23,6 +23,8 @@ import { timestamp } from './Helpers/Time'; import { notify, parseLocation, waitForLoad } from './Helpers/Browser'; import { Action } from './Queue/Action'; import { Task } from './Queue/Task'; +import { HeroAttributes } from './Core/Hero'; +import { HeroStorage } from './Storage/HeroStorage'; Vue.use(Vuex); @@ -31,6 +33,7 @@ interface GameState { version: string; activeVillageState: VillageState | undefined; villageStates: ReadonlyArray; + heroAttr: HeroAttributes; taskList: ReadonlyArray; actionList: ReadonlyArray; pauseSeconds: number; @@ -64,17 +67,20 @@ export class ControlPanel { const villageFactory = this.villageFactory; const executionState = new ExecutionStorage(); + const heroStorage = new HeroStorage(); const state: GameState = { name: 'Control', version: this.version, activeVillageState: undefined, villageStates: [], + heroAttr: HeroAttributes.default(), taskList: [], actionList: [], pauseSeconds: 0, refresh() { + this.heroAttr = heroStorage.getAttributes(); this.taskList = scheduler.getTaskItems(); this.actionList = scheduler.getActionItems(); const { pauseTs } = executionState.getExecutionSettings(); diff --git a/src/Core/Hero.ts b/src/Core/Hero.ts index 5c3b6a2..64ac65d 100644 --- a/src/Core/Hero.ts +++ b/src/Core/Hero.ts @@ -6,6 +6,10 @@ export class HeroAttributes { constructor(health: number) { this.health = health; } + + static default() { + return new HeroAttributes(0); + } } export type HeroAllResourcesType = 'all'; diff --git a/src/Dashboard/Dashboard.vue b/src/Dashboard/Dashboard.vue index 60cbb2d..1ccd493 100644 --- a/src/Dashboard/Dashboard.vue +++ b/src/Dashboard/Dashboard.vue @@ -1,8 +1,9 @@