字典表更新,物品分类

This commit is contained in:
mamengke01
2020-12-23 16:05:46 +08:00
parent c6fca817e2
commit 592ee35763
7 changed files with 2432 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ import Actor from './actor';
import fs = require('fs');
import path = require('path');
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
const _ = require('underscore');
const moment = require('moment');
@@ -502,4 +503,17 @@ export function parseNumberList(str: string) {
res.push(parseInt(g));
}
return res;
}
export function mergeSameGoods(goods: Array<{id: number, count: number}>) {
let resGoods = [];
for (let {id, count} of goods) {
let index = _.findIndex(resGoods, {id});
if (index > -1) {
resGoods[index].count += count;
} else {
resGoods.push({id, count});
}
}
return resGoods;
}