添加远征每日重置
This commit is contained in:
@@ -5,8 +5,8 @@ import { HANG_UP_CONSTS, TOWER_TASK_CONST } from './../consts/consts';
|
||||
import { BattleRecordModel } from './../db/BattleRecord';
|
||||
import { TowerRecordModel } from './../db/TowerRecord';
|
||||
import { RoleModel } from './../db/Role';
|
||||
import { getHeroInfoById, getJobInfoById, getTowerDataByLv, getTaskById, getTaskIdByFloor } from "../pubUtils/gamedata"
|
||||
import { decodeArrayStr, shouldRefresh, resResult, decodeStr, cal, getRandomWithWeight, getRefTime } from '../pubUtils/util';
|
||||
import { getHeroInfoById, getJobInfoById, getTowerDataByLv, getTaskById, getGamedata } from "../pubUtils/gamedata"
|
||||
import { decodeArrayStr, shouldRefresh, resResult, decodeStr, cal, getRandomWithWeight, getRefTime, decodeStrSingle } from '../pubUtils/util';
|
||||
import { handleFixedReward } from './rewardService';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { HangUpSpdUpRecModel } from '../db/HangUpSpdUpRec';
|
||||
@@ -197,15 +197,16 @@ async function checkCond(roleId: string, heroes, type: number, param: number, cn
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
for(let hid of heroes) {
|
||||
const rec = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
for(let seqId of heroes) {
|
||||
const rec = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
if (rec.star >= param) {
|
||||
heroCnt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for(let hid of heroes) {
|
||||
for(let seqId of heroes) {
|
||||
let {hid} = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
const hInfo = getHeroInfoById(hid);
|
||||
if (hInfo.camp === param) {
|
||||
heroCnt++;
|
||||
@@ -213,7 +214,8 @@ async function checkCond(roleId: string, heroes, type: number, param: number, cn
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for(let hid of heroes) {
|
||||
for(let seqId of heroes) {
|
||||
let {hid} = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
const hInfo = getHeroInfoById(hid);
|
||||
if (getJobInfoById(hInfo.jobid) === param) {
|
||||
heroCnt++;
|
||||
@@ -252,8 +254,16 @@ export async function checkTaskConditions(roleId: string, heroes: Array<number>,
|
||||
export async function createCurTasks(towerLv: number, roleId: string, roleName: string) {
|
||||
|
||||
let taskIds = [];
|
||||
const taskList = getTaskIdByFloor(towerLv)||[];
|
||||
const randomList = taskList.map(taskId => getTaskById(taskId));
|
||||
let randomList = [];
|
||||
let dicTask = getGamedata('dic_zyz_search');
|
||||
for(let task of dicTask) {
|
||||
let {suitFloor} = task;
|
||||
let {min, max} = decodeStrSingle('suitLevel', suitFloor);
|
||||
let flag = max?(towerLv >= min && towerLv <= max): (towerLv >= min);
|
||||
if(flag) {
|
||||
randomList.push(task);
|
||||
}
|
||||
}
|
||||
for(let i = 0; i < TOWER_TASK_CONST.RAND_CNT; i++) {
|
||||
let list = randomList.filter(cur => !taskIds.includes(cur.taskId));
|
||||
let {dic: tmp} = getRandomWithWeight(list);
|
||||
|
||||
Reference in New Issue
Block a user