From 143c8233bf1dffaa833aa4e8a770dc3262813605 Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 20 May 2022 14:39:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=87=E9=81=87=EF=BC=9A=20=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E5=85=B3=E5=8D=A1=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/eventSercive.ts | 11 +++++++++-- shared/pubUtils/dictionary/DicEvent.ts | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/game-server/app/services/eventSercive.ts b/game-server/app/services/eventSercive.ts index c09379ae0..1963078d4 100644 --- a/game-server/app/services/eventSercive.ts +++ b/game-server/app/services/eventSercive.ts @@ -8,6 +8,7 @@ import { STATUS } from '../consts/statusCode'; import { gameData } from '../pubUtils/data'; import { DicQuestion } from '../pubUtils/dictionary/DicQuestion'; import { sendMessageToUserWithSuc } from './pushService'; +import { WarStar } from '../domain/dbGeneral'; /** * 从检查接口调用,检查是否有这么个战斗,顺便保存一下battleCode @@ -166,8 +167,8 @@ export async function refreshEvent(num: number, roleId: string, roleName: string let dicEvent = gameData.eventList.filter(cur => cur.movePointArray && cur.movePointArray.length > 0); let role = await RoleModel.findByRoleId(roleId); dicEvent = dicEvent.filter(cur => { // 筛选适合等级 - let { suitLevel } = cur; - return suitLevel.min <= role.lv && suitLevel.max >= role.lv + let { suitLevel, previousGk } = cur; + return suitLevel.min <= role.lv && suitLevel.max >= role.lv && checkPreviousGk(previousGk, role.warStar) }); if(EVENT_RANDOM_TYPE_ONE_OPEN) { let historyRecord = await EventRecordModel.getHostoryEventRecord(roleId); @@ -240,6 +241,12 @@ export async function refreshEvent(num: number, roleId: string, roleName: string return event; } +export function checkPreviousGk(previousGk: number, warStar: WarStar[]) { + if(!previousGk) return true; + let preBattle = warStar.findIndex(cur => cur.id == previousGk); + return preBattle != -1; +} + /** * 随机出当前事件的位置 * diff --git a/shared/pubUtils/dictionary/DicEvent.ts b/shared/pubUtils/dictionary/DicEvent.ts index c3b1f249f..fa416f8a8 100644 --- a/shared/pubUtils/dictionary/DicEvent.ts +++ b/shared/pubUtils/dictionary/DicEvent.ts @@ -29,6 +29,8 @@ export interface DicEvent { readonly weight: number; // 移动点 readonly movePointArray: Array; + // 必须通过的关卡 + readonly previousGk: number; }