i have no idea, stuff i guess

This commit is contained in:
Chomp 2022-01-15 17:21:24 +00:00
parent 7c2f4cbaf7
commit cb1f23c8f6
3 changed files with 45 additions and 9 deletions

View File

@ -12,6 +12,18 @@ namespace AssortUpdater
// Add live assorts to merged list
foreach (var liveAssort in flattenedLiveAssorts)
{
if (liveAssort.AssortId == "61e0a2a8033bdc459438d31f")
{
var x = 1;
}
if (liveAssort.RawItem.upd.StackObjectsCount == 0)
{
var newStackCount = liveAssort.RawItem.upd.BuyRestrictionMax.HasValue
? (liveAssort.RawItem.upd.BuyRestrictionMax.Value * 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}");
}
completeAssorts.Add(liveAssort);
}
LoggingHelpers.LogSuccess($"{trader} Added {flattenedLiveAssorts.Count} items from live");
@ -83,6 +95,15 @@ namespace AssortUpdater
return existingAssort.First();
}
existingAssort = GetAssortByItemIdIsMoneyAndSubItemCount(assortToFind, completeAssorts);
if (MultipleAssortsFound(existingAssort))
{
throw new Exception("oh shit");
}
if (SingleAssortFound(existingAssort))
{
return existingAssort.First();
}
//LoggingHelpers.LogError($"{traderName} No match found for item: {assortToFind.ItemId} {assortToFind.ItemName} Level: {assortToFind.Level}");
// No matches found, probably doesnt exist
@ -102,28 +123,37 @@ namespace AssortUpdater
private static IEnumerable<FlatAssort> GetAssortByItemIdLevelMoneySubItemCountAndCostItemCount(FlatAssort assortToFind, List<FlatAssort> completeAssorts)
{
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId
&& x.Level == assortToFind.Level
&& x.IsMoney == assortToFind.IsMoney
&& x.SubItems.Count == assortToFind.SubItems.Count
&& x.BarterDetails[0].count == assortToFind.BarterDetails[0].count);
&& x.Level == assortToFind.Level
&& x.IsMoney == assortToFind.IsMoney
&& x.SubItems.Count == assortToFind.SubItems.Count
&& x.BarterDetails[0].count == assortToFind.BarterDetails[0].count);
}
private static IEnumerable<FlatAssort> GetAssortByItemId(FlatAssort assortToFind, List<FlatAssort> completeAssorts)
{
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId);
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId
&& x.AssortId != assortToFind.AssortId);
}
private static IEnumerable<FlatAssort> GetAssortByItemIdAndLevel(FlatAssort assortToFind, List<FlatAssort> completeAssorts)
{
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId
&& x.Level == assortToFind.Level);
&& x.Level == assortToFind.Level);
}
private static IEnumerable<FlatAssort> GetAssortByItemIdLevelAndMoney(FlatAssort assortToFind, List<FlatAssort> completeAssorts)
{
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId
&& x.Level == assortToFind.Level
&& x.IsMoney == assortToFind.IsMoney);
&& x.Level == assortToFind.Level
&& x.IsMoney == assortToFind.IsMoney);
}
private static IEnumerable<FlatAssort>? GetAssortByItemIdIsMoneyAndSubItemCount(FlatAssort assortToFind, List<FlatAssort> completeAssorts)
{
return completeAssorts.Where(x => x.ItemId == assortToFind.ItemId
&& x.IsMoney == assortToFind.IsMoney
&& x.SubItems.Count == assortToFind.SubItems.Count
&& x.BarterDetails.Count == assortToFind.BarterDetails.Count);
}
private static IEnumerable<FlatAssort>? GetAssortByBarterCostAndCount(FlatAssort assortToFind, List<FlatAssort> completeAssorts)

View File

@ -109,7 +109,7 @@ namespace AssortValidator.Common.Helpers
if (traderType != Trader.Unknown)
{
_assortLiveDataCache.Add(traderType, parsedAssorts.data);
}
}
}
}

View File

@ -259,6 +259,12 @@ namespace AssortValidator.Common.Helpers
{ "6179afd0bca27a099552e040", "Lost Contact"},
{ "613708a7f8333a5d15594368", "Action Test"}
};
public static Quest GetQuestById(string questId)
{
return _liveQuestData[questId];
}
private static Dictionary<string, Quest> _liveQuestData;
public static Dictionary<string, Quest> GetQuestDataFromDump(string filename = "resp.client.quest.list")