pvp:修复存储roleId字段
This commit is contained in:
@@ -559,13 +559,13 @@ export async function sendPVPRewardToUser(pvpDefense: PvpDefenseType, seasonNum:
|
||||
|
||||
async function resetPvpScores(pvpDefense: PvpDefenseType, seasonNum: number, pvpSeasonResult: PvpSeasonResultType) {
|
||||
let { roleId, attack, defense } = pvpDefense;
|
||||
let { heroScores, score } = pvpSeasonResult;
|
||||
let { newHeroScores, newScore } = pvpSeasonResult;
|
||||
|
||||
let newAttack = <Attack>calLineupScore(attack, heroScores);
|
||||
let newDefense = <Defense>calLineupScore(defense, heroScores);
|
||||
let newAttack = <Attack>calLineupScore(attack, newHeroScores);
|
||||
let newDefense = <Defense>calLineupScore(defense, newHeroScores);
|
||||
|
||||
pvpDefense = await PvpDefenseModel.updateInfoAndInclude(roleId, {
|
||||
heroScores, score, attack: newAttack, defense: newDefense,
|
||||
heroScores: newHeroScores, score: newScore, attack: newAttack, defense: newDefense,
|
||||
seasonNum, challengeCnt: PVP.PVP_CHALLENGE_COUNTS, challengeRefTime: 0, winStreakNum: 0
|
||||
});
|
||||
return pvpDefense;
|
||||
@@ -599,8 +599,11 @@ export async function savePvpSeasonResult(pvpDefense: PvpDefenseType, seasonNum:
|
||||
hid: heroScore.hid, id, count
|
||||
});
|
||||
}
|
||||
newScore += pvpHeroReward.heroscore;
|
||||
} else {
|
||||
newHeroScores.push(heroScore);
|
||||
newScore += heroScore.score;
|
||||
}
|
||||
newScore += heroScore.score;
|
||||
}
|
||||
|
||||
//pvp锁定的信息存入赛季结算表中
|
||||
|
||||
@@ -572,7 +572,7 @@ export function getChineseName() {
|
||||
return randomName.generate()
|
||||
}
|
||||
|
||||
export function getRobotInfo(sysType = ROBOT_SYS_TYPE.COM_BTL) {
|
||||
export function getRobotInfo(sysType?: ROBOT_SYS_TYPE) {
|
||||
return {
|
||||
robotRoleName: getChineseName(),
|
||||
robotRoleId: makeRobotId(genCode(8), sysType),
|
||||
@@ -585,7 +585,7 @@ export function checkRoleIsRobot(roleId: string) {
|
||||
}
|
||||
|
||||
// 将一般的roleId转为带_r的
|
||||
export function makeRobotId(roleId: string, sysType = ROBOT_SYS_TYPE.COM_BTL) {
|
||||
export function makeRobotId(roleId: string, sysType?: ROBOT_SYS_TYPE) {
|
||||
if(sysType) {
|
||||
return `${sysType}|${roleId}_r`;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user