寻宝:扣减藏宝图顺序
This commit is contained in:
@@ -435,8 +435,8 @@ export class ComBattleHandler {
|
||||
let channel = channelService.getChannel(teamCode, false);
|
||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr}, true);
|
||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||
// 将藏宝图加回去
|
||||
await addItems(roleId, roleName, sid, [{ id: team.blueprtId, count: 1 }])
|
||||
// // 将藏宝图加回去
|
||||
// await addItems(roleId, roleName, sid, [{ id: team.blueprtId, count: 1 }])
|
||||
teamStatus.timeout = true;
|
||||
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: false, timeout: true}));
|
||||
thiz.teamMap.delete(teamCode);
|
||||
|
||||
@@ -256,17 +256,17 @@ export async function handleComBtlProgress(teamStatus: MemComBtlTeam, robotHurtT
|
||||
let team = await ComBattleTeamModel.syncTeamData({ teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr });
|
||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||
|
||||
// // 战斗胜利队长扣减藏宝图
|
||||
// if (result && teamStatus.capId != 'robot') {
|
||||
// const { sid } = channel.getMember(teamStatus.capId);
|
||||
// let res = await decreaseItems(teamStatus.capId, sid, [{ id: teamStatus.blueprtId, count: 1 }]);
|
||||
// if (res === true) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH);
|
||||
// }
|
||||
// 为了背包显示,队长藏宝图在创建队伍的时候就扣掉了,如果输了,返还藏宝图
|
||||
if (!result && teamStatus.capId != 'robot') {
|
||||
// 战斗胜利队长扣减藏宝图
|
||||
if (result && teamStatus.capId != 'robot') {
|
||||
const { sid } = channel.getMember(teamStatus.capId);
|
||||
await addItems(teamStatus.capId, teamStatus.capId, sid, [{ id: teamStatus.blueprtId, count: 1 }]);
|
||||
let res = await decreaseItems(teamStatus.capId, sid, [{ id: teamStatus.blueprtId, count: 1 }]);
|
||||
if (res === true) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH);
|
||||
}
|
||||
// // 为了背包显示,队长藏宝图在创建队伍的时候就扣掉了,如果输了,返还藏宝图
|
||||
// if (!result && teamStatus.capId != 'robot') {
|
||||
// const { sid } = channel.getMember(teamStatus.capId);
|
||||
// await addItems(teamStatus.capId, teamStatus.capId, sid, [{ id: teamStatus.blueprtId, count: 1 }]);
|
||||
// }
|
||||
|
||||
clearRobotHurtTimer(teamStatus, robotHurtTimer);
|
||||
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, { teamCode, result }));
|
||||
@@ -576,11 +576,13 @@ export async function hasEnoughBlueprt(roleId: string, sid: string, blueprtId: n
|
||||
let blueprt = await ItemModel.findbyRoleAndGidAndCount(roleId, blueprtId, 1);
|
||||
if (!blueprt || blueprt.count <= 0) return false;
|
||||
// 检查是否有已创建未结束的寻宝,预先占用一张藏宝图
|
||||
// 背包中占用的藏宝图不显示,所以这里就扣掉,结束再加回去
|
||||
let result = await handleCost(roleId, sid, [{ id: blueprtId, count: 1 }]);
|
||||
// let teams = await ComBattleTeamModel.(roleId, COM_TEAM_STATUS.FIGHTING, blueprtId);
|
||||
// if (teams && blueprt.count <= teams.length) return false;
|
||||
return result;
|
||||
// // 背包中占用的藏宝图不显示,所以这里就扣掉,结束再加回去
|
||||
// let result = await handleCost(roleId, sid, [{ id: blueprtId, count: 1 }]);
|
||||
// return result;
|
||||
let teams = await ComBattleTeamModel.getBlueprtInUse(roleId, COM_TEAM_STATUS.FIGHTING, blueprtId);
|
||||
console.log('hasEnoughBlueprt', blueprt.count, teams.length)
|
||||
if (teams && blueprt.count <= teams.length) return false;
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ export function loadWarJson() {
|
||||
let warid = 0;
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttribute(o.attribute);
|
||||
warid = o.warId;
|
||||
if(o.warId) warid = o.warId;
|
||||
warjson.push(o);
|
||||
});
|
||||
dicWarJson.set(warid, warjson);
|
||||
|
||||
Reference in New Issue
Block a user