Further fixes for flea items being listed by bots

This commit is contained in:
Chomp
2025-01-27 16:10:49 +00:00
parent 5dc472014e
commit 2617cbd0e5
6 changed files with 21 additions and 11 deletions
@@ -1,4 +1,4 @@
using System.Runtime.InteropServices.JavaScript;
using System.Runtime.InteropServices.JavaScript;
using Core.Helpers;
using SptCommon.Annotations;
using Core.Models.Eft.Common.Tables;
@@ -331,8 +331,10 @@ public class RagfairOfferGenerator(
? expiredOffers ?? []
: ragfairAssortGenerator.GetAssortItems();
assortItemsToProcess.ForEach(assortItemWithChildren => CreateOffersFromAssort(assortItemWithChildren, replacingExpiredOffers, ragfairConfig.Dynamic));
foreach (var assortItem in assortItemsToProcess)
{
CreateOffersFromAssort(assortItem, replacingExpiredOffers, ragfairConfig.Dynamic);
}
}
@@ -465,8 +467,11 @@ public class RagfairOfferGenerator(
armorConfig.PlateSlotIdToRemovePool.Contains(item.SlotId?.ToLower())
);
foreach (var plateItem in offerItemPlatesToRemove) {
itemWithChildren.Splice(itemWithChildren.IndexOf(plateItem), 1);
// Latest first, to ensure we don't move later items off by 1 each time we remove an item below it
var indexesToRemove = offerItemPlatesToRemove.Select(plateItem => itemWithChildren.IndexOf(plateItem)).ToList();
foreach (var index in indexesToRemove.OrderByDescending(x => x))
{
itemWithChildren.RemoveAt(index);
}
}
}
+1 -1
View File
@@ -1148,7 +1148,7 @@ public class ItemHelper(
public bool IsQuestItem(string tpl)
{
var itemDetails = GetItem(tpl);
if (itemDetails.Key && itemDetails.Value.Properties.QuestItem != null)
if (itemDetails.Key && itemDetails.Value.Properties.QuestItem.GetValueOrDefault(false))
return true;
return false;
@@ -1,4 +1,4 @@
using System.Runtime.InteropServices.JavaScript;
using System.Runtime.InteropServices.JavaScript;
using SptCommon.Annotations;
using Core.Models.Eft.Common.Tables;
using Core.Models.Enums;
@@ -182,7 +182,9 @@ public class RagfairServerHelper(
}
}
return bias[(int) Math.Floor(randomUtil.RandNum(0, 1) * bias.Count)];
var index = Math.Min((int)Math.Floor((randomUtil.RandNum(0, 1, 14) * bias.Count)), 99);
return bias[index];
}
/**
@@ -20,8 +20,9 @@ public record Requirement
[JsonPropertyName("_tpl")]
public string? Template { get; set; }
// Can be decimal value
[JsonPropertyName("count")]
public int? Count { get; set; }
public double? Count { get; set; }
[JsonPropertyName("level")]
public int? Level { get; set; }
@@ -1,8 +1,9 @@
using System.Text.Json.Serialization;
using Core.Models.Utils;
namespace Core.Models.Eft.Ragfair;
public record GetMarketPriceRequestData
public record GetMarketPriceRequestData : IRequestData
{
[JsonPropertyName("templateId")]
public string? TemplateId { get; set; }
@@ -1,8 +1,9 @@
using System.Text.Json.Serialization;
using Core.Models.Utils;
namespace Core.Models.Eft.Ragfair;
public record StorePlayerOfferTaxAmountRequestData
public record StorePlayerOfferTaxAmountRequestData : IRequestData
{
[JsonPropertyName("id")]
public string? Id { get; set; }