Fix insert build tasks, so order is matter
This commit is contained in:
@ -2,6 +2,8 @@ import { StateGrabber } from './StateGrabber';
|
||||
import { grabActiveVillageId, grabBuildingQueueInfo, grabResourcesPerformance } from '../Page/VillageBlock';
|
||||
import { VillageState } from './VillageState';
|
||||
import { parseLocation } from '../utils';
|
||||
import { GrabError } from '../Errors';
|
||||
import { BuildingQueueInfo } from '../Game';
|
||||
|
||||
export class VillageOverviewPageGrabber extends StateGrabber {
|
||||
grab(): void {
|
||||
@ -13,6 +15,17 @@ export class VillageOverviewPageGrabber extends StateGrabber {
|
||||
const villageId = grabActiveVillageId();
|
||||
const state = new VillageState(villageId);
|
||||
state.storeResourcesPerformance(grabResourcesPerformance());
|
||||
state.storeBuildingQueueInfo(grabBuildingQueueInfo());
|
||||
state.storeBuildingQueueInfo(this.grabBuildingQueueInfoOrDefault());
|
||||
}
|
||||
|
||||
private grabBuildingQueueInfoOrDefault() {
|
||||
try {
|
||||
return grabBuildingQueueInfo();
|
||||
} catch (e) {
|
||||
if (e instanceof GrabError) {
|
||||
return new BuildingQueueInfo(0);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user