Skip to content

Commit 48a0442

Browse files
committed
fix inconsistent log message in upgrade building
1 parent 30e1601 commit 48a0442

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

TbsCore/Tasks/LowLevel/UpgradeBuilding.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private async Task<bool> Upgrade(Account acc)
156156

157157
if (lvl >= _buildingTask.Level)
158158
{
159-
acc.Logger.Information($"{_buildingTask.Building} is already level {lvl} in village {Vill.Name}. Will be removed from the queue.");
159+
acc.Logger.Information($"{_buildingTask.Building} is already level {lvl} in village {Vill.Name}. Will be removed from the queue.", this);
160160
RemoveCurrentTask();
161161
return false;
162162
}
@@ -165,7 +165,7 @@ private async Task<bool> Upgrade(Account acc)
165165
var buttons = container?.Descendants("button");
166166
if (buttons == null)
167167
{
168-
acc.Logger.Warning($"We wanted to upgrade {_buildingTask.Building}, but no 'upgrade' button was found! Url={acc.Wb.CurrentUrl}");
168+
acc.Logger.Information($"We wanted to upgrade {_buildingTask.Building}, but no 'upgrade' button was found! Url={acc.Wb.CurrentUrl}", this);
169169
return false;
170170
}
171171

@@ -178,20 +178,21 @@ private async Task<bool> Upgrade(Account acc)
178178

179179
if (upgradeButton == null)
180180
{
181-
acc.Logger.Warning($"We wanted to upgrade {_buildingTask.Building}, but no 'upgrade' button was found!");
181+
acc.Logger.Information($"We wanted to upgrade {_buildingTask.Building}, but no 'upgrade' button was found!", this);
182182
return false;
183183
}
184184

185185
// Not enough resources?
186186
if (acc.AccInfo.ServerVersion == ServerVersionEnum.T4_5 && errorMessage != null)
187187
{
188-
acc.Logger.Warning($"We wanted to upgrade {_buildingTask.Building}, but there was an error message:\n{errorMessage.InnerText}");
188+
acc.Logger.Information($"We wanted to upgrade {_buildingTask.Building}, but there was an error message:\n{errorMessage.InnerText}", this);
189189
return false;
190190
}
191191

192192
var buildDuration = InfrastructureParser.GetBuildDuration(container, acc.AccInfo.ServerVersion);
193193

194-
acc.Logger.Information($"Started upgrading {_buildingTask.Building} to level {lvl + 1} in {Vill.Name}");
194+
acc.Logger.Information("Complete checking", this);
195+
acc.Logger.Information($"Upgrading {_buildingTask.Building} to level {lvl + 1} in {Vill.Name}", this);
195196

196197
var watchAd = false;
197198
if (acc.AccInfo.ServerVersion == ServerVersionEnum.T4_5 && buildDuration.TotalMinutes > acc.Settings.WatchAdAbove)
@@ -205,7 +206,7 @@ private async Task<bool> Upgrade(Account acc)
205206
await DriverHelper.ClickById(acc, upgradeButton.Id); // Normal upgrade
206207
}
207208

208-
acc.Logger.Information($"Upgraded {_buildingTask.Building} to level {lvl + 1} in {Vill.Name}");
209+
acc.Logger.Information($"Upgraded {_buildingTask.Building} to level {lvl + 1} in {Vill.Name}", this);
209210
if (_buildingTask.Level == lvl + 1)
210211
{
211212
RemoveCurrentTask();
@@ -514,7 +515,7 @@ private async Task<bool> IsEnoughRes(Account acc)
514515
var resWrapper = contractNode.Descendants().FirstOrDefault(x => x.HasClass("resourceWrapper"));
515516
var cost = ResourceParser.GetResourceCost(resWrapper);
516517

517-
acc.Logger.Information($"Need {cost}");
518+
acc.Logger.Information($"Need {cost}", this);
518519

519520
if (!ResourcesHelper.IsEnoughRes(Vill, cost.ToArray()))
520521
{
@@ -527,7 +528,7 @@ private async Task<bool> IsEnoughRes(Account acc)
527528
}
528529

529530
var stillNeededRes = ResourcesHelper.SubtractResources(cost.ToArray(), Vill.Res.Stored.Resources.ToArray(), true);
530-
acc.Logger.Information("Not enough resources to build.");
531+
acc.Logger.Information("Not enough resources to build.", this);
531532
if (Vill.Settings.UseHeroRes && acc.AccInfo.ServerVersion == ServerVersionEnum.T4_5) // Only T4.5 has resources in hero inv
532533
{
533534
var heroRes = HeroHelper.GetHeroResources(acc);

0 commit comments

Comments
 (0)