Introduce production queues

And add queue state in village state list
This commit is contained in:
2020-05-19 09:20:10 +03:00
parent 3b34e06a7d
commit 4c90af31aa
12 changed files with 178 additions and 42 deletions

View File

@ -1,9 +1,10 @@
import { Grabber } from './Grabber';
import { grabActiveVillageId, grabBuildingQueueInfo, grabResourcesPerformance } from '../Page/VillageBlock';
import { VillageStorage } from '../Storage/VillageStorage';
import { parseLocation } from '../utils';
import { parseLocation, timestamp } from '../utils';
import { GrabError } from '../Errors';
import { BuildingQueueInfo } from '../Game';
import { ProductionQueue } from '../Core/ProductionQueue';
export class VillageOverviewPageGrabber extends Grabber {
grab(): void {
@ -13,9 +14,13 @@ export class VillageOverviewPageGrabber extends Grabber {
}
const villageId = grabActiveVillageId();
const state = new VillageStorage(villageId);
state.storeResourcesPerformance(grabResourcesPerformance());
state.storeBuildingQueueInfo(this.grabBuildingQueueInfoOrDefault());
const storage = new VillageStorage(villageId);
storage.storeResourcesPerformance(grabResourcesPerformance());
storage.storeBuildingQueueInfo(this.grabBuildingQueueInfoOrDefault());
const buildingQueueInfo = this.grabBuildingQueueInfoOrDefault();
const buildingEndTime = buildingQueueInfo.seconds ? buildingQueueInfo.seconds + timestamp() : 0;
storage.storeQueueTaskEnding(ProductionQueue.Building, buildingEndTime);
}
private grabBuildingQueueInfoOrDefault() {