diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs index cd298064..ccd34a51 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs @@ -591,18 +591,14 @@ public class TraderHelper( /// Rouble price public double GetHighestSellToTraderPrice(MongoId tpl) { - // Find largest trader price for item var highestPrice = 1d; // Default price + var itemHandbookPrice = handbookHelper.GetTemplatePrice(tpl); foreach (var trader in traderStore.GetAllTraders()) { // Get trader and check buy category allows tpl var traderBase = databaseService.GetTrader(trader.Id).Base; - // Skip traders that don't sell this category of item - if ( - traderBase is null - || !itemHelper.IsOfBaseclasses(tpl, traderBase.ItemsBuy.Category) - ) + if (traderBase is null) { continue; } @@ -613,7 +609,6 @@ public class TraderHelper( var traderBuyBackPricePercent = 100 - traderBase.LoyaltyLevels.FirstOrDefault().BuyPriceCoefficient; - var itemHandbookPrice = handbookHelper.GetTemplatePrice(tpl); var priceTraderBuysItemAt = randomUtil.GetPercentOfValue( traderBuyBackPricePercent ?? 0, itemHandbookPrice, diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs index e5503618..de76ed16 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs @@ -168,7 +168,7 @@ public record Dynamic /// Settings to control the durability range of item items listed on flea /// [JsonPropertyName("condition")] - public Dictionary Condition { get; set; } + public Dictionary Condition { get; set; } /// /// Size stackable items should be listed for in percent of max stack size diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs index 45e1e7cf..aadd4581 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SPTarkov.Server.Core.Models.Common; namespace SPTarkov.Server.Core.Models.Spt.Ragfair; @@ -8,11 +9,11 @@ public record TplWithFleaPrice public Dictionary? ExtensionData { get; set; } [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public MongoId Tpl { get; set; } /// /// Roubles /// [JsonPropertyName("price")] - public double? Price { get; set; } + public double Price { get; set; } } diff --git a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs index d1df3755..12da3714 100644 --- a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs @@ -350,8 +350,7 @@ public class DatabaseService( /// assets/database/traders/ public Trader? GetTrader(MongoId traderId) { - var traders = GetTraders(); - if (!traders.TryGetValue(traderId, out var desiredTrader)) + if (!databaseServer.GetTables().Traders.TryGetValue(traderId, out var desiredTrader)) { logger.Error( serverLocalisationService.GetText("database-no_trader_found_with_id", traderId)