装备
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { Application, BackendSession } from "pinus";
|
||||
import { STATUS, EQUIP_STRENGTHEN_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, CONSUME_TYPE, GOOD_TYPE, HERO_GROW_MAX } from "../../../consts";
|
||||
import { ItemInter } from "../../../pubUtils/interface";
|
||||
import { resResult, parseReward, getRandomByLen } from "../../../pubUtils/util";
|
||||
import { resResult, parseReward, getRandomByLen, getItems } from "../../../pubUtils/util";
|
||||
import { addItems, handleCost } from "../../../services/rewardService";
|
||||
import { EquipModel, RandSe } from "../../../db/Equip";
|
||||
import { HeroModel, EPlace } from "../../../db/Hero";
|
||||
import Role from "../../../db/Role";
|
||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||
import { getGoodById, gameData, getJewelById } from "../../../pubUtils/data";
|
||||
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../../../pubUtils/data";
|
||||
import { EQUIP } from "../../../pubUtils/dicParam";
|
||||
import { ITID, SPEICAL_ITEM } from "../../../consts/constModules/itemConst";
|
||||
|
||||
@@ -346,13 +346,21 @@ export class EquipHandler {
|
||||
let obj = ITID.get(goodInfo.itid);
|
||||
let ePlaceId = obj.type;
|
||||
let curEquips:Array<{seqId: number, hid: number, ePlaceId: number }> = [];
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
if (type == 1) {
|
||||
let { jobid } = gameData.hero.get(hid);
|
||||
let { job_class } = getHeroJob(jobid);
|
||||
let { classId } = getHeroEquipByClassId(goodInfo.itid);
|
||||
// if (_.indexOf(classId, job_class) < 0)
|
||||
// return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
|
||||
if (!!equip.hid)
|
||||
return resResult(STATUS.EQUIP_IS_EQUIPED);
|
||||
let ePlace = await HeroModel.getHeroEquip(roleId, hid);
|
||||
if (!ePlace)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
let index = _.findIndex(ePlace, {id: ePlaceId});
|
||||
let index = _.findIndex(hero.ePlace, {id: ePlaceId});
|
||||
if (index < 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (!!ePlace[index].equip) {
|
||||
@@ -483,7 +491,7 @@ export class EquipHandler {
|
||||
if (index > 0)
|
||||
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
|
||||
if (!equip.holes[index].jewel)
|
||||
return resResult(STATUS.JEWEL_IS_NOT_FIND);
|
||||
return resResult(STATUS.EQUIP_NOT_FILL_HOLE);
|
||||
goods.push({id: equip.holes[index].jewel, count: 1});
|
||||
equip.holes[index].jewel = 0;
|
||||
await EquipModel.updateEquipInfo(eid, {holes: equip.holes});
|
||||
|
||||
Reference in New Issue
Block a user