数值:装备支持小数点
This commit is contained in:
@@ -52,10 +52,10 @@ function parseAttrMap(str: string) {
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let i = 0; i < decodeArr.length; 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');
|
||||
}
|
||||
result.set(i + 1, [{id: parseInt(id), num: parseInt(num)}]);
|
||||
result.set(i + 1, [{id: parseInt(id), num: parseFloat(num)}]);
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -65,10 +65,10 @@ function parseAttr(str: string) {
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
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');
|
||||
}
|
||||
result.push({id: parseInt(id), num: parseInt(num)});
|
||||
result.push({id: parseInt(id), num: parseFloat(num)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -34,10 +34,10 @@ function parseEffect(str: string) {
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
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');
|
||||
}
|
||||
result.push({star: parseInt(star), id: parseInt(id), val: parseInt(val)});
|
||||
result.push({star: parseInt(star), id: parseInt(id), val: parseFloat(val)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user