fix 奇遇无法刷出

This commit is contained in:
luying
2021-01-09 15:35:05 +08:00
parent 6fae9646c9
commit be77ffab3f
5 changed files with 16 additions and 7 deletions

View File

@@ -127,7 +127,7 @@ export class PvpHandler {
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
$set: {
roleId, roleName, warId,
roleId, roleName, battleId: warId,
status: 0,
warName: warInfo.gk_name,
warType: warInfo.warType,

View File

@@ -78,7 +78,7 @@ export class EntryHandler {
let equips = await EquipModel.findbyRole(role.roleId);
let items = await ItemModel.findbyRole(role.roleId);
await chackFunOpenWhenLogin(role, session.get('funcs'));
await chackFunOpenWhenLogin(role, session);
await loginRefresh(role.roleId);
role['heros'] = heros.map(cur => returnHeroCeRatio(cur));

View File

@@ -31,6 +31,6 @@ export async function switchOnFunc(roleId: string, type: number, param: number,
}
}
export async function chackFunOpenWhenLogin(role: any, dataFuncs:Array<number>) {
await eventOnPlayerLvUp(role.roleId, role.lv, [], dataFuncs);
export async function chackFunOpenWhenLogin(role: any, session: BackendSession|FrontendSession) {
await switchOnFunc(role.roleId, FUNC_OPT_TYPE.LEVEL_UP, role.lv, session);
}

View File

@@ -5,12 +5,14 @@ import { fromCallback } from 'bluebird';
import { checkPvp, findPvpDefByRoleId } from '../services/pvpService'
import { getFuncsSwitch } from '../pubUtils/data';
import { FUNCS_ID, FUNC_OPT_TYPE } from '../consts/constModules/sysConst';
import { RoleModel } from '../db/Role'
import { RoleModel } from '../db/Role';
import { startEvent } from "./eventSercive";
export async function eventOnPlayerLvUp(roleId: string, lv: number, addFuncs: Array<number>, dataFuncs: Array<number>) {
if (!dataFuncs.includes(FUNCS_ID.PVP)) {//开启pvp
let res = getFuncsSwitch(FUNCS_ID.PVP);
if (!res || lv >= res.param) {
if (res && lv >= res.param) {
let role = await RoleModel.findByRoleId(roleId);
await checkPvp(role);
addFuncs.push(FUNCS_ID.PVP);
@@ -19,7 +21,7 @@ export async function eventOnPlayerLvUp(roleId: string, lv: number, addFuncs: Ar
if (!dataFuncs.includes(FUNCS_ID.EVENT)) {//开启奇遇
let res = getFuncsSwitch(FUNCS_ID.EVENT);
if (!res || lv >= res.param) {
if (res && lv >= res.param) {
addFuncs.push(FUNCS_ID.EVENT);
}
}

View File

@@ -5,5 +5,12 @@
"conditionType": 1,
"param": 1,
"script": "&"
},
{
"id": 2,
"desc": "PVP",
"conditionType": 1,
"param": 1,
"script": "&"
}
]