新增*抽卡记录 *武器记录

This commit is contained in:
Aluxes 2024-05-23 23:37:38 +08:00
parent f8a5f6c394
commit 50251cb20b
No known key found for this signature in database
GPG Key ID: 6696152F9C003087
10 changed files with 344 additions and 76 deletions

View File

@ -9,17 +9,16 @@ 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)
}
})

View File

@ -6,7 +6,28 @@ import { Button, Character, Player } from '#miao.models'
let Gacha = {
async detail (e) {
let msg = e.msg.replace(/#|抽卡|记录|祈愿|分析|池/g, '')
let type = 301
let game = /星铁/.test(msg) ? 'sr' : 'gs'
msg = msg.replace(/星铁/, '')
let type
if (e.isSr) {
type = 11
switch (msg) {
case 'up':
case '抽卡':
case '角色':
case '抽奖':
type = 11
break
case '常驻':
type = 1
break
case '武器':
case '光锥':
type = 12
break
}
} else {
type = 301
switch (msg) {
case 'up':
case '抽卡':
@ -24,28 +45,36 @@ let Gacha = {
type = 500
break
}
}
let uid = e.uid || await getTargetUid(e)
let qq = e.user_id
if (!uid || !qq) {
return false
}
let gacha = GachaData.analyse(e.user_id, uid, type)
let gacha = GachaData.analyse(e.user_id, uid, type, game)
if (!gacha) {
e.reply([`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`, new Button(e).gacha()])
return true
}
if (type === 302 || type === 12) type = 'weapon'
this.reply([await Common.render('gacha/gacha-detail', {
save_id: uid,
uid,
gacha,
face: Gacha.getFace(uid)
face: Gacha.getFace(uid, game),
game,
type,
elem: e.isSr ? 'sr' : 'hydro'
}, { e, scale: 1.4, retType: 'base64' }), new Button(e).gacha()])
},
async stat (e) {
let msg = e.msg.replace(/#|统计|分析|池/g, '')
let game = /星铁/.test(msg) ? 'sr' : 'gs'
msg = msg.replace(/星铁/, '')
let type = 'up'
if (/武器/.test(msg)) {
if (/武器|光锥/.test(msg)) {
type = 'weapon'
} else if (/角色/.test(msg)) {
type = 'char'
@ -61,7 +90,7 @@ let Gacha = {
if (!uid || !qq) {
return false
}
let gacha = GachaData.stat(e.user_id, uid, type)
let gacha = GachaData.stat(e.user_id, uid, type, game)
if (!gacha) {
e.reply([`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`, new Button(e).gacha()])
return true
@ -70,14 +99,16 @@ let Gacha = {
save_id: uid,
uid,
gacha,
face: Gacha.getFace(uid)
face: Gacha.getFace(uid, game),
game,
elem: e.isSr ? 'sr' : 'hydro'
}, { e, scale: 1.4, retType: 'base64' }), new Button(e).gacha()])
},
getFace (uid) {
let player = Player.create(uid)
let faceChar = Character.get(player.face || 10000014)
getFace (uid, game) {
let player = Player.create(uid, game)
let defaultFaceChar = game === 'gs' ? 10000014 : 1005
let faceChar = Character.get(player.face || defaultFaceChar, game)
let imgs = faceChar?.imgs
if (!imgs?.face) {
imgs = Character.get(10000079).imgs

View File

@ -2,6 +2,7 @@ import lodash from 'lodash'
import { Data } from '#miao'
import { Character, Weapon } from '#miao.models'
import { poolDetail, mixPoolDetail } from '../../resources/meta-gs/info/index.js'
import { poolDetailSr } from '../../resources/meta-sr/info/index.js'
import moment from 'moment'
let poolVersion = []
@ -23,6 +24,24 @@ poolVersion.push({
end: new Date('2025-12-31 23:59:59')
})
let poolVersionSr = []
lodash.forEach(poolDetailSr, (ds) => {
poolVersionSr.push({
...ds,
start: new Date(ds.from),
end: new Date(ds.to)
})
})
let lastSr = poolVersionSr[poolVersionSr.length - 1]
poolVersionSr.push({
version: '新版本',
half: '?',
from: lastSr.to,
to: '2025-12-31 23:59:59',
start: lastSr.end,
end: new Date('2025-12-31 23:59:59')
})
let mixPoolVersion = []
lodash.forEach(mixPoolDetail, (ds) => {
mixPoolVersion.push({
@ -44,18 +63,20 @@ mixPoolVersion.push({
let GachaData = {
// 获取JSON数据
readJSON (qq, uid, type) {
readJSON (qq, uid, type, game) {
let logJson = []
// 获取本地数据 进行数据合并
logJson = Data.readJSON(`/data/gachaJson/${qq}/${uid}/${type}.json`, 'root')
game === 'gs'
? logJson = Data.readJSON(`/data/gachaJson/${qq}/${uid}/${type}.json`, 'root')
: logJson = Data.readJSON(`/data/srJson/${qq}/${uid}/${type}.json`, 'root')
let itemMap = {}
let nameMap = {}
let items = []
let ids = {}
lodash.forEach(logJson, (ds) => {
if (!nameMap[ds.name]) {
if (ds.item_type === '武器') {
let weapon = Weapon.get(ds.name)
if (ds.item_type === '武器' || ds.item_type === '光锥') {
let weapon = Weapon.get(ds.name, game)
if (weapon) {
nameMap[ds.name] = weapon.id
itemMap[weapon.id] = {
@ -75,7 +96,7 @@ let GachaData = {
}
}
} else if (ds.item_type === '角色') {
let char = Character.get(ds.name)
let char = Character.get(ds.name, game)
if (char) {
nameMap[ds.name] = char.id
itemMap[char.id] = {
@ -112,8 +133,8 @@ let GachaData = {
},
// 卡池分析
analyse (qq, uid, type) {
let logData = GachaData.readJSON(qq, uid, type)
analyse (qq, uid, type, game) {
let logData = GachaData.readJSON(qq, uid, type, game)
let fiveLog = []
let fourLog = []
let fiveNum = 0
@ -139,7 +160,7 @@ let GachaData = {
let currVersion
lodash.forEach(logData.items, (item) => {
if (!currVersion || (item.time < currVersion.start)) {
currVersion = GachaData.getVersion(item.time, true, isMix)
currVersion = GachaData.getVersion(item.time, true, isMix, game)
}
allNum++
@ -282,31 +303,32 @@ let GachaData = {
},
// 卡池统计
stat (qq, uid, type) {
stat (qq, uid, type, game) {
let items = []
let itemMap = {}
let hasVersion = true
let isMix = false
let isSr = game === 'sr'
let loadData = function (poolId) {
let gachaData = GachaData.readJSON(qq, uid, poolId)
let gachaData = GachaData.readJSON(qq, uid, poolId, game)
items = items.concat(gachaData.items)
lodash.extend(itemMap, gachaData.itemMap || {})
}
if (['up', 'char', 'all'].includes(type)) {
loadData(301)
isSr ? loadData(11) : loadData(301)
}
if (['up', 'weapon', 'all'].includes(type)) {
loadData(302)
isSr ? loadData(12) : loadData(302)
}
if (['all', 'normal'].includes(type)) {
hasVersion = false
loadData(200)
isSr ? loadData(1) : loadData(200)
}
if (['mix'].includes(type)) {
isMix = true
loadData(500)
}
if (['all'].includes(type)) {
if (['all'].includes(type) && !isSr) {
loadData(500)
}
@ -396,7 +418,7 @@ let GachaData = {
if (currVersion) {
versionData.push(getCurr())
}
let v = GachaData.getVersion(ds.time, hasVersion, isMix)
let v = GachaData.getVersion(ds.time, hasVersion, isMix, game)
if (!hasVersion) {
v.version = type === 'all' ? '全部统计' : '常驻池'
}
@ -436,7 +458,7 @@ let GachaData = {
}
},
getVersion (time, hasVersion = true, isMix = false) {
getVersion (time, hasVersion = true, isMix = false, game) {
if (isMix) {
for (let ds of mixPoolVersion) {
if (time > ds.start && time < ds.end) {
@ -444,12 +466,18 @@ let GachaData = {
}
}
}
if (hasVersion) {
if (hasVersion && game === 'gs') {
for (let ds of poolVersion) {
if (time > ds.start && time < ds.end) {
return ds
}
}
} else if (hasVersion && game === 'sr') {
for (let ds of poolVersionSr) {
if (time > ds.start && time < ds.end) {
return ds
}
}
}
return {
version: hasVersion === false ? '全部' : '未知',

View File

@ -20,7 +20,7 @@
.gacha-list .gacha-item .date .dot {
width: 23.75px;
height: 43px;
background: url('./imgs/date-icon.webp') center -38px;
background: url('imgs/date-icon.webp') center -38px;
background-size: 100% auto;
}
.gacha-list .gacha-item .date .dot.first {
@ -45,7 +45,6 @@
margin-top: 5px;
}
.gacha-list .gacha-item .name {
width: 90px;
text-align: right;
line-height: 38px;
padding-right: 5px;
@ -140,4 +139,3 @@
.avatar-card .name {
text-align: center;
}
/*# sourceMappingURL=gacha-detail.css.map */

View File

@ -1,15 +1,16 @@
{{extend elemLayout}}
{{block 'css'}}
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/tpl.css?v=1.0"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/avatar-list.css"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/gacha/gacha-detail.css?v=1.0"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/tpl.css?v=1.0" />
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/avatar-list.css" />
<link rel="stylesheet" type="text/css" href="{{_res_path}}/gacha/gacha-detail.css?v=1.0" />
{{/block}}
{{if game === 'gs'}}
{{ set statMap = { allNum:'抽卡总数', fiveNum:'金卡数',wai:'歪 T.T',fourNum:'紫卡数', fiveAvg:'平均出金', upYs:'UP原石' } }}
{{else}}
{{ set statMap = { allNum:'抽卡总数', fiveNum:'金卡数',wai:'歪 T.T',fourNum:'紫卡数', fiveAvg:'平均出金', upYs:'UP星琼' } }}
{{/if}}
{{block 'main'}}
{{ set gameHash = game === 'gs' ? '#' : '*'}}
<div class="basic">
<div class="user-banner" style="background-image:url({{_res_path}}{{face?.banner}})">
<div class="face">
@ -18,7 +19,6 @@
<div class="user-info">
<div class="name">
<strong>{{face.name}}</strong>
</div>
<div class="uid">
{{if uid}}<span> #{{uid}}</span>{{/if}}
@ -38,23 +38,23 @@
</div>
{{/if}}
</div>
<div class="ck-notice"><strong>#抽卡帮助</strong>获取抽卡链接,<strong>#更新抽卡记录</strong>更新抽卡信息,<strong>#抽卡统计</strong><strong>#角色统计</strong>可查看按卡池分析结果
<div class="ck-notice">
<strong>{{gameHash}}抽卡帮助</strong>获取抽卡链接,<strong>{{gameHash}}更新抽卡记录</strong>更新抽卡信息,<strong>{{gameHash}}抽卡统计</strong><strong>{{gameHash}}角色统计</strong>可查看按卡池分析结果
</div>
<div class="cont avatar-cont">
<div class="gacha-list">
{{each gacha.fiveLog ds idx}}
{{set item = gacha.items[ds.id]}}
{{set max = item.type === 'weapon'?80:90}}
{{set max = type === 'weapon'?80:90}}
{{set hasDate = (idx===0 || idx ===gacha.items.length-1 || (idx>0 && gacha.fiveLog[idx-1].date !== ds.date)) }}
{{set nameWidth = (game==='sr' && type==='weapon'? 120 : 90)}}
<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>
</div>
<div class="name">{{item.abbr}}</div>
<div class="name" style="width:{{nameWidth}}px">{{item.abbr}}</div>
<div class="icon">
<div class="icon-bg star{{item.star}}">
<span class="img mini" style="background-image:url({{_res_path}}{{item.img}})"></span>

View File

@ -68,7 +68,6 @@
}
.name {
width: 90px;
text-align: right;
line-height: @height;
padding-right: 5px;
@ -80,9 +79,9 @@
color: #aaa;
}
.name, .icon, .process {
}
.name,
.icon,
.process {}
}
&.up {
@ -91,7 +90,8 @@
color: rgb(255, 212, 132);
}
.process, .icon {
.process,
.icon {
/* background-color: rgba(0, 0, 0, .5);*/
}

View File

@ -94,7 +94,6 @@
text-align: center;
}
.gacha-stat .gacha-item .item-card {
width: 69px;
border-radius: 6px;
background: #fff;
}

View File

@ -39,6 +39,7 @@
{{/if}}
</div>
{{if game==='gs'}}
<div class="ck-notice">
<strong>#角色统计/#武器统计</strong>角色/武器池统计,
<strong>#常驻统计/#集录统计</strong>常驻/集录池统计
@ -47,6 +48,14 @@
<strong>#全部统计</strong>全部抽卡统计,
<strong>#抽卡帮助</strong> 获取帮助
</div>
{{else}}
<div class="ck-notice">
<strong>*角色统计/*武器统计</strong>角色/武器池统计,
<strong>*常驻统计</strong>常驻池统计,
<strong>*全部统计</strong>全部抽卡统计,
<strong>*抽卡帮助</strong>获取帮助
</div>
{{/if}}
{{each gacha.versionData vData}}
{{set stats = vData.stats}}
@ -83,8 +92,9 @@
{{each vData.items ds}}
{{set item = gacha.itemMap[ds.id]}}
{{if item.star === 4 || item.star === 5}}
{{set cardWidth = (game==='gs' ? 69: 90)}}
<div class="gacha-item">
<div class="item-card {{ds.isUp ? 'up-card':'normal-card'}}">
<div class="item-card {{ds.isUp ? 'up-card':'normal-card'}}" style="width:{{cardWidth}}px">
<div class="item-icon star{{item.star}}">
<div class="item-bg" style="background-image:url({{_res_path}}{{item.img}})"></div>
<div class="item-life {{ds.isUp ? 'life5': 'life1'}}">{{ds.num}}</div>

View File

@ -7,7 +7,7 @@
display: flex;
text-align: center;
&>div {
& > div {
padding: 10px;
height: 56px;
}
@ -111,7 +111,6 @@
text-align: center;
.item-card {
width: 69px;
border-radius: 6px;
background: #fff;
}

View File

@ -0,0 +1,204 @@
export const poolNameSr = {
希儿: '蝶立锋锷',
景元: '天戈麾斥',
银狼: '零号协议',
罗刹: '寻索世间',
: '业途游魂',
卡芙卡: '夜将不眠',
'丹恒•饮月': '濯世垂虹',
符玄: '穷观妙算',
镜流: '月有薄蚀',
'托帕&账账': '落日条款',
藿藿: '令奉贞凶',
银枝: '荆冠芳勋',
'阮•梅': '疏影三迭',
真理医生: '万物皆流',
黑天鹅: '镜映婆娑',
花火: '焰锦游鱼',
黄泉: '远辞畴昔',
砂金: '囚石铸金',
知更鸟: '翼声纯律',
波提欧: '扬尘孤星'
}
export const poolDetailSr = [{
version: '1.0',
half: '上半',
from: '2023-04-26 06:00:00',
to: '2023-05-17 17:59:59',
char5: ['希儿'],
char4: ['娜塔莎', '虎克', '佩拉'],
weapon5: ['于夜色中'],
weapon4: ['一场术后对话', '晚安与睡颜', '鼹鼠党欢迎你']
}, {
version: '1.0',
half: '下半',
from: '2023-05-17 18:00:00',
to: '2023-06-06 14:59:59',
char5: ['景元'],
char4: ['停云', '素裳', '三月七'],
weapon5: ['拂晓之前'],
weapon4: ['与行星相会', '唯有沉默', '余生的第一天']
}, {
version: '1.1',
half: '上半',
from: '2023-06-07 06:00:00',
to: '2023-06-28 11:59:59',
char5: ['银狼'],
char4: ['丹恒', '艾丝妲', '希露瓦'],
weapon5: ['雨一直下'],
weapon4: ['点个关注吧!', '记忆中的模样', '别让世界静下来']
}, {
version: '1.1',
half: '下半',
from: '2023-06-28 12:00:00',
to: '2023-07-18 14:59:59',
char5: ['罗刹'],
char4: ['驭空', '佩拉', '青雀'],
weapon5: ['棺的回响'],
weapon4: ['晚安与睡颜', '天才们的休憩', '舞!舞!舞!']
}, {
version: '1.2',
half: '上半',
from: '2023-07-19 06:00:00',
to: '2023-08-09 11:59:59',
char5: ['刃'],
char4: ['阿兰', '娜塔莎', '素裳'],
weapon5: ['到不了的彼岸'],
weapon4: ['秘密誓心', '同一种心情', '论剑']
}, {
version: '1.2',
half: '下半',
from: '2023-08-09 12:00:00',
to: '2023-08-29 14:59:59',
char5: ['卡芙卡'],
char4: ['卢卡', '桑博', '希露瓦'],
weapon5: ['只需等待'],
weapon4: ['决心如汗珠般闪耀', '猎物的视线', '「我」的诞生']
}, {
version: '1.3',
half: '上半',
from: '2023-08-30 06:00:00',
to: '2023-09-20 11:59:59',
char5: ['丹恒•饮月'],
char4: ['驭空', '艾丝妲', '三月七'],
weapon5: ['比阳光更明亮的'],
weapon4: ['舞!舞!舞!', '与行星相会', '朗道的选择']
}, {
version: '1.3',
half: '下半',
from: '2023-09-20 12:00:00',
to: '2023-10-10 14:59:59',
char5: ['符玄'],
char4: ['玲可', '虎克', '佩拉'],
weapon5: ['她已闭上双眼'],
weapon4: ['此时恰好', '宇宙市场趋势', '在蓝天下']
}, {
version: '1.4',
half: '上半',
from: '2023-10-11 06:00:00',
to: '2023-10-27 11:59:59',
char5: ['镜流'],
char4: ['停云', '青雀', '桑博'],
weapon5: ['此身为剑'],
weapon4: ['记忆中的模样', '别让世界静下来', '猎物的视线']
}, {
version: '1.4',
half: '下半',
from: '2023-10-27 12:00:00',
to: '2023-11-14 14:59:59',
char5: ['托帕&账账', '希儿'],
char4: ['桂乃芬', '卢卡', '素裳'],
weapon5: ['烦恼着,幸福着', '于夜色中'],
weapon4: ['鼹鼠党欢迎你', '决心如汗珠般闪耀', '唯有沉默']
}, {
version: '1.5',
half: '上半',
from: '2023-11-15 06:00:00',
to: '2023-12-06 11:59:59',
char5: ['藿藿'],
char4: ['丹恒', '阿兰', '希露瓦'],
weapon5: ['惊魂夜'],
weapon4: ['同一种心情', '点个关注吧!', '宇宙市场趋势']
}, {
version: '1.5',
half: '下半',
from: '2023-12-06 12:00:00',
to: '2023-12-26 14:59:59',
char5: ['银枝', '银狼'],
char4: ['寒鸦', '玲可', '艾丝妲'],
weapon5: ['片刻,留在眼底', '雨一直下'],
weapon4: ['在蓝天下', '一场术后对话', '『我』的诞生']
}, {
version: '1.6',
half: '上半',
from: '2023-12-27 06:00:00',
to: '2024-01-17 11:59:59',
char5: ['阮•梅', '刃'],
char4: ['雪衣', '三月七', '停云'],
weapon5: ['镜中故我', '到不了的彼岸'],
weapon4: ['与行星相会', '余生的第一天', '秘密誓心']
}, {
version: '1.6',
half: '下半',
from: '2024-01-17 12:00:00',
to: '2024-02-05 14:59:59',
char5: ['真理医生', '卡芙卡'],
char4: ['素裳', '娜塔莎', '虎克'],
weapon5: ['纯粹思维的洗礼', '只需等待'],
weapon4: ['此时恰好', '唯有沉默', '朗道的选择']
}, {
version: '2.0',
half: '上半',
from: '2024-02-06 06:00:00',
to: '2024-02-29 11:59:59',
char5: ['黑天鹅', '丹恒•饮月'],
char4: ['米沙', '停云', '桂乃芬'],
weapon5: ['重塑时光之忆', '比阳光更明亮的'],
weapon4: ['铭记于心的约定', '决心如汗珠般闪耀', '舞!舞!舞!']
}, {
version: '2.0',
half: '下半',
from: '2024-02-29 12:00:00',
to: '2024-03-26 14:59:59',
char5: ['花火', '景元'],
char4: ['桑博', '青雀', '寒鸦'],
weapon5: ['游戏尘寰', '拂晓之前'],
weapon4: ['与行星相会', '在蓝天下', '天才们的休憩']
}, {
version: '2.1',
half: '上半',
from: '2024-03-27 06:00:00',
to: '2024-04-17 11:59:59',
char5: ['黄泉', '罗刹'],
char4: ['加拉赫', '佩拉', '丹恒'],
weapon5: ['行于流逝的岸', '棺的回响'],
weapon4: ['晚安与睡颜', '一场术后对话', '点个关注吧!']
}, {
version: '2.1',
half: '下半',
from: '2024-04-17 12:00:00',
to: '2024-05-07 14:59:59',
char5: ['砂金', '镜流'],
char4: ['玲可', '卢卡', '希露瓦'],
weapon5: ['命运从未公平', '此身为剑'],
weapon4: ['两个人的演唱会', '同一种心情', '别让世界静下来']
}, {
version: '2.2',
half: '上半',
from: '2024-05-08 06:00:00',
to: '2024-05-29 11:59:59',
char5: ['知更鸟', '托帕&账账'],
char4: ['三月七', '寒鸦', '雪衣'],
weapon5: ['夜色流光溢彩', '烦恼着,幸福着'],
weapon4: ['无边曼舞', '论剑', '此时恰好']
}, {
version: '2.2',
half: '下半',
from: '2024-05-29 12:00:00',
to: '2024-06-18 14:59:59',
char5: ['波提欧', '符玄'],
char4: ['佩拉', '卢卡', '虎克'],
weapon5: ['驶向第二次生命', '她已闭上双眼'],
weapon4: ['天才们的休憩', '秘密誓心', '朗道的选择']
}]