Skip to content

Commit c8c061a

Browse files
committed
fix logic check storage when upgrade building
1 parent 2b9ff8f commit c8c061a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

TbsCore/Helpers/ResourcesHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static void UpgradeStorage(Account acc, Village vill, BuildingEnum build
140140
var task = new BuildingTask()
141141
{
142142
Building = building,
143-
TaskType = Classificator.BuildingType.General
143+
TaskType = BuildingType.General
144144
};
145145

146146
var current = vill.Build.Buildings.FirstOrDefault(x =>

TbsCore/Tasks/LowLevel/UpgradeBuilding.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,17 @@ private async Task<bool> IsEnoughRes(Account acc)
584584
{
585585
if (ResourcesHelper.IsStorageTooLow(acc, Vill, cost))
586586
{
587-
acc.Logger.Warning($"Storage is too low. Added storage upgrade.");
587+
var building = Vill.Build.CurrentlyBuilding.FirstOrDefault(x => x.Building == BuildingEnum.Warehouse || x.Building == BuildingEnum.Granary);
588+
if (building == null)
589+
{
590+
acc.Logger.Warning($"Storage is too low. Added storage upgrade.");
591+
}
592+
else
593+
{
594+
acc.Logger.Warning($"Storage is too low. Next building will be contructed after {building.Building} - level {building.Level} complete. ({NextExecute})");
595+
NextExecute = TimeHelper.RanDelay(acc, building.Duration);
596+
StopFlag = true;
597+
}
588598
return false;
589599
}
590600

0 commit comments

Comments
 (0)