2022-09-04 21:03:23 +00:00
|
|
|
import lodash from 'lodash'
|
2022-09-03 21:08:57 +00:00
|
|
|
|
|
|
|
const CharTalent = {
|
2022-09-04 21:03:23 +00:00
|
|
|
// 处理获取天赋数据
|
2022-09-03 21:08:57 +00:00
|
|
|
getAvatarTalent (id, talent, cons, mode, consTalent = {}) {
|
|
|
|
let ret = {}
|
|
|
|
lodash.forEach(['a', 'e', 'q'], (key) => {
|
|
|
|
let ds = talent[key]
|
|
|
|
if (!ds) {
|
2022-10-06 19:36:24 +00:00
|
|
|
return false
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
2022-09-04 21:03:23 +00:00
|
|
|
let value
|
2022-09-03 21:08:57 +00:00
|
|
|
let level
|
2022-09-04 21:03:23 +00:00
|
|
|
let original
|
|
|
|
let aPlus = id === 10000033
|
2022-09-03 21:08:57 +00:00
|
|
|
if (lodash.isNumber(ds)) {
|
2022-09-04 21:03:23 +00:00
|
|
|
value = ds
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
|
|
|
if (mode === 'level') {
|
|
|
|
// 基于level计算original
|
2022-09-04 21:03:23 +00:00
|
|
|
value = value || ds.level || ds.level_current || ds.original || ds.level_original
|
|
|
|
level = value
|
|
|
|
if (key === 'a') {
|
|
|
|
original = aPlus ? value - 1 : value
|
|
|
|
} else {
|
|
|
|
original = cons >= consTalent[key] ? (value - 3) : value
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 基于original计算level
|
2022-09-04 21:03:23 +00:00
|
|
|
value = value || ds.original || ds.level_original || ds.level || ds.level_current
|
|
|
|
original = value
|
|
|
|
if (key === 'a') {
|
|
|
|
level = aPlus ? value + 1 : value
|
|
|
|
} else {
|
|
|
|
level = cons >= consTalent[key] ? (value + 3) : value
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-04 21:03:23 +00:00
|
|
|
ret[key] = { level, original }
|
2022-09-03 21:08:57 +00:00
|
|
|
})
|
2022-10-06 19:36:24 +00:00
|
|
|
return lodash.isEmpty(ret) ? false : ret
|
2022-09-03 21:08:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
export default CharTalent
|