mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
parent
e9ca415922
commit
bc3c641928
10 changed files with 640 additions and 575 deletions
|
|
@ -31,6 +31,14 @@ export const IDToCharSprite = id => {
|
|||
return data?.['sprite_id']
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色数据
|
||||
* @param {string | number} id
|
||||
*/
|
||||
export const IDToCharData = id => {
|
||||
return PartnerId2Data[id] || null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {number | null}
|
||||
|
|
|
|||
35
lib/score.js
35
lib/score.js
|
|
@ -1,46 +1,37 @@
|
|||
import { getMapData } from '../utils/file.js';
|
||||
import { charNameToID } from './convert/char.js';
|
||||
import { IDToCharData } from './convert/char.js';
|
||||
import { nameToId } from './convert/property.js';
|
||||
|
||||
/** @type {{ [propID: string]: number }} */
|
||||
export const baseValueData = getMapData('EquipBaseValue');
|
||||
const equipScore = getMapData('EquipScore');
|
||||
/** @type {{ [charID: string]: { [propID: string]: number } }} */
|
||||
export const scoreWeight = {};
|
||||
|
||||
const elementType2propId = (elementType) => [31503, 31603, 31703, 31803, , 31903][elementType - 200];
|
||||
|
||||
/**
|
||||
* 将权重数据格式化为ID格式权重数据并处理小词条
|
||||
* @returns {{ [propID: string]: number }}
|
||||
* 将权重数据格式化为ID格式权重数据
|
||||
* @returns {{ rules?: string[], [propID: string]: number }}
|
||||
*/
|
||||
export function formatScoreWeight(oriScoreWeight) {
|
||||
export function formatScoreWeight(oriScoreWeight, charID) {
|
||||
if (!oriScoreWeight) return false;
|
||||
if (Array.isArray(oriScoreWeight)) return oriScoreWeight;
|
||||
if (typeof oriScoreWeight !== 'object') return false;
|
||||
const weight = {};
|
||||
for (const propName in oriScoreWeight) {
|
||||
if (!oriScoreWeight[propName] && oriScoreWeight[propName] !== 0)
|
||||
continue;
|
||||
const propID = +propName || nameToId(propName);
|
||||
let propID;
|
||||
if (charID && propName === '属性伤害加成') {
|
||||
propID = elementType2propId(IDToCharData(charID)?.ElementType);
|
||||
} else {
|
||||
propID = +propName || nameToId(propName);
|
||||
}
|
||||
if (!propID)
|
||||
continue;
|
||||
weight[propID] = oriScoreWeight[propName];
|
||||
};
|
||||
/** 小生命、小攻击、小防御映射为大生命、大攻击、大防御的1/3 */
|
||||
for (const [small, big] of [[11103, 11102], [12103, 12102], [13103, 13102]]) {
|
||||
if (weight[big]) {
|
||||
weight[small] ??= weight[big] / 3;
|
||||
};
|
||||
};
|
||||
return weight;
|
||||
}
|
||||
|
||||
for (const charName in equipScore) {
|
||||
// 兼容原ID格式
|
||||
const charID = +charName || charNameToID(charName);
|
||||
if (!charID)
|
||||
continue;
|
||||
scoreWeight[charID] = formatScoreWeight(equipScore[charName]);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取词条强化次数
|
||||
* @param {string} propertyID 属性id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue