pvp:头像框解锁
This commit is contained in:
@@ -12,10 +12,10 @@ import { PVPConfigModel } from '../../../db/SystemConfig';
|
||||
import { Rank } from '../../../services/rankService';
|
||||
import { checkActivityTask, checkTask, checkTaskInPvpEnd } from '../../../services/taskService';
|
||||
import { Attack, AttackHero, Defense, DefenseHero, PvpDataReturn } from '../../../domain/battleField/pvp';
|
||||
import { LINEUP_NUM, REDIS_KEY, TASK_TYPE } from '../../../consts';
|
||||
import { FIGURE_UNLOCK_CONDITION, LINEUP_NUM, REDIS_KEY, TASK_TYPE } from '../../../consts';
|
||||
import { PVP } from '../../../pubUtils/dicParam';
|
||||
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
||||
import { addItems, handleCost } from '../../../services/rewardService';
|
||||
import { addItems, handleCost, unlockFigure } from '../../../services/rewardService';
|
||||
import { pick } from "underscore";
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
import PvpHistoryOpp, { PvpHistoryOppModel } from '../../../db/PvpHistoryOpp';
|
||||
@@ -216,6 +216,7 @@ export class PvpHandler {
|
||||
// 更新军功
|
||||
let pvpDefense = await PvpDefenseModel.findByRoleIdIncludeAll(roleId);
|
||||
if (!pvpDefense) return resResult(STATUS.PVP_NOT_OPEN);
|
||||
let { hisWinStreakNum = 0 } = pvpDefense;
|
||||
|
||||
let update: pvpUpdateInter = {};
|
||||
|
||||
@@ -271,7 +272,9 @@ export class PvpHandler {
|
||||
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.PVP_WIN, 1)
|
||||
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.PVP_WIN_SERIES, 1)
|
||||
}
|
||||
|
||||
if(hisWinStreakNum < pvpDefense.hisWinStreakNum) {
|
||||
await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.PVP_WIN_SERIES, paramWinStreakNum: pvpDefense.hisWinStreakNum }]);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleCode, isSuccess,
|
||||
|
||||
@@ -399,13 +399,16 @@ export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAtt
|
||||
|
||||
// 获取我方战报记录
|
||||
export async function generMyRecInfo(pvpDefense: PvpDefenseType, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) {
|
||||
let { attack, defense, heroScores, winStreakNum, score, hisScore } = pvpDefense;
|
||||
let { attack, defense, heroScores, winStreakNum, hisWinStreakNum = 0, score, hisScore } = pvpDefense;
|
||||
let { roleId } = role;
|
||||
if (isSuccess) {
|
||||
winStreakNum ++;
|
||||
} else {
|
||||
winStreakNum = 0;
|
||||
}
|
||||
if(winStreakNum > hisWinStreakNum) {
|
||||
hisWinStreakNum = winStreakNum;
|
||||
}
|
||||
|
||||
const dicOpp = gameData.pvpOpponent.get(pos);
|
||||
const plusScore = getPlusScore(winStreakNum);
|
||||
@@ -450,7 +453,7 @@ export async function generMyRecInfo(pvpDefense: PvpDefenseType, role: RoleType,
|
||||
let newDefense = <Defense>calLineupScore(defense, heroScores);
|
||||
|
||||
let updateParam = {
|
||||
winStreakNum, attack: newAttack, defense: newDefense, heroScores, score: score + addSumScore, hisScore: hisScore > score + addSumScore? hisScore: score + addSumScore
|
||||
winStreakNum, hisWinStreakNum, attack: newAttack, defense: newDefense, heroScores, score: score + addSumScore, hisScore: hisScore > score + addSumScore? hisScore: score + addSumScore
|
||||
}
|
||||
|
||||
return { attackInfo, showHeroScores, updateParam }
|
||||
|
||||
@@ -426,7 +426,7 @@ export async function checkHeroes(roleId: string, hids: number[]) {
|
||||
return true
|
||||
}
|
||||
|
||||
export async function unlockFigure(sid: string, roleId: string, conditions: { type: number, paramHid?: number, paramFavourLv?: number, paramSkinId?: number }[], role?: RoleType) {
|
||||
export async function unlockFigure(sid: string, roleId: string, conditions: { type: number, paramHid?: number, paramFavourLv?: number, paramSkinId?: number, paramWinStreakNum?: number }[], role?: RoleType) {
|
||||
let figureInfo = await pubUnlockFigure(roleId, conditions, role);
|
||||
await pushFigureUpdate(roleId, sid, figureInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user