extra check for multiple mod items that would throw off the data returned

This commit is contained in:
Chomp 2021-09-11 14:08:22 +01:00
parent bb40918722
commit 5620468e0f

View File

@ -5,7 +5,6 @@ using QuestValidator.Helpers;
using QuestValidator.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace QuestValidator
@ -187,14 +186,20 @@ namespace QuestValidator
foreach (var subItem in questSuccessRewardItem.items.Where(x => !string.IsNullOrEmpty(x.slotId)))
{
// find matching live counterpart by slotid
var liveCounterpart = relatedLiveRewardItem.items.FirstOrDefault(x => x.slotId == subItem.slotId);
if (liveCounterpart == null)
var liveCounterpart = relatedLiveRewardItem.items.Where(x => x.slotId == subItem.slotId);
if (liveCounterpart == null || liveCounterpart.Count() == 0)
{
LoggingHelpers.LogWarning($"a live counterpart for the subItem {subItem.slotId} could not be found, skipping subItem check");
continue;
}
if (liveCounterpart.Count() > 1)
{
LoggingHelpers.LogWarning($"Multiple live counterparts for the subItem {subItem.slotId} found, skipping subItem check");
continue;
}
CheckValuesMatch(subItem._tpl, liveCounterpart._tpl, $"mismatch for success subItem({subItem.slotId}) reward templateId", subItem._id);
var firstLiveItem = liveCounterpart.FirstOrDefault();
CheckValuesMatch(subItem._tpl, firstLiveItem._tpl, $"mismatch for success subItem({subItem.slotId}) reward templateId", subItem._id);
}
}
@ -271,7 +276,7 @@ namespace QuestValidator
// Check template ids match
CheckValuesMatch(questStartedRewardItem.items[0]._tpl, relatedLiveRewardItem.items[0]._tpl, "mismatch for template id", questStartedRewardItem.items[0]._id, true);
// Check value values match
// Check 'value' values match
CheckValuesMatch(questStartedRewardItem.value, relatedLiveRewardItem.value, "mismatch for success item reward value", questStartedRewardItem.id);
// Check item stack count