From b72dfe187e4d842bd9362e6d0ea598c3081fcd8e Mon Sep 17 00:00:00 2001 From: Aluxes <39981645+AshenAshes@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E#=E9=9B=86=E5=BD=95=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=20#=E9=9B=86=E5=BD=95=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/gacha.js | 8 +++--- apps/gacha/Gacha.js | 11 +++++-- apps/gacha/GachaData.js | 48 +++++++++++++++++++++++++++---- resources/gacha/gacha-stat.css | 4 ++- resources/gacha/gacha-stat.html | 14 +++++---- resources/gacha/gacha-stat.less | 9 ++++-- resources/meta-gs/info/pool.js | 18 ++++++++++++ resources/meta-gs/weapon/alias.js | 3 +- 8 files changed, 91 insertions(+), 24 deletions(-) diff --git a/apps/gacha.js b/apps/gacha.js index 7ae93ddc..af537d6b 100644 --- a/apps/gacha.js +++ b/apps/gacha.js @@ -9,15 +9,15 @@ app.reg({ detail: { name: '抽卡记录', fn: Gacha.detail, - rule: /^#*喵喵(抽卡|抽奖|角色|武器|常驻|up)+池?(记录|祈愿|分析)$/, - yzRule: /^#*(抽卡|抽奖|角色|武器|常驻|up)+池?(记录|祈愿|分析)$/, + rule: /^#*喵喵(抽卡|抽奖|角色|武器|常驻|集录|up)+池?(记录|祈愿|分析)$/, + yzRule: /^#*(抽卡|抽奖|角色|武器|常驻|集录|up)+池?(记录|祈愿|分析)$/, yzCheck: () => Cfg.get('gachaStat', false) }, stat: { name: '抽卡统计', fn: Gacha.stat, - rule: /^#*喵喵(全部|抽卡|抽奖|角色|武器|常驻|up|版本)+池?统计$/, - yzRule: /^#*(全部|抽卡|抽奖|角色|武器|常驻|up|版本)+池?统计$/, + rule: /^#*喵喵(全部|抽卡|抽奖|角色|武器|常驻|集录|up|版本)+池?统计$/, + yzRule: /^#*(全部|抽卡|抽奖|角色|武器|常驻|集录|up|版本)+池?统计$/, yzCheck: () => Cfg.get('gachaStat', false) } diff --git a/apps/gacha/Gacha.js b/apps/gacha/Gacha.js index 7d1bd7fd..557dcf54 100644 --- a/apps/gacha/Gacha.js +++ b/apps/gacha/Gacha.js @@ -20,6 +20,9 @@ let Gacha = { case '武器': type = 302 break + case '集录': + type = 500 + break } let uid = e.uid || await getTargetUid(e) let qq = e.user_id @@ -37,7 +40,7 @@ let Gacha = { uid, gacha, face: Gacha.getFace(uid) - }, { e, scale: 1.4, retType: "base64" }), new Button(e).gacha()]) + }, { e, scale: 1.4, retType: 'base64' }), new Button(e).gacha()]) }, async stat (e) { let msg = e.msg.replace(/#|统计|分析|池/g, '') @@ -48,6 +51,8 @@ let Gacha = { type = 'char' } else if (/常驻/.test(msg)) { type = 'normal' + } else if (/集录/.test(msg)) { + type = 'mix' } else if (/全部/.test(msg)) { type = 'all' } @@ -66,7 +71,7 @@ let Gacha = { uid, gacha, face: Gacha.getFace(uid) - }, { e, scale: 1.4, retType: "base64" }), new Button(e).gacha()]) + }, { e, scale: 1.4, retType: 'base64' }), new Button(e).gacha()]) }, getFace (uid) { @@ -87,4 +92,4 @@ let Gacha = { } } } -export default Gacha \ No newline at end of file +export default Gacha diff --git a/apps/gacha/GachaData.js b/apps/gacha/GachaData.js index ece2c9c1..75f62c84 100644 --- a/apps/gacha/GachaData.js +++ b/apps/gacha/GachaData.js @@ -1,7 +1,7 @@ import lodash from 'lodash' import { Data } from '#miao' import { Character, Weapon } from '#miao.models' -import { poolDetail } from '../../resources/meta-gs/info/index.js' +import { poolDetail, mixPoolDetail } from '../../resources/meta-gs/info/index.js' import moment from 'moment' let poolVersion = [] @@ -23,6 +23,24 @@ poolVersion.push({ end: new Date('2025-12-31 23:59:59') }) +let mixPoolVersion = [] +lodash.forEach(mixPoolDetail, (ds) => { + mixPoolVersion.push({ + ...ds, + start: new Date(ds.from), + end: new Date(ds.to) + }) +}) +let mixLast = mixPoolVersion[mixPoolVersion.length - 1] +mixPoolVersion.push({ + version: '新版本', + half: '?', + from: mixLast.to, + to: '2025-12-31 23:59:59', + start: mixLast.end, + end: new Date('2025-12-31 23:59:59') +}) + let GachaData = { // 获取JSON数据 @@ -109,6 +127,10 @@ let GachaData = { let weaponFourNum = 0 let bigNum = 0 let allNum = 0 + let isMix = false + if (type === 500) { + isMix = true + } let itemMap = logData.itemMap if (logData.items.length === 0) { @@ -117,7 +139,7 @@ let GachaData = { let currVersion lodash.forEach(logData.items, (item) => { if (!currVersion || (item.time < currVersion.start)) { - currVersion = GachaData.getVersion(item.time) + currVersion = GachaData.getVersion(item.time, true, isMix) } allNum++ @@ -264,6 +286,7 @@ let GachaData = { let items = [] let itemMap = {} let hasVersion = true + let isMix = false let loadData = function (poolId) { let gachaData = GachaData.readJSON(qq, uid, poolId) items = items.concat(gachaData.items) @@ -279,6 +302,13 @@ let GachaData = { hasVersion = false loadData(200) } + if (['mix'].includes(type)) { + isMix = true + loadData(500) + } + if (['all'].includes(type)) { + loadData(500) + } items = items.sort((a, b) => b.time - a.time) @@ -366,7 +396,7 @@ let GachaData = { if (currVersion) { versionData.push(getCurr()) } - let v = GachaData.getVersion(ds.time, hasVersion) + let v = GachaData.getVersion(ds.time, hasVersion, isMix) if (!hasVersion) { v.version = type === 'all' ? '全部统计' : '常驻池' } @@ -401,11 +431,19 @@ let GachaData = { return { versionData, itemMap, - totalStat: stat + totalStat: stat, + isMix } }, - getVersion (time, hasVersion = true) { + getVersion (time, hasVersion = true, isMix = false) { + if (isMix) { + for (let ds of mixPoolVersion) { + if (time > ds.start && time < ds.end) { + return ds + } + } + } if (hasVersion) { for (let ds of poolVersion) { if (time > ds.start && time < ds.end) { diff --git a/resources/gacha/gacha-stat.css b/resources/gacha/gacha-stat.css index bd9f207d..5e2589ea 100644 --- a/resources/gacha/gacha-stat.css +++ b/resources/gacha/gacha-stat.css @@ -46,6 +46,9 @@ width: 125px; text-align: left; } +.gacha-pool .pool-name.mix { + width: 160px; +} .gacha-pool .pool-name .name { height: 22px; line-height: 22px; @@ -136,4 +139,3 @@ background: #333; color: #fff; } -/*# sourceMappingURL=gacha-stat.css.map */ \ No newline at end of file diff --git a/resources/gacha/gacha-stat.html b/resources/gacha/gacha-stat.html index 0abf4a51..dd791982 100644 --- a/resources/gacha/gacha-stat.html +++ b/resources/gacha/gacha-stat.html @@ -1,10 +1,10 @@ {{extend elemLayout}} {{block 'css'}} - - - - + + + + {{/block}} @@ -41,7 +41,9 @@