计算宝箱总数

This commit is contained in:
小花花花儿 2024-01-25 12:31:37 +08:00
parent 12e280b38c
commit a5cb607c98
2 changed files with 34 additions and 32 deletions

View File

@ -7,9 +7,6 @@ avatar: 77
# 等级
level: 60
# 总宝箱
all_chest: 6044
# 奇馈宝箱
magic_chest: 221

View File

@ -10,7 +10,7 @@ let dsz = '待实装'
let imgFile = {}
export default class RoleIndex extends base {
constructor (e) {
constructor(e) {
super(e)
this.model = 'roleIndex'
this.other = gsCfg.getdefSet('role', 'other')
@ -29,17 +29,22 @@ export default class RoleIndex extends base {
枫丹: 9
}
this.all_chest = 0
lodash.forEach(this.lable, (v, i) => {
if (i.includes('_chest')) this.all_chest += v
})
this.areaName = lodash.invert(this.area)
this.headIndexStyle = `<style> .head_box { background: url(${this.screenData.pluResPath}img/roleIndex/namecard/${lodash.random(1, 8)}.png) #f5f5f5; background-position-x: 30px; background-repeat: no-repeat; border-radius: 15px; font-family: tttgbnumber; padding: 10px 20px; position: relative; background-size: auto 101%; }</style>`
}
static async get (e) {
static async get(e) {
let roleIndex = new RoleIndex(e)
return await roleIndex.getIndex()
}
async getIndex () {
async getIndex() {
let ApiData = {
index: '',
spiralAbyss: { schedule_type: 1 },
@ -63,7 +68,7 @@ export default class RoleIndex extends base {
return data
}
dealData (data) {
dealData(data) {
let [resIndex, resAbyss, resDetail, basicInfo] = data
let avatars = resDetail.avatars || []
@ -117,11 +122,11 @@ export default class RoleIndex extends base {
let percentage = lodash.round(
((stats.precious_chest_number +
stats.luxurious_chest_number +
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number) /
this.lable.all_chest) *
stats.luxurious_chest_number +
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number) /
this.all_chest) *
100,
1
)
@ -150,7 +155,7 @@ export default class RoleIndex extends base {
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number,
extra: this.lable.all_chest
extra: this.all_chest
},
{
@ -240,7 +245,7 @@ export default class RoleIndex extends base {
}
// 处理深渊数据
abyssAll (roleArr, resAbyss) {
abyssAll(roleArr, resAbyss) {
let abyss = {}
if (roleArr.length <= 0) {
@ -327,14 +332,14 @@ export default class RoleIndex extends base {
}
}
dayCount (num) {
dayCount(num) {
let daysDifference = Math.floor((new Date() - new Date('2020-09-15')) / (1000 * 60 * 60 * 24)) + 1
let days = Math.floor(num)
let msg = '活跃天数:' + days + `/${daysDifference}`
return msg
}
async roleCard () {
async roleCard() {
this.model = 'roleCard'
let res = await MysInfo.get(this.e, 'index')
@ -343,7 +348,7 @@ export default class RoleIndex extends base {
return this.roleCardData(res.data)
}
roleCardData (res) {
roleCardData(res) {
this.initFile()
let stats = res.stats
@ -430,7 +435,7 @@ export default class RoleIndex extends base {
}
}
async roleExplore () {
async roleExplore() {
this.model = 'roleExplore'
let ApiData = {
index: '',
@ -446,18 +451,18 @@ export default class RoleIndex extends base {
return this.roleExploreData(ret)
}
async roleExploreData (res) {
async roleExploreData(res) {
let [resIndex, basicInfo] = res
let stats = resIndex.stats
let percentage = lodash.round(
((stats.precious_chest_number +
stats.luxurious_chest_number +
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number) *
stats.luxurious_chest_number +
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number) *
100) /
this.lable.all_chest,
this.all_chest,
2
)
@ -465,12 +470,12 @@ export default class RoleIndex extends base {
percentage < 60
? 'D'
: (percentage < 70
? 'C'
: percentage < 80
? 'B'
: percentage < 90
? 'A'
: 'S') + `[${percentage}%]`
? 'C'
: percentage < 80
? 'B'
: percentage < 90
? 'A'
: 'S') + `[${percentage}%]`
let daysDifference = Math.floor((new Date() - new Date('2020-09-15')) / (1000 * 60 * 60 * 24)) + 1
@ -492,7 +497,7 @@ export default class RoleIndex extends base {
stats.exquisite_chest_number +
stats.common_chest_number +
stats.magic_chest_number,
extra: this.lable.all_chest
extra: this.all_chest
},
{
lable: '宝箱获取率',
@ -621,7 +626,7 @@ export default class RoleIndex extends base {
}
}
initFile () {
initFile() {
if (imgFile['刻晴']) return imgFile
let path = './plugins/genshin/resources/img/gacha/'
let character = fs.readdirSync(path + 'character/')