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
@@ -14,7 +14,7 @@ import { EQUIP } from "../../../pubUtils/dicParam";
import { ITID, SPEICAL_ITEM, RANDOM_SE_COUNT } from "../../../consts/constModules/itemConst";
import { changeEquip, dressEquip, checkMaterialEnough, takeOffEquipAndCalPlayerCe } from "../../../services/equipService";
const _ = require('underscore');
import { indexOf, findIndex } from 'underscore';
export default function (app: Application) {
return new EquipHandler(app);
@@ -433,9 +433,9 @@ export class EquipHandler {
let { jobid } = gameData.hero.get(hid);
let { job_class } = getHeroJob(jobid);
let { classId } = getHeroEquipByClassId(goodInfo.itid);
if (_.indexOf(classId, job_class) < 0)
if (indexOf(classId, job_class) < 0)
return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
let index = _.findIndex(hero.ePlace, { id });
let index = findIndex(hero.ePlace, { id });
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
let equipOffInfo = <EquipType>hero.ePlace[index].equip;
@@ -460,7 +460,7 @@ export class EquipHandler {
let roleId: string = session.get('roleId');
let sid: string = session.get('sid');
let equip = await EquipModel.getEquip(eid);
let index = _.findIndex(equip.holes, { id });
let index = findIndex(equip.holes, { id });
if (index < 0)
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
if (equip.holes[index].isOpen)
@@ -494,7 +494,7 @@ export class EquipHandler {
let jewelInfo = getGoodById(jewel);
if (jewelInfo.itid != equipJewel)
return resResult(STATUS.EQUIP_NOT_MATCH_JEWEL);
let index = _.findIndex(equip.holes, { id });
let index = findIndex(equip.holes, { id });
if (index < 0)
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
if (!equip.holes[index].isOpen)
@@ -549,7 +549,7 @@ export class EquipHandler {
let sid: string = session.get('sid');
let goods: Array<{ id: number, count: number }> = [];
let equip = await EquipModel.getEquip(eid);
let index = _.findIndex(equip.holes, { id });
let index = findIndex(equip.holes, { id });
if (index > 0)
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
let jewel = equip.holes[index].jewel;
@@ -623,7 +623,7 @@ export class EquipHandler {
let equip;
if (!!eid) {
equip = await EquipModel.getEquip(eid);
let index = _.findIndex(equip.holes,{id});
let index = findIndex(equip.holes,{id});
if (!!equip.holes[index] && equip.holes[index].jewel == goodInfo.composeMaterial[0].id) {
oldJewel = equip.holes[index].jewel;
equip.holes[index].jewel = jewel;
@@ -7,7 +7,7 @@ import { handleCost } from '../../../services/rewardService';
import { getTitle, getTeraph, gameData, getScollByStar } from '../../../pubUtils/data';
import { SCHOOL, SCROLL } from '../../../pubUtils/dicParam';
import { getTeraphAttr, getAtrrNameById } from '../../../consts/constModules/abilityConst'
const _ = require('underscore');
import { findIndex } from 'underscore';
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
import { SchoolModel } from '../../../db/School';
import { checkMaterialEnough } from '../../../services/roleService'
@@ -103,7 +103,7 @@ export class RoleHandler {
let roleId = session.get('roleId');
let role = await RoleModel.findByRoleId(roleId);
let sid: string = session.get('sid');
let index = _.findIndex(role.teraphs, {id});
let index = findIndex(role.teraphs, {id});
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
let teraph = role.teraphs[index];
@@ -138,7 +138,7 @@ export class RoleHandler {
let roleId = session.get('roleId');
let role = await RoleModel.findByRoleId(roleId);
let sid: string = session.get('sid');
let index = _.findIndex(role.teraphs, {id});
let index = findIndex(role.teraphs, {id});
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
let teraph = role.teraphs[index];