皮肤:周边相关功能影响
This commit is contained in:
@@ -7,7 +7,7 @@ import { RoleModel, RoleType } from './../db/Role';
|
||||
import { shouldRefresh, resResult, cal, getRandEelmWithWeight, genCode, } from '../pubUtils/util';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { HangUpSpdUpRecModel } from '../db/HangUpSpdUpRec';
|
||||
import { TowerTaskRecModel, TowerTaskRecType } from '../db/TowerTaskRec';
|
||||
import { TaskHero, TowerTaskRecModel, TowerTaskRecType } from '../db/TowerTaskRec';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { Rank } from './rankService';
|
||||
import { checkActivityTask, checkTask } from './taskService';
|
||||
@@ -97,7 +97,7 @@ export async function getTasks(role: RoleType) {
|
||||
const batchCode = genCode(8);
|
||||
let preTasks = await TowerTaskRecModel.getPreTasks(roleId);
|
||||
if(preTasks && preTasks.length) {
|
||||
let checkResult = await checkTaskRewards(roleId, preTasks[0].batchCode, preTasks );
|
||||
let checkResult = checkTaskRewards(preTasks[0].batchCode, preTasks );
|
||||
if(!checkResult) return false;
|
||||
await sendMailByContent(MAIL_TYPE.TOWER_TASK_REWARD, roleId, { goods: checkResult.rewards });
|
||||
await TowerTaskRecModel.finishTask(preTasks[0].batchCode, preTasks.map(cur => cur.taskCode));
|
||||
@@ -116,7 +116,7 @@ export async function getTasks(role: RoleType) {
|
||||
return {curTasks: treatTask(curTasks, curTime), refRemainTime, nextCostGold}
|
||||
}
|
||||
|
||||
export async function checkTaskRewards(roleId: string, batchCode: string, tasks: TowerTaskRecType[]) {
|
||||
export function checkTaskRewards(batchCode: string, tasks: TowerTaskRecType[]) {
|
||||
const curTime = new Date();
|
||||
let compTasks: string[] = [];
|
||||
let rewards: RewardInter[] = [];
|
||||
@@ -128,7 +128,7 @@ export async function checkTaskRewards(roleId: string, batchCode: string, tasks:
|
||||
compTasks.push(task.taskCode);
|
||||
rewards.push(...reward);
|
||||
if(termsForAdd) {
|
||||
const result = await checkTaskConditions(roleId, task.heroes, termsForAdd);
|
||||
const result = checkTaskConditions(task.heroes, termsForAdd);
|
||||
if(result) {
|
||||
rewards.push(...additionalReward);
|
||||
}
|
||||
@@ -356,33 +356,28 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp
|
||||
};
|
||||
}
|
||||
|
||||
async function checkCond(roleId: string, heroes, type: number, param: number, cnt: number) {
|
||||
function checkCond(heroes: TaskHero[], type: number, param: number, cnt: number) {
|
||||
|
||||
let heroCnt = 0;
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
for (let seqId of heroes) {
|
||||
const { star, colorStar } = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
for (let { star, colorStar } of heroes) {
|
||||
if (star + colorStar >= param) {
|
||||
heroCnt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (let seqId of heroes) {
|
||||
let { hid } = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
const hInfo = gameData.hero.get(hid);
|
||||
if (hInfo.camp === param) {
|
||||
for (let { camp } of heroes) {
|
||||
if (camp === param) {
|
||||
heroCnt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (let seqId of heroes) {
|
||||
let { hid } = await HeroModel.findBySeqIdAndRole(seqId, roleId);
|
||||
const hInfo = gameData.hero.get(hid);
|
||||
if (gameData.job.get(hInfo.jobid).job_class === param) {
|
||||
for (let { jobClass } of heroes) {
|
||||
if (jobClass === param) {
|
||||
heroCnt++;
|
||||
}
|
||||
}
|
||||
@@ -396,11 +391,11 @@ async function checkCond(roleId: string, heroes, type: number, param: number, cn
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function checkTaskConditions(roleId: string, heroes: number[], condition: { type: number, param: number, count: number }[]) {
|
||||
export function checkTaskConditions(heroes: TaskHero[], condition: { type: number, param: number, count: number }[]) {
|
||||
|
||||
let res = true;
|
||||
for (let { type, param, count } of condition) {
|
||||
const checkRes = await checkCond(roleId, heroes, type, param, count);
|
||||
const checkRes = checkCond(heroes, type, param, count);
|
||||
if (!checkRes) {
|
||||
res = false;
|
||||
break;
|
||||
@@ -556,9 +551,9 @@ export async function getTasksReward(roleId: string, curTime: Date) {
|
||||
if (task.sendTime && task.sendTime.getTime() + completeTime * 1000 < curTime.getTime()) {
|
||||
goods = goods.concat(reward);
|
||||
if (termsForAdd) {
|
||||
const result = checkTaskConditions(roleId, task.heroes, termsForAdd);
|
||||
const result = checkTaskConditions(task.heroes, termsForAdd);
|
||||
if (result) {
|
||||
goods = goods.concat(additionalReward);
|
||||
goods.push(...additionalReward);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,6 +582,7 @@ export function getRandRobot(cnt = 1, withAttr = false) {
|
||||
let dicHero = gameData.hero.get(hero.actorId);
|
||||
heroes.push({
|
||||
id: hero.actorId,
|
||||
skinId: hero.actorId,
|
||||
star: hero.star||dicHero.initialStars,
|
||||
colorStar: 0,
|
||||
lv: hero.lv,
|
||||
|
||||
@@ -157,6 +157,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
let { attribute } = getPlayerAttribute(lv, heroAttrs, roleAttrs);
|
||||
let heroInfo = {
|
||||
actorId: hero.actorId,
|
||||
skinId: hero.skinId,
|
||||
actorName: dicHero.name,
|
||||
skill:0,
|
||||
seid:'&',
|
||||
@@ -202,7 +203,7 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
|
||||
const { attribute, enemyCount } = json;
|
||||
|
||||
let { attribute: newAttribute, ce } = getRobotAttribute(attribute, enemyCount, dicExpeditionSubAttr.attribute, dicExpeditionSubAttr.lv, myCe, robotCe, scale);
|
||||
enemyObj.enemies.push({...json, attribute: newAttribute, lv, ce});
|
||||
enemyObj.enemies.push({...json, skinId: json.actorId, attribute: newAttribute, lv, ce});
|
||||
allCe += ce;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { HeroModel } from '../db/Hero';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import Role, { RoleModel, RoleType } from '../db/Role'
|
||||
import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data';
|
||||
import { updateUserInfo } from './redisService';
|
||||
@@ -83,7 +83,7 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
|
||||
|
||||
|
||||
export async function checkBattleHeroes(roleId: string, seqIds: Array<number> = []) {
|
||||
let heroes: number[] = [], lineup: LineupParam[] = [];
|
||||
let hids: number[] = [], lineup: LineupParam[] = [], heroes: HeroType[] = [];
|
||||
let flag = true;
|
||||
// if (seqIds.length <= 0) flag = false;
|
||||
|
||||
@@ -94,10 +94,11 @@ export async function checkBattleHeroes(roleId: string, seqIds: Array<number> =
|
||||
if (!hero) {
|
||||
flag = false; break;
|
||||
}
|
||||
heroes.push(hero.hid);
|
||||
hids.push(hero.hid);
|
||||
lineup.push(new LineupParam(hero));
|
||||
heroes.push(hero);
|
||||
}
|
||||
return { isOK: flag, heroes, seqIds, lineup };
|
||||
return { isOK: flag, hids, heroes, seqIds, lineup };
|
||||
}
|
||||
|
||||
export async function checkBattleHeroesByHid(roleId: string, heroes: Array<number> = []) {
|
||||
|
||||
@@ -36,6 +36,7 @@ export async function initPvpInfo(role: RoleType) {
|
||||
if (item) defCe += item.ce;
|
||||
heroes.push({
|
||||
actorId: item?.hid || 0,
|
||||
skinId: item?.hid || 0,
|
||||
hero: item?.hero || null,
|
||||
ce: item?.ce || 0,
|
||||
dataId: i,
|
||||
@@ -592,11 +593,11 @@ export async function generMyRecInfo(heroScores: HeroScores[], winStreakNum: num
|
||||
hid, addScore: 0, plusScore: 0, score: curHeroScore ? curHeroScore.score : 0
|
||||
});
|
||||
}
|
||||
const myHero = await HeroModel.findByHidAndRole(hid, roleId, 'quality star colorStar lv');
|
||||
let { quality, star, colorStar, lv } = myHero;
|
||||
const myHero = await HeroModel.findByHidAndRole(hid, roleId, 'quality star colorStar lv skinId');
|
||||
let { quality, star, colorStar, lv, skinId } = myHero;
|
||||
|
||||
myHeroRecords.push({
|
||||
hid, quality, star, colorStar, lv, damage, heal, underDamage
|
||||
hid, quality, star, colorStar, lv, damage, heal, underDamage, skinId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user