Implemented GetFleaPriceForOfferItems

This commit is contained in:
Chomp
2025-01-26 17:55:34 +00:00
parent c84754bd2d
commit e1b354e67b
2 changed files with 17 additions and 10 deletions
@@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Core.Models.Eft.Common;
namespace Core.Models.Spt.Config;
@@ -10,23 +10,23 @@ public record ItemConfig : BaseConfig
/** Items that should be globally blacklisted */
[JsonPropertyName("blacklist")]
public List<string> Blacklist { get; set; }
public HashSet<string> Blacklist { get; set; }
/** Items that should not be lootable from any location */
[JsonPropertyName("lootableItemBlacklist")]
public List<string> LootableItemBlacklist { get; set; }
public HashSet<string> LootableItemBlacklist { get; set; }
/** items that should not be given as rewards */
[JsonPropertyName("rewardItemBlacklist")]
public List<string> RewardItemBlacklist { get; set; }
public HashSet<string> RewardItemBlacklist { get; set; }
/** Item base types that should not be given as rewards */
[JsonPropertyName("rewardItemTypeBlacklist")]
public List<string> RewardItemTypeBlacklist { get; set; }
public HashSet<string> RewardItemTypeBlacklist { get; set; }
/** Items that can only be found on bosses */
[JsonPropertyName("bossItems")]
public List<string> BossItems { get; set; }
public HashSet<string> BossItems { get; set; }
[JsonPropertyName("handbookPriceOverride")]
public Dictionary<string, HandbookPriceOverride> HandbookPriceOverride { get; set; }
+11 -4
View File
@@ -34,12 +34,13 @@ public class RagfairPriceService(
/// </summary>
public async Task OnLoadAsync()
{
throw new NotImplementedException();
RefreshStaticPrices();
RefreshDynamicPrices();
}
public string GetRoute()
{
throw new NotImplementedException();
return "RagfairPriceService";
}
/// <summary>
@@ -58,7 +59,7 @@ public class RagfairPriceService(
/// </summary>
public void RefreshDynamicPrices()
{
throw new NotImplementedException();
// TODO: remove as redundant?
}
/// <summary>
@@ -95,7 +96,13 @@ public class RagfairPriceService(
/// <returns>Rouble price</returns>
public double GetFleaPriceForOfferItems(List<Item> offerItems)
{
throw new NotImplementedException();
// Preset weapons take the direct prices.json value, otherwise they're massivly inflated
if (_itemHelper.IsOfBaseclass(offerItems[0].Template, BaseClasses.WEAPON))
{
return GetFleaPriceForItem(offerItems[0].Template);
}
return offerItems.Sum(item => GetFleaPriceForItem(item.Template));
}
/// <summary>