Skip items that have less than 4 price points, they can't be averaged properly

This commit is contained in:
Dev 2023-11-12 10:45:54 +00:00
parent 3198fac515
commit c7061b6e84
4 changed files with 15374 additions and 3 deletions

View File

@ -9,6 +9,7 @@
//public string Trader { get; set; }
//public int BuyPackPrice { get; set; }
public string Currency { get; set; }
public int PricePoints { get; set; }
public string TemplateId { get; set; }
public int TraderPrice { get; set; }
public string Trader { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,7 @@ namespace MarketPriceLookup.Common.Helpers
//Price = price,
Average24hPrice = item.avg24hPrice,
Average7DaysPrice = averagedItemPrice,
PricePoints = item.historicalPrices.Length,
//Trader = trader,
//BuyPackPrice = buyBackPrice,
//Currency = currency,

View File

@ -21,11 +21,32 @@ namespace MarketPriceLookup
var handbookPrices = HandbookHelper.Items;
foreach (var item in ItemTemplateHelper.Items)
{
var priceData = MarketPricesHelper.GetItemPrice(item.Key);
if (priceData != null && priceData.Average7DaysPrice != 0)
// Not an item, skip
if (item.Value._type != "Item")
{
priceList.Add(item.Key, priceData.Average7DaysPrice);
continue;
}
var priceData = MarketPricesHelper.GetItemPrice(item.Key);
if (priceData == null)
{
//LoggingHelpers.LogWarning($"Skipping item {item.Value._name} as it no price data");
continue;
}
if (priceData.Average7DaysPrice == 0)
{
LoggingHelpers.LogWarning($"Skipping item {item.Value._name} as it has a Average7DaysPrice value of 0");
continue;
}
if (priceData.PricePoints < 4)
{
LoggingHelpers.LogWarning($"Skipping item {item.Value._name} as it only has {priceData.PricePoints} price points to sample from");
continue;
}
priceList.Add(item.Key, priceData.Average7DaysPrice);
}
// Ammo packs are easy to exploit, they're never listed on flea which casues server to use handbook price, often contain ammo worth x100 the cost of handbook price