underscore读取,排行榜保护

This commit is contained in:
mamengke01
2021-01-12 14:13:30 +08:00
parent 58f3e94fc0
commit 22f2eed34e
16 changed files with 53 additions and 51 deletions
+5 -5
View File
@@ -11,7 +11,7 @@ import { pinus } from 'pinus';
import { addEquips, addBags, addSkins } from '../pubUtils/itemUtils';
import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
import { gameData } from '../pubUtils/data';
const _ = require('underscore');
import { indexOf, findIndex } from 'underscore';
export async function handleFixedReward(roleId: string, roleName: string, sid: string, rewardStr: string, multi: number) {
let reward = parseGoodStr(rewardStr);
@@ -79,7 +79,7 @@ function sortConsumes(goods: Array<ItemInter>, bags: Array<ItemInter>, currencys
return false;
}
} else if (table == ITEM_TABLE.ITEM) {
let index = _.indexOf(bags, {id: good.id});
let index = indexOf(bags, {id: good.id});
if (index > 0) {
bags[index].count = bags[index].count + good.count;
} else {
@@ -177,7 +177,7 @@ function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array
}
} else if (table == ITEM_TABLE.ITEM) {
let index = _.indexOf(bags, {id: good.id});
let index = findIndex(bags, {id: good.id});
if (index > 0) {
bags[index].count = bags[index].count + good.count;
} else {
@@ -186,7 +186,7 @@ function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array
} else if (table == ITEM_TABLE.HERO) {
if (type == CONSUME_TYPE.SKIN) {
let index = _.indexOf(skins, good.id);
let index = indexOf(skins, good.id);
if (index == -1) {
skins.push(good.id);
}
@@ -196,7 +196,7 @@ function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array
if (!!isCurrency) {
let curname = getCurNameById(goodInfo.good_id);
if (!!curname) {
let index = _.findIndex(showItems, {id: good.id});
let index = findIndex(showItems, {id: good.id});
if (index > 0) {
showItems[index].count = showItems[index].count + good.count;
} else {