任务:修复每日任务未正确开启bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
import { checkPvp, findPvpDefByRoleId } from '../services/pvpService'
|
||||
import { getFuncsSwitch } from '../pubUtils/data';
|
||||
import { getFuncsSwitch, gameData } from '../pubUtils/data';
|
||||
import { FUNCS_ID, FUNC_OPT_TYPE } from '../consts/constModules/sysConst';
|
||||
import { RoleModel } from '../db/Role';
|
||||
/**
|
||||
@@ -12,21 +12,20 @@ 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, null, true);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
if(id == FUNCS_ID.PVP) {
|
||||
let role = await RoleModel.findByRoleId(roleId, null, true);
|
||||
await checkPvp(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function loginRefresh(roleId: string) {
|
||||
|
||||
Reference in New Issue
Block a user