fix(shop): don't treat ContractLockPurchase sentinel 'None' as a real lock
Build & Deploy / build (push) Successful in 34s
Build & Deploy / build (push) Successful in 34s
Regression from the contract-lock feature: the check gated on any non-empty ContractLockPurchase, but the blueprint data uses the string "None" (not "") for items with no lock (749/773 items). So virtually every item returned 'Item is locked' before the currency deduction -> players couldn't buy anything (error shown, K-Marks unchanged). Skip the gate when the value is null/empty/"None". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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