Skip to content

Commit

Permalink
Ignore finished plan for upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Jebzou committed Dec 7, 2024
1 parent 7322c0a commit e48a485
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,16 @@ private void UpdatePlanAfterEquipmentImprovement(EquipmentUpgradePlanItemViewMod
/// <returns>Null if not found</returns>
private EquipmentUpgradePlanItemViewModel? FindEquipmentPlanFromEquipmentData(IEquipmentData equipmentData)
{
EquipmentUpgradePlanItemViewModel? foundPlan = PlannedUpgrades.FirstOrDefault(plan => plan.Equipment?.MasterID == equipmentData.MasterID);
List<EquipmentUpgradePlanItemViewModel> plans = PlannedUpgrades.Where(plan => !plan.Finished).ToList();

EquipmentUpgradePlanItemViewModel? foundPlan = plans.FirstOrDefault(plan => plan.Equipment?.MasterID == equipmentData.MasterID);

// Plan found, return it
if (foundPlan != null) return foundPlan;

// Not found => look for a matching plan
foundPlan = PlannedUpgrades
foundPlan = plans
.Where(plan => plan.Equipment?.MasterID == 0)
.Where(plan => !plan.Finished)
.Where(plan => plan.DesiredUpgradeLevel is UpgradeLevel.Conversion || plan.DesiredUpgradeLevel > equipmentData.UpgradeLevel)
.FirstOrDefault(plan => plan.Equipment?.EquipmentID == equipmentData.EquipmentID);

Expand Down

0 comments on commit e48a485

Please sign in to comment.