From 167bba85e2306e1e121932380c03b353419f9a5f Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 31 Jul 2023 14:23:13 +0100 Subject: [PATCH] Remove exit path when only one assort is found for a quest, this isnt always the correct one, force the weights to be appied to each finding If result is <0, ignore --- AssortGenerator/Program.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/AssortGenerator/Program.cs b/AssortGenerator/Program.cs index fc05d34..98b8c6b 100644 --- a/AssortGenerator/Program.cs +++ b/AssortGenerator/Program.cs @@ -235,7 +235,17 @@ namespace AssortGenerator continue; } - var highestScoringAssortIdMatch = results.OrderByDescending(x => x.Value).First().Key; + if (results.Values.All( x => x < 0)) + { + LoggingHelpers.LogError($"{trader} item templateId: {assortUnlock.ItemUnlockedTemplateId} ({ItemName}). questId: {assortUnlock.QuestId}. Only negative scored matches found"); + + result.success.Add($"UnknownAssortId{unknownCount}", assortUnlock.QuestId); + unknownCount++; + + continue; + } + + var highestScoringAssortIdMatch = results.OrderByDescending(x => x.Value).Where(x => x.Value > 0).First().Key; // Add assort item id to blacklist so it wont be matched again assortItemsThatMatchBlackList.Add(highestScoringAssortIdMatch); @@ -315,13 +325,6 @@ namespace AssortGenerator LoggingHelpers.LogWarning($"{trader} item templateId: {assortUnlock.ItemUnlockedTemplateId}. questId: {questData.Value.QuestName}. multiple matches found. "); } - // Only one result, no need to work out score - if (assortItemsThatMatch.Count == 1) - { - matchScores[assortItemsThatMatch[0]._id] = 1; - return matchScores; - } - foreach (var assortItemMatch in assortItemsThatMatch) { matchScores[assortItemMatch._id] = 0;