addItem goodType修改
This commit is contained in:
@@ -22,6 +22,17 @@ export class EquipHandler {
|
||||
constructor(private app: Application) {
|
||||
}
|
||||
|
||||
|
||||
// 合成装备
|
||||
public async addItem(msg: { id: number, count: number}, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
let {id, count} = msg;
|
||||
let goods = await addItems(roleId, roleName, sid, [{id, count}]);
|
||||
return resResult(STATUS.SUCCESS, { goods });
|
||||
}
|
||||
|
||||
// 合成装备
|
||||
public async composeEquip(msg: { gid: number, originalEquip: number[]}, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
@@ -192,7 +203,7 @@ export class EquipHandler {
|
||||
return resResult(STATUS.SUCCESS, { isSuccess, curHero});
|
||||
}
|
||||
|
||||
// 装备洗炼锁定,消耗TODO
|
||||
// 装备洗炼锁定
|
||||
public async lockRandSe(msg: { eid: number, id: number, lock: boolean }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
// let roleName: string = session.get('roleName');
|
||||
@@ -207,10 +218,10 @@ export class EquipHandler {
|
||||
return resResult(STATUS.EQUIP_HAVE_NO_RANDSE);
|
||||
}
|
||||
|
||||
// TODO 锁
|
||||
// let lock = 0;
|
||||
// let result = await handleCost(roleId, sid, [{id: lock, count: 1}]);
|
||||
// if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
if(lock) { // 仅在上锁时消耗
|
||||
let result = await handleCost(roleId, sid, []);
|
||||
if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
let result = await EquipModel.lock(roleId, eid, id, lock);
|
||||
if(!result) {
|
||||
@@ -241,7 +252,7 @@ export class EquipHandler {
|
||||
let {randomEffect} = dicGoods;
|
||||
let pool = randomEffect.map(cur => gameData.randomEffectPool.get(cur));
|
||||
let chosen = randSe.map(cur => cur.seid); // 上一轮和这一轮随机出来的
|
||||
let hasReset = false;
|
||||
let hasReset = false, lockNum = 0;
|
||||
for(let i = 0; i < randSe.length; i++) {
|
||||
if(!randSe[i].locked) {
|
||||
let newPool = pool.filter(cur => !chosen.includes(cur.id));
|
||||
@@ -252,6 +263,8 @@ export class EquipHandler {
|
||||
randSe[i].seid = random.id;
|
||||
randSe[i].rand = rand;
|
||||
hasReset = true;
|
||||
} else {
|
||||
lockNum ++;
|
||||
}
|
||||
}
|
||||
if(!hasReset) {
|
||||
@@ -259,7 +272,11 @@ export class EquipHandler {
|
||||
}
|
||||
|
||||
// TODO 消耗
|
||||
let cost = [];
|
||||
let cost = new Array<ItemInter>();
|
||||
if(lockNum == 0) {
|
||||
|
||||
}
|
||||
|
||||
let result = await handleCost(roleId, sid, cost);
|
||||
if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user