添加藏宝图按体力掉落
This commit is contained in:
@@ -98,6 +98,12 @@ const moment = require('moment');
|
||||
result = { type: parseInt(type), param: parseInt(param), cnt: parseInt(cnt) };
|
||||
break;
|
||||
}
|
||||
case 'possibility': {
|
||||
let [id, weight] = arr;
|
||||
if(isNaN(id) || isNaN(weight)) throw new Error('data table format wrong');
|
||||
result = { id: parseInt(id), weight: parseInt(weight) };
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -163,6 +169,10 @@ export function decodeIdCntArrayStr(str: string, multi: number) {
|
||||
return ce;
|
||||
}
|
||||
|
||||
export function getRandomByLen(arr: Array<any>) {
|
||||
let len = arr.length;
|
||||
return arr[Math.floor(Math.random() * len)]
|
||||
}
|
||||
|
||||
export function getRandomWithWeight(randomList: any) {
|
||||
let len = randomList.reduce((pre, cur) => {
|
||||
|
||||
Reference in New Issue
Block a user