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 @@
#角色统计/#武器统计角色/武器池统计, - #常驻统计常驻池统计, + #常驻统计/#集录统计常驻/集录池统计 +
+
#全部统计全部抽卡统计, #抽卡帮助 获取帮助
@@ -56,7 +58,7 @@
{{vData.version}} {{vData.half}}
-
+
{{vData.name}}
{{vData.from}}~{{vData.to}}
diff --git a/resources/gacha/gacha-stat.less b/resources/gacha/gacha-stat.less index 8669b3d0..4c4553d6 100644 --- a/resources/gacha/gacha-stat.less +++ b/resources/gacha/gacha-stat.less @@ -7,7 +7,7 @@ display: flex; text-align: center; - & > div { + &>div { padding: 10px; height: 56px; } @@ -53,6 +53,10 @@ width: 125px; text-align: left; + &.mix { + width: 160px; + } + .name { height: 22px; line-height: 22px; @@ -163,5 +167,4 @@ } -} - +} \ No newline at end of file diff --git a/resources/meta-gs/info/pool.js b/resources/meta-gs/info/pool.js index dd2e4896..1e2e523a 100644 --- a/resources/meta-gs/info/pool.js +++ b/resources/meta-gs/info/pool.js @@ -594,5 +594,23 @@ export const poolDetail = [{ char4: ['五郎', '云堇', '多莉'], weapon5: ['有乐御簾切', '赤角石溃杵'], weapon4: ['暗巷闪光', '暗巷猎手', '钟剑', '匣里灭辰', '西风秘典'] +}, { + version: '4.5', + half: '下半', + from: '2024-04-02 18:00:00', + to: '2024-04-23 14:59:59', + char5: ['那维莱特', '枫原万叶'], + char4: ['芭芭拉', '行秋', '烟绯'], + weapon5: ['万世流涌大典', '苍古自由之誓'], + weapon4: ['暗巷的酒与诗', '幽夜华尔兹', '笛剑', '西风大剑', '西风长枪'] } ] + +export const mixPoolDetail = [{ + version: '4.5', + half: '上半', + from: '2024-03-13 06:00:00', + to: '2024-04-02 17:59:59', + char5: ['优菈', '阿贝多', '可莉'], + weapon5: ['苇海信标', '松籁响起之时', '猎人之径'] +}] diff --git a/resources/meta-gs/weapon/alias.js b/resources/meta-gs/weapon/alias.js index 686e2269..3d0a51eb 100644 --- a/resources/meta-gs/weapon/alias.js +++ b/resources/meta-gs/weapon/alias.js @@ -52,7 +52,7 @@ export const alias = { // 剑 天空之刃: '天空剑', 风鹰剑: '风鹰,风影', - 波乱月白经津: '波乱,月白,波乱月白,经津,波波津,啵啵剑,月经剑', + 波乱月白经津: '波乱,月白,波乱月白,经津,波波津,啵啵剑,月经剑,波波剑', 磐岩结绿: '绿箭,绿剑', 斫峰之刃: '斫峰,盾剑', 苍古自由之誓: '苍古,乐团剑', @@ -110,7 +110,6 @@ export const alias = { '「究极霸王超级魔剑」': '霸王超级魔剑,究极霸王超级魔剑,霸王剑,超级魔剑,霸王魔剑,究极魔剑,魔剑,极霸剑', 裁断: '斧头', - // 枪 天空之脊: '天空枪,薄荷枪', 护摩之杖: '护摩,护摩枪,护膜',