主线:添加warType

This commit is contained in:
luying
2022-03-14 17:08:36 +08:00
parent 992885674e
commit 7b4f500979
4 changed files with 53 additions and 48 deletions
@@ -436,8 +436,8 @@ export class NormalBattleHandler {
}
// 关卡列表
async receiveChapterBox(msg: { chapter: number, id: number }, session: BackendSession) {
const { id, chapter } = msg;
async receiveChapterBox(msg: { chapter: number, id: number, warType: number }, session: BackendSession) {
const { id, chapter, warType } = msg;
if(!isNumber(id)) return resResult(STATUS.WRONG_PARMS);
let roleId = session.get('roleId');
@@ -447,14 +447,13 @@ export class NormalBattleHandler {
let role = await RoleModel.findByRoleId(roleId, 'warStar receivedBox');
let ids: number[] = [];
let rewards: RewardInter[] = [];
let starOfChapter = getStarOfChapter(role.warStar);
let star = getStarOfChapter(role.warStar, warType, chapter);
let boxIds = id == 0? gameData.mainBoxByChapter.get(chapter): [id];
let boxIds = id == 0? gameData.mainBoxByChapter.get(`${warType}_${chapter}`): [id];
for(let id of boxIds) {
let dicBox = gameData.mainBox.get(id);
if(dicBox && dicBox.chapter == chapter) {
let star = starOfChapter.get(chapter)
if(dicBox && dicBox.chapter == chapter && dicBox.warType == warType) {
if(star >= dicBox.star) {
rewards.push(...dicBox.reward);
ids.push(id);