Skip to content

Commit 4cfefc6

Browse files
committed
feat: 鸣潮抽卡分析展示是否up
1 parent 134877f commit 4cfefc6

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

data/system/pluginConstants.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,21 @@ export const mcGachaDataPath = dataPath + '/gachaData/mc'
3434

3535
// 其它信息
3636
export const pluginThemeColor = chalk.rgb(57, 197, 187)
37+
38+
// 鸣潮历史 up 池时间和物品 id
39+
export const mcGachaUpPools = [
40+
{ // 1.0 上半
41+
startTime: '1716429600', // 2024.05.23 10:00
42+
endTime: '1717639200', // 2024.06.06 10:00
43+
itemId: '1404',
44+
itemName: '忌炎',
45+
itemType: 1, // 1 为角色, 2 为武器
46+
},
47+
{ // 1.0 上半
48+
startTime: '1716429600', // 2024.05.23 10:00
49+
endTime: '1717639200', // 2024.06.06 10:00
50+
itemId: '21010016',
51+
itemName: '苍鳞千嶂',
52+
itemType: 2,
53+
},
54+
]

model/mcGachaCard.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
pluginVer,
66
resPath,
77
_ResPath,
8+
mcGachaUpPools,
89
} from '../data/system/pluginConstants.js'
910
import mcGachaData from './mcGachaData.js'
1011
import userConfig from './userConfig.js'
@@ -71,6 +72,7 @@ export default class mcGachaCard {
7172
time: gachaRecord[i].time,
7273
totalGachaTimes: i + 1,
7374
thisCardCost: i - lastGoldIndex,
75+
isUpItem: false,
7476
})
7577
lastGoldIndex = i
7678
}
@@ -88,10 +90,23 @@ export default class mcGachaCard {
8890
time: gachaRecord[i].time,
8991
totalGachaTimes: i + 1,
9092
thisCardCost: i - lastGoldIndex,
93+
isUpItem: false,
9194
})
9295
}
9396
}
9497

98+
// 遍历所有五星, 判断是否为 up 物品
99+
for (let i = 0; i < goldCardRecord.length; i++) {
100+
if (goldCardRecord[i].itemId === '-1') continue
101+
for (let j = 0; j < mcGachaUpPools.length; j++) {
102+
if ( // 注意时间需要转换为时间戳
103+
goldCardRecord[i].itemId === mcGachaUpPools[j].itemId && new Date(goldCardRecord[i].time).getTime() >= mcGachaUpPools[j].startTime * 1000 && new Date(goldCardRecord[i].time).getTime() <= mcGachaUpPools[j].endTime * 1000){
104+
goldCardRecord[i].isUpItem = true
105+
break
106+
}
107+
}
108+
}
109+
95110
// 再次倒序, 把新的记录放在最前面
96111
goldCardRecord.reverse()
97112

@@ -104,7 +119,7 @@ export default class mcGachaCard {
104119
if (goldCardRecord.length !== 0) {
105120
let hasNoGold = false
106121
for (let i = 0; i < goldCardRecord.length; i++) {
107-
if (goldCardRecord[i].itemRank == -1) { // 排除未出金记录
122+
if (goldCardRecord[i].itemId == -1) { // 排除未出金记录
108123
hasNoGold = true
109124
continue
110125
}

resources/html/mcGachaRecord/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<img src="{{pluResPath}}/img/common/bg/Alisa-Echo_0.jpg" alt="{{card.itemName}}" class="card-avatar">
6060
<div class="bar-container">
6161
<div class="bar" style="width: calc({{card.thisCardCost}}px * 3); background-color: {{card.itemName == '?' ? '#FFD700' : '#4CAF50'}};"></div>
62-
<div class="bar-label">{{ card.itemName == '?' ? '未出金' : card.itemName }} 抽数: {{card.thisCardCost}}</div>
62+
<div class="bar-label">{{ card.itemId == -1 ? '未出金' : card.itemName }}{{card.itemCount > 1 ? `x${card.itemCount}` : ""}} 抽数: {{card.thisCardCost}} {{card.isUpItem ? "UP" : ""}}</div>
6363
</div>
6464
</div>
6565
</div>

0 commit comments

Comments
 (0)