Fix critique: achats bloqués (sentinelle ContractLockPurchase None) #5
@@ -155,12 +155,14 @@ public class PurchaseWeaponShopItemFunction : ICloudScriptFunction<PurchaseWeapo
|
||||
var blueprintData = blueprints[request.BaseItemID];
|
||||
|
||||
// Contract unlock criteria: some items can only be purchased after completing a
|
||||
// specific contract. Only gate when the item explicitly declares such a lock, so
|
||||
// items with no lock keep working as before.
|
||||
if (!string.IsNullOrEmpty(blueprintData.UnlockData?.ContractLockPurchase))
|
||||
// specific contract. The data uses the sentinel "None" (not an empty string) for
|
||||
// items with no lock — treat that (and null/empty) as "no lock", otherwise EVERY
|
||||
// item gets gated and nothing can be bought.
|
||||
var contractLockPurchase = blueprintData.UnlockData?.ContractLockPurchase;
|
||||
if (!string.IsNullOrEmpty(contractLockPurchase) && contractLockPurchase != "None")
|
||||
{
|
||||
var completed = JsonSerializer.Deserialize<FYGetCompletedContractsResult>(userData["ContractsOneTimeCompleted"].Value);
|
||||
if (completed?.ContractsIDs == null || !completed.ContractsIDs.Contains(blueprintData.UnlockData.ContractLockPurchase))
|
||||
if (completed?.ContractsIDs == null || !completed.ContractsIDs.Contains(contractLockPurchase))
|
||||
{
|
||||
return new PurchaseWeaponShopItemResponse
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user