fix: keep starter pack rewards client-side

This commit is contained in:
COMPUTER\EDY
2026-09-30 21:49:05 +08:00
parent 60f8fc4047
commit b8e02e08d0
9 changed files with 60 additions and 52 deletions
+11 -4
View File
@@ -1,7 +1,14 @@
/** Use the order's offer for delivery; missing snapshots retain legacy rewards. */
export function starterPackReward(offer?: any) {
if (offer?.reward) return { ...offer.reward };
return { coin: 3000, hammer: 3, freeze: 3, magic_wand: 3, infinite_health: 30 * 60 };
const STARTER_PACK_REWARDS = {
starter_pack: { coin: 3000, hammer: 1, freeze: 1, magic_wand: 1, infinite_health: 30 * 60 },
starter_pack_2: { coin: 3000, hammer: 1, freeze: 1, magic_wand: 1, infinite_health: 30 * 60 },
starter_pack_3: { coin: 4500, hammer: 3, freeze: 3, magic_wand: 3, infinite_health: 45 * 60 },
starter_pack_4: { coin: 5000, hammer: 5, freeze: 5, magic_wand: 5, infinite_health: 60 * 60 },
starter_pack_5: { coin: 8000, hammer: 8, freeze: 8, magic_wand: 8, infinite_health: 180 * 60 },
};
/** Rewards are fixed by the client SKU; the server only selects the offer tier. */
export function starterPackReward(productId = "starter_pack") {
return { ...(STARTER_PACK_REWARDS[productId] || STARTER_PACK_REWARDS.starter_pack) };
}
export function starterPackNow(): number {