update validator

This commit is contained in:
Chomp 2022-01-12 15:08:41 +00:00
parent f4d2c20fca
commit 6b0406889b

View File

@ -44,7 +44,7 @@ namespace AssortValidator
}
}
private static void ListAssortsInLiveNotInOffline(Dictionary<Trader, Assort> assortData, Dictionary<Trader, LiveAssort> liveAssortData)
private static void ListAssortsInLiveNotInOffline(Dictionary<Trader, Assort> assortData, Dictionary<Trader, Assort> liveAssortData)
{
foreach (var trader in liveAssortData)
{
@ -59,7 +59,15 @@ namespace AssortValidator
if (offlineAssort == null)
{
missingAssortCount++;
var itemName = ItemTemplateHelper.GetTemplateById(liveAssort._tpl)._name;
var data = ItemTemplateHelper.GetTemplateById(liveAssort._tpl);
if (data is null)
{
LoggingHelpers.LogInfo($"Assort not found skipping: {liveAssort._tpl}");
continue;
}
var itemName = data._name;
int assortLoyaltyLevel = GetAssortLoyaltyLevel(liveAssort._id, trader.Value);
var liveBarterData = trader.Value.barter_scheme.FirstOrDefault(x => x.Key == liveAssort._id).Value;
@ -79,12 +87,12 @@ namespace AssortValidator
}
else
{
LoggingHelpers.LogSuccess("no missing assorts found in offline when compared to live :)");
LoggingHelpers.LogSuccess("live and existing assorts match :)");
}
}
}
private static void CheckAssortValues(Dictionary<Trader, Assort> assortData, Dictionary<Trader, LiveAssort> liveAssortData)
private static void CheckAssortValues(Dictionary<Trader, Assort> assortData, Dictionary<Trader, Assort> liveAssortData)
{
List<QuestAssortUnlock> questAssortUnlocks = GetQuestsThatUnlockAssorts();
foreach (var trader in assortData)
@ -142,7 +150,7 @@ namespace AssortValidator
}
}
LogAssortType(offlineBarterItems);
LogAssortType(offlineBarterItems, "Existing");
if (offlineBarterItems.Count != liveItem.Count)
{
@ -189,15 +197,15 @@ namespace AssortValidator
/// <summary>
/// Log the quest type: money or barter trade
/// </summary>
private static void LogAssortType(List<BarterDetails> offlineBarterItems)
private static void LogAssortType(List<BarterDetails> offlineBarterItems, string assortSource)
{
if (ItemIsMoney(offlineBarterItems.First()._tpl))
{
LoggingHelpers.LogInfo("assort is money trade");
LoggingHelpers.LogInfo($"{assortSource} assort is money trade");
}
else
{
LoggingHelpers.LogInfo("assort is barter trade");
LoggingHelpers.LogInfo($"{assortSource} assort is barter trade");
}
}
@ -215,7 +223,7 @@ namespace AssortValidator
return ItemTemplateHelper.GetTemplateById(templateId)._parent == "543be5dd4bdc2deb348b4569"; // money type
}
private static bool DoesLiveAssortUpdMatchOffline(Item assort, LiveAssort.Item correspondingLiveAssort, string itemName)
private static bool DoesLiveAssortUpdMatchOffline(Item assort, Assort.Item correspondingLiveAssort, string itemName)
{
if (assort.upd != null && correspondingLiveAssort.upd == null)
{
@ -235,7 +243,7 @@ namespace AssortValidator
return true;
}
private static int GetAssortLoyaltyLevel(string assortId, LiveAssort assort)
private static int GetAssortLoyaltyLevel(string assortId, Assort assort)
{
int assortLoyaltyLevel = 1;
if (!assort.loyal_level_items.ContainsKey(assortId))
@ -251,7 +259,7 @@ namespace AssortValidator
return assortLoyaltyLevel;
}
private static void CheckUpdValues(Item assort, LiveAssort.Item correspondingLiveAssort)
private static void CheckUpdValues(Item assort, Assort.Item correspondingLiveAssort)
{
if (assort.upd.StackObjectsCount.HasValue && !assort.upd.UnlimitedCount)
{
@ -269,7 +277,7 @@ namespace AssortValidator
ValueCheckerHelper.CheckValuesMatch(assort.upd.BuyRestrictionMax.GetValueOrDefault(0), correspondingLiveAssort.upd.BuyRestrictionMax.GetValueOrDefault(0), "BuyRestrictionMax does not match");
}
private static LiveAssort.Item GetLiveAssort(LiveAssort trader, string templateId, int expectedLoyaltyLevel)
private static Assort.Item GetLiveAssort(Assort trader, string templateId, int expectedLoyaltyLevel)
{
var liveAssorts = trader.items;
var liveLoyaltyLevels = trader.loyal_level_items;
@ -464,7 +472,7 @@ namespace AssortValidator
return 9999999;
}
private static void CheckAssortCost(List<List<BarterDetails>> offlineBarterData, List<List<LiveAssort.BarterDetails>> liveBarterData)
private static void CheckAssortCost(List<List<BarterDetails>> offlineBarterData, List<List<Assort.BarterDetails>> liveBarterData)
{
var firstBarterItem = offlineBarterData.First().First();
var firstOfflineItemIsMoney = ItemIsMoney(firstBarterItem._tpl);
@ -496,8 +504,8 @@ namespace AssortValidator
private static List<QuestAssortUnlock> GetQuestsThatUnlockAssorts()
{
var liveQuests = QuestHelper.GetLiveQuestData();
return QuestHelper.GetQuestAssortUnlocks(liveQuests.data);
var liveQuests = QuestHelper.GetQuestData();
return QuestHelper.GetQuestAssortUnlocks(liveQuests.Values);
}
}
}