diff --git a/Content.Client/SS220/Contractor/UI/ContractorPDAMenu.xaml b/Content.Client/SS220/Contractor/UI/ContractorPDAMenu.xaml index 2411faf073bd07..f6ac92b103ac37 100644 --- a/Content.Client/SS220/Contractor/UI/ContractorPDAMenu.xaml +++ b/Content.Client/SS220/Contractor/UI/ContractorPDAMenu.xaml @@ -18,7 +18,7 @@ - + diff --git a/Content.Server/Store/Conditions/BuyBeforeCondition.cs b/Content.Server/Store/Conditions/BuyBeforeCondition.cs index fcfb5f92c9d070..2800ecb808a7c7 100644 --- a/Content.Server/Store/Conditions/BuyBeforeCondition.cs +++ b/Content.Server/Store/Conditions/BuyBeforeCondition.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Shared.Store; using Content.Shared.Store.Components; using Robust.Shared.Prototypes; @@ -6,11 +7,19 @@ namespace Content.Server.Store.Conditions; public sealed partial class BuyBeforeCondition : ListingCondition { + //ss220 blocking all listings, if any other listing was bought start /// /// Required listing(s) needed to purchase before this listing is available /// - [DataField(required: true)] - public HashSet> Whitelist; + [DataField] + public HashSet>? Whitelist; + + /// + /// If true, block to buy listing if any other listing was bought + /// + [DataField] + public bool BlacklistAll; + //ss220 blocking all listings, if any other listing was bought end /// /// Listing(s) that if bought, block this purchase, if any. @@ -24,7 +33,15 @@ public override bool Condition(ListingConditionArgs args) var allListings = storeComp.FullListingsCatalog; - var purchasesFound = false; + //ss220 blocking all listings, if any other listing was bought start + if (BlacklistAll) + { + if (allListings.Any(listing => listing.PurchaseAmount > 0)) + return false; + } + + var purchasesFound = true; + //ss220 blocking all listings, if any other listing was bought end if (Blacklist != null) { @@ -38,17 +55,22 @@ public override bool Condition(ListingConditionArgs args) } } - foreach (var requiredListing in Whitelist) + //ss220 blocking all listings, if any other listing was bought start + if (Whitelist != null) { - foreach (var listing in allListings) + foreach (var requiredListing in Whitelist) { - if (listing.ID == requiredListing.Id) + foreach (var listing in allListings) { - purchasesFound = listing.PurchaseAmount > 0; - break; + if (listing.ID == requiredListing.Id) + { + purchasesFound = listing.PurchaseAmount > 0; + break; + } } } } + //ss220 blocking all listings, if any other listing was bought end return purchasesFound; } diff --git a/Resources/Prototypes/SS220/Catalog/uplink_catalog.yml b/Resources/Prototypes/SS220/Catalog/uplink_catalog.yml index c981095a2f5554..41905dfd3889e4 100644 --- a/Resources/Prototypes/SS220/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/SS220/Catalog/uplink_catalog.yml @@ -253,6 +253,8 @@ conditions: - !type:ListingLimitedStockCondition stock: 1 + - !type:BuyBeforeCondition #block buy listing, if any other listing was bought + blacklistAll: true - !type:StoreWhitelistCondition blacklist: tags: