任务:任务去除funcs的判断,直接达成

This commit is contained in:
luying
2021-09-10 16:53:35 +08:00
parent 28f9c65873
commit faf4d25f60
76 changed files with 471 additions and 610 deletions
@@ -3,7 +3,7 @@ import { HeroModel } from '../db/Hero';
import Role, { RoleModel, RoleType } from '../db/Role'
import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data';
import { updateUserInfo } from './redisService';
import { switchOnFunc } from './funcSwitchService';
// import { switchOnFunc } from './funcSwitchService';
import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE, STATUS, KING_EXP_RATIO_TYPE } from '../consts';
import { BackendSession, pinus } from 'pinus';
import { REDIS_KEY } from '../consts';
@@ -18,7 +18,7 @@ import { LineupParam } from '../domain/rank';
export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) {
const serverId = session.get('serverId');
const sid = session.get('sid');
const funcs = session.get('funcs');
let role = await RoleModel.findByRoleId(roleId);
let { lv = 1, exp = 0 } = role;
let canGetExp = lv < gameData.maxPlayerLv.max; // 当主公超过最大级后,挑战结算不再获得经验值
@@ -34,16 +34,16 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
role = await RoleModel.levelup(roleId, newLv, newExp);
if (newLv > lv) { // 升级
await switchOnFunc(roleId, FUNC_OPT_TYPE.LEVEL_UP, newLv, session);
// await switchOnFunc(roleId, FUNC_OPT_TYPE.LEVEL_UP, newLv, session);
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'lv', value: newLv }]);
let r = new Rank(REDIS_KEY.USER_LV, { serverId: role.serverId });
await r.setRankWithRoleInfo(roleId, newLv, Date.now(), role);
// 任务
await checkTask(roleId, session.get('sid'), session.get('funcs'), TASK_TYPE.ROLE_LV, newLv, false, {});
await checkTask(roleId, session.get('sid'), TASK_TYPE.ROLE_LV, newLv, false, {});
//成长任务
await checkActivityTask(serverId, session.get('sid'), session.get('funcs'), roleId, TASK_TYPE.ROLE_LV, newLv);
await checkActivityTask(serverId, session.get('sid'), roleId, TASK_TYPE.ROLE_LV, newLv);
}
let actordata: { lv: number, exp: number, getExp: number, mostExp: number }[] = [];
@@ -65,7 +65,7 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
});
if(i != lv) { // 升级加体力
let dicAp = getDicApByLv(i);
await setAp(roleId, i, dicAp.restoreAp, sid, funcs);
await setAp(roleId, i, dicAp.restoreAp, sid);
}
}
// 推送