pvp:添加购买挑战次数
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
|
||||
import { getFuncsSwitch, gameData } from '../pubUtils/data';
|
||||
import { FUNCS_ID, FUNC_OPT_TYPE } from '../consts/constModules/sysConst';
|
||||
import { RoleModel } from '../db/Role';
|
||||
/**
|
||||
* 等级提升触发事件
|
||||
* @param roleId
|
||||
* @param lv
|
||||
* @param addFuncs
|
||||
* @param dataFuncs
|
||||
*/
|
||||
export async function eventOnPlayerLvUp(roleId: string, lv: number, addFuncs: Array<number>, dataFuncs: Array<number>) {
|
||||
|
||||
for(let [id, dicFunSwitch] of gameData.funcsSwitch) {
|
||||
if(dicFunSwitch.conditionType != FUNC_OPT_TYPE.LEVEL_UP) continue;
|
||||
if (dataFuncs.includes(id)) continue; // 已开启过了
|
||||
|
||||
if (dicFunSwitch && lv >= dicFunSwitch.param) {
|
||||
addFuncs.push(id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -331,15 +331,16 @@ export async function sendLastSeasonRewardIfNotSent(pvpDefense: PvpDefenseType)
|
||||
}
|
||||
|
||||
// 获取刷新对手次数及消耗
|
||||
export function refreshRefOppCnt(refOppCnt: number, setAttackCnt: number, refDaily: Date) {
|
||||
export function refreshRefOppCnt(pvpDefense: PvpDefenseType) {
|
||||
let { refOppCnt = 0, setAttackCnt = 0, buyAttackCnt = 0, refDaily } = pvpDefense;
|
||||
let curTime = new Date();
|
||||
let shouldRefOpp = shouldRefresh(refDaily, curTime);
|
||||
if (shouldRefOpp) {
|
||||
refOppCnt = 0; setAttackCnt = 0; refDaily = curTime;
|
||||
refOppCnt = 0; setAttackCnt = 0; buyAttackCnt =0; refDaily = curTime;
|
||||
}
|
||||
return {
|
||||
shouldRefOpp,
|
||||
refOppCnt, refDaily, setAttackCnt,
|
||||
refOppCnt, refDaily, setAttackCnt, buyAttackCnt,
|
||||
consume: gameData.pvpRefreshConsume.get(refOppCnt + 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user