Merge pull request 'Fix critique: achats bloqués (sentinelle ContractLockPurchase None)' (#5) from preprod into main
Build & Deploy / build (push) Successful in 24s

This commit was merged in pull request #5.
This commit is contained in:
2026-07-15 00:15:14 +00:00
@@ -155,12 +155,14 @@ public class PurchaseWeaponShopItemFunction : ICloudScriptFunction<PurchaseWeapo
var blueprintData = blueprints[request.BaseItemID]; var blueprintData = blueprints[request.BaseItemID];
// Contract unlock criteria: some items can only be purchased after completing a // 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 // specific contract. The data uses the sentinel "None" (not an empty string) for
// items with no lock keep working as before. // items with no lock — treat that (and null/empty) as "no lock", otherwise EVERY
if (!string.IsNullOrEmpty(blueprintData.UnlockData?.ContractLockPurchase)) // 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); 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 return new PurchaseWeaponShopItemResponse
{ {