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
+4 -4
View File
@@ -18,7 +18,7 @@ import { HeroModel, HeroType } from '../db/Hero';
import { CeAttrNumber, CeAttr, CeAttrRole } from '../db/generalField';
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
import { OutliningSpanKind } from 'typescript';
const _ = require('underscore');
import { findWhere, findIndex } from 'underscore';
export async function initPvpInfo(role: RoleType) {
@@ -251,7 +251,7 @@ export async function defaultHeroes ( role:RoleType, challengeCnt?:number, chall
return b.ce - b.dataId - a.ce + a.dataId;
});
for (let hero of heroes) {
if (!!hero.order&& !!hero.hero && _.findIndex(role.topFive, {hid: hero.actorId}) != -1) {
if (!!hero.order&& !!hero.hero && findIndex(role.topFive, {hid: hero.actorId}) != -1) {
let index = orders.indexOf(hero.order);
orders.splice(index, 1);
}
@@ -260,14 +260,14 @@ export async function defaultHeroes ( role:RoleType, challengeCnt?:number, chall
let num = 0;
for (let i = 0; i < role.topFive.length; i++) {
let item = role.topFive[i];
let index = _.findIndex(heroes, {actorId: item.hid});
let index = findIndex(heroes, {actorId: item.hid});
if (index == -1) {
for (let j = num; j < heroes.length; j++) {
let hero = heroes[j];
if (num >= 5) {
break;
}
if (!!_.findWhere(role.topFive, {hid: hero.actorId})) {
if (!!findWhere(role.topFive, {hid: hero.actorId})) {
continue;
}
if (!orders[0]) {