BuyerWhitelistCondition.cs 944 B

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Shared.Store;
  2. using Content.Shared.Whitelist;
  3. namespace Content.Server.Store.Conditions;
  4. /// <summary>
  5. /// Filters out an entry based on the components or tags on an entity.
  6. /// </summary>
  7. public sealed partial class BuyerWhitelistCondition : ListingCondition
  8. {
  9. /// <summary>
  10. /// A whitelist of tags or components.
  11. /// </summary>
  12. [DataField("whitelist")]
  13. public EntityWhitelist? Whitelist;
  14. /// <summary>
  15. /// A blacklist of tags or components.
  16. /// </summary>
  17. [DataField("blacklist")]
  18. public EntityWhitelist? Blacklist;
  19. public override bool Condition(ListingConditionArgs args)
  20. {
  21. var ent = args.EntityManager;
  22. var whitelistSystem = ent.System<EntityWhitelistSystem>();
  23. if (whitelistSystem.IsWhitelistFail(Whitelist, args.Buyer) ||
  24. whitelistSystem.IsBlacklistPass(Blacklist, args.Buyer))
  25. return false;
  26. return true;
  27. }
  28. }