mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
Upd:角色面板属性颜色根据词条权重切换
This commit is contained in:
parent
289a0a9a6d
commit
06ec5152a0
9 changed files with 74 additions and 53 deletions
12
lib/score.js
12
lib/score.js
|
|
@ -6,7 +6,7 @@ import { nameToId } from './convert/property.js';
|
|||
export const baseValueData = getMapData('EquipBaseValue');
|
||||
const equipScore = getMapData('EquipScore');
|
||||
/** @type {{ [charID: string]: { [propID: string]: number } }} */
|
||||
export const scoreData = {};
|
||||
export const scoreData = Object.create(null);
|
||||
for (const charName in equipScore) {
|
||||
// 兼容原ID格式
|
||||
if (+charName) {
|
||||
|
|
@ -16,17 +16,17 @@ for (const charName in equipScore) {
|
|||
const charID = charNameToID(charName);
|
||||
if (!charID)
|
||||
continue;
|
||||
scoreData[charID] = {};
|
||||
scoreData[charID] = Object.create(null);
|
||||
for (const propName in equipScore[charName]) {
|
||||
const propID = nameToId(propName);
|
||||
if (!propID)
|
||||
if (!propID || !equipScore[charName][propName])
|
||||
continue;
|
||||
scoreData[charID][propID] = equipScore[charName][propName];
|
||||
};
|
||||
/** 小生命、小攻击、小防御映射为大生命、大攻击、大防御的1/3 */
|
||||
for (const [small, big] of [[11103, 11102], [12103, 12102], [13103, 13102]]) {
|
||||
if (!scoreData[charID][small] && scoreData[charID][big]) {
|
||||
scoreData[charID][small] = scoreData[charID][big] / 3;
|
||||
if (scoreData[charID][big]) {
|
||||
scoreData[charID][small] ??= scoreData[charID][big] / 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ for (const charName in equipScore) {
|
|||
*/
|
||||
export const hasScoreData = charID => {
|
||||
return (
|
||||
scoreData.hasOwnProperty(charID) &&
|
||||
scoreData[charID] &&
|
||||
Object.keys(scoreData[charID]).length > 0
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue