This commit is contained in:
aozhiwei 2022-04-17 10:33:13 +08:00
parent 7c2b15da5f
commit 560bc927ab
2 changed files with 4 additions and 1 deletions

View File

@ -37,7 +37,7 @@ class Present extends basewrap.BaseWrap {
const rand = utils.randRange(0, this._totalSpace);
for (let i in this._items) {
const item = this._items[i];
if (rand >= item['space']) {
if (rand < item['space']) {
return item;
}
}

View File

@ -24,6 +24,7 @@ class Present extends BaseService {
const list = [];
metaFactory.traverseMetaList('Present' + name, (item) => {
list.push(item);
return true;
});
await this.processList(name, list);
}
@ -32,8 +33,10 @@ class Present extends BaseService {
async processList(name, list) {
for (let i in list){
const presentMeta = list[i];
console.log(presentMeta);
const randItem = presentMeta.randItem();
if (randItem) {
console.log(11111);
const itemId = randItem['itemId'];
const tokenType = randItem['tokenType'];
for (let ii = 0; ii < presentMeta.getCount(); ++ii) {