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
This commit is contained in:
Dev 2023-07-31 14:23:13 +01:00
parent 309b882796
commit 167bba85e2

View File

@ -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;