任务:修复任务无法达成bug
This commit is contained in:
@@ -585,7 +585,7 @@ export enum TASK_TYPE {
|
||||
LOGIN_SUM = 1, // 累计登录
|
||||
LOGIN_SERIES = 2, // 连续登录
|
||||
ROLE_LV = 3, // 主公等级
|
||||
GASHA = 4, // 招募 暂无
|
||||
GASHA = 4, // 招募
|
||||
HERO_NUM = 5, // 武将数量
|
||||
HERO_STAR_UP = 6, // 升星次数
|
||||
HERO_QUALITY = 7, // 拥有品质
|
||||
|
||||
@@ -81,7 +81,7 @@ export default class ActivityGrowth extends BaseModel {
|
||||
}
|
||||
|
||||
//删除活动领取记录
|
||||
public static async deleteActivity(acvitityId: number, roleId: string, dayIndex: number, cellIndex: number, lean = true) {
|
||||
public static async deleteActivity(acvitityId: number, roleId: string, dayIndex: number, cellIndex: number) {
|
||||
let result = await ActivityGrowthModel.deleteMany({ roleId, acvitityId, dayIndex, cellIndex });
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ export default class Role extends BaseModel {
|
||||
|
||||
@prop({ required: true, default: 1 })
|
||||
loginCnt: number; // 登录次数
|
||||
@prop({ required: true, default: nowSeconds() })
|
||||
@prop({ required: true, default: nowSeconds })
|
||||
createTime: number; // 创建时间
|
||||
@prop({ required: true, default: nowSeconds() })
|
||||
@prop({ required: true, default: 0 })
|
||||
loginTime: number; // 更新 / 登录时间
|
||||
@prop({ required: true, default: 0 })
|
||||
quitTime: number; // 更新 / 登录时间
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
|
||||
// 活动数据
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { TASK_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityGrowthModelType } from '../../db/ActivityGrowth';
|
||||
|
||||
@@ -45,7 +45,7 @@ arr.forEach(o => {
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys)));
|
||||
let jobClass = jobClassMaxGrades.get(o.job_class);
|
||||
if (!!jobClass && jobClass.grade < o.grade) {
|
||||
if (!jobClass || jobClass.grade < o.grade) {
|
||||
jobClassMaxGrades.set(o.job_class, {grade: o.grade,jobid: o.jobid});
|
||||
}
|
||||
jobClassAndgrades.set(o.job_class+'_'+o.grade,{unlockLevel:o.unlockLevel, jobid:o.jobid});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
import { ABI_TYPE, COM_BTL_LV_RANGE } from '../consts';
|
||||
import { decodeIdCntArrayStr, getRandEelm } from './util';
|
||||
import { decodeIdCntArrayStr } from './util';
|
||||
import { IT_TYPE } from '../consts';
|
||||
|
||||
let gamedata = {};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
import { HeroModel, HeroUpdate, HeroType } from '../db/Hero';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { ItemModel } from '../db/Item';
|
||||
import { EquipModel, RandSe, Holes } from './../db/Equip';
|
||||
import { BagInter, EquipInter } from './interface';
|
||||
@@ -222,12 +222,12 @@ function unlockSingleFigure(dbFigures: Figure[], id: number, unlockDirect = fals
|
||||
return figure
|
||||
}
|
||||
|
||||
export async function createHero(roleId: string, roleName: string, serverId: number, heroInfo: CreateHeroParam) {
|
||||
let { role, figureInfo, heroes, calHeroResults, calAllHeroResults, taskPushMessage } = await createHeroes(roleId, roleName, serverId, [heroInfo])
|
||||
export async function createHero(roleId: string, roleName: string, serverId: number, heroInfo: CreateHeroParam, funcs?: number[]) {
|
||||
let { role, figureInfo, heroes, calHeroResults, calAllHeroResults, taskPushMessage } = await createHeroes(roleId, roleName, serverId, [heroInfo], funcs)
|
||||
return { hero: heroes[0], role, figureInfo, calHeroResult: calHeroResults[0], calAllHeroResult: calAllHeroResults[0], taskPushMessage }
|
||||
}
|
||||
|
||||
export async function createHeroes(roleId: string, roleName: string, serverId: number, heroInfos: CreateHeroParam[]) {
|
||||
export async function createHeroes(roleId: string, roleName: string, serverId: number, heroInfos: CreateHeroParam[], funcs?: number[]) {
|
||||
|
||||
let heroNum = 0;
|
||||
let skinIds = new Array<number>();
|
||||
@@ -254,10 +254,10 @@ export async function createHeroes(roleId: string, roleName: string, serverId: n
|
||||
|
||||
let role = await RoleModel.incRoleInfo(roleId, { heroNum }, { heroNumUpdatedAt: nowSeconds() });
|
||||
// 任务
|
||||
let m1 = await checkTask(roleId, TASK_TYPE.HERO_NUM, heroNum, true, {});
|
||||
let m2 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_QUALITY, heroes);
|
||||
let m3 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_QUALITY_STAR_UP, heroes);
|
||||
let m4 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_LV, heroes);
|
||||
let m1 = await checkTask(roleId, TASK_TYPE.HERO_NUM, heroNum, true, {}, funcs);
|
||||
let m2 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_QUALITY, heroes, funcs);
|
||||
let m3 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_QUALITY_STAR_UP, heroes, funcs);
|
||||
let m4 = await checkTaskWithHeroes(roleId, TASK_TYPE.HERO_LV, heroes, funcs);
|
||||
let taskPushMessage = m1.concat(m2, m3, m4);
|
||||
//成长任务
|
||||
await accomplishTask(roleId, TASK_TYPE.HERO_NUM, heroNum)
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function checkTaskWithRole(roleId: string, taskType: number, role:
|
||||
let today = getTodayZeroPoint();
|
||||
if (today > role.loginTime) {
|
||||
if (today - role.loginTime > 24 * 60 * 60) {
|
||||
pushMessage = await checkTask(roleId, taskType, 0, false, {}, funcs);
|
||||
pushMessage = await checkTask(roleId, taskType, 1, false, {}, funcs);
|
||||
} else {
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, {}, funcs);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export async function checkTaskWithHero(roleId: string, taskType: number, hero:
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, { quality: dicHero.quality, star: hero.star }, funcs);
|
||||
}
|
||||
else if (taskType == TASK_TYPE.HERO_LV) {
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, { lv: hero.lv }, funcs);
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, { lv: hero.lv, oldLv: args[0] }, funcs);
|
||||
}
|
||||
else if (taskType == TASK_TYPE.HERO_TRAIN) {
|
||||
let dicHero = gameData.hero.get(hero.hid);
|
||||
@@ -283,6 +283,7 @@ export async function checkTaskWithGoods(roleId: string, taskType: number, goods
|
||||
|
||||
// 根据taskType判断有哪些任务需要check的
|
||||
export async function checkTask(roleId: string, taskType: number, count: number, isInc: boolean, param: TaskParam, funcs?: number[]) {
|
||||
console.log('******checkTask', roleId, taskType, count, isInc, param, funcs)
|
||||
let tasks = gameData.taskType.get(taskType) || [];
|
||||
let pushMessage = new Array<TaskListReturn>();
|
||||
let groups = new Map<string, { task0: DicTask, tasks: DicTask[] }>();
|
||||
@@ -343,7 +344,7 @@ export async function checkTaskRec(roleId: string, type: number, group: number,
|
||||
isMatch = taskParam[1] == param.quality && taskParam[2] == param.star;
|
||||
break;
|
||||
case TASK_TYPE.HERO_LV:
|
||||
isMatch = taskParam[1] == param.lv;
|
||||
isMatch = param.lv >= taskParam[1] && param.oldLv < taskParam[1];
|
||||
break;
|
||||
case TASK_TYPE.HERO_TRAIN:
|
||||
isMatch = taskParam[1] == param.count;
|
||||
@@ -457,11 +458,7 @@ function checkRecResult(rec: UserTaskRecType, id: number, condition: number) {
|
||||
if (!rec) return false;
|
||||
if (rec.received && rec.received.includes(id)) return false; // 已领取,不再推送
|
||||
|
||||
if (rec.count >= condition) {
|
||||
return rec
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return rec
|
||||
}
|
||||
|
||||
|
||||
@@ -561,3 +558,21 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
||||
}
|
||||
return addCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建账号时临时获得可开启功能,主要用于check 主公升级任务
|
||||
* 该函数不会存储funcs,如pvp开启会在entryHandler里面再查一次funcs,那时候正式开启
|
||||
* @param dataFuncs
|
||||
* @param lv
|
||||
*/
|
||||
export async function getCreateUserFuncs(dataFuncs: number[], lv: number) {
|
||||
let addFuncs: number[] = [];
|
||||
for(let [id, dicFunSwitch] of gameData.funcsSwitch) {
|
||||
if (dataFuncs.includes(id)) continue; // 已开启过了
|
||||
|
||||
if (dicFunSwitch && lv >= dicFunSwitch.param) {
|
||||
addFuncs.push(id);
|
||||
}
|
||||
}
|
||||
return addFuncs;
|
||||
}
|
||||
Reference in New Issue
Block a user