29 lines
868 B
TypeScript
29 lines
868 B
TypeScript
|
|
import { findPvpDefByRoleId } from '../services/pvpService'
|
|
import { getFuncsSwitch, gameData } from '../pubUtils/data';
|
|
import { FUNCS_ID, FUNC_OPT_TYPE } from '../consts/constModules/sysConst';
|
|
import { RoleModel } from '../db/Role';
|
|
/**
|
|
* 等级提升触发事件
|
|
* @param roleId
|
|
* @param lv
|
|
* @param addFuncs
|
|
* @param dataFuncs
|
|
*/
|
|
export async function eventOnPlayerLvUp(roleId: string, lv: number, addFuncs: Array<number>, dataFuncs: Array<number>) {
|
|
|
|
for(let [id, dicFunSwitch] of gameData.funcsSwitch) {
|
|
if(dicFunSwitch.conditionType != FUNC_OPT_TYPE.LEVEL_UP) continue;
|
|
if (dataFuncs.includes(id)) continue; // 已开启过了
|
|
|
|
if (dicFunSwitch && lv >= dicFunSwitch.param) {
|
|
addFuncs.push(id);
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export async function loginRefresh(roleId: string) {
|
|
await findPvpDefByRoleId(roleId);
|
|
} |