using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; namespace SPTarkov.Server.Core.Extensions; public static class RagfairOfferExtensions { /// /// Is the passed in offer stale - end time > passed in time /// /// Offer to check /// Time to check offer against /// True - offer is stale public static bool IsStale(this RagfairOffer offer, long time) { return offer.EndTime < time || (offer.Quantity) < 1; } /// /// Does this offer come from a trader /// /// Offer to check /// True = from trader public static bool IsTraderOffer(this RagfairOffer offer) { if (offer.CreatedBy is not null) { return offer.CreatedBy == OfferCreator.Trader; } return offer.User.MemberType == MemberCategory.Trader; } /// /// Was this offer created by a human player /// /// /// public static bool IsPlayerOffer(this RagfairOffer offer) { if (offer.CreatedBy is not null) { return offer.CreatedBy == OfferCreator.Player; } return false; } /// /// Was this offer created by a fake player /// /// /// public static bool IsFakePlayerOffer(this RagfairOffer offer) { if (offer.CreatedBy is not null) { return offer.CreatedBy == OfferCreator.FakePlayer; } return false; } }