最后一周ingame task奖励翻倍

This commit is contained in:
CounterFire2023 2024-05-27 16:27:19 +08:00
parent 65689b1395
commit b32caf1551
5 changed files with 138 additions and 11 deletions

View File

@ -22,7 +22,7 @@
"category": 1,
"pretasks": ["g3885fwjnddej6jmcha"],
"ticket": 0,
"score": 10,
"score": 20,
"checkChain": false,
"cfg": { "key": "loginVal", "amount": 1 },
"autoclaim": true
@ -38,7 +38,7 @@
"pretasks": ["g3885fwjnddej6jmcha"],
"ticket": 0,
"tickettasks": [],
"score": 20,
"score": 40,
"checkChain": false,
"cfg": { "key": "battleTimes", "amount": 3 },
"autoclaim": true
@ -54,7 +54,7 @@
"pretasks": ["g3885fwjnddej6jmcha"],
"ticket": 0,
"tickettasks": [],
"score": 20,
"score": 40,
"checkChain": false,
"cfg": { "key": "kills", "amount": 10 },
"autoclaim": true
@ -68,8 +68,8 @@
"category": 3,
"pretasks": ["g3885fwjnddej6jmcha"],
"type": 2,
"ticket": 1,
"score": 25,
"ticket": 2,
"score": 50,
"checkTime": true,
"checkChain": false,
"cfg": { "key": "getGoldVal","amount": 500 },

View File

@ -1,14 +1,14 @@
[
{
"rarity": "Common",
"ticket": 1
},
{
"rarity": "Rare",
"ticket": 2
},
{
"rarity": "Rare",
"ticket": 4
},
{
"rarity": "Legendary",
"ticket": 5
"ticket": 10
}
]

View File

@ -483,10 +483,106 @@
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g3r4zvkgq91qhcqyrub",
"task": "TwitterRetweet",
"title": "RT - Lazar Gameplay",
"type": 1,
"desc": "Retweet specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1793630212909084805"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g39w97t8y7d5e5arnx6",
"task": "TwitterLike",
"title": "Like - Lazar Gameplay",
"type": 1,
"desc": "Like specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1793630212909084805"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g3k2yd9drcxshw93rup",
"task": "TwitterRetweet",
"title": "RT - Doubled Game Quest Rewards",
"type": 1,
"desc": "Retweet specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1794216997498360269"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g31raymnxz1at1ctae9",
"task": "TwitterLike",
"title": "Like - Doubled Game Quest Rewards",
"type": 1,
"desc": "Like specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1794216997498360269"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g37fm8syv7fahg6727q",
"task": "TwitterRetweet",
"title": "RT - 200% Rewards Live Now",
"type": 1,
"desc": "Retweet specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1794939416253006327"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
},
{
"id": "g3fsuzz55pkvet9pxy1",
"task": "TwitterLike",
"title": "Like - 200% Rewards Live Now",
"type": 1,
"desc": "Like specific tweets",
"category": "Social Tasks",
"score": 50,
"autoclaim": false,
"pretasks": ["e2yhq2lj30vwcpedv7p"],
"cfg": { "icon": "twitter", "content": "1794939416253006327"},
"start": "2024-01-01 00:00",
"end": "2025-01-01 00:00",
"checkChain": false,
"params": { "time": 6, "failRate": 0 }
}
],
"drawTime": 1715245160457,
"startTime": 1713355200000,
"endTime": 1717199999999
"endTime": 1717372799999
}
]

View File

@ -23,6 +23,24 @@ export interface ApiAuthOptions {
secret: string
expiresIn: string
}
const checkEndList = [
'/api/activity/upload_invite_code',
'/api/chest/enhance',
'/api/chest/open',
'/api/user/checkin',
'/api/user/checkin/claim',
'/api/user/checkin/claim_seq',
'/api/game/pre_step',
'/api/game/step',
'/api/ingame/claim',
'/api/ingame/draw',
'/api/partner/claim',
'/api/tasks/begin_task',
'/api/tasks/check_task',
'/api/tasks/claim',
'/api/voucher/claim',
]
const checkEndSet = new Set(checkEndList)
const apiAuthPlugin: FastifyPluginAsync<ApiAuthOptions> = async function (fastify, opts) {
fastify.register(require('@fastify/jwt'), {
@ -39,6 +57,9 @@ const apiAuthPlugin: FastifyPluginAsync<ApiAuthOptions> = async function (fastif
}
}
if (activity) {
if (checkEndSet.has(request.url) && Date.now() > activity.endTime) {
return reply.send({ errcode: 90, errmsg: 'activity is end' })
}
request.activity = activity
}
if (!request.roles || request.roles.indexOf(ROLE_ANON) == -1 || request.token) {

View File

@ -46,6 +46,16 @@ const generateBounsCfg = (cfg: any) => {
return ys
}
export const generateChestCfg = (level: number) => {
let cfg = chestLevelMap.get(level)
if (!cfg) {
cfg = chestLevelMap.get(1)
}
const scoreInit = Math.floor(Math.random() * (cfg.initScoreMax - cfg.initScoreMin + 1) + cfg.initScoreMin)
const bounsCfg = generateBounsCfg(cfg)
return { scoreInit, bounsCfg, maxBounsCount: cfg.maxBounsCount }
}
export const generateNewChest = (uid: string, activity: string, level = 1, status = ChestStatusEnum.LOCKED) => {
let cfg = chestLevelMap.get(level)
if (!cfg) {