皮肤:周边相关功能影响

This commit is contained in:
luying
2021-10-19 14:24:05 +08:00
parent da5a43abba
commit 864f856c1c
16 changed files with 254 additions and 199 deletions

View File

@@ -140,7 +140,7 @@ export class ExpeditionBattleHandler {
if (!preBattle) return resResult(STATUS.BATTLE_NEED_PREVIOUS_GK);
}
let { isOK, heroes } = await checkBattleHeroes(roleId, seqIds);
let { isOK, hids } = await checkBattleHeroes(roleId, seqIds);
if (!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCodeAndId(expeditionCode, expeditionId);
@@ -158,7 +158,7 @@ export class ExpeditionBattleHandler {
status: 0,
warName: warInfo.gk_name,
warType: warInfo.warType,
record: { heroes, seqIds }
record: { heroes: hids, seqIds }
}
}, true);

View File

@@ -58,7 +58,7 @@ export class NormalBattleHandler {
if (preBattle == -1) return resResult(STATUS.BATTLE_NEED_PREVIOUS_GK);
}
let { isOK, heroes, lineup } = await checkBattleHeroes(roleId, seqIds);
let { isOK, hids, lineup } = await checkBattleHeroes(roleId, seqIds);
if (!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
const battleCode = genCode(8); // 关卡唯一值
@@ -72,7 +72,7 @@ export class NormalBattleHandler {
}
dailyNum = Object.assign(dailyNum, checkResult.data);
} else if (warInfo.warType == WAR_TYPE.TOWER) {
let checkResult = await checkTowerWar(roleId, battleId, seqIds, heroes);
let checkResult = await checkTowerWar(roleId, battleId, seqIds, hids);
if (checkResult.status == -1) {
return checkResult.resResult
}
@@ -98,7 +98,7 @@ export class NormalBattleHandler {
status: 0,
warName: warInfo.gk_name,
warType: warInfo.warType,
record: { heroes, seqIds, lineup }
record: { heroes: hids, seqIds, lineup }
}
}, true);

View File

@@ -34,73 +34,6 @@ export class PvpHandler {
constructor(private app: Application) {
}
async addRoleScore(msg: { heroScores: Array<{ hid: number, score: number }> }, session: BackendSession) {
let { heroScores: addHeroScores } = msg;
let roleId = session.get('roleId');
let sid = session.get('sid');
let { heroScores, hisScore } = await PvpDefenseModel.findByRoleId(roleId);
let score = 0;
for (let { hid, score: heroScore } of addHeroScores) {
if (heroScore < 0) continue;
let index = findIndex(heroScores, { hid });
if (index != -1) {
heroScores[index].score = heroScore;
} else {
heroScores.push({ hid, score: heroScore });
}
}
for (let heroScore of heroScores) {
score += heroScore.score;
}
if (score < 0) {
score = 0;
}
if (hisScore < score) {
hisScore = score;
}
let pLv = getPLvByScore(score);
let pvpDefense = await PvpDefenseModel.updateInfoAndInclude(roleId, { score, hisScore, pLv, heroScores });
let roleName = session.get('roleName');
const role = await RoleModel.findByRoleId(roleId);
// 加入排行榜
let r = new Rank(REDIS_KEY.PVP_RANK, {});
await r.setRankWithRoleInfo(roleId, pvpDefense.score, pvpDefense.updatedAt.getTime(), role);
// 任务
await checkTask(roleId, sid, TASK_TYPE.PVP_HERO_SCORE, 0, false, { heroScores });
return resResult(STATUS.SUCCESS, { score, hisScore, heroScores });
}
async debugPvpSeasonReset(msg: {}, session: BackendSession) {
await pvpSeasonEnd({ name: 'exce setPvpSeasonResult debug' });
let systemConfig = await createNextPvpSeason();
return resResult(STATUS.SUCCESS, { seasonNum: systemConfig.seasonNum, seasonEndTime: systemConfig.seasonEndTime })
}
async debugPvpWarReset(msg: {}, session: BackendSession) {
let systemConfig = await resetPvpWarId();
return resResult(STATUS.SUCCESS, { systemConfig });
}
async debugPvpSeasonResetTime(msg: { day: number }, session: BackendSession) {
let { day: hour } = msg;
let { seasonNum, seasonEndTime } = await pinus.app.rpc.systimer.systimerRemote.resetPvpSeasonTime.toServer('systimer-server-1', hour);
return resResult(STATUS.SUCCESS, { seasonNum, seasonEndTime });
}
async debugAddChallengeCnt(msg: { challengeCnt: number }, session: BackendSession) {
let { challengeCnt } = msg;
let roleId = session.get('roleId');
if (challengeCnt > PVP.PVP_CHALLENGE_COUNTS) {
challengeCnt = PVP.PVP_CHALLENGE_COUNTS;
}
let { challengeRefTime } = await PvpDefenseModel.updateInfoAndInclude(roleId, { challengeCnt, challengeRefTime: nowSeconds(), refOppCnt: 0 });
return resResult(STATUS.SUCCESS, { challengeCnt, challengeRefTime });
}
//1获取主界面
async getData(msg: {}, session: BackendSession) {
let roleId = session.get('roleId');
@@ -383,7 +316,7 @@ export class PvpHandler {
let defIndex = findIndex(defHeros, { dataId });
if (defIndex == -1) {
defIndex = defHeros.length;
defHeros.push({ actorId: 0, order: 0, ce: 0, hero: null, dataId });
defHeros.push({ actorId: 0, skinId: 0, order: 0, ce: 0, hero: null, dataId });
}
if (index == -1) {
defHeros[defIndex].actorId = 0;
@@ -462,10 +395,10 @@ export class PvpHandler {
let role = await RoleModel.findByRoleId(oppoRoleId);
let heroes = new Array<PlayerDetailHero>();
for (let { hid, lv, star, colorStar, quality } of dbHeroes) {
for (let { hid, lv, star, colorStar, quality, skinId } of dbHeroes) {
let heroScore = pvpDefense.heroScores.find(cur => cur.hid == hid);
heroes.push({
actorId: hid, lv, star, colorStar, quality,
actorId: hid, lv, star, colorStar, quality, skinId,
score: heroScore ? heroScore.score : 0
});
}
@@ -511,4 +444,74 @@ export class PvpHandler {
let pvpRecords = await PvpRecordModel.getRecByRoleId(roleId);
return resResult(STATUS.SUCCESS, { list: pvpRecords });
}
// debug接口
async addRoleScore(msg: { heroScores: Array<{ hid: number, score: number }> }, session: BackendSession) {
let { heroScores: addHeroScores } = msg;
let roleId = session.get('roleId');
let sid = session.get('sid');
let { heroScores, hisScore } = await PvpDefenseModel.findByRoleId(roleId);
let score = 0;
for (let { hid, score: heroScore } of addHeroScores) {
if (heroScore < 0) continue;
let index = findIndex(heroScores, { hid });
if (index != -1) {
heroScores[index].score = heroScore;
} else {
heroScores.push({ hid, score: heroScore });
}
}
for (let heroScore of heroScores) {
score += heroScore.score;
}
if (score < 0) {
score = 0;
}
if (hisScore < score) {
hisScore = score;
}
let pLv = getPLvByScore(score);
let pvpDefense = await PvpDefenseModel.updateInfoAndInclude(roleId, { score, hisScore, pLv, heroScores });
let roleName = session.get('roleName');
const role = await RoleModel.findByRoleId(roleId);
// 加入排行榜
let r = new Rank(REDIS_KEY.PVP_RANK, {});
await r.setRankWithRoleInfo(roleId, pvpDefense.score, pvpDefense.updatedAt.getTime(), role);
// 任务
await checkTask(roleId, sid, TASK_TYPE.PVP_HERO_SCORE, 0, false, { heroScores });
return resResult(STATUS.SUCCESS, { score, hisScore, heroScores });
}
async debugPvpSeasonReset(msg: {}, session: BackendSession) {
await pvpSeasonEnd({ name: 'exce setPvpSeasonResult debug' });
let systemConfig = await createNextPvpSeason();
return resResult(STATUS.SUCCESS, { seasonNum: systemConfig.seasonNum, seasonEndTime: systemConfig.seasonEndTime })
}
async debugPvpWarReset(msg: {}, session: BackendSession) {
let systemConfig = await resetPvpWarId();
return resResult(STATUS.SUCCESS, { systemConfig });
}
async debugPvpSeasonResetTime(msg: { day: number }, session: BackendSession) {
let { day: hour } = msg;
let { seasonNum, seasonEndTime } = await pinus.app.rpc.systimer.systimerRemote.resetPvpSeasonTime.toServer('systimer-server-1', hour);
return resResult(STATUS.SUCCESS, { seasonNum, seasonEndTime });
}
async debugAddChallengeCnt(msg: { challengeCnt: number }, session: BackendSession) {
let { challengeCnt } = msg;
let roleId = session.get('roleId');
if (challengeCnt > PVP.PVP_CHALLENGE_COUNTS) {
challengeCnt = PVP.PVP_CHALLENGE_COUNTS;
}
let { challengeRefTime } = await PvpDefenseModel.updateInfoAndInclude(roleId, { challengeCnt, challengeRefTime: nowSeconds(), refOppCnt: 0 });
return resResult(STATUS.SUCCESS, { challengeCnt, challengeRefTime });
}
}

View File

@@ -1,19 +1,17 @@
import { STATUS } from './../../../consts/statusCode';
import { HANG_UP_CONSTS, REDIS_KEY } from './../../../consts';
import { TowerTaskRecModel, TowerTaskRecType } from './../../../db/TowerTaskRec';
import { TaskHero, TowerTaskRecModel, TowerTaskRecType } from './../../../db/TowerTaskRec';
import { HangUpSpdUpRecModel } from './../../../db/HangUpSpdUpRec';
import { HangUpRecordModel } from './../../../db/HangUpRecord';
import { RoleModel } from './../../../db/Role';
import { TowerRecordModel } from './../../../db/TowerRecord';
import { Application, BackendSession } from 'pinus';
import { resResult, shouldRefresh, genCode } from '../../../pubUtils/util';
import { calcuHangUpReward, checkTaskConditions, checkHangUpSpdUpCnt, refreshTasks, treatTask, getRemainTime, getDoingOrWaitingTasks, getTowerStatus, getHungupRewards, getTasks, checkTaskRewards, getTowerTaskCostGold, getHangSpdUpCostGold, getManyHangSpdUpCostGold, getTaskStatus } from '../../../services/battleService';
import { resResult, genCode } from '../../../pubUtils/util';
import { calcuHangUpReward, checkHangUpSpdUpCnt, refreshTasks, treatTask, getRemainTime, getTowerStatus, getHungupRewards, getTasks, checkTaskRewards, getTowerTaskCostGold, getHangSpdUpCostGold, getManyHangSpdUpCostGold, getTaskStatus } from '../../../services/battleService';
import { addItems, handleCost } from '../../../services/rewardService';
import { checkBattleHeroes } from '../../../services/normalBattleService';
import { getGoldObject } from '../../../pubUtils/itemUtils';
import { Rank } from '../../../services/rankService';
import { gameData } from '../../../pubUtils/data';
import { ItemInter } from '../../../pubUtils/interface';
import * as dicParam from '../../../pubUtils/dicParam';
export default function(app: Application) {
@@ -154,7 +152,7 @@ export class TowerBattleHandler {
return resResult(STATUS.SUCCESS, { curTasks: treatTask(curTasks, curTime), costGold, nextCostGold, refRemainTime});
}
async sendTaskHero(msg: {batchCode: string, tasks: Array<{taskCode: string, heroes: Array<number>}>}, session: BackendSession) {
async sendTaskHero(msg: {batchCode: string, tasks: {taskCode: string, heroes: number[]}[]}, session: BackendSession) {
let roleId = session.get('roleId');
const curTime = new Date();
@@ -162,36 +160,44 @@ export class TowerBattleHandler {
if (!curTasks || curTasks.length == 0) {
return resResult(STATUS.TOWER_TASK_NOT_FOUND);
}
let usedHeroes = [], tasks = [];
const tasksCode = [];
let usedHeroes: number[] = [], tasks: {taskCode:string, heroes: TaskHero[], completeTime: number}[] = [];
const tasksCode: string[] = [];
const taskMap = new Map<string, any>()
curTasks.forEach(task => {
let getStatusResult = getTaskStatus(task.status, task.completeTime, curTime);
if(getStatusResult.status == 1) usedHeroes = usedHeroes.concat(task.heroes);
if(getStatusResult.status == 1) {
for(let { seqId } of task.heroes) {
usedHeroes.push(seqId);
}
}
tasksCode.push(task.taskCode);
taskMap.set(task.taskCode, task);
});
for (let task of msg.tasks) {
let curTask = taskMap.get(task.taskCode); // 数据库中,这个任务的数据
for (let { taskCode, heroes: seqIds } of msg.tasks) {
let curTask = taskMap.get(taskCode); // 数据库中,这个任务的数据
if(!curTask) {
return resResult(STATUS.TOWER_TASK_MISSING)
}
let taskInfo = gameData.towerTask.get(curTask.taskId);
if (task.heroes.length !== taskInfo.actorNeeded) { // 武将数,从策划表中读取
let dicTask = gameData.towerTask.get(curTask.taskId);
if (seqIds.length !== dicTask.actorNeeded) { // 武将数,从策划表中读取
return resResult(STATUS.TOWER_TASK_MAX_HERO);
}
let { isOK } = await checkBattleHeroes(roleId, task.heroes);
let { isOK, heroes } = await checkBattleHeroes(roleId, seqIds);
if(!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
if (tasksCode.indexOf(task.taskCode) === -1) {
if (tasksCode.indexOf(taskCode) === -1) {
return resResult(STATUS.TOWER_TASK_CODE_NOT_FOUND);
}
if (usedHeroes.length > 0) { // 是否在其他任务重使用了武将
let used = !!task.heroes.find(seqId => usedHeroes.indexOf(seqId) !== -1);
let used = !!seqIds.find(seqId => usedHeroes.indexOf(seqId) !== -1);
if (used) {
return resResult(STATUS.TOWER_TASK_HERO_HAS_USED);
}
}
tasks.push({...task, completeTime: taskInfo.completeTime})
let taskHeroes = heroes.map(hero => {
return new TaskHero(hero);
});
tasks.push({ taskCode, heroes: taskHeroes, completeTime: dicTask.completeTime})
}
const recs = await TowerTaskRecModel.sendHeroes(roleId, msg.batchCode, tasks, curTime,);
@@ -225,7 +231,7 @@ export class TowerBattleHandler {
if (!tasks || tasks.length == 0) {
return resResult(STATUS.TOWER_TASK_NOT_FOUND);
}
const checkResult = await checkTaskRewards(roleId, batchCode, tasks);
const checkResult = checkTaskRewards(batchCode, tasks);
if (!checkResult) {
return resResult(STATUS.TOWER_TASK_BATCH_NOT_FOUND);
}

View File

@@ -668,9 +668,9 @@ export class FriendHandler {
for (let hid of showLineup) {
let curHero = dbHeroes.find(cur => cur.hid == hid);
if (curHero) {
let { lv, star, colorStar, quality } = curHero;
let { lv, star, colorStar, quality, skinId } = curHero;
heroes.push({
actorId: hid, lv, star, colorStar, quality,
actorId: hid, skinId, lv, star, colorStar, quality,
score: 0
});
}
@@ -679,9 +679,9 @@ export class FriendHandler {
for (let { hid } of topLineup) {
let curHero = dbHeroes.find(cur => cur.hid == hid);
if (curHero) {
let { lv, star, colorStar, quality } = curHero;
let { lv, star, colorStar, quality, skinId } = curHero;
heroes.push({
actorId: hid, lv, star, colorStar, quality,
actorId: hid, lv, skinId, star, colorStar, quality,
score: 0
});
}

View File

@@ -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,

View File

@@ -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;
}
}

View File

@@ -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> = []) {

View File

@@ -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
});
}

View File

@@ -8,6 +8,8 @@ export class ComRoleStatusHero {
@prop({ required: true })
id: number;
@prop({ required: true })
skinId: number;
@prop({ required: true })
quality: number;
@prop({ required: true })
star: number;
@@ -17,6 +19,7 @@ export class ComRoleStatusHero {
lv: number;
constructor(hero: HeroType) {
this.id = hero.hid;
this.skinId = hero.skinId;
this.quality = hero.quality;
this.star = hero.star;
this.colorStar = hero.colorStar;

View File

@@ -9,6 +9,8 @@ import { reduceCe } from '../pubUtils/util';
export class Heroes {
@prop({ required: true })
actorId: number; // 武将id
@prop({ required: true })
skinId: number; // 皮肤idfashions表的heroId
@prop({ ref: 'Hero', type: mongoose.Schema.Types.ObjectId })
hero: Ref<Hero>;
@prop({ required: true })

View File

@@ -9,6 +9,8 @@ export class HeroesRecord {
@prop({ required: true, default: 0 })
hid: number; // 武将id
@prop({ required: true, default: 0 })
skinId: number; // 皮肤idfashions表的heroId
@prop({ required: true, default: 0 })
quality: number; // 品质
@prop({ required: true, default: 0 })
star: number; // 星级
@@ -25,6 +27,7 @@ export class HeroesRecord {
constructor(pvpHero: PvpHeroInfo, damage: number, heal: number, underDamage: number) {
this.hid = pvpHero.actorId;
this.skinId = pvpHero.skinId;
this.quality = pvpHero.quality;
this.star = pvpHero.star;
this.colorStar = pvpHero.colorStar;

View File

@@ -3,6 +3,36 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
import { TOWER_TASK_STATUS } from '../consts';
import { genCode } from '../pubUtils/util';
import { getZeroPointD } from '../pubUtils/timeUtil';
import { HeroType } from './Hero';
import { gameData } from '../pubUtils/data';
export class TaskHero {
@prop({ required: true })
seqId: number;
@prop({ required: true })
hid: number;
@prop({ required: true })
skinId: number;
@prop({ required: true })
jobClass: number;
@prop({ required: true })
star: number;
@prop({ required: true })
colorStar: number;
@prop({ required: true })
camp: number;
constructor(hero: HeroType) {
let dicHero = gameData.hero.get(hero.hid);
this.seqId = hero.seqId;
this.hid = hero.hid;
this.skinId = hero.skinId;
this.jobClass = dicHero.jobClass;
this.star = hero.star;
this.colorStar = hero.colorStar;
this.camp = dicHero.camp;
}
}
/**
* 天梯派遣记录表
@@ -21,8 +51,8 @@ export default class TowerTaskRec extends BaseModel {
position: number; // 本批派遣任务当中的第几个任务
@prop({ required: true, default: 0, enum: TOWER_TASK_STATUS })
status: TOWER_TASK_STATUS; // 派遣任务当前状态0-可派遣1-已派遣2-已完成3-已领取
@prop({ required: true, type: Number, default: [] })
heroes: Array<number>; // 此批派遣使用的全部武将
@prop({ required: true, type: TaskHero, default: [], _id: false })
heroes: TaskHero[]; // 此批派遣使用的全部武将
@prop({ required: true })
taskId: number; // 任务唯一 Id来自任务表
@@ -82,12 +112,12 @@ export default class TowerTaskRec extends BaseModel {
return recs;
}
public static async sendHeroes(_roleId: string, batchCode: string, tasks: Array<{taskCode:string, heroes: Array<number>, completeTime: number}>, sendTime: Date, lean = true) {
public static async sendHeroes(_roleId: string, batchCode: string, tasks: {taskCode:string, heroes: TaskHero[], completeTime: number}[], sendTime: Date, lean = true) {
let recs = new Array();
for (let {taskCode, heroes, completeTime} of tasks) {
const rec: TowerTaskRecType = await TowerTaskRecModel.findOneAndUpdate(
{ batchCode, taskCode: taskCode },
{heroes: heroes, status: TOWER_TASK_STATUS.DOINING, sendTime, completeTime: new Date(sendTime.getTime() + completeTime * 1000)},
{ heroes, status: TOWER_TASK_STATUS.DOINING, sendTime, completeTime: new Date(sendTime.getTime() + completeTime * 1000)},
{new: true}).lean(lean);
recs.push(rec);

View File

@@ -7,6 +7,7 @@ import { EXTERIOR } from "../../pubUtils/dicParam";
export class PlayerDetailHero {
actorId: number;
skinId: number;
lv: number;
star: number;
colorStar: number;
@@ -15,6 +16,7 @@ export class PlayerDetailHero {
setPvpHeroInfo?(hero: PvpEnemies|PvpOtherHeroes) {
this.actorId = hero.actorId;
this.skinId = hero.skinId;
this.lv = hero.lv;
this.star = hero.star;
this.colorStar = hero.colorStar;

View File

@@ -7,6 +7,8 @@ import { nowSeconds } from '../pubUtils/timeUtil';
export class PvpHeroInfo {
@prop({ required: true })
actorId?: number = 0; // 敌人id
@prop({ required: true })
skinId?: number = 0; // 时装idfashions表的heroId字段
@prop({ required: false })
actorName?: string = ""; // 敌人名
@prop({ required: false })
@@ -31,6 +33,7 @@ export class PvpHeroInfo {
setHeroInfo(hero: HeroType) {
this.actorId = hero.hid;
this.skinId = hero.skinId;
this.actorName = hero.hName;
this.star = hero.star;
this.lv = hero.lv;
@@ -40,6 +43,7 @@ export class PvpHeroInfo {
setRobotInfo(warjson: DicWarJson, lv: number, initialStar: number, quality: number) {
this.actorId = warjson.actorId;
this.skinId = warjson.actorId;
this.actorName = warjson.actorName;
this.star = initialStar;
this.lv = lv;
@@ -60,6 +64,8 @@ export class Enemies extends PvpHeroInfo {
@prop({ required: true })
actorId: number; // 敌人id
@prop({ required: false })
skinId: number; // 皮肤idfashions表的heroId
@prop({ required: false })
actorName: string; // 敌人名
@prop({ required: false })
dataId: number; // 战场中唯一指向武将的代码
@@ -85,6 +91,7 @@ export class Enemies extends PvpHeroInfo {
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo, ce: number) {
super();
this.actorId = heroInfo.actorId != undefined ? heroInfo.actorId : warjson.actorId;
this.skinId = heroInfo.skinId != undefined ? heroInfo.skinId: warjson.actorId;
this.actorName = heroInfo.actorName != undefined ? heroInfo.actorName : warjson.actorName;
this.dataId = warjson.dataId;
this.relation = warjson.relation;

View File

@@ -67,7 +67,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "72&95&30",
"initialSkin": 41003,
"initialSkin": 41002,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9902,
@@ -104,7 +104,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "96&62&30",
"initialSkin": 41004,
"initialSkin": 41003,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9903,
@@ -141,7 +141,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "90&60&50",
"initialSkin": 41005,
"initialSkin": 41004,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9904,
@@ -178,7 +178,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "93&56&57",
"initialSkin": 41006,
"initialSkin": 41005,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9905,
@@ -215,7 +215,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "90&70&5",
"initialSkin": 41008,
"initialSkin": 41007,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9906,
@@ -252,7 +252,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "71&87&15",
"initialSkin": 41009,
"initialSkin": 41008,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9907,
@@ -289,7 +289,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "72&75&38",
"initialSkin": 41011,
"initialSkin": 41010,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9908,
@@ -326,7 +326,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "82&64&32",
"initialSkin": 41012,
"initialSkin": 41011,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9909,
@@ -363,7 +363,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "81&65&15",
"initialSkin": 41013,
"initialSkin": 41012,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9910,
@@ -400,7 +400,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "54&54&69",
"initialSkin": 41014,
"initialSkin": 41013,
"gender": 2,
"atkSpineEffect": "faqi",
"probation": 9911,
@@ -437,7 +437,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "84&54&15",
"initialSkin": 41015,
"initialSkin": 41014,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9912,
@@ -474,7 +474,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "65&64&5",
"initialSkin": 41017,
"initialSkin": 41016,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9913,
@@ -511,7 +511,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "94&75&15",
"initialSkin": 41018,
"initialSkin": 41017,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9914,
@@ -548,7 +548,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "96&72&40",
"initialSkin": 41019,
"initialSkin": 41018,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9915,
@@ -585,7 +585,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "80&65&40",
"initialSkin": 41020,
"initialSkin": 41019,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9916,
@@ -622,7 +622,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "76&60&72",
"initialSkin": 41021,
"initialSkin": 41020,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9917,
@@ -659,7 +659,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "90&62&15",
"initialSkin": 41022,
"initialSkin": 41021,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9918,
@@ -696,7 +696,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "100&53&55",
"initialSkin": 41023,
"initialSkin": 41022,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9919,
@@ -733,7 +733,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "89&82&15",
"initialSkin": 41025,
"initialSkin": 41024,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 9920,
@@ -770,7 +770,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "80&69&15",
"initialSkin": 41026,
"initialSkin": 41025,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9921,
@@ -807,7 +807,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "82&65&35",
"initialSkin": 41027,
"initialSkin": 41026,
"gender": 2,
"atkSpineEffect": "liqi",
"probation": 9922,
@@ -844,7 +844,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "84&63&5",
"initialSkin": 41028,
"initialSkin": 41027,
"gender": 2,
"atkSpineEffect": "liqi",
"probation": 9923,
@@ -881,7 +881,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "54&50&59",
"initialSkin": 41029,
"initialSkin": 41028,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9924,
@@ -918,7 +918,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "81&54&15",
"initialSkin": 41031,
"initialSkin": 41030,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9925,
@@ -955,7 +955,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "73&46&32",
"initialSkin": 41032,
"initialSkin": 41031,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9926,
@@ -992,7 +992,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "70&100&30",
"initialSkin": 41033,
"initialSkin": 41032,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 9927,
@@ -1029,7 +1029,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "92&70&15",
"initialSkin": 41034,
"initialSkin": 41033,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9928,
@@ -1066,7 +1066,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "93&52&55",
"initialSkin": 41035,
"initialSkin": 41034,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9929,
@@ -1103,7 +1103,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "89&70&55",
"initialSkin": 41036,
"initialSkin": 41035,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9930,
@@ -1140,7 +1140,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "63&76&80",
"initialSkin": 41037,
"initialSkin": 41036,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9931,
@@ -1177,7 +1177,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "72&68&65",
"initialSkin": 41038,
"initialSkin": 41037,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9932,
@@ -1214,7 +1214,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "81&60&40",
"initialSkin": 41039,
"initialSkin": 41038,
"gender": 2,
"atkSpineEffect": "gong",
"probation": 9933,
@@ -1251,7 +1251,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "60&52&100",
"initialSkin": 41041,
"initialSkin": 41040,
"gender": 2,
"atkSpineEffect": "faqi",
"probation": 9934,
@@ -1288,7 +1288,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "85&54&40",
"initialSkin": 41042,
"initialSkin": 41041,
"gender": 2,
"atkSpineEffect": "faqi",
"probation": 9935,
@@ -1325,7 +1325,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "95&76&30",
"initialSkin": 41045,
"initialSkin": 41044,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9936,
@@ -1362,7 +1362,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "90&60&30",
"initialSkin": 41046,
"initialSkin": 41045,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9937,
@@ -1399,7 +1399,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "60&48&65",
"initialSkin": 41047,
"initialSkin": 41046,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9938,
@@ -1436,7 +1436,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "92&52&55",
"initialSkin": 41048,
"initialSkin": 41047,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9939,
@@ -1473,7 +1473,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "70&100&40",
"initialSkin": 41050,
"initialSkin": 41049,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9940,
@@ -1510,7 +1510,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "81&60&40",
"initialSkin": 41051,
"initialSkin": 41050,
"gender": 1,
"atkSpineEffect": "gong",
"probation": 9941,
@@ -1547,7 +1547,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "54&49&65",
"initialSkin": 41052,
"initialSkin": 41051,
"gender": 1,
"atkSpineEffect": "faqi",
"probation": 9942,
@@ -1584,7 +1584,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "72&63&5",
"initialSkin": 41053,
"initialSkin": 41052,
"gender": 2,
"atkSpineEffect": "liqi",
"probation": 9943,
@@ -1621,7 +1621,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "64&64&15",
"initialSkin": 41054,
"initialSkin": 41053,
"gender": 2,
"atkSpineEffect": "dunqi",
"probation": 9944,
@@ -1658,7 +1658,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "64&62&15",
"initialSkin": 41055,
"initialSkin": 41054,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9945,
@@ -1695,7 +1695,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "75&60&15",
"initialSkin": 41056,
"initialSkin": 41055,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 9946,
@@ -1732,7 +1732,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "80&67&65",
"initialSkin": 41057,
"initialSkin": 41056,
"gender": 2,
"atkSpineEffect": "faqi",
"probation": 9947,
@@ -1769,7 +1769,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "&",
"initialSkin": 0,
"initialSkin": 41057,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 0,
@@ -1806,7 +1806,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "&",
"initialSkin": 0,
"initialSkin": 41058,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 0,
@@ -1843,7 +1843,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "&",
"initialSkin": 0,
"initialSkin": 41059,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 0,
@@ -1880,7 +1880,7 @@
"actorinfo": "物理职业的弓兵,勉强还行。",
"skillScroll": "&",
"position": "&",
"initialSkin": 0,
"initialSkin": 41060,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 0,
@@ -1917,7 +1917,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "&",
"initialSkin": 0,
"initialSkin": 41061,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 0,
@@ -1954,7 +1954,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "64&64&5",
"initialSkin": 41114,
"initialSkin": 41062,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9948,
@@ -1991,7 +1991,7 @@
"actorinfo": "物理职业的步兵,强的一笔。",
"skillScroll": "&",
"position": "75&59&5",
"initialSkin": 41116,
"initialSkin": 41063,
"gender": 1,
"atkSpineEffect": "dunqi",
"probation": 9949,
@@ -2028,7 +2028,7 @@
"actorinfo": "远程职业的法师,菜的一笔。",
"skillScroll": "&",
"position": "72&63&5",
"initialSkin": 41118,
"initialSkin": 41064,
"gender": 1,
"atkSpineEffect": "liqi",
"probation": 9950,
@@ -6044,7 +6044,7 @@
"area": 0,
"cost": 0,
"jobid": 3,
"jobClass": 3,
"jobClass": 1,
"skill": 1047,
"pieceId": 0,
"hp": 10000,
@@ -6414,7 +6414,7 @@
"area": 0,
"cost": 0,
"jobid": 2,
"jobClass": 2,
"jobClass": 10,
"skill": 1004,
"pieceId": 0,
"hp": 1000,
@@ -7043,7 +7043,7 @@
"area": 0,
"cost": 0,
"jobid": 3,
"jobClass": 3,
"jobClass": 11,
"skill": 1001,
"pieceId": 0,
"hp": 1000,
@@ -14661,11 +14661,11 @@
"quality": 3,
"initialStars": 3,
"pieceCount": 80,
"camp": 1,
"camp": 2,
"area": 0,
"cost": 0,
"jobid": 100,
"jobClass": 1,
"jobid": 200,
"jobClass": 2,
"skill": 1,
"pieceId": 21001,
"hp": 218,
@@ -14809,11 +14809,11 @@
"quality": 3,
"initialStars": 3,
"pieceCount": 80,
"camp": 2,
"camp": 1,
"area": 0,
"cost": 0,
"jobid": 200,
"jobClass": 2,
"jobid": 600,
"jobClass": 6,
"skill": 17,
"pieceId": 21017,
"hp": 186,
@@ -14846,11 +14846,11 @@
"quality": 3,
"initialStars": 3,
"pieceCount": 80,
"camp": 2,
"camp": 1,
"area": 0,
"cost": 0,
"jobid": 300,
"jobClass": 3,
"jobid": 200,
"jobClass": 1,
"skill": 18,
"pieceId": 21018,
"hp": 132,
@@ -14886,8 +14886,8 @@
"camp": 2,
"area": 0,
"cost": 0,
"jobid": 200,
"jobClass": 2,
"jobid": 300,
"jobClass": 3,
"skill": 19,
"pieceId": 21019,
"hp": 186,
@@ -14920,11 +14920,11 @@
"quality": 3,
"initialStars": 3,
"pieceCount": 80,
"camp": 2,
"camp": 3,
"area": 0,
"cost": 0,
"jobid": 600,
"jobClass": 6,
"jobid": 700,
"jobClass": 7,
"skill": 22,
"pieceId": 21022,
"hp": 122,