装备:修改装备限制

This commit is contained in:
luying
2021-07-27 20:19:59 +08:00
parent aeb0913c24
commit df48003b76
4 changed files with 28 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
import { mergeSameGoods, deepCopy } from '../pubUtils/util';
import { EquipModel } from "../db/Equip";
import { HeroModel, EPlace, HeroType } from "../db/Hero";
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../pubUtils/data";
import { getHeroJob, getGoodById, gameData, getJewelById } from "../pubUtils/data";
import { calPlayerCeAndSave } from "./playerCeService";
import { HERO_SYSTEM_TYPE, TASK_TYPE } from "../consts";
import { EquipType } from "../db/Equip";
@@ -69,10 +69,7 @@ export async function changeEquip(serverId: number, roleId: string, sid: string,
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
return res;
}
let { jobid } = gameData.hero.get(hid);
let { job_class } = getHeroJob(jobid);
let { classId } = getHeroEquipByClassId(goodInfo.itid);
if (indexOf(classId, job_class) < 0) {
if (checkEquipCanPut(hid, equipA.id)) {
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
return res;
}
@@ -132,4 +129,13 @@ export async function dressEquip(serverId: number, roleId: string, sid: string,
await checkActivityTask(serverId, sid, funcs, roleId, TASK_TYPE.EQUIP_SUM, 1)
return { seqId: equip.seqId, hid: hero.hid, id: equip.id, ePlaceId: equip.ePlaceId };
}
export function checkEquipCanPut(hid: number, id: number) {
let dicGood = gameData.goods.get(id);
let dicHero = gameData.hero.get(hid);
let dicJob = gameData.job.get(dicHero.jobid);
if(dicGood.jobLimited != 0 && dicGood.jobLimited != dicJob.job_class) return false;
if(dicGood.charLimited != 0 && dicGood.charLimited != hid) return false;
return true
}