feat: tier starter packs using daily payment factors
This commit is contained in:
@@ -581,6 +581,9 @@ export class GameConfig {
|
||||
starter_packTime: number; // 新手礼包截止时间,秒
|
||||
starterPackServerOffset: number; // 服务端时间与本地时间差,毫秒
|
||||
starterPackPurchased: boolean;
|
||||
starterPackRound: number;
|
||||
starterPackOffer: any;
|
||||
starterPackAutoShownRound: number;
|
||||
starterPackLastShownAt: number; // 最近一次实际弹出时间,毫秒
|
||||
starterPackReactivatedDeadline: number; // 本次会话已确认的新周期截止时间,毫秒
|
||||
wxFriend: boolean; //微信好友信息授权
|
||||
@@ -796,6 +799,9 @@ export class GameConfig {
|
||||
starter_packTime: 0, // 新手礼包截止时间
|
||||
starterPackServerOffset: 0,
|
||||
starterPackPurchased: false,
|
||||
starterPackRound: 0,
|
||||
starterPackOffer: null,
|
||||
starterPackAutoShownRound: 0,
|
||||
starterPackLastShownAt: 0,
|
||||
starterPackReactivatedDeadline: 0,
|
||||
wxFriend: false, //微信好友信息授权
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** Purchases and login compensation use the same client-owned reward. */
|
||||
export function starterPackReward() {
|
||||
/** 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 };
|
||||
}
|
||||
|
||||
@@ -21,6 +22,17 @@ export function starterPackTimeText(seconds: number): string {
|
||||
export function applyStarterPackStatus(data: any): void {
|
||||
const info = cc.fx.GameConfig.GM_INFO;
|
||||
const expiry = Number(data.starter_pack) || 0;
|
||||
const round = Number(data.starterPackRound || data.starterPackOffer?.round) || 0;
|
||||
if (round && round < (info.starterPackRound || 0)) return;
|
||||
if (round > (info.starterPackRound || 0)) {
|
||||
info.starterPackPurchased = false;
|
||||
info.starterPackReactivatedDeadline = 0;
|
||||
info.starterPackRound = round;
|
||||
}
|
||||
if (data.starterPackOffer && (!info.starterPackOffer || round > Number(info.starterPackOffer.round))) {
|
||||
info.starterPackOffer = data.starterPackOffer;
|
||||
}
|
||||
info.starterPackAutoShownRound = Math.max(info.starterPackAutoShownRound || 0, Number(data.starterPackAutoShownRound) || 0);
|
||||
if (data.reactivated) info.starterPackReactivatedDeadline = Math.max(info.starterPackReactivatedDeadline || 0, expiry);
|
||||
// An activity read started before reactivation may arrive after its response.
|
||||
info.starter_packTime = Math.max(expiry, info.starterPackReactivatedDeadline || 0) / 1000;
|
||||
@@ -37,7 +49,8 @@ export function starterPackDay(): string {
|
||||
}
|
||||
|
||||
export function starterPackPopupKey(): string {
|
||||
return 'Starter_pack_' + cc.fx.GameConfig.GM_INFO.uid;
|
||||
const info = cc.fx.GameConfig.GM_INFO;
|
||||
return 'Starter_pack_' + info.uid + '_' + (info.starterPackRound || info.starter_packTime);
|
||||
}
|
||||
|
||||
export function starterPackFailureKey(): string {
|
||||
|
||||
Reference in New Issue
Block a user