Files
ZYZ/game-server/app/services/playerEventService.ts

27 lines
920 B
TypeScript

/**
* 体力系统
*/
import { fromCallback } from 'bluebird';
import { checkPvp } from '../services/pvpService'
import { getFuncsSwitch } from '../pubUtils/data';
import { FUNCS_ID, FUNC_OPT_TYPE } from '../consts/constModules/sysConst';
import { RoleModel } from '../db/Role'
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) {
let role = await RoleModel.findByRoleId(roleId);
await checkPvp(role);
addFuncs.push(FUNCS_ID.PVP);
}
}
if (!dataFuncs.includes(FUNCS_ID.EVENT)) {//开启奇遇
let res = getFuncsSwitch(FUNCS_ID.EVENT);
if (!res || lv >= res.param) {
addFuncs.push(FUNCS_ID.EVENT);
}
}
}