任务:修复每日任务未正确开启bug

This commit is contained in:
luying
2021-04-21 17:08:00 +08:00
parent 6f65ff880f
commit 7540aa5150
4 changed files with 80 additions and 24 deletions
+14 -15
View File
@@ -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) {