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

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'
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)
}
})

View File

@ -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
}

View File

@ -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

View File

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

View File

@ -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

View File

@ -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 {

View File

@ -39,7 +39,8 @@
{{/if}}
</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="gacha-list">
@ -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)) }}
<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="dot {{idx===0?'first':''}} {{idx===gacha.items.length-1?'last':''}}"></div>
<div class="txt">{{ds.date}}</div>

View File

@ -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;
}

View File

@ -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;

View File

@ -54,7 +54,7 @@
<div class="version">
{{if vData.from}}
<div class="version-name line">
{{vData.version}}{{vData.half}}
{{vData.version}} {{vData.half}}
</div>
<div class="pool-name">
<div class="name">{{vData.name}}</div>

View File

@ -37,7 +37,7 @@
}
.version-name {
width: 100px;
width: 105px;
line-height: 36px;
font-size: 20px;
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