Improved handling of poorly migrated archive creatures

This commit is contained in:
Stefan Zermatten
2022-03-08 14:12:11 +02:00
parent 12fc9b1be3
commit fada07e048
3 changed files with 45 additions and 19 deletions

View File

@@ -215,16 +215,17 @@ function getInlineComputationTransforms(key){
];
}
function calculationUp(val){
export function calculationUp(val){
if (typeof val !== 'string') return val;
if (!val.replace) console.log({val, replace: val.replace});
return val.replace(/#(\w+).(\w+)Result/g, '#$1.$2')
.replace('.value', '.total')
.replace('.currentValue', '.value');
.replace(/\.value/g, '.total')
.replace(/\.currentValue/g, '.value');
}
function calculationDown(val){
if (typeof val !== 'string') return val;
return val.replace('.value', '.currentValue').replace('.total', '.value');
return val.replace(/\.value/g, '.currentValue').replace(/\.total/g, '.value');
}
function nanToNull(val){