inheit更改,支持嵌套

This commit is contained in:
kuangshen04 2023-09-27 17:04:20 +08:00
parent 4f596885aa
commit f4e2a8230c
1 changed files with 19 additions and 8 deletions

View File

@ -39830,14 +39830,25 @@
});
}
if(info.inherit){
const skill=lib.skill[info.inherit];
if(skill) Object.keys(skill).forEach(value=>{
if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=skill[value];
});
if(lib.translate[i]==undefined) lib.translate[i]=lib.translate[info.inherit];
if(lib.translate[iInfo]==undefined) lib.translate[iInfo]=lib.translate[`${info.inherit}_info`];
var inheritHistory=[];
doInherit(i);
function doInherit(i){
const info=lib.skill[i],iInfo=`${i}_info`;
if(!info.inherit) return;
if(inheritHistory.includes(info.inherit)) return;
inheritHistory.push(info.inherit);
const inheritInfo=lib.skill[info.inherit];
if(inheritInfo) Object.keys(inheritInfo).forEach(value=>{
if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=inheritInfo[value];
});
if(lib.translate[i]==undefined) lib.translate[i]=lib.translate[info.inherit];
if(lib.translate[iInfo]==undefined) lib.translate[iInfo]=lib.translate[`${info.inherit}_info`];
doInherit(info.inherit);
}
}
if(info.limited){
if(info.mark===undefined) info.mark=true;