diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index 85271380b..00b3de3d7 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -666,6 +666,12 @@ export enum TASK_TYPE { ACTIVITY_RMB = 86, // 累计充值*元 } +// 任务累积类型 +export enum TASK_SUM_TYPE { + SUM = 1, // 累积型 + DO = 2, // 去做型 +} + // 卡池类型 export enum GACHA_ID { NORMAL = 1, // 元宝招募 diff --git a/shared/domain/activityField/sevenDaysField.ts b/shared/domain/activityField/sevenDaysField.ts index 80f74206d..7cc43724d 100644 --- a/shared/domain/activityField/sevenDaysField.ts +++ b/shared/domain/activityField/sevenDaysField.ts @@ -59,9 +59,9 @@ export class SevenDaysDailyChallengesData { return (index != -1) ? this.list[index] : null; } - public findTaskByType(type: TASK_TYPE, dayIndex: number) { + public findTaskByType(type: TASK_TYPE) { return this.list.filter(obj => { - return obj && obj.taskType == type && obj.dayIndex == dayIndex; + return obj && obj.taskType == type; }) } diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index a919ed04c..6a9e6a5d3 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -82,7 +82,7 @@ import { dicGiftPackage, loadGiftPackage } from "./dictionary/DicGiftPackage"; import { dicRecruit, loadRecruit } from './dictionary/DicRecruit'; import { loadRMB, dicRMB } from './dictionary/DicRMB'; import { dicActivityType, loadActivityType } from './dictionary/DicActivityType'; -import { DicTaskType, dicTaskTypeDesc, loadTaskType } from './dictionary/DicTaskType'; +import { DicTaskType, dicTaskTypeDesc, loadTaskType, taskDescByType } from './dictionary/DicTaskType'; import { dicServerName, loadServerName } from "./dictionary/DicServerName"; import { dicAp, loadAp, dicApMaxLevel } from './dictionary/DicAp'; import { dicApBuy, dicApMaxBuyTimes, loadApBuy } from "./dictionary/DicApBuy"; @@ -227,6 +227,7 @@ export const gameData = { rmb: dicRMB, activityType: dicActivityType, taskTypeDesc: dicTaskTypeDesc, + taskDescByType: taskDescByType, serverNames: dicServerName, ap: dicAp, apMaxLevel: dicApMaxLevel, diff --git a/shared/pubUtils/dictionary/DicTaskType.ts b/shared/pubUtils/dictionary/DicTaskType.ts index 8d6592cfd..2b704b06a 100644 --- a/shared/pubUtils/dictionary/DicTaskType.ts +++ b/shared/pubUtils/dictionary/DicTaskType.ts @@ -13,6 +13,8 @@ export interface DicTaskType { readonly param: string; // condition怎么填 readonly condition: string; + // 累积类型 1-累积型 2-去做型 + readonly sumType: number; } const DicTaskTypeKeys: KeysEnum = { @@ -20,15 +22,19 @@ const DicTaskTypeKeys: KeysEnum = { name: true, info: true, param: true, - condition: true + condition: true, + sumType: true, }; export const dicTaskTypeDesc = new Array(); +export const taskDescByType = new Map(); export function loadTaskType() { dicTaskTypeDesc.splice(0, dicTaskTypeDesc.length); + taskDescByType.clear(); let arr = readFileAndParse(FILENAME.DIC_TASK_TYPE); arr.forEach(o => { dicTaskTypeDesc.push(_.pick(o, Object.keys(DicTaskTypeKeys))); + taskDescByType.set(o.id, _.pick(o, Object.keys(DicTaskTypeKeys))); }); arr = undefined; } \ No newline at end of file diff --git a/shared/pubUtils/taskUtil.ts b/shared/pubUtils/taskUtil.ts index 55b115c30..7ae3972a6 100644 --- a/shared/pubUtils/taskUtil.ts +++ b/shared/pubUtils/taskUtil.ts @@ -1,6 +1,6 @@ import { gameData } from './data'; import { DicTask } from './dictionary/DicTask'; -import { TASK_TYPE, ABI_STAGE, WAR_TYPE, GUILD_JOB } from '../consts'; +import { TASK_TYPE, ABI_STAGE, WAR_TYPE, GUILD_JOB, TASK_SUM_TYPE } from '../consts'; import { UserTaskRecModel, UserTaskRecType } from '../db/UserTaskRec' import { RoleType, RoleModel } from '../db/Role'; import { TaskParam, TaskListReturn } from '../domain/roleField/task'; @@ -492,6 +492,7 @@ function checkRecResult(rec: UserTaskRecType, id: number) { */ export async function accomplishTask(serverId: number, roleId: string, taskType: TASK_TYPE, count: number, parma?: any, activities?: ActivityInRemote[]) { // console.log('accomplishTask', roleId, taskType, count, JSON.stringify(parma)) + let dicTaskType = gameData.taskDescByType.get(taskType); let pushMessage = []; let { activityGroupId } = await ServerlistModel.findByServerId(serverId); let findActivitiesByTypes = async (types: number[]) => { @@ -520,7 +521,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType: let playerData = new SevenDaysData(activity, createTime) //成长活动统计 let growthActivity = playerData.growth; - let growthTaskArray = growthActivity.findTaskByType(taskType); + let growthTaskArray = growthActivity.findTaskByType(taskType); // 所有任务 for (let task of growthTaskArray) { let taskRecord = await ActivityGrowthModel.findDataByCellIndex(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType); let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null; @@ -547,8 +548,12 @@ export async function accomplishTask(serverId: number, roleId: string, taskType: } //今日挑战统计 let dailyChallengeActivity = playerData.dailyChallenge; - let dailyChallengeTaskArray = dailyChallengeActivity.findTaskByType(taskType, playerData.today()); + let dailyChallengeTaskArray = dailyChallengeActivity.findTaskByType(taskType); for (let task of dailyChallengeTaskArray) { + if(dicTaskType.sumType == TASK_SUM_TYPE.DO && task.dayIndex != playerData.today()) { + continue; + } + let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType) let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData); diff --git a/shared/resource/jsons/dic_zyz_taskType.json b/shared/resource/jsons/dic_zyz_taskType.json index 4b013acdc..791c7c04b 100644 --- a/shared/resource/jsons/dic_zyz_taskType.json +++ b/shared/resource/jsons/dic_zyz_taskType.json @@ -6,7 +6,8 @@ "param": "day&", "string": "天数", "content": "每日就用这个填1", - "condition": "day" + "condition": "day", + "sumType": 1 }, { "id": 2, @@ -15,7 +16,8 @@ "param": "day&", "string": "天数", "content": 0, - "condition": "day" + "condition": "day", + "sumType": 1 }, { "id": 3, @@ -24,7 +26,8 @@ "param": "lv&", "string": "主公等级&", "content": 0, - "condition": "lv" + "condition": "lv", + "sumType": 1 }, { "id": 4, @@ -33,7 +36,8 @@ "param": "count&", "string": "招募次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 5, @@ -42,7 +46,8 @@ "param": "herocount&", "string": "武将数量&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 6, @@ -51,7 +56,8 @@ "param": "herocount&count&", "string": "武将数量&升星次数&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 2 }, { "id": 7, @@ -60,7 +66,8 @@ "param": "herocount&quality&", "string": "武将数量&品质&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 8, @@ -69,7 +76,8 @@ "param": "herocount&quality&star&", "string": "武将数量&品质&星级&", "content": "只算普通星级、只算这一种品质", - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 9, @@ -78,7 +86,8 @@ "param": "herocount&lv&", "string": "武将数量&武将等级&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 10, @@ -87,7 +96,8 @@ "param": "herocount&count&", "string": "武将数量&训练次数", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 2 }, { "id": 11, @@ -96,7 +106,8 @@ "param": "herocount&", "string": "武将数量&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 2 }, { "id": 12, @@ -105,7 +116,8 @@ "param": "herocount&", "string": "武将觉醒次数&", "content": "从6星升到觉醒1星那一次", - "condition": "herocount" + "condition": "herocount", + "sumType": 2 }, { "id": 13, @@ -114,7 +126,8 @@ "param": "count&", "string": "训练次数", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 14, @@ -123,7 +136,8 @@ "param": "herocount&count&", "string": "武将数量&进阶次数&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 2 }, { "id": 15, @@ -132,7 +146,8 @@ "param": "herocount&favourlv&", "string": "武将数量&好感度等级&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 16, @@ -141,7 +156,8 @@ "param": "count&star&", "string": "激活次数&星级&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 17, @@ -150,7 +166,8 @@ "param": "count&", "string": "解锁的数量&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 18, @@ -159,7 +176,8 @@ "param": "herocount&", "string": "放置武将数量&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 19, @@ -168,7 +186,8 @@ "param": "title&", "string": "升到的爵位&", "content": 0, - "condition": "title" + "condition": "title", + "sumType": 1 }, { "id": 20, @@ -177,7 +196,8 @@ "param": "count&", "string": "强化次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 21, @@ -186,7 +206,8 @@ "param": "herocount&", "string": "武将数量&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 22, @@ -195,7 +216,8 @@ "param": "equipcount&", "string": "装备的装备数量&", "content": "所有武将", - "condition": "equipcount" + "condition": "equipcount", + "sumType": 2 }, { "id": 23, @@ -204,7 +226,8 @@ "param": "herocount&equipcount&", "string": "武将数量&装备数量", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 24, @@ -213,7 +236,8 @@ "param": "equipcount&quality&", "string": "装备数量&装备品质&", "content": 0, - "condition": "equipcount" + "condition": "equipcount", + "sumType": 1 }, { "id": 25, @@ -222,7 +246,8 @@ "param": "equipcount&lv&", "string": "装备数量&强化等级&", "content": 0, - "condition": "equipcount" + "condition": "equipcount", + "sumType": 1 }, { "id": 26, @@ -231,7 +256,8 @@ "param": "equipcount&", "string": "装备数量&", "content": "必须同时镶嵌中,脱下再嵌不算", - "condition": "equipcount" + "condition": "equipcount", + "sumType": 1 }, { "id": 27, @@ -240,7 +266,8 @@ "param": "equipcount&", "string": "套装数量&", "content": "根据物品表里是否有suitId判断", - "condition": "equipcount" + "condition": "equipcount", + "sumType": 1 }, { "id": 28, @@ -249,7 +276,8 @@ "param": "count&", "string": "套装数量&", "content": "不需要装备上", - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 29, @@ -258,7 +286,8 @@ "param": "day&", "string": "天数", "content": 0, - "condition": "day" + "condition": "day", + "sumType": 1 }, { "id": 30, @@ -267,7 +296,8 @@ "param": "count&", "string": "精炼次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 31, @@ -276,7 +306,8 @@ "param": "count&", "string": "洗炼数量", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 32, @@ -285,16 +316,18 @@ "param": "count&stage&", "string": "镶嵌次数&宝石阶数&", "content": "必须同时镶嵌中,脱下再嵌不算", - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 33, "name": "装备", - "info": "装备x个宝石", + "info": "当前装备x个宝石", "param": "count&", "string": "宝石数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 34, @@ -303,7 +336,8 @@ "param": "count&", "string": "好友数量&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 35, @@ -312,7 +346,8 @@ "param": "count&", "string": "赠送次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 36, @@ -321,7 +356,8 @@ "param": "chattype&count&", "string": "聊天频道type&发言次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 37, @@ -330,7 +366,8 @@ "param": "cost&", "string": "消耗体力数&", "content": 0, - "condition": "cost" + "condition": "cost", + "sumType": 2 }, { "id": 38, @@ -339,7 +376,8 @@ "param": "hid&count&warcount&warid&…", "string": "武将id&挑战次数&填几个warid&关卡id&…", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 39, @@ -348,7 +386,8 @@ "param": "warcount&warid&…", "string": "关卡id", "content": 0, - "condition": "warcount" + "condition": "warcount", + "sumType": 2 }, { "id": 40, @@ -357,7 +396,8 @@ "param": "count&", "string": "扫荡次数&", "content": "不包括手打", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 41, @@ -366,7 +406,8 @@ "param": "eventType&count&", "string": "奇遇类型&次数&", "content": "eventType=0,表示任意奇遇类型", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 42, @@ -375,7 +416,8 @@ "param": "star&count&warcount&warid&…", "string": "星级&通关次数&填几个warid&关卡id&…", "content": "不包括扫荡,不强求三星star填0", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 43, @@ -384,7 +426,8 @@ "param": "dailytype&count&", "string": "每日类型&挑战次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 44, @@ -393,7 +436,8 @@ "param": "count&", "string": "秘境挑战次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 45, @@ -402,7 +446,8 @@ "param": "warcount&warid&…", "string": "填几个warid&关卡id&…", "content": 0, - "condition": "warcount" + "condition": "warcount", + "sumType": 1 }, { "id": 46, @@ -411,7 +456,8 @@ "param": "lv&", "string": "镇念塔层数", "content": 0, - "condition": "lv" + "condition": "lv", + "sumType": 1 }, { "id": 47, @@ -420,7 +466,8 @@ "param": "count&", "string": "通关次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 48, @@ -429,7 +476,8 @@ "param": "count&", "string": "挑战次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 49, @@ -438,7 +486,8 @@ "param": "count&", "string": "远征次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 50, @@ -447,7 +496,8 @@ "param": "count&point&", "string": "领取次数&宝箱的积分&", "content": "积分27分", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 51, @@ -456,7 +506,8 @@ "param": "count&", "string": "创建队伍次数&", "content": "创建了队伍,匹配到人了,并进去挑战了才算一次", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 52, @@ -465,7 +516,8 @@ "param": "quality&count&", "string": "合成藏宝图品质&合成次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 53, @@ -474,7 +526,8 @@ "param": "count&", "string": "协助寻宝次数&", "content": "一定是加别人的", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 54, @@ -483,7 +536,8 @@ "param": "count&", "string": "寻宝次数&", "content": "都算", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 55, @@ -492,7 +546,8 @@ "param": "quality&count&", "string": "寻宝品质&次数&", "content": "创建了队伍,匹配到人了,并进去挑战了才算一次", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 56, @@ -501,7 +556,8 @@ "param": "count&goodcount&goodid&…", "string": "掉落碎片数量&填的gid的条数&物品id&…", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 57, @@ -510,7 +566,8 @@ "param": "count&", "string": "pvp次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 58, @@ -519,7 +576,8 @@ "param": "count&", "string": "pvp胜利次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 59, @@ -528,7 +586,8 @@ "param": "count&", "string": "领取次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 60, @@ -537,7 +596,8 @@ "param": "count&", "string": "连胜次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 61, @@ -546,7 +606,8 @@ "param": "herocount&score&", "string": "武将数量&积分&", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 62, @@ -555,7 +616,8 @@ "param": "rank&", "string": "排名&", "content": 0, - "condition": "rank" + "condition": "rank", + "sumType": 1 }, { "id": 63, @@ -564,7 +626,8 @@ "param": "job&", "string": "军团的官职&", "content": 0, - "condition": "job" + "condition": "job", + "sumType": 1 }, { "id": 64, @@ -573,7 +636,8 @@ "param": "count&", "string": "捐献次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 65, @@ -582,7 +646,8 @@ "param": "count&", "string": "领取活跃宝箱次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 66, @@ -591,7 +656,8 @@ "param": "quality&count&", "string": "碎片品质&炼制出次数&", "content": "quality=0,表示任意品质", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 67, @@ -600,7 +666,8 @@ "param": "count&", "string": "加速次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 68, @@ -609,7 +676,8 @@ "param": "count&", "string": "压制次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 69, @@ -618,7 +686,8 @@ "param": "count&", "string": "挑战次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 70, @@ -627,7 +696,8 @@ "param": "count&", "string": "挑战次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 71, @@ -636,7 +706,8 @@ "param": "aid&count&", "string": "军团活动id&活动次数&", "content": "aid-1.蛮夷 2.诸侯 3.粮草,aid=0就是任意军团活动类型", - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 72, @@ -645,7 +716,8 @@ "param": "count&", "string": "加入军团次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 73, @@ -654,7 +726,8 @@ "param": "warcount&warid&", "string": "关卡id", "content": 0, - "condition": "warcount" + "condition": "warcount", + "sumType": 1 }, { "id": 74, @@ -663,7 +736,8 @@ "param": "herocount&quality&quality&", "string": "武将数量&武将初始品质&武将升级后品质", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 75, @@ -672,7 +746,8 @@ "param": "herocount&quality&", "string": "武将数量&武将初始品质", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 76, @@ -681,7 +756,8 @@ "param": "herocount&star&", "string": "武将数量&星级", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 77, @@ -690,16 +766,8 @@ "param": "count&lv&", "string": "装备件数&精炼等级", "content": 0, - "condition": "count" - }, - { - "id": 78, - "name": "装备", - "info": "一个武将满装备情况下,必须都镶嵌有相同阶的宝石(阶数大于等于x情况下都算达成),触发x次数", - "param": "count&stage&", - "string": "发生次数&宝石阶数&", - "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 79, @@ -708,7 +776,8 @@ "param": "count&wardId&", "string": "发生次数&关卡Id&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 80, @@ -717,7 +786,8 @@ "param": "count&camp&", "string": "数量&阵营类型&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 81, @@ -726,7 +796,8 @@ "param": "count&quality&", "string": "数量&武将品质&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 82, @@ -735,7 +806,8 @@ "param": "count&", "string": "次数&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 1 }, { "id": 83, @@ -744,7 +816,8 @@ "param": "count&quality&", "string": "次数&装备品质&", "content": 0, - "condition": "count" + "condition": "count", + "sumType": 2 }, { "id": 84, @@ -753,7 +826,8 @@ "param": "herocount&", "string": "武将数量", "content": 0, - "condition": "herocount" + "condition": "herocount", + "sumType": 1 }, { "id": 86, @@ -762,6 +836,7 @@ "param": "RMB&", "string": "累计充值金额", "content": 0, - "condition": "RMB" + "condition": "RMB", + "sumType": 1 } ] \ No newline at end of file