Files
WT-Offline/gui-patches/online-shop/present-saved-entitlement-grants/patch.json
T
N0VAN0M4LY 4b1e226c34 feat(store): show native receipts for purchases
Persist the actual grant in the purchase log and open one native receipt per unread entry. Keep pending receipts during log trimming and resume them when the price table becomes available.

Verified TypeScript types, GUI patch application, and Quirrel syntax.
2026-11-26 10:00:19 +08:00

31 lines
2.4 KiB
JSON

{
"id": "online-shop/present-saved-entitlement-grants",
"title": "Present the benefits recorded by the purchase",
"file": "scripts/userlog/userlogdata.nut",
"program_behaviour": {
"stock": "Entitlement rewards are displayed from the current catalogue.",
"patched": "Use the stored grant amounts and vehicle IDs for the purchase receipt. A retired product uses the existing text confirmation."
},
"derivation": {
"requirement": "Present the benefits recorded by the purchase",
"cause": "Catalogue bundles include all offered benefits, including vehicles the buyer may already own, and can be retired after the purchase.",
"lighter_options_ruled_out": [
"Render the current catalogue product directly. This cannot describe what was actually granted."
],
"if_not_applied": "Already owned vehicles can be listed as new, and receipts for removed products do not open."
},
"features": [
"G-Store",
"G-Premium Account"
],
"evidence": [
"2.61.0.37 scripts/onlineshop/entitlementview.nut: aircraftGift, goldIncome, wpIncome and entitlementGift are the reward list inputs.",
"2.61.0.37 scripts/onlineshop/onlinepurchase.nut and scripts/sqdagui/framework/msgbox.nut: purchase_done text confirmation and modal result.",
"packages/local-service/src/profile/profile-trophies-log.ts: purchaseReceipt stores the actual grant."
],
"edit": {
"find": "let { ENTITLEMENTS_PRICE } = require(\"%scripts/utils/configs.nut\")\r\n",
"replace": "let { ENTITLEMENTS_PRICE } = require(\"%scripts/utils/configs.nut\")\r\n\r\nlet queuedPurchaseReceipts = {}\r\nlocal waitingForPurchasePrices = false\r\n\r\nfunction showPurchaseReceipt(receipt) {\r\n let { getEntitlementConfig } = require(\"%scripts/onlineShop/entitlements.nut\")\r\n if (getEntitlementConfig(receipt.entitlement) == null)\r\n return scene_msg_box(\"purchase_done\", get_cur_gui_scene(),\r\n format(loc(\"userlog/buy_entitlement\"), receipt.entitlement),\r\n [[\"ok\", @() null]], \"ok\", { cancel_fn = @() null })\r\n\r\n let granted = receipt.granted\r\n let premiumDays = granted?.premiumDays ?? 0\r\n return showEntitlement(receipt.entitlement, { ignoreAvailability = true }, {\r\n goldIncome = granted?.goldIncome\r\n wpIncome = granted?.wpIncome\r\n aircraftGift = granted % \"aircraftGift\"\r\n entitlementGift = premiumDays > 0 ? [{ alias = \"PremiumAccount\", ttl = premiumDays }] : []\r\n })\r\n}\r\n"
}
}