数值:装备支持小数点

This commit is contained in:
luying
2022-04-13 16:51:39 +08:00
parent 8f377a5d91
commit 1b33d8a03e
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -52,10 +52,10 @@ function parseAttrMap(str: string) {
let decodeArr = decodeArrayListStr(str); let decodeArr = decodeArrayListStr(str);
for(let i = 0; i < decodeArr.length; i++) { for(let i = 0; i < decodeArr.length; i++) {
let [id, num] = decodeArr[i]; let [id, num] = decodeArr[i];
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) { if(isNaN(parseInt(id)) || isNaN(parseFloat(num))) {
throw new Error('data table format wrong'); throw new Error('data table format wrong');
} }
result.set(i + 1, [{id: parseInt(id), num: parseInt(num)}]); result.set(i + 1, [{id: parseInt(id), num: parseFloat(num)}]);
} }
return result return result
} }
@@ -65,10 +65,10 @@ function parseAttr(str: string) {
if(!str) return result; if(!str) return result;
let decodeArr = decodeArrayListStr(str); let decodeArr = decodeArrayListStr(str);
for(let [id, num] of decodeArr) { for(let [id, num] of decodeArr) {
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) { if(isNaN(parseInt(id)) || isNaN(parseFloat(num))) {
throw new Error('data table format wrong'); throw new Error('data table format wrong');
} }
result.push({id: parseInt(id), num: parseInt(num)}); result.push({id: parseInt(id), num: parseFloat(num)});
} }
return result return result
} }
+2 -2
View File
@@ -34,10 +34,10 @@ function parseEffect(str: string) {
if(!str) return result; if(!str) return result;
let decodeArr = decodeArrayListStr(str); let decodeArr = decodeArrayListStr(str);
for(let [star, id, val] of decodeArr) { for(let [star, id, val] of decodeArr) {
if(isNaN(parseInt(star)) || isNaN(parseInt(id)) || isNaN(parseInt(val))) { if(isNaN(parseInt(star)) || isNaN(parseInt(id)) || isNaN(parseFloat(val))) {
throw new Error('data table format wrong'); throw new Error('data table format wrong');
} }
result.push({star: parseInt(star), id: parseInt(id), val: parseInt(val)}); result.push({star: parseInt(star), id: parseInt(id), val: parseFloat(val)});
} }
return result return result
} }