Improved how ragfair offer creator status is checked - store creator type in offer

Converted `IsTraderOffer` into extension method
string to mongoid conversions
This commit is contained in:
Chomp
2025-07-21 13:36:51 +01:00
parent 5eaedccdfa
commit 3901a91f45
11 changed files with 93 additions and 98 deletions
@@ -1,8 +1,8 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Ragfair;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Services;
@@ -30,7 +30,7 @@ public class RagfairCategoriesService(
return offers
.Where(offer =>
{
var isTraderOffer = offer.User.MemberType == MemberCategory.Trader;
var isTraderOffer = offer.IsTraderOffer();
// Not level 15 and offer is from player, skip
if (!fleaUnlocked && !isTraderOffer)
@@ -63,7 +63,7 @@ public class RagfairOfferService(
/// </summary>
/// <param name="offerId"> Offer id to check for </param>
/// <returns> True when offer exists </returns>
public bool DoesOfferExist(string offerId)
public bool DoesOfferExist(MongoId offerId)
{
return ragfairOfferHolder.GetOfferById(offerId) != null;
}
@@ -72,7 +72,7 @@ public class RagfairOfferService(
/// Remove an offer from ragfair by offer id
/// </summary>
/// <param name="offerId"> Offer id to remove </param>
public void RemoveOfferById(string offerId)
public void RemoveOfferById(MongoId offerId)
{
ragfairOfferHolder.RemoveOffer(offerId);
}
@@ -82,7 +82,7 @@ public class RagfairOfferService(
/// </summary>
/// <param name="offerId"> Offer to adjust stack size of </param>
/// <param name="amount"> How much to deduct from offers stack size </param>
public void ReduceOfferQuantity(string offerId, int amount)
public void ReduceOfferQuantity(MongoId offerId, int amount)
{
var offer = ragfairOfferHolder.GetOfferById(offerId);
if (offer == null)