This commit is contained in:
Kokomi 2023-03-01 01:59:13 +08:00
parent 2d104076ad
commit aa00a656fa
15 changed files with 127 additions and 131 deletions

View File

@ -1,6 +1,10 @@
# 2.3.3 Dev # 2.3.3
* 初步增加`#抽卡分析``#抽卡统计`,样式与功能尚未完全稳定 * 增加`#角色记录``#抽卡统计`功能,可在`#喵喵设置`中开启
* `#角色记录`、`#武器记录`、`#常驻记录` 可查看对应池子的抽卡记录
* `#角色统计`、`#武器统计` 可按卡池汇总统计抽卡记录
* `#全部统计` 可将所有抽卡信息汇总展示
* 其余`#更新抽卡记录`、`#抽卡帮助`等功能均为Yunzai原生功能
# 2.3.1~2.3.2 # 2.3.1~2.3.2

View File

@ -1,4 +1,4 @@
import { App } from '../components/index.js' import { App, Cfg } from '../components/index.js'
import Gacha from './gacha/Gacha.js' import Gacha from './gacha/Gacha.js'
let app = App.init({ let app = App.init({
@ -9,12 +9,17 @@ app.reg({
detail: { detail: {
name: '抽卡记录', name: '抽卡记录',
fn: Gacha.detail, fn: Gacha.detail,
rule: /^#*(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/ rule: /^#*喵喵(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/,
yzRule: /^#*(抽卡|抽奖|角色|武器|常驻|up)池*(记录|祈愿|分析)$/,
yzCheck: () => Cfg.get('gachaStat', false)
}, },
stat: { stat: {
name: '抽卡统计', name: '抽卡统计',
fn: Gacha.stat, fn: Gacha.stat,
rule: /^#*(全部|抽卡|抽奖|角色|武器|常驻|up|版本)池*统计$/ rule: /^#*喵喵(全部|抽卡|抽奖|角色|武器|常驻|up|版本)池*统计$/,
yzRule: /^#*(抽奖|角色|武器|常驻|up|版本)池*统计$/,
yzCheck: () => Cfg.get('gachaStat', false)
} }
}) })

View File

@ -29,16 +29,15 @@ let Gacha = {
let gacha = GachaData.analyse(e.user_id, uid, type) let gacha = GachaData.analyse(e.user_id, uid, type)
if (!gacha) { if (!gacha) {
e.reply('本地暂无抽卡信息') e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`)
return true return true
} }
await Common.render('gacha/gacha-detail', { await Common.render('gacha/gacha-detail', {
save_id: uid, save_id: uid,
uid, uid,
gacha, gacha,
face: Gacha.getFace(uid), face: Gacha.getFace(uid)
imgType: 'png' }, { e, scale: 1.4, retMsgId: true })
}, { e, scale: 1.2, retMsgId: true })
}, },
async stat (e) { async stat (e) {
let msg = e.msg.replace(/#|统计|分析|池/g, '') let msg = e.msg.replace(/#|统计|分析|池/g, '')
@ -59,16 +58,15 @@ let Gacha = {
} }
let gacha = GachaData.stat(e.user_id, uid, type) let gacha = GachaData.stat(e.user_id, uid, type)
if (!gacha) { if (!gacha) {
e.reply('本地暂无抽卡信息') e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`)
return true return true
} }
await Common.render('gacha/gacha-stat', { await Common.render('gacha/gacha-stat', {
save_id: uid, save_id: uid,
uid, uid,
gacha, gacha,
face: Gacha.getFace(uid), face: Gacha.getFace(uid)
quality: 92 }, { e, scale: 1.4 })
}, { e, scale: 1.3 })
}, },
getFace (uid) { getFace (uid) {
@ -76,11 +74,14 @@ let Gacha = {
let faceChar = Character.get(player.face || 10000014) let faceChar = Character.get(player.face || 10000014)
let imgs = faceChar.imgs let imgs = faceChar.imgs
if (!imgs.face) {
imgs = Character.get(10000079).imgs
}
return { return {
banner: imgs?.banner, banner: imgs?.banner,
face: imgs?.face, face: imgs?.face,
qFace: imgs?.qFace, qFace: imgs?.qFace,
name: player.name || `#${uid}`, name: player.name || '旅行者',
sign: player.sign, sign: player.sign,
level: player.level level: player.level
} }

View File

@ -15,7 +15,7 @@ lodash.forEach(poolDetail, (ds) => {
let last = poolVersion[poolVersion.length - 1] let last = poolVersion[poolVersion.length - 1]
// 为未知卡池做兼容 // 为未知卡池做兼容
poolVersion.push({ poolVersion.push({
version: '?', version: '新版本',
half: '?', half: '?',
from: last.to, from: last.to,
to: '2025-12-31 23:59:59', to: '2025-12-31 23:59:59',
@ -29,7 +29,7 @@ let GachaData = {
readJSON (qq, uid, type) { readJSON (qq, uid, type) {
let logJson = [] 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 itemMap = {}
let nameMap = {} let nameMap = {}
let items = [] let items = []
@ -114,7 +114,12 @@ let GachaData = {
if (logData.items.length === 0) { if (logData.items.length === 0) {
return false return false
} }
let currVersion
lodash.forEach(logData.items, (item) => { lodash.forEach(logData.items, (item) => {
if (!currVersion || (item.time < currVersion.start)) {
currVersion = GachaData.getVersion(item.time)
}
allNum++ allNum++
let ds = itemMap[item.id] let ds = itemMap[item.id]
let { star, type } = ds let { star, type } = ds
@ -147,13 +152,17 @@ let GachaData = {
let isUp = false let isUp = false
// 歪了多少个 // 歪了多少个
if (type === 'char') { if (type === 'char') {
if (GachaData.checkIsUp(item, ds)) { if (currVersion.char5.includes(ds.name)) {
isUp = true isUp = true
} else { } else {
wai++ wai++
} }
} else { } else {
weaponNum++ if (currVersion.weapon5.includes(ds.name)) {
isUp = true
} else {
wai++
}
} }
fiveLog.push({ fiveLog.push({
@ -213,6 +222,7 @@ let GachaData = {
noWaiRate = (noWaiRate * 100).toFixed(1) noWaiRate = (noWaiRate * 100).toFixed(1)
} }
if (noFiveNum > 0) {
fiveLog.unshift({ fiveLog.unshift({
id: 888, id: 888,
isUp: true, isUp: true,
@ -220,11 +230,12 @@ let GachaData = {
date: moment().format('MM-DD') date: moment().format('MM-DD')
}) })
itemMap['888'] = { itemMap['888'] = {
name: '即将获得', name: '已抽',
star: 5, star: 5,
abbr: '即将获得', abbr: '已抽',
img: 'gacha/imgs/no-avatar.webp' img: 'gacha/imgs/no-avatar.webp'
} }
}
return { return {
stat: { stat: {
@ -428,29 +439,6 @@ let GachaData = {
...char.getData('id,star,name,abbr,face') ...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 export default GachaData

View File

@ -27,6 +27,11 @@ export const cfgSchema = {
key: '帮助', key: '帮助',
def: false def: false
}, },
gachaStat: {
title: '#抽卡分析 #抽卡统计',
key: '抽卡',
def: false
},
avatarPoke: { avatarPoke: {
title: '戳一戳展示角色卡片', title: '戳一戳展示角色卡片',
key: '戳一戳', key: '戳一戳',

View File

@ -107,7 +107,7 @@ export default class MysApi {
} }
e._reqCount++ e._reqCount++
let ret = await mys.getData(api, data) let ret = await mys.getData(api, data)
ret = await mysInfo.checkCode(ret, api) ret = await mysInfo.checkCode(ret, api, this.mys)
e._reqCount-- e._reqCount--
if (e._reqCount === 0) { if (e._reqCount === 0) {
e.reply = e._original_reply e.reply = e._original_reply

View File

@ -19,8 +19,8 @@
} }
.gacha-list .gacha-item .date .dot { .gacha-list .gacha-item .date .dot {
width: 23.75px; width: 23.75px;
height: 38px; height: 43px;
background: url('./imgs/date-icon.webp') center -100%; background: url('./imgs/date-icon.webp') center -38px;
background-size: 100% auto; background-size: 100% auto;
} }
.gacha-list .gacha-item .date .dot.first { .gacha-list .gacha-item .date .dot.first {
@ -53,42 +53,6 @@
.gacha-list .gacha-item.wai .name { .gacha-list .gacha-item.wai .name {
color: #aaa; 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 { .gacha-list .gacha-item.up .name {
/*background: rgba(0, 0, 0, .5);*/ /*background: rgba(0, 0, 0, .5);*/
color: #ffd484; color: #ffd484;
@ -97,6 +61,29 @@
.gacha-list .gacha-item.up .icon { .gacha-list .gacha-item.up .icon {
/* background-color: rgba(0, 0, 0, .5);*/ /* 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 { .gacha-list .icon {
width: 32px; width: 32px;
height: 38px; height: 38px;
@ -134,8 +121,12 @@
color: #6f4b00; color: #6f4b00;
min-width: 18px; min-width: 18px;
} }
.gacha-list .process .bar.gold:after {
right: -30px;
}
.gacha-list .process .bar.good { .gacha-list .process .bar.good {
background: #168b2c; background: #168b2c;
min-width: 13%;
color: #fff; color: #fff;
} }
.gacha-list .process .bar.normal { .gacha-list .process .bar.normal {

View File

@ -39,7 +39,8 @@
{{/if}} {{/if}}
</div> </div>
<div class="ck-notice"><strong>#抽卡帮助</strong>获取抽卡链接,<strong>#更新抽卡记录</strong>更新抽卡信息,<strong>#抽卡统计</strong><strong>#角色统计</strong>可查看按卡池分析结果</div> <div class="ck-notice"><strong>#抽卡帮助</strong>获取抽卡链接,<strong>#更新抽卡记录</strong>更新抽卡信息,<strong>#抽卡统计</strong><strong>#角色统计</strong>可查看按卡池分析结果
</div>
<div class="cont avatar-cont"> <div class="cont avatar-cont">
<div class="gacha-list"> <div class="gacha-list">
@ -47,7 +48,8 @@
{{set item = gacha.items[ds.id]}} {{set item = gacha.items[ds.id]}}
{{set max = item.type === 'weapon'?80:90}} {{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)) }} {{set hasDate = (idx===0 || idx ===gacha.items.length-1 || (idx>0 && gacha.fiveLog[idx-1].date !== ds.date)) }}
<div class="gacha-item {{!hasDate?'no-date':'has-date'}} {{ds.isUp||item.type==='weapon' ?'up':'wai'}}"> <div class="gacha-item {{!hasDate?'no-date':'has-date'
}} {{ds.isUp ?'up':'wai'}} {{item.abbr==='已抽'?'no-avatar':''}}">
<div class="date "> <div class="date ">
<div class="dot {{idx===0?'first':''}} {{idx===gacha.items.length-1?'last':''}}"></div> <div class="dot {{idx===0?'first':''}} {{idx===gacha.items.length-1?'last':''}}"></div>
<div class="txt">{{ds.date}}</div> <div class="txt">{{ds.date}}</div>

View File

@ -29,8 +29,8 @@
.dot { .dot {
width: @height * 0.625; width: @height * 0.625;
height: @height; height: @height + 5px;
background: url('./imgs/date-icon.webp') center -100%; background: url('./imgs/date-icon.webp') center -@height;
background-size: 100% auto; background-size: 100% auto;
&.first { &.first {
@ -81,40 +81,7 @@
} }
.name, .icon, .process { .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 { .process, .icon {
/* background-color: rgba(0, 0, 0, .5);*/ /* 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; background: #ffeb73;
color: #6f4b00; color: #6f4b00;
min-width: 18px; min-width: 18px;
&:after {
right: -30px;
}
} }
&.good { &.good {
background: #168b2c; background: #168b2c;
min-width: 13%;
color: #fff; color: #fff;
} }

View File

@ -32,7 +32,7 @@
border-right: 1px solid rgba(255, 255, 255, 0.3); border-right: 1px solid rgba(255, 255, 255, 0.3);
} }
.gacha-pool .version-name { .gacha-pool .version-name {
width: 100px; width: 105px;
line-height: 36px; line-height: 36px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;

View File

@ -37,7 +37,7 @@
} }
.version-name { .version-name {
width: 100px; width: 105px;
line-height: 36px; line-height: 36px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB