寻宝:抽象藏宝图数量判断方法

This commit is contained in:
liangtongchuan
2021-02-19 15:34:09 +08:00
parent a057da5c13
commit 9913bca97d
2 changed files with 16 additions and 11 deletions
+12 -1
View File
@@ -1,3 +1,4 @@
import { ItemModel } from './../db/Item';
import { IT_TYPE } from './../consts/consts';
import { COM_BTL_QUALITY } from './../consts/constModules/itemConst';
import { FriendRelationModel } from './../db/FriendRelation';
@@ -99,7 +100,8 @@ export function checkComBattleResult(teamStatus) {
}
/**
* @description 计算寻宝结算-deprecated
* ! deprecated
* @description 计算寻宝结算
* @export
* @param {string} roleId
* @param {string} battleCode
@@ -540,4 +542,13 @@ export function createComTeamData(teamCode: string, pub: boolean, blueprtId: num
return {
teamCode, pub, blueprtId, status, capId, ceLimit, bossHp, bossCurHp, quality, bossHpArr, curRnd, roleCnt, timeout, lvRange
};
}
export async function hasEnoughBlueprt(roleId: string, blueprtId: number) {
let blueprt = await ItemModel.findbyRoleAndGidAndCount(roleId, blueprtId, 1);
if (!blueprt) return false;
// 检查是否有已创建未结束的寻宝,预先占用一张藏宝图
let teams = await ComBattleTeamModel.getTeamByCapAndStatus(roleId, COM_TEAM_STATUS.FIGHTING);
if (teams && blueprt.count <= teams.length) return false;
return true;
}