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