From a300da8dba1690e4c0763771278220c30f6556bd Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 9 Feb 2022 23:11:21 +0000 Subject: [PATCH] Rework how 'buyRestrictionMax' is handled, bsg send it as string or int --- AssortUpdater/AssortMerger.cs | 5 +++-- AssortValidator.Common/Models/Assort.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AssortUpdater/AssortMerger.cs b/AssortUpdater/AssortMerger.cs index 6e06e4d..743b603 100644 --- a/AssortUpdater/AssortMerger.cs +++ b/AssortUpdater/AssortMerger.cs @@ -15,8 +15,9 @@ namespace AssortUpdater { if (liveAssort.RawItem.upd.StackObjectsCount == 0) { - var newStackCount = liveAssort.RawItem.upd.BuyRestrictionMax.HasValue - ? (liveAssort.RawItem.upd.BuyRestrictionMax.Value * 10) + var canBeParsed = int.TryParse(liveAssort.RawItem.upd.BuyRestrictionMax?.ToString(), out int BuyRestrictionMax); + var newStackCount = canBeParsed + ? (BuyRestrictionMax * 10) : 1000; liveAssort.RawItem.upd.StackObjectsCount = newStackCount; LoggingHelpers.LogWarning($"live assort: {liveAssort.ItemName} level: {liveAssort.Level} has a stack of 0, adding a new value of {newStackCount}"); diff --git a/AssortValidator.Common/Models/Assort.cs b/AssortValidator.Common/Models/Assort.cs index 7b1e936..a96ec7e 100644 --- a/AssortValidator.Common/Models/Assort.cs +++ b/AssortValidator.Common/Models/Assort.cs @@ -44,7 +44,7 @@ namespace AssortValidator.Common.Models public class Upd { - public int? BuyRestrictionMax { get; set; } + public object BuyRestrictionMax { get; set; } public int? BuyRestrictionCurrent { get; set; } public int? StackObjectsCount { get; set; } public bool? UnlimitedCount { get; set; }