活动:统计套装宝石相同阶数的任务

This commit is contained in:
qiaoxin
2021-05-08 15:19:08 +08:00
parent 96804c4055
commit 43bca3a5b7
8 changed files with 157 additions and 55 deletions

View File

@@ -12,7 +12,7 @@ import { ItemInter } from '../pubUtils/interface';
import { UserTaskModel, UserTaskType } from '../db/UserTask';
import { UserTaskRecModel } from '../db/UserTaskRec';
import { UserTaskHistoryModel } from '../db/UserTaskHistory';
import { gameData } from '../pubUtils/data';
import { gameData, getGoodById } from '../pubUtils/data';
import { getCurWeekDate, getSeconds } from '../pubUtils/timeUtil';
import { RoleStatus } from '../db/ComBattleTeam';
@@ -95,7 +95,7 @@ export async function checkTaskInBattleEnd(roleId: string, sid: string, funcs: n
export async function checkTaskInComBattleEnd(roleStatus: RoleStatus[], capId: string, quality: number) {
console.log('********', JSON.stringify(roleStatus), capId, quality)
for (let { roleId, isRobot } of roleStatus) {
if(!isRobot) {
if (!isRobot) {
if (roleId == capId && roleStatus.length > 1) { // 招募队友
await checkTask(roleId, null, null, TASK_TYPE.COM_BATTLE_CREATE_TEAM, 1, true, {});
} else if (roleId !== capId) { // 协助寻宝
@@ -239,4 +239,33 @@ export async function refDailyTaskBox(roleId: string, sid: string, debug = false
point, weeklyPoint, box
}), uids);
}
}
//任务条件
//英雄满装备且都镶嵌相同阶数的宝石
export async function checkTaskConditionEquipSuitJewelStage(hero: HeroType) {
let isTask = true;//是否满足任务条件
let jewelLevel = -1;//宝石阶数
for (let i = 0; i < hero.ePlace.length; i++) {
let equipObj = <EquipType>hero.ePlace[i].equip;
let equipObjInfo = getGoodById(equipObj.id);
if (equipObj.holes.length == equipObjInfo.hole && equipObjInfo.hole > 0) {
for (let j = 0; j < equipObj.holes.length; j++) {
let jewel = equipObj.holes[j].jewel;
let jewelInfo = getGoodById(jewel);
if (jewelLevel == -1) {
jewelLevel = jewelInfo.lvLimited;
} else if (jewelInfo.lvLimited != jewelLevel) {
//宝石阶数不同
isTask = false;
break;
}
}
} else {
//宝石没有镶满
isTask = false;
break;
}
}
return { isTask, jewelLevel };
}