diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ea0fdc..8ee68fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ -# 2.3.3 Dev +# 2.3.3 -* 初步增加`#抽卡分析``#抽卡统计`,样式与功能尚未完全稳定 +* 增加`#角色记录``#抽卡统计`功能,可在`#喵喵设置`中开启 + * `#角色记录`、`#武器记录`、`#常驻记录` 可查看对应池子的抽卡记录 + * `#角色统计`、`#武器统计` 可按卡池汇总统计抽卡记录 + * `#全部统计` 可将所有抽卡信息汇总展示 + * 其余`#更新抽卡记录`、`#抽卡帮助`等功能均为Yunzai原生功能 # 2.3.1~2.3.2 diff --git a/apps/gacha.js b/apps/gacha.js index a74ca284..80dd8524 100644 --- a/apps/gacha.js +++ b/apps/gacha.js @@ -1,4 +1,4 @@ -import { App } from '../components/index.js' +import { App, Cfg } from '../components/index.js' import Gacha from './gacha/Gacha.js' let app = App.init({ @@ -9,12 +9,17 @@ app.reg({ detail: { name: '抽卡记录', fn: Gacha.detail, - rule: /^#*(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/ + rule: /^#*喵喵(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/, + yzRule: /^#*(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/, + yzCheck: () => Cfg.get('gachaStat', false) }, stat: { name: '抽卡统计', fn: Gacha.stat, - rule: /^#*(全部|抽卡|抽奖|角色|武器|常驻|up|版本)池*统计$/ + rule: /^#*喵喵(全部|抽卡|抽奖|角色|武器|常驻|up|版本)池*统计$/, + yzRule: /^#*(抽奖|角色|武器|常驻|up|版本)池*统计$/, + yzCheck: () => Cfg.get('gachaStat', false) + } }) diff --git a/apps/gacha/Gacha.js b/apps/gacha/Gacha.js index b43669cc..3a66b5f2 100644 --- a/apps/gacha/Gacha.js +++ b/apps/gacha/Gacha.js @@ -29,16 +29,15 @@ let Gacha = { let gacha = GachaData.analyse(e.user_id, uid, type) if (!gacha) { - e.reply('本地暂无抽卡信息') + e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`) return true } await Common.render('gacha/gacha-detail', { save_id: uid, uid, gacha, - face: Gacha.getFace(uid), - imgType: 'png' - }, { e, scale: 1.2, retMsgId: true }) + face: Gacha.getFace(uid) + }, { e, scale: 1.4, retMsgId: true }) }, async stat (e) { let msg = e.msg.replace(/#|统计|分析|池/g, '') @@ -59,16 +58,15 @@ let Gacha = { } let gacha = GachaData.stat(e.user_id, uid, type) if (!gacha) { - e.reply('本地暂无抽卡信息') + e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`) return true } await Common.render('gacha/gacha-stat', { save_id: uid, uid, gacha, - face: Gacha.getFace(uid), - quality: 92 - }, { e, scale: 1.3 }) + face: Gacha.getFace(uid) + }, { e, scale: 1.4 }) }, getFace (uid) { @@ -76,11 +74,14 @@ let Gacha = { let faceChar = Character.get(player.face || 10000014) let imgs = faceChar.imgs + if (!imgs.face) { + imgs = Character.get(10000079).imgs + } return { banner: imgs?.banner, face: imgs?.face, qFace: imgs?.qFace, - name: player.name || `#${uid}`, + name: player.name || '旅行者', sign: player.sign, level: player.level } diff --git a/apps/gacha/GachaData.js b/apps/gacha/GachaData.js index 2eb40292..ff538fda 100644 --- a/apps/gacha/GachaData.js +++ b/apps/gacha/GachaData.js @@ -15,7 +15,7 @@ lodash.forEach(poolDetail, (ds) => { let last = poolVersion[poolVersion.length - 1] // 为未知卡池做兼容 poolVersion.push({ - version: '?', + version: '新版本', half: '?', from: last.to, to: '2025-12-31 23:59:59', @@ -29,7 +29,7 @@ let GachaData = { readJSON (qq, uid, type) { let logJson = [] // 获取本地数据 进行数据合并 - logJson = Data.readJSON(`/data/gachaJSON/${qq}/${uid}/${type}.json`, 'root') + logJson = Data.readJSON(`/data/gachaJson/${qq}/${uid}/${type}.json`, 'root') let itemMap = {} let nameMap = {} let items = [] @@ -114,7 +114,12 @@ let GachaData = { if (logData.items.length === 0) { return false } + let currVersion lodash.forEach(logData.items, (item) => { + if (!currVersion || (item.time < currVersion.start)) { + currVersion = GachaData.getVersion(item.time) + } + allNum++ let ds = itemMap[item.id] let { star, type } = ds @@ -147,13 +152,17 @@ let GachaData = { let isUp = false // 歪了多少个 if (type === 'char') { - if (GachaData.checkIsUp(item, ds)) { + if (currVersion.char5.includes(ds.name)) { isUp = true } else { wai++ } } else { - weaponNum++ + if (currVersion.weapon5.includes(ds.name)) { + isUp = true + } else { + wai++ + } } fiveLog.push({ @@ -213,17 +222,19 @@ let GachaData = { noWaiRate = (noWaiRate * 100).toFixed(1) } - fiveLog.unshift({ - id: 888, - isUp: true, - count: noFiveNum, - date: moment().format('MM-DD') - }) - itemMap['888'] = { - name: '即将获得', - star: 5, - abbr: '即将获得', - img: 'gacha/imgs/no-avatar.webp' + if (noFiveNum > 0) { + fiveLog.unshift({ + id: 888, + isUp: true, + count: noFiveNum, + date: moment().format('MM-DD') + }) + itemMap['888'] = { + name: '已抽', + star: 5, + abbr: '已抽', + img: 'gacha/imgs/no-avatar.webp' + } } return { @@ -428,29 +439,6 @@ let GachaData = { ...char.getData('id,star,name,abbr,face') } } - }, - - // 检查角色是否是Up角色 - checkIsUp (ds, item) { - if (['莫娜', '七七', '迪卢克', '琴'].includes(item.name)) { - return false - } - - let time = ds.time - - if (item.name === '刻晴') { - let start = new Date('2021-02-17 18:00:00').getTime() - let end = new Date('2021-03-02 15:59:59').getTime() - return !(time < start || time > end) - } - - if (item.name === '提纳里') { - let start = new Date('2022-08-24 06:00:00').getTime() - let end = new Date('2022-09-09 17:59:59').getTime() - return !(time < start || time > end) - } - return true } - } export default GachaData diff --git a/config/system/cfg_system.js b/config/system/cfg_system.js index c409cf39..799025b0 100644 --- a/config/system/cfg_system.js +++ b/config/system/cfg_system.js @@ -27,6 +27,11 @@ export const cfgSchema = { key: '帮助', def: false }, + gachaStat: { + title: '#抽卡分析 #抽卡统计', + key: '抽卡', + def: false + }, avatarPoke: { title: '戳一戳展示角色卡片', key: '戳一戳', diff --git a/models/MysApi.js b/models/MysApi.js index 00e6c613..564da57b 100644 --- a/models/MysApi.js +++ b/models/MysApi.js @@ -107,7 +107,7 @@ export default class MysApi { } e._reqCount++ let ret = await mys.getData(api, data) - ret = await mysInfo.checkCode(ret, api) + ret = await mysInfo.checkCode(ret, api, this.mys) e._reqCount-- if (e._reqCount === 0) { e.reply = e._original_reply diff --git a/resources/gacha/gacha-detail.css b/resources/gacha/gacha-detail.css index 03b464d4..727449d5 100644 --- a/resources/gacha/gacha-detail.css +++ b/resources/gacha/gacha-detail.css @@ -19,8 +19,8 @@ } .gacha-list .gacha-item .date .dot { width: 23.75px; - height: 38px; - background: url('./imgs/date-icon.webp') center -100%; + height: 43px; + background: url('./imgs/date-icon.webp') center -38px; background-size: 100% auto; } .gacha-list .gacha-item .date .dot.first { @@ -53,42 +53,6 @@ .gacha-list .gacha-item.wai .name { color: #aaa; } -.gacha-list .gacha-item.wai .name, -.gacha-list .gacha-item.wai .icon, -.gacha-list .gacha-item.wai .process { - background-color: #47484d; -} -.gacha-list .gacha-item.wai .bar { - position: relative; - /* &:after { - display: block; - position: absolute; - right: -34px; - top: -2px; - width: 25px; - height: 25px; - border-radius: 15px; - content: "歪"; - border: 2px solid #f00; - color: #f00; - text-align: center; - line-height: 26px; - font-size: 18px; - transform: rotate(30deg); - background-color: #47484d; - } */ -} -.gacha-list .gacha-item.wai .bar:after { - content: ""; - display: block; - position: absolute; - right: -33px; - top: -2px; - width: 30px; - height: 30px; - background: url('./imgs/wai.webp') center no-repeat; - background-size: 100% 100%; -} .gacha-list .gacha-item.up .name { /*background: rgba(0, 0, 0, .5);*/ color: #ffd484; @@ -97,6 +61,29 @@ .gacha-list .gacha-item.up .icon { /* background-color: rgba(0, 0, 0, .5);*/ } +.gacha-list .gacha-item.up .bar { + position: relative; +} +.gacha-list .gacha-item.up .bar:after { + display: block; + position: absolute; + right: 5px; + top: 3px; + width: 26px; + border-radius: 15px; + content: "UP"; + text-align: center; + height: 18px; + line-height: 18px; + font-size: 12px; + font-weight: bold; + background: #ffeb73; + color: #6f4b00; + box-shadow: 0 0 3px 0 #6f4b00; +} +.gacha-list .gacha-item.no-avatar .bar:after { + display: none; +} .gacha-list .icon { width: 32px; height: 38px; @@ -134,8 +121,12 @@ color: #6f4b00; min-width: 18px; } +.gacha-list .process .bar.gold:after { + right: -30px; +} .gacha-list .process .bar.good { background: #168b2c; + min-width: 13%; color: #fff; } .gacha-list .process .bar.normal { diff --git a/resources/gacha/gacha-detail.html b/resources/gacha/gacha-detail.html index 09e66bca..9714d54c 100644 --- a/resources/gacha/gacha-detail.html +++ b/resources/gacha/gacha-detail.html @@ -39,7 +39,8 @@ {{/if}} -
#抽卡帮助获取抽卡链接,#更新抽卡记录更新抽卡信息,#抽卡统计#角色统计可查看按卡池分析结果
+
#抽卡帮助获取抽卡链接,#更新抽卡记录更新抽卡信息,#抽卡统计#角色统计可查看按卡池分析结果 +
@@ -47,7 +48,8 @@ {{set item = gacha.items[ds.id]}} {{set max = item.type === 'weapon'?80:90}} {{set hasDate = (idx===0 || idx ===gacha.items.length-1 || (idx>0 && gacha.fiveLog[idx-1].date !== ds.date)) }} -
+
{{ds.date}}
diff --git a/resources/gacha/gacha-detail.less b/resources/gacha/gacha-detail.less index b04eee79..4fb5e897 100644 --- a/resources/gacha/gacha-detail.less +++ b/resources/gacha/gacha-detail.less @@ -29,8 +29,8 @@ .dot { width: @height * 0.625; - height: @height; - background: url('./imgs/date-icon.webp') center -100%; + height: @height + 5px; + background: url('./imgs/date-icon.webp') center -@height; background-size: 100% auto; &.first { @@ -81,40 +81,7 @@ } .name, .icon, .process { - background-color: #47484d; - } - .bar { - position: relative; - /* &:after { - display: block; - position: absolute; - right: -34px; - top: -2px; - width: 25px; - height: 25px; - border-radius: 15px; - content: "歪"; - border: 2px solid #f00; - color: #f00; - text-align: center; - line-height: 26px; - font-size: 18px; - transform: rotate(30deg); - background-color: #47484d; - } */ - - &:after { - content: ""; - display: block; - position: absolute; - right: -33px; - top: -2px; - width: 30px; - height: 30px; - background: url('./imgs/wai.webp') center no-repeat; - background-size: 100% 100%; - } } } @@ -127,6 +94,34 @@ .process, .icon { /* background-color: rgba(0, 0, 0, .5);*/ } + + .bar { + position: relative; + + &:after { + display: block; + position: absolute; + right: 5px; + top: 3px; + width: 26px; + border-radius: 15px; + content: "UP"; + text-align: center; + height: 18px; + line-height: 18px; + font-size: 12px; + font-weight: bold; + background: #ffeb73; + color: #6f4b00; + box-shadow: 0 0 3px 0 #6f4b00; + } + } + } + + &.no-avatar { + .bar:after { + display: none; + } } } @@ -175,10 +170,15 @@ background: #ffeb73; color: #6f4b00; min-width: 18px; + + &:after { + right: -30px; + } } &.good { background: #168b2c; + min-width: 13%; color: #fff; } diff --git a/resources/gacha/gacha-stat.css b/resources/gacha/gacha-stat.css index ba0687b1..bd9f207d 100644 --- a/resources/gacha/gacha-stat.css +++ b/resources/gacha/gacha-stat.css @@ -32,7 +32,7 @@ border-right: 1px solid rgba(255, 255, 255, 0.3); } .gacha-pool .version-name { - width: 100px; + width: 105px; line-height: 36px; font-size: 20px; font-weight: bold; diff --git a/resources/gacha/gacha-stat.html b/resources/gacha/gacha-stat.html index 45927da1..0abf4a51 100644 --- a/resources/gacha/gacha-stat.html +++ b/resources/gacha/gacha-stat.html @@ -54,7 +54,7 @@
{{if vData.from}}
- {{vData.version}}{{vData.half}} + {{vData.version}} {{vData.half}}
{{vData.name}}
diff --git a/resources/gacha/gacha-stat.less b/resources/gacha/gacha-stat.less index d7097b39..8669b3d0 100644 --- a/resources/gacha/gacha-stat.less +++ b/resources/gacha/gacha-stat.less @@ -37,7 +37,7 @@ } .version-name { - width: 100px; + width: 105px; line-height: 36px; font-size: 20px; font-weight: bold; diff --git a/resources/gacha/imgs/date-icon.webp b/resources/gacha/imgs/date-icon.webp index 63a036fd..fa336ba6 100644 Binary files a/resources/gacha/imgs/date-icon.webp and b/resources/gacha/imgs/date-icon.webp differ diff --git a/resources/gacha/imgs/no-avatar.webp b/resources/gacha/imgs/no-avatar.webp index d2123e12..61886b5f 100644 Binary files a/resources/gacha/imgs/no-avatar.webp and b/resources/gacha/imgs/no-avatar.webp differ diff --git a/resources/gacha/imgs/wai.webp b/resources/gacha/imgs/wai.webp deleted file mode 100644 index 54022aec..00000000 Binary files a/resources/gacha/imgs/wai.webp and /dev/null differ