ListingLimitedStockCondition.cs 537 B

1234567891011121314151617181920
  1. using Content.Shared.Store;
  2. namespace Content.Server.Store.Conditions;
  3. /// <summary>
  4. /// Only allows a listing to be purchased a certain amount of times.
  5. /// </summary>
  6. public sealed partial class ListingLimitedStockCondition : ListingCondition
  7. {
  8. /// <summary>
  9. /// The amount of times this listing can be purchased.
  10. /// </summary>
  11. [DataField("stock", required: true)]
  12. public int Stock;
  13. public override bool Condition(ListingConditionArgs args)
  14. {
  15. return args.Listing.PurchaseAmount < Stock;
  16. }
  17. }