添加刷新消耗
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
import { PvpDefenseModel, Heroes, OppPlayers, Robot, PvpDefenseType, HeroScores } from '../db/PvpDefense';
|
||||
import { RoleType } from '../db/Role';
|
||||
import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY } from '../consts';
|
||||
import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY, PVP_CONST } from '../consts';
|
||||
import { setPvpDefResult } from '../services/timeTaskService';
|
||||
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
||||
import { getRandomIndexByLen, genCode, getRandomByLen } from '../pubUtils/util';
|
||||
import { getRandomIndexByLen, genCode, getRandomByLen, shouldRefresh } from '../pubUtils/util';
|
||||
import { oppPlayersInter, RankParam } from '../pubUtils/interface';
|
||||
import { gameData, getPLvByScore } from "../pubUtils/data";
|
||||
import { PVP } from '../pubUtils/dicParam';
|
||||
@@ -267,3 +267,15 @@ export async function findPvpDefByRoleId(roleId: string) {
|
||||
return {pvpDefense, warId};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取刷新对手次数及消耗
|
||||
export function getRefOppCnt(refOppCnt: number, refOppTime: Date) {
|
||||
let curTime = new Date();
|
||||
if(shouldRefresh(refOppTime, curTime, PVP_CONST.REFRESH_TIME)) {
|
||||
refOppCnt = 0; refOppTime = curTime;
|
||||
}
|
||||
return {
|
||||
refOppCnt, refOppTime,
|
||||
consume: gameData.pvpRefreshConsume.get(refOppCnt + 1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user