Improve resources to level task
This commit is contained in:
parent
d2e238b4e7
commit
8807c2b070
@ -31,12 +31,19 @@ export class UpgradeResourceToLevel extends ActionController {
|
|||||||
|
|
||||||
notUpgraded.sort((x, y) => x.level - y.level);
|
notUpgraded.sort((x, y) => x.level - y.level);
|
||||||
|
|
||||||
|
// Next two buildings: no delay between start building and scheduling next
|
||||||
|
|
||||||
const firstNotUpgraded = notUpgraded.shift();
|
const firstNotUpgraded = notUpgraded.shift();
|
||||||
|
const secondNotUpgraded = notUpgraded.shift();
|
||||||
|
|
||||||
if (firstNotUpgraded && this.isTaskNotInQueue(villageId, firstNotUpgraded)) {
|
if (firstNotUpgraded && this.isTaskNotInQueue(villageId, firstNotUpgraded)) {
|
||||||
this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId: firstNotUpgraded.buildId });
|
this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId: firstNotUpgraded.buildId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (secondNotUpgraded && this.isTaskNotInQueue(villageId, secondNotUpgraded)) {
|
||||||
|
this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId: secondNotUpgraded.buildId });
|
||||||
|
}
|
||||||
|
|
||||||
throw new TryLaterError(aroundMinutes(10), 'Sleep for next round');
|
throw new TryLaterError(aroundMinutes(10), 'Sleep for next round');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user