增加埃洛伊的头像,部分Mys请求逻辑优化

This commit is contained in:
Kokomi 2023-02-22 01:26:17 +08:00
parent 8511605a09
commit d0b9d4c175
87 changed files with 987 additions and 2778 deletions

View File

@ -34,7 +34,7 @@ const ProfileStat = {
}) })
if (avatarRet.length === 0) { if (avatarRet.length === 0) {
e.reply(player.getErrMsg() || `查询失败,暂未获得#${uid}角色数据请绑定CK或 #更新面板`) e._isReplyed || e.reply(`查询失败,暂未获得#${uid}角色数据请绑定CK或 #更新面板`)
return true return true
} }

View File

@ -51,12 +51,26 @@ let Data = {
/* /*
* 写JSON * 写JSON
* */ * */
writeJSON (file, data, space = '\t', root = '') { writeJSON (cfg, data, space = '\t', root = '') {
if (arguments.length > 1) {
return Data.writeJSON({
name: cfg,
data,
space,
root
})
}
// 检查并创建目录 // 检查并创建目录
Data.createDir(file, root, true) let name = cfg.path ? (cfg.path + '/' + cfg.name) : cfg.name
root = getRoot(root) Data.createDir(name, cfg.root, true)
root = getRoot(cfg.root)
data = cfg.data
delete data._res delete data._res
return fs.writeFileSync(`${root}/${file}`, JSON.stringify(data, null, space)) data = JSON.stringify(data, null, cfg.space || 2)
if (cfg.rn) {
data = data.replaceAll('\n', '\r\n')
}
return fs.writeFileSync(`${root}/${name}`, data)
}, },
delFile (file, root = '') { delFile (file, root = '') {
root = getRoot(root) root = getRoot(root)

View File

@ -76,25 +76,6 @@ export default class MysApi {
} }
} }
static async checkRetCode (retcode) {
switch (retcode) {
case -1:
case -100:
case 1001:
case 10001:
case 10103:
return 'CK失效或报错'
case 1008:
return '请先去米游社绑定角色'
case 10101:
return '查询已达今日上限'
case 10102:
return '请先去米游社绑定角色或公开数据'
case 1034:
return '米游社查询遇到验证码,请稍后再试'
}
}
async getMysApi (e, targetType = 'all', option = {}) { async getMysApi (e, targetType = 'all', option = {}) {
if (this.mys) { if (this.mys) {
return this.mys return this.mys
@ -109,6 +90,7 @@ export default class MysApi {
} }
let e = this.e let e = this.e
let mys = await this.getMysApi(e, api, { log: false }) let mys = await this.getMysApi(e, api, { log: false })
let mysInfo = this.mysInfo || {}
// 暂时先在plugin侧阻止错误防止刷屏 // 暂时先在plugin侧阻止错误防止刷屏
e._original_reply = e._original_reply || e.reply e._original_reply = e._original_reply || e.reply
e._reqCount = e._reqCount || 0 e._reqCount = e._reqCount || 0
@ -122,6 +104,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)
e._reqCount-- e._reqCount--
if (e._reqCount === 0) { if (e._reqCount === 0) {
e.reply = e._original_reply e.reply = e._original_reply

View File

@ -325,8 +325,4 @@ export default class Player extends Base {
} }
return avatarRet return avatarRet
} }
getErrMsg () {
return MysAvatar.getErrMsg(this.e)
}
} }

View File

@ -43,16 +43,15 @@ let EnkaData = {
getTalent (charid, ds = {}) { getTalent (charid, ds = {}) {
let char = Character.get(charid) let char = Character.get(charid)
let { talentId = {}, talentElem = {}, talentKey = {} } = char.meta let { talentId = {}, talentElem = {} } = char.meta
let elem = '' let elem = ''
let idx = 0 let idx = 0
let ret = {} let ret = {}
lodash.forEach(ds, (lv, id) => { lodash.forEach(ds, (lv, id) => {
let key let key
if (talentId[id]) { if (talentId[id]) {
let tid = talentId[id] let key = talentId[id]
key = talentKey[tid] elem = elem || talentElem[id]
elem = elem || talentElem[tid]
ret[key] = lv ret[key] = lv
} else { } else {
key = ['a', 'e', 'q'][idx++] key = ['a', 'e', 'q'][idx++]

View File

@ -45,16 +45,15 @@ let MiaoData = {
getTalentNew (charid, data = {}) { getTalentNew (charid, data = {}) {
let char = Character.get(charid) let char = Character.get(charid)
let { talentId = {}, talentElem = {}, talentKey = {} } = char.meta let { talentId = {}, talentElem = {} } = char.meta
let elem = '' let elem = ''
let idx = 0 let idx = 0
let ret = {} let ret = {}
lodash.forEach(data, (level, id) => { lodash.forEach(data, (level, id) => {
let key let key
if (talentId[id]) { if (talentId[id]) {
let tid = talentId[id] key = talentId[id]
key = talentKey[tid] elem = elem || talentElem[id]
elem = elem || talentElem[tid]
ret[key] = level ret[key] = level
} else { } else {
key = ['a', 'e', 'q'][idx] key = ['a', 'e', 'q'][idx]
@ -70,16 +69,15 @@ let MiaoData = {
getTalent (charid, data = {}) { getTalent (charid, data = {}) {
let char = Character.get(charid) let char = Character.get(charid)
let { talentId = {}, talentElem = {}, talentKey = {} } = char.meta let { talentId = {}, talentElem = {} } = char.meta
let elem = '' let elem = ''
let idx = 0 let idx = 0
let ret = {} let ret = {}
lodash.forEach(data, (ds) => { lodash.forEach(data, (ds) => {
let key let key
if (talentId[ds.id]) { if (talentId[ds.id]) {
let tid = talentId[ds.id] key = talentId[ds.id]
key = talentKey[tid] elem = elem || talentElem[ds.id]
elem = elem || talentElem[tid]
ret[key] = { ret[key] = {
level: ds.level level: ds.level
} }

View File

@ -4,28 +4,6 @@ import { chestInfo } from '../../resources/meta/info/index.js'
import moment from 'moment' import moment from 'moment'
const MysAvatar = { const MysAvatar = {
getErrMsg (e) {
if (!e._retcode) {
return false
}
switch (e._retcode * 1) {
case -1:
case -100:
case 1001:
case 10001:
case 10103:
return 'CK失效或报错'
case 1008:
return '请先去米游社绑定角色'
case 10101:
return '查询已达今日上限'
case 10102:
return '请先去米游社绑定角色或公开数据'
case 1034:
return '米游社查询遇到验证码,请稍后再试'
}
return false
},
needRefresh (time, force = 0, forceMap = {}) { needRefresh (time, force = 0, forceMap = {}) {
if (!time || force === 2) { if (!time || force === 2) {

View File

@ -23,15 +23,10 @@
"key": "heal", "key": "heal",
"value": 22.15 "value": 22.15
}, },
"talentKey": {
"3531": "a",
"3532": "e",
"3539": "q"
},
"talentId": { "talentId": {
"10351": 3531, "10351": "a",
"10352": 3532, "10352": "e",
"10353": 3539 "10353": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -25,15 +25,10 @@
"key": "mastery", "key": "mastery",
"value": 96 "value": 96
}, },
"talentKey": {
"431": "a",
"432": "e",
"439": "q"
},
"talentId": { "talentId": {
"10060": 431, "10060": "a",
"10061": 432, "10061": "e",
"10062": 439 "10062": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"6531": "a",
"6532": "e",
"6539": "q"
},
"talentId": { "talentId": {
"10651": 6531, "10651": "a",
"10652": 6532, "10652": "e",
"10655": 6539 "10655": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"5631": "a",
"5632": "e",
"5639": "q"
},
"talentId": { "talentId": {
"10561": 5631, "10561": "a",
"10562": 5632, "10562": "e",
"10565": 5639 "10565": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 26.67 "value": 26.67
}, },
"talentKey": {
"6431": "a",
"6432": "e",
"6439": "q"
},
"talentId": { "talentId": {
"10641": 6431, "10641": "a",
"10642": 6432, "10642": "e",
"10643": 6439 "10643": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"5531": "a",
"5532": "e",
"5539": "q"
},
"talentId": { "talentId": {
"10551": 5531, "10551": "a",
"10552": 5532, "10552": "e",
"10555": 5539 "10555": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"5131": "a",
"5132": "e",
"5139": "q"
},
"talentId": { "talentId": {
"10511": 5131, "10511": "a",
"10512": 5132, "10512": "e",
"10515": 5139 "10515": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"5831": "a",
"5832": "e",
"5839": "q"
},
"talentId": { "talentId": {
"10581": 5831, "10581": "a",
"10582": 5832, "10582": "e",
"10585": 5839 "10585": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -25,15 +25,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"2731": "a",
"2732": "e",
"2739": "q"
},
"talentId": { "talentId": {
"10271": 2731, "10271": "a",
"10272": 2732, "10272": "e",
"10274": 2739 "10274": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 26.67 "value": 26.67
}, },
"talentKey": {
"1531": "a",
"1532": "e",
"1539": "q"
},
"talentId": { "talentId": {
"10073": 1531, "10073": "a",
"10074": 1532, "10074": "e",
"10075": 1539 "10075": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -25,15 +25,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"4231": "a",
"4232": "e",
"4239": "q"
},
"talentId": { "talentId": {
"10421": 4231, "10421": "a",
"10422": 4232, "10422": "e",
"10425": 4239 "10425": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"2431": "a",
"2432": "e",
"2439": "q"
},
"talentId": { "talentId": {
"10241": 2431, "10241": "a",
"10242": 2432, "10242": "e",
"10245": 2439 "10245": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"2931": "a",
"2932": "e",
"2939": "q"
},
"talentId": { "talentId": {
"10291": 2931, "10291": "a",
"10292": 2932, "10292": "e",
"10295": 2939 "10295": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"7231": "a",
"7232": "e",
"7239": "q"
},
"talentId": { "talentId": {
"10721": 7231, "10721": "a",
"10722": 7232, "10722": "e",
"10725": 7239 "10725": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"6231": "a",
"6232": "e",
"6239": "q"
},
"talentId": { "talentId": {
"10621": 6231, "10621": "a",
"10622": 6232, "10622": "e",
"10625": 6239 "10625": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"6831": "a",
"6832": "e",
"6839": "q"
},
"talentId": { "talentId": {
"10681": 6831, "10681": "a",
"10682": 6832, "10682": "e",
"10685": 6839 "10685": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"6031": "a",
"6032": "e",
"6039": "q"
},
"talentId": { "talentId": {
"10606": 6031, "10606": "a",
"10607": 6032, "10607": "e",
"10610": 6039 "10610": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -803,6 +803,68 @@
31.049999999999997, 31.049999999999997,
32.88, 32.88,
34.71 34.71
],
"玄掷玲珑伤害2": [
[
4.87,
3
],
[
5.24,
3
],
[
5.6,
3
],
[
6.09,
3
],
[
6.46,
3
],
[
6.82,
3
],
[
7.31,
3
],
[
7.8,
3
],
[
8.28,
3
],
[
8.77,
3
],
[
9.26,
3
],
[
9.74,
3
],
[
10.35,
3
],
[
10.96,
3
],
[
11.57,
3
]
] ]
} }
}, },

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"7031": "a",
"7032": "e",
"7039": "q"
},
"talentId": { "talentId": {
"10701": 7031, "10701": "a",
"10702": 7032, "10702": "e",
"10705": 7039 "10705": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,
@ -45,5 +40,5 @@
"talent": "「笃行」的哲学", "talent": "「笃行」的哲学",
"weekly": "祸神之禊泪" "weekly": "祸神之禊泪"
}, },
"eta": 1665741600000 "eta": 1665712800000
} }

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"2131": "a",
"2132": "e",
"2139": "q"
},
"talentId": { "talentId": {
"10017": 2139, "10017": "q",
"10032": 2132, "10032": "e",
"10041": 2131 "10041": "a"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"4931": "a",
"4932": "e",
"4939": "q"
},
"talentId": { "talentId": {
"10491": 4931, "10491": "a",
"10492": 4932, "10492": "e",
"10495": 4939 "10495": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -462,6 +462,68 @@
156.34, 156.34,
163.62 163.62
], ],
"一段伤害2": [
[
35.64,
2
],
[
38.07,
2
],
[
40.5,
2
],
[
43.74,
2
],
[
46.17,
2
],
[
49,
2
],
[
52.65,
2
],
[
56.3,
2
],
[
59.94,
2
],
[
63.59,
2
],
[
67.23,
2
],
[
70.88,
2
],
[
74.52,
2
],
[
78.17,
2
],
[
81.81,
2
]
],
"二段伤害": [ "二段伤害": [
68.38, 68.38,
73.04, 73.04,
@ -513,6 +575,68 @@
203.62, 203.62,
213.1 213.1
], ],
"四段伤害2": [
[
46.42,
2
],
[
49.58,
2
],
[
52.75,
2
],
[
56.97,
2
],
[
60.14,
2
],
[
63.83,
2
],
[
68.58,
2
],
[
73.32,
2
],
[
78.07,
2
],
[
82.82,
2
],
[
87.56,
2
],
[
92.31,
2
],
[
97.06,
2
],
[
101.81,
2
],
[
106.55,
2
]
],
"五段伤害": [ "五段伤害": [
105.86, 105.86,
113.08, 113.08,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"5031": "a",
"5032": "e",
"5039": "q"
},
"talentId": { "talentId": {
"10501": 5031, "10501": "a",
"10502": 5032, "10502": "e",
"10505": 5039 "10505": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -543,6 +543,68 @@
135.82, 135.82,
143.28 143.28
], ],
"三段伤害2": [
[
26.79,
2
],
[
28.97,
2
],
[
31.15,
2
],
[
34.26,
2
],
[
36.45,
2
],
[
38.94,
2
],
[
42.36,
2
],
[
45.79,
2
],
[
49.22,
2
],
[
52.96,
2
],
[
56.69,
2
],
[
60.43,
2
],
[
64.17,
2
],
[
67.91,
2
],
[
71.64,
2
]
],
"四段伤害": [ "四段伤害": [
67.36, 67.36,
72.84, 72.84,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"6931": "a",
"6932": "e",
"6939": "q"
},
"talentId": { "talentId": {
"10691": 6931, "10691": "a",
"10692": 6932, "10692": "e",
"10695": 6939 "10695": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -491,6 +491,68 @@
134.08, 134.08,
141.44 141.44
], ],
"三段伤害2": [
[
26.45,
2
],
[
28.6,
2
],
[
30.75,
2
],
[
33.83,
2
],
[
35.98,
2
],
[
38.44,
2
],
[
41.82,
2
],
[
45.2,
2
],
[
48.59,
2
],
[
52.28,
2
],
[
55.97,
2
],
[
59.65,
2
],
[
63.34,
2
],
[
67.04,
2
],
[
70.72,
2
]
],
"四段伤害": [ "四段伤害": [
68.63, 68.63,
74.21, 74.21,

View File

@ -23,42 +23,29 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"731": "a",
"732": "e",
"739": "q",
"932": "e",
"939": "q",
"1031": "a",
"1032": "e",
"1039": "q",
"1131": "a",
"1132": "e",
"1139": "q"
},
"talentId": { "talentId": {
"10067": 732, "10067": "e",
"10068": 739, "10068": "q",
"10077": 932, "10077": "e",
"10078": 939, "10078": "q",
"10117": 1132, "10117": "e",
"10118": 1139, "10118": "q",
"10602": 1032, "10602": "e",
"10605": 1039, "10605": "q",
"100553": 731, "100553": "a",
"100555": 731, "100555": "a",
"100556": 1031, "100556": "a",
"100557": 1131 "100557": "a"
}, },
"talentElem": { "talentElem": {
"732": "anemo", "10067": "anemo",
"739": "anemo", "10068": "anemo",
"932": "geo", "10077": "geo",
"939": "geo", "10078": "geo",
"1032": "electro", "10117": "dendro",
"1039": "electro", "10118": "dendro",
"1132": "dendro", "10602": "electro",
"1139": "dendro" "10605": "electro"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "mastery", "key": "mastery",
"value": 96 "value": 96
}, },
"talentKey": {
"5331": "a",
"5332": "e",
"5339": "q"
},
"talentId": { "talentId": {
"10531": 5331, "10531": "a",
"10532": 5332, "10532": "e",
"10535": 5339 "10535": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "mastery", "key": "mastery",
"value": 115.19999694824 "value": 115.19999694824
}, },
"talentKey": {
"4731": "a",
"4732": "e",
"4739": "q"
},
"talentId": { "talentId": {
"10471": 4731, "10471": "a",
"10472": 4732, "10472": "e",
"10475": 4739 "10475": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -618,6 +618,68 @@
205.56, 205.56,
221.16 221.16
], ],
"五段伤害2": [
[
25.37,
3
],
[
27.43,
3
],
[
29.5,
3
],
[
32.45,
3
],
[
34.51,
3
],
[
36.88,
3
],
[
40.12,
3
],
[
43.36,
3
],
[
46.61,
3
],
[
50.15,
3
],
[
54.21,
3
],
[
58.98,
3
],
[
63.75,
3
],
[
68.52,
3
],
[
73.72,
3
]
],
"重击伤害": [ "重击伤害": [
117.65, 117.65,
127.22, 127.22,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"6731": "a",
"6732": "e",
"6739": "q"
},
"talentId": { "talentId": {
"10671": 6731, "10671": "a",
"10672": 6732, "10672": "e",
"10675": 6739 "10675": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"7531": "a",
"7532": "e",
"7539": "q"
},
"talentId": { "talentId": {
"10751": 7531, "10751": "a",
"10752": 7532, "10752": "e",
"10755": 7539 "10755": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 32 "value": 32
}, },
"talentKey": {
"2231": "a",
"2232": "e",
"2239": "q"
},
"talentId": { "talentId": {
"10221": 2231, "10221": "a",
"10224": 2232, "10224": "e",
"10225": 2239 "10225": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"4831": "a",
"4832": "e",
"4839": "q"
},
"talentId": { "talentId": {
"10481": 4831, "10481": "a",
"10482": 4832, "10482": "e",
"10485": 4839 "10485": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"5431": "a",
"5432": "e",
"5439": "q"
},
"talentId": { "talentId": {
"10541": 5431, "10541": "a",
"10542": 5432, "10542": "e",
"10545": 5439 "10545": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"7631": "a",
"7632": "e",
"7639": "q"
},
"talentId": { "talentId": {
"10761": 7631, "10761": "a",
"10762": 7632, "10762": "e",
"10765": 7639 "10765": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 26.67 "value": 26.67
}, },
"talentKey": {
"3231": "a",
"3232": "e",
"3239": "q"
},
"talentId": { "talentId": {
"10321": 3231, "10321": "a",
"10322": 3232, "10322": "e",
"10323": 3239 "10323": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -25,15 +25,10 @@
"key": "heal", "key": "heal",
"value": 22.15 "value": 22.15
}, },
"talentKey": {
"331": "a",
"332": "e",
"339": "q"
},
"talentId": { "talentId": {
"10031": 331, "10031": "a",
"10033": 332, "10033": "e",
"10034": 339 "10034": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"7731": "a",
"7732": "e",
"7739": "q"
},
"talentId": { "talentId": {
"10771": 7731, "10771": "a",
"10772": 7732, "10772": "e",
"10775": 7739 "10775": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"3731": "a",
"3732": "e",
"3739": "q"
},
"talentId": { "talentId": {
"10371": 3731, "10371": "a",
"10372": 3732, "10372": "e",
"10373": 3739 "10373": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"6331": "a",
"6332": "e",
"6339": "q"
},
"talentId": { "talentId": {
"10631": 6331, "10631": "a",
"10632": 6332, "10632": "e",
"10635": 6339 "10635": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"4331": "a",
"4332": "e",
"4339": "q"
},
"talentId": { "talentId": {
"10431": 4331, "10431": "a",
"10432": 4332, "10432": "e",
"10435": 4339 "10435": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"6631": "a",
"6632": "e",
"6639": "q"
},
"talentId": { "talentId": {
"10661": 6631, "10661": "a",
"10662": 6632, "10662": "e",
"10665": 6639 "10665": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -645,6 +645,68 @@
149.3, 149.3,
157.52 157.52
], ],
"四段伤害2": [
[
29.45,
2
],
[
31.85,
2
],
[
34.24,
2
],
[
37.67,
2
],
[
40.06,
2
],
[
42.8,
2
],
[
46.57,
2
],
[
50.34,
2
],
[
54.1,
2
],
[
58.21,
2
],
[
62.32,
2
],
[
66.43,
2
],
[
70.54,
2
],
[
74.65,
2
],
[
78.76,
2
]
],
"五段伤害": [ "五段伤害": [
75.6, 75.6,
81.76, 81.76,

View File

@ -25,15 +25,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"231": "a",
"232": "e",
"239": "q"
},
"talentId": { "talentId": {
"10018": 232, "10018": "e",
"10019": 239, "10019": "q",
"10024": 231 "10024": "a"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,42 +23,29 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"730": "a",
"732": "e",
"739": "q",
"932": "e",
"939": "q",
"1030": "a",
"1032": "e",
"1039": "q",
"1130": "a",
"1132": "e",
"1139": "q"
},
"talentId": { "talentId": {
"10067": 732, "10067": "e",
"10068": 739, "10068": "q",
"10077": 932, "10077": "e",
"10078": 939, "10078": "q",
"10117": 1132, "10117": "e",
"10118": 1139, "10118": "q",
"10602": 1032, "10602": "e",
"10605": 1039, "10605": "q",
"100543": 730, "100543": "a",
"100545": 730, "100545": "a",
"100546": 1030, "100546": "a",
"100547": 1130 "100547": "a"
}, },
"talentElem": { "talentElem": {
"732": "anemo", "10067": "anemo",
"739": "anemo", "10068": "anemo",
"932": "geo", "10077": "geo",
"939": "geo", "10078": "geo",
"1032": "electro", "10117": "dendro",
"1039": "electro", "10118": "dendro",
"1132": "dendro", "10602": "electro",
"1139": "dendro" "10605": "electro"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,11 +23,6 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"8031": "a",
"8032": "e",
"8039": "q"
},
"talentId": {}, "talentId": {},
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "mastery", "key": "mastery",
"value": 115.19999694824 "value": 115.19999694824
}, },
"talentKey": {
"7331": "a",
"7332": "e",
"7339": "q"
},
"talentId": { "talentId": {
"10731": 7331, "10731": "a",
"10732": 7332, "10732": "e",
"10735": 7339 "10735": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"4531": "a",
"4532": "e",
"4539": "q"
},
"talentId": { "talentId": {
"10451": 4531, "10451": "a",
"10452": 4532, "10452": "e",
"10453": 4539 "10453": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -466,6 +466,68 @@
161.32, 161.32,
170.2 170.2
], ],
"三段伤害2": [
[
31.82,
2
],
[
34.41,
2
],
[
37,
2
],
[
40.7,
2
],
[
43.29,
2
],
[
46.25,
2
],
[
50.32,
2
],
[
54.39,
2
],
[
58.46,
2
],
[
62.9,
2
],
[
67.34,
2
],
[
71.78,
2
],
[
76.22,
2
],
[
80.66,
2
],
[
85.1,
2
]
],
"四段伤害": [ "四段伤害": [
69.66, 69.66,
75.33, 75.33,

View File

@ -23,15 +23,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"4631": "a",
"4632": "e",
"4639": "q"
},
"talentId": { "talentId": {
"10461": 4631, "10461": "a",
"10462": 4632, "10462": "e",
"10463": 4639 "10463": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"7831": "a",
"7832": "e",
"7839": "q"
},
"talentId": { "talentId": {
"10781": 7831, "10781": "a",
"10782": 7832, "10782": "e",
"10785": 7839 "10785": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -25,15 +25,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"1431": "a",
"1432": "e",
"1439": "q"
},
"talentId": { "talentId": {
"10070": 1431, "10070": "a",
"10071": 1432, "10071": "e",
"10072": 1439 "10072": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"5731": "a",
"5732": "e",
"5739": "q"
},
"talentId": { "talentId": {
"10571": 5731, "10571": "a",
"10572": 5732, "10572": "e",
"10575": 5739 "10575": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,42 +23,29 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"731": "a",
"732": "e",
"739": "q",
"932": "e",
"939": "q",
"1031": "a",
"1032": "e",
"1039": "q",
"1131": "a",
"1132": "e",
"1139": "q"
},
"talentId": { "talentId": {
"10067": 732, "10067": "e",
"10068": 739, "10068": "q",
"10077": 932, "10077": "e",
"10078": 939, "10078": "q",
"10117": 1132, "10117": "e",
"10118": 1139, "10118": "q",
"10602": 1032, "10602": "e",
"10605": 1039, "10605": "q",
"100553": 731, "100553": "a",
"100555": 731, "100555": "a",
"100556": 1031, "100556": "a",
"100557": 1131 "100557": "a"
}, },
"talentElem": { "talentElem": {
"732": "anemo", "10067": "anemo",
"739": "anemo", "10068": "anemo",
"932": "geo", "10077": "geo",
"939": "geo", "10078": "geo",
"1032": "electro", "10117": "dendro",
"1039": "electro", "10118": "dendro",
"1132": "dendro", "10602": "electro",
"1139": "dendro" "10605": "electro"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 32 "value": 32
}, },
"talentKey": {
"4131": "a",
"4132": "e",
"4139": "q"
},
"talentId": { "talentId": {
"10411": 4131, "10411": "a",
"10412": 4132, "10412": "e",
"10415": 4139 "10415": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "hpPct", "key": "hpPct",
"value": 24 "value": 24
}, },
"talentKey": {
"7431": "a",
"7432": "e",
"7439": "q"
},
"talentId": { "talentId": {
"10741": 7431, "10741": "a",
"10742": 7432, "10742": "e",
"10745": 7439 "10745": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -25,15 +25,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"3131": "a",
"3132": "e",
"3139": "q"
},
"talentId": { "talentId": {
"10311": 3131, "10311": "a",
"10312": 3132, "10312": "e",
"10313": 3139 "10313": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"2531": "a",
"2532": "e",
"2539": "q"
},
"talentId": { "talentId": {
"10381": 2531, "10381": "a",
"10382": 2532, "10382": "e",
"10385": 2539 "10385": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "defPct", "key": "defPct",
"value": 30 "value": 30
}, },
"talentKey": {
"3431": "a",
"3432": "e",
"3439": "q"
},
"talentId": { "talentId": {
"10341": 3431, "10341": "a",
"10342": 3432, "10342": "e",
"10343": 3439 "10343": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "cdmg", "key": "cdmg",
"value": 38.4 "value": 38.4
}, },
"talentKey": {
"7131": "a",
"7132": "e",
"7139": "q"
},
"talentId": { "talentId": {
"10711": 7131, "10711": "a",
"10712": 7132, "10712": "e",
"10715": 7139 "10715": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"4431": "a",
"4432": "e",
"4439": "q"
},
"talentId": { "talentId": {
"10441": 4431, "10441": "a",
"10442": 4432, "10442": "e",
"10443": 4439 "10443": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"3331": "a",
"3332": "e",
"3339": "q"
},
"talentId": { "talentId": {
"10331": 3331, "10331": "a",
"10332": 3332, "10332": "e",
"10333": 3339 "10333": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -918,6 +918,68 @@
83.69999999999999, 83.69999999999999,
88.35 88.35
], ],
"断流·闪 伤害2": [
[
12.4,
3
],
[
13.33,
3
],
[
14.26,
3
],
[
15.5,
3
],
[
16.43,
3
],
[
17.36,
3
],
[
18.6,
3
],
[
19.84,
3
],
[
21.08,
3
],
[
22.32,
3
],
[
23.56,
3
],
[
24.8,
3
],
[
26.35,
3
],
[
27.9,
3
],
[
29.45,
3
]
],
"断流·破 伤害": [ "断流·破 伤害": [
62, 62,
66.65, 66.65,

View File

@ -25,15 +25,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"1631": "a",
"1632": "e",
"1639": "q"
},
"talentId": { "talentId": {
"10160": 1631, "10160": "a",
"10161": 1632, "10161": "e",
"10165": 1639 "10165": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"3931": "a",
"3932": "e",
"3939": "q"
},
"talentId": { "talentId": {
"10391": 3931, "10391": "a",
"10392": 3932, "10392": "e",
"10395": 3939 "10395": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,11 +23,6 @@
"key": "hpPct", "key": "hpPct",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"7931": "a",
"7932": "e",
"7939": "q"
},
"talentId": {}, "talentId": {},
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "atkPct", "key": "atkPct",
"value": 24 "value": 24
}, },
"talentKey": {
"3631": "a",
"3632": "e",
"3639": "q"
},
"talentId": { "talentId": {
"10401": 3631, "10401": "a",
"10402": 3632, "10402": "e",
"10403": 3639 "10403": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"3031": "a",
"3032": "e",
"3039": "q"
},
"talentId": { "talentId": {
"10301": 3031, "10301": "a",
"10302": 3032, "10302": "e",
"10303": 3039 "10303": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -604,6 +604,68 @@
116.12, 116.12,
124.96 124.96
], ],
"五段伤害2": [
[
10.75,
4
],
[
11.63,
4
],
[
12.5,
4
],
[
13.75,
4
],
[
14.62,
4
],
[
15.63,
4
],
[
17,
4
],
[
18.38,
4
],
[
19.75,
4
],
[
21.25,
4
],
[
22.97,
4
],
[
24.99,
4
],
[
27.01,
4
],
[
29.03,
4
],
[
31.24,
4
]
],
"六段伤害": [ "六段伤害": [
54.5, 54.5,
58.93, 58.93,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 28.8 "value": 28.8
}, },
"talentKey": {
"3831": "a",
"3832": "e",
"3839": "q"
},
"talentId": { "talentId": {
"10386": 3831, "10386": "a",
"10387": 3832, "10387": "e",
"10388": 3839 "10388": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "phy", "key": "phy",
"value": 30 "value": 30
}, },
"talentKey": {
"2031": "a",
"2032": "e",
"2039": "q"
},
"talentId": { "talentId": {
"10201": 2031, "10201": "a",
"10202": 2032, "10202": "e",
"10203": 2039 "10203": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "recharge", "key": "recharge",
"value": 32 "value": 32
}, },
"talentKey": {
"5231": "a",
"5232": "e",
"5239": "q"
},
"talentId": { "talentId": {
"10521": 5231, "10521": "a",
"10522": 5232, "10522": "e",
"10525": 5239 "10525": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -23,15 +23,10 @@
"key": "mastery", "key": "mastery",
"value": 96 "value": 96
}, },
"talentKey": {
"2331": "a",
"2332": "e",
"2339": "q"
},
"talentId": { "talentId": {
"10231": 2331, "10231": "a",
"10232": 2332, "10232": "e",
"10235": 2339 "10235": "q"
}, },
"talentCons": { "talentCons": {
"e": 5, "e": 5,

View File

@ -487,68 +487,6 @@
140.74, 140.74,
151.44 151.44
], ],
"三段伤害2": [
[
26.06,
26.06
],
[
28.18,
28.18
],
[
30.3,
30.3
],
[
33.33,
33.33
],
[
35.45,
35.45
],
[
37.87,
37.87
],
[
41.21,
41.21
],
[
44.54,
44.54
],
[
47.87,
47.87
],
[
51.51,
51.51
],
[
55.68,
55.68
],
[
60.58,
60.58
],
[
65.48,
65.48
],
[
70.37,
70.37
],
[
75.72,
75.72
]
],
"四段伤害": [ "四段伤害": [
56.4, 56.4,
61, 61,
@ -618,128 +556,21 @@
170.98 170.98
], ],
"低空/高空坠地冲击伤害": [ "低空/高空坠地冲击伤害": [
[ "[127.84,159.68]",
127.84, "[138.24,172.67]",
159.68 "[148.65,185.67]",
], "[163.51,204.24]",
[ "[173.92,217.23]",
138.24, "[185.81,232.09]",
172.67 "[202.16,252.51]",
], "[218.51,272.93]",
[ "[234.86,293.36]",
148.65, "[252.7,315.64]",
185.67 "[270.54,337.92]",
], "[288.38,360.2]",
[ "[306.22,382.48]",
163.51, "[324.05,404.76]",
204.24 "[341.89,427.04]"
],
[
173.92,
217.23
],
[
185.81,
232.09
],
[
202.16,
252.51
],
[
218.51,
272.93
],
[
234.86,
293.36
],
[
252.7,
315.64
],
[
270.54,
337.92
],
[
288.38,
360.2
],
[
306.22,
382.48
],
[
324.05,
404.76
],
[
341.89,
427.04
]
],
"低空/高空坠地冲击伤害2": [
[
127.84,
159.68
],
[
138.24,
172.67
],
[
148.65,
185.67
],
[
163.51,
204.24
],
[
173.92,
217.23
],
[
185.81,
232.09
],
[
202.16,
252.51
],
[
218.51,
272.93
],
[
234.86,
293.36
],
[
252.7,
315.64
],
[
270.54,
337.92
],
[
288.38,
360.2
],
[
306.22,
382.48
],
[
324.05,
404.76
],
[
341.89,
427.04
]
] ]
}, },
"e": { "e": {

View File

@ -23,15 +23,10 @@
"key": "cpct", "key": "cpct",
"value": 19.2 "value": 19.2
}, },
"talentKey": {
"2631": "a",
"2632": "e",
"2639": "q"
},
"talentId": { "talentId": {
"10261": 2631, "10261": "a",
"10262": 2632, "10262": "e",
"10265": 2639 "10265": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

View File

@ -23,15 +23,10 @@
"key": "dmg", "key": "dmg",
"value": 24 "value": 24
}, },
"talentKey": {
"5931": "a",
"5932": "e",
"5939": "q"
},
"talentId": { "talentId": {
"10591": 5931, "10591": "a",
"10592": 5932, "10592": "e",
"10595": 5939 "10595": "q"
}, },
"talentCons": { "talentCons": {
"e": 3, "e": 3,

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
import fs from 'fs'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import lodash from 'lodash' import lodash from 'lodash'
import fetch from 'node-fetch' import fetch from 'node-fetch'
@ -7,14 +6,7 @@ import CharData from './sprider/CharData.js'
import { Data } from '../components/index.js' import { Data } from '../components/index.js'
import tId from './sprider/TalentId.js' import tId from './sprider/TalentId.js'
const _path = process.cwd() let mData = Data.readJSON('/resources/meta/material/data.json')
const _root = _path + '/plugins/miao-plugin/'
const _mRoot = _root + 'resources/meta/material/'
let mData = {}
if (fs.existsSync(_mRoot + 'data.json')) {
mData = JSON.parse(fs.readFileSync(_mRoot + 'data.json', 'utf8'))
}
const tElems = ['anemo', 'geo', 'electro', 'dendro'] const tElems = ['anemo', 'geo', 'electro', 'dendro']
@ -83,12 +75,6 @@ let getCharData = async function (id, key, name = '', _id = id) {
detail.attr = attr detail.attr = attr
detail.elem = tElems[idx] detail.elem = tElems[idx]
details.push(detail) details.push(detail)
lodash.forEach(detail.talent, (ds, k) => {
talentKey[ds.id] = k
if (k === 'e' || k === 'q') {
talentElem[ds.id] = tElems[idx]
}
})
const te = { const te = {
anemo: 4, anemo: 4,
geo: 6, geo: 6,
@ -99,6 +85,12 @@ let getCharData = async function (id, key, name = '', _id = id) {
lodash.forEach(tId[cid].ProudMap || {}, (v, k) => { lodash.forEach(tId[cid].ProudMap || {}, (v, k) => {
talentId[k] = v talentId[k] = v
}) })
lodash.forEach(detail.talent, (ds, k) => {
talentKey[ds.id] = k
if (k === 'e' || k === 'q') {
talentElem[ds.id] = tElems[idx]
}
})
} }
} else { } else {
let detail = CharData.getDetail({ $, id, name }) let detail = CharData.getDetail({ $, id, name })
@ -107,10 +99,18 @@ let getCharData = async function (id, key, name = '', _id = id) {
} }
let detail = details[0] let detail = details[0]
let { talent, cons } = detail let { talent, cons } = detail
data.talentKey = talentKey || lodash.invert(lodash.mapValues(talent, (t) => t.id)) talentKey = talentKey || lodash.invert(lodash.mapValues(talent, (t) => t.id))
data.talentId = talentId data.talentId = {}
let talentKeyId = {}
lodash.forEach(talentId, (tid, id) => {
data.talentId[id] = talentKey[tid]
talentKeyId[tid] = id
})
if (data.elem === 'multi') { if (data.elem === 'multi') {
data.talentElem = talentElem data.talentElem = {}
lodash.forEach(talentElem, (elem, tid) => {
data.talentElem[talentKeyId[tid]] = elem
})
} }
data.talentCons = CharData.getConsTalent(talent, cons) data.talentCons = CharData.getConsTalent(talent, cons)
data.materials = CharData.getMaterials($, mData) data.materials = CharData.getMaterials($, mData)
@ -158,14 +158,17 @@ async function saveCharData (id, key, name = '', force = false, _id = id) {
if (eta[name]) { if (eta[name]) {
data.eta = new Date(`${eta[name]} 10:00:00`) * 1 data.eta = new Date(`${eta[name]} 10:00:00`) * 1
} }
let charPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/` let charPath = `/resources/meta/character/${name}/`
fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2).replaceAll('\n', '\r\n')) // fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2).replaceAll('\n', '\r\n'))
Data.writeJSON({ path: charPath, name: 'data.json', data, rn: true })
if (details.length === 1) { if (details.length === 1) {
fs.writeFileSync(`${charPath}detail.json`, JSON.stringify(details[0], '', 2).replaceAll('\n', '\r\n')) // fs.writeFileSync(`${charPath}detail.json`, JSON.stringify(details[0], '', 2).replaceAll('\n', '\r\n'))
Data.writeJSON({ path: charPath, name: 'detail.json', data: details[0], rn: true })
} else if (data.id === 20000000) { } else if (data.id === 20000000) {
for (let idx in details) { for (let idx in details) {
let detail = details[idx] let detail = details[idx]
fs.writeFileSync(`${charPath}/${detail.elem}/detail.json`, JSON.stringify(detail, '', 2).replaceAll('\n', '\r\n')) // fs.writeFileSync(`${charPath}/${detail.elem}/detail.json`, JSON.stringify(detail, '', 2).replaceAll('\n', '\r\n'))
Data.writeJSON({ path: `${charPath}/${detail.elem}`, name: 'detail.json', data: detail, rn: true })
} }
} }
@ -187,12 +190,13 @@ async function down (name = '', force = false) {
ds = ds.split(',') ds = ds.split(',')
ds = { key: ds[0], name: ds[1] } ds = { key: ds[0], name: ds[1] }
} }
if (!names.includes(id) && !names.includes(ds.key) && !names.includes(ds.name)) { if (!names.includes(id) && !names.includes(ds.key) && !names.includes(ds.name)) {
continue continue
} }
await saveCharData(ds.id || id, ds.key, ds.name, force, id) await saveCharData(ds.id || id, ds.key, ds.name, force, id)
} }
fs.writeFileSync(`${_mRoot}data.json`, JSON.stringify(mData, '', 2).replaceAll('\n', '\r\n')) Data.writeJSON({ name: '/resources/meta/material/data.json', data: mData, rn: true })
} }
const charData = { const charData = {
@ -275,4 +279,4 @@ let eta = {
迪希雅: '2023-03-01', 迪希雅: '2023-03-01',
米卡: '2023-03-01' 米卡: '2023-03-01'
} }
await down('迪希雅,米卡', true) await down('香菱', true)