弹出礼包:pvp改为挑战次数
This commit is contained in:
@@ -131,7 +131,7 @@ export class PopUpShopHandler {
|
|||||||
newLv: param||100,
|
newLv: param||100,
|
||||||
quality: param||3,
|
quality: param||3,
|
||||||
warId: param||128,
|
warId: param||128,
|
||||||
score: param||10,
|
seasonWinNum: param||10,
|
||||||
equipStar: param||10
|
equipStar: param||10
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ export class PvpHandler {
|
|||||||
let myRank = await r.getMyRank({ roleId });
|
let myRank = await r.getMyRank({ roleId });
|
||||||
result.setMyRank(myRank);
|
result.setMyRank(myRank);
|
||||||
|
|
||||||
await checkTaskInPvpEnd(serverId, roleId, sid, isSuccess, pvpDefense.heroScores, pvpDefense.score);
|
await checkTaskInPvpEnd(serverId, roleId, sid, isSuccess, pvpDefense.heroScores, pvpDefense.seasonWinNum);
|
||||||
if(hisWinStreakNum < pvpDefense.hisWinStreakNum) {
|
if(hisWinStreakNum < pvpDefense.hisWinStreakNum) {
|
||||||
await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.PVP_WIN_SERIES, paramWinStreakNum: pvpDefense.hisWinStreakNum }]);
|
await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.PVP_WIN_SERIES, paramWinStreakNum: pvpDefense.hisWinStreakNum }]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,10 @@ export async function checkPopUpConditions(serverId: number, roleId: string, con
|
|||||||
map.get(item.param).push(item);
|
map.get(item.param).push(item);
|
||||||
}
|
}
|
||||||
for(let [_, items] of map) {
|
for(let [_, items] of map) {
|
||||||
|
let effectTimes = await pkg.getEffectTime();
|
||||||
let popUpShopRec = await ActivityPopUpShopModel.createRecord({
|
let popUpShopRec = await ActivityPopUpShopModel.createRecord({
|
||||||
serverId, activityId, roleId, id: pkg.id,
|
serverId, activityId, roleId, id: pkg.id,
|
||||||
...pkg.getEffectTime(),
|
...effectTimes,
|
||||||
items: items.map(item => new PopUpShopItem(item))
|
items: items.map(item => new PopUpShopItem(item))
|
||||||
});
|
});
|
||||||
let result = pkg.pushPackage(popUpShopRec);
|
let result = pkg.pushPackage(popUpShopRec);
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ export async function getParamStr(activity: ActivityModelType, productID: string
|
|||||||
} else {
|
} else {
|
||||||
let popUpShopRec = await ActivityPopUpShopModel.createRecord({
|
let popUpShopRec = await ActivityPopUpShopModel.createRecord({
|
||||||
serverId, activityId: activity.activityId, roleId, id: pkg.id,
|
serverId, activityId: activity.activityId, roleId, id: pkg.id,
|
||||||
...pkg.getEffectTime(),
|
...await pkg.getEffectTime(),
|
||||||
items: pkg.items.map(item => new PopUpShopItem(item))
|
items: pkg.items.map(item => new PopUpShopItem(item))
|
||||||
});
|
});
|
||||||
param['code'] = popUpShopRec.code;
|
param['code'] = popUpShopRec.code;
|
||||||
|
|||||||
@@ -208,14 +208,14 @@ export async function checkTaskInComBattleEnd(roleStatus: RoleStatus[], capId: s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: string, isSuccess: boolean, heroScores: HeroScores[], score: number) {
|
export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: string, isSuccess: boolean, heroScores: HeroScores[], seasonWinNum: number) {
|
||||||
let task = new CheckTask(serverId, roleId);
|
let task = new CheckTask(serverId, roleId);
|
||||||
task.setParam(TASK_TYPE.PVP_WIN, { isSuccess });
|
task.setParam(TASK_TYPE.PVP_WIN, { isSuccess });
|
||||||
task.setParam(TASK_TYPE.PVP_WIN_SERIES, { isSuccess });
|
task.setParam(TASK_TYPE.PVP_WIN_SERIES, { isSuccess });
|
||||||
task.setParam(TASK_TYPE.PVP_HERO_SCORE, { heroScores });
|
task.setParam(TASK_TYPE.PVP_HERO_SCORE, { heroScores });
|
||||||
await task.saveAndPush(sid);
|
await task.saveAndPush(sid);
|
||||||
if(score) {
|
if(seasonWinNum) {
|
||||||
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.PVP, { score }, sid);
|
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.PVP, { seasonWinNum }, sid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ export enum POP_UP_SHOP_REFRESH_TIME_TYPE {
|
|||||||
NATURAL_WEEK = 2, // 自然周
|
NATURAL_WEEK = 2, // 自然周
|
||||||
NATURAL_MONTH = 3, // 自然月
|
NATURAL_MONTH = 3, // 自然月
|
||||||
DAYS = 4, // 从beginTime开始固定日
|
DAYS = 4, // 从beginTime开始固定日
|
||||||
|
PVP = 5, // pvp赛季
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TREASURE_HUNT_DATA_TYPE {
|
export enum TREASURE_HUNT_DATA_TYPE {
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { RewardInter } from "../../pubUtils/interface";
|
|||||||
import { parseNumberList } from "../../pubUtils/util";
|
import { parseNumberList } from "../../pubUtils/util";
|
||||||
import { stringWithTypeToRewardInter } from "../../pubUtils/roleUtil";
|
import { stringWithTypeToRewardInter } from "../../pubUtils/roleUtil";
|
||||||
import { ActivityBase } from './activityField';
|
import { ActivityBase } from './activityField';
|
||||||
|
import { PVPConfigModel } from "../../db/SystemConfig";
|
||||||
|
import { nowSeconds } from "../../pubUtils/timeUtil";
|
||||||
|
|
||||||
// 数据库格式
|
// 数据库格式
|
||||||
interface PopUpShopDataInDb {
|
interface PopUpShopDataInDb {
|
||||||
@@ -20,7 +22,7 @@ interface PopUpShopPackageInDb {
|
|||||||
items: PopUpShopItemInDb[]; // 礼包
|
items: PopUpShopItemInDb[]; // 礼包
|
||||||
duration: number; // 礼包弹出之后,持续时间,单位小时
|
duration: number; // 礼包弹出之后,持续时间,单位小时
|
||||||
keyItem: PopUpShopKeyItemIbDb[]; // 关键资源限制,refreshDay内可以获得Y个
|
keyItem: PopUpShopKeyItemIbDb[]; // 关键资源限制,refreshDay内可以获得Y个
|
||||||
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天
|
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天 5-按pvp赛季
|
||||||
refreshDay: number; // 上面刷新时间的具体天数,refreshTimeType=0-3都不会使用这个参数,refreshTimeType=4时这个表示固定几天
|
refreshDay: number; // 上面刷新时间的具体天数,refreshTimeType=0-3都不会使用这个参数,refreshTimeType=4时这个表示固定几天
|
||||||
pushCnt: number; // 在自然日cd之内,总推送次数,不复现的填0,不限制这个使用其他限制的填-1(如passCnt填次数的时候,这里填-1)
|
pushCnt: number; // 在自然日cd之内,总推送次数,不复现的填0,不限制这个使用其他限制的填-1(如passCnt填次数的时候,这里填-1)
|
||||||
passCnt: number; // 弹出了没有购买多少次之后不再推送,默认填0
|
passCnt: number; // 弹出了没有购买多少次之后不再推送,默认填0
|
||||||
@@ -282,7 +284,7 @@ export class PopUpShopPackage {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEffectTime() {
|
public async getEffectTime() {
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
let beginTime = now;
|
let beginTime = now;
|
||||||
let endTime = moment(now).add(this.duration, 'h').toDate();
|
let endTime = moment(now).add(this.duration, 'h').toDate();
|
||||||
@@ -310,6 +312,11 @@ export class PopUpShopPackage {
|
|||||||
effectBeginTime = moment(this.parent.beginTime).startOf('d').add(n * this.refreshDay, 'd').add(REFRESH_TIME, 'h').toDate();
|
effectBeginTime = moment(this.parent.beginTime).startOf('d').add(n * this.refreshDay, 'd').add(REFRESH_TIME, 'h').toDate();
|
||||||
effectEndTime = moment(this.parent.beginTime).startOf('d').add((n + 1) * this.refreshDay, 'd').add(REFRESH_TIME, 'h').toDate();
|
effectEndTime = moment(this.parent.beginTime).startOf('d').add((n + 1) * this.refreshDay, 'd').add(REFRESH_TIME, 'h').toDate();
|
||||||
break;
|
break;
|
||||||
|
case POP_UP_SHOP_REFRESH_TIME_TYPE.PVP:
|
||||||
|
let pvpConfig = await PVPConfigModel.findCurPVPConfig();
|
||||||
|
effectBeginTime = new Date((pvpConfig?.seasonStartTime??nowSeconds()) * 1000);
|
||||||
|
effectEndTime = new Date((pvpConfig?.seasonEndTime??nowSeconds()) * 1000);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -412,7 +419,7 @@ export class PopShopItem {
|
|||||||
case POP_UP_SHOP_CONDITION_TYPE.MAIN_BATTLE:
|
case POP_UP_SHOP_CONDITION_TYPE.MAIN_BATTLE:
|
||||||
return param.warId == this.conditionParam[0];
|
return param.warId == this.conditionParam[0];
|
||||||
case POP_UP_SHOP_CONDITION_TYPE.PVP:
|
case POP_UP_SHOP_CONDITION_TYPE.PVP:
|
||||||
return param.score >= this.conditionParam[0];
|
return param.seasonWinNum >= this.conditionParam[0];
|
||||||
case POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR:
|
case POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR:
|
||||||
return param.equipStar >= this.conditionParam[0];
|
return param.equipStar >= this.conditionParam[0];
|
||||||
case POP_UP_SHOP_CONDITION_TYPE.AUCTION:
|
case POP_UP_SHOP_CONDITION_TYPE.AUCTION:
|
||||||
@@ -480,7 +487,7 @@ export interface PopUpConditionParamInter {
|
|||||||
newLv?: number;
|
newLv?: number;
|
||||||
quality?: number;
|
quality?: number;
|
||||||
warId?: number;
|
warId?: number;
|
||||||
score?: number;
|
seasonWinNum?: number;
|
||||||
equipStar?: number;
|
equipStar?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user