活动:弹窗活动新类型

This commit is contained in:
luying
2022-04-20 21:37:51 +08:00
parent 7b3b826167
commit 1913a4a2b9
13 changed files with 128 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
import { RoleModel, RoleType } from '../../db/Role';
import { pinus, FrontendOrBackendSession } from 'pinus';
import { resResult, shouldRefresh } from '../../pubUtils/util';
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE, WAR_TYPE, PUSH_ROUTE } from '../../consts';
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE, WAR_TYPE, PUSH_ROUTE, POP_UP_SHOP_CONDITION_TYPE } from '../../consts';
import { TaskParamInter, TaskListReturn } from '../../domain/roleField/task';
import { EPlace, HeroType } from '../../db/Hero';
import { HeroScores } from '../../db/PvpHistoryOpp';
@@ -16,7 +16,7 @@ import { getActivities } from '../activity/activityService';
import { CheckTask } from './taskObj';
import { getEquipById } from '../equipService';
import { JewelType } from '../../db/Jewel';
import { checkPopUpConditionInCreateHero } from '../activity/popUpShopService';
import { checkPopUpCondition, checkPopUpConditionInCreateHero, checkPopUpConditionInEntry } from '../activity/popUpShopService';
import { sendMessageToUserWithSuc } from '../pushService';
export async function checkTaskWithRoles(serverId: number, roleId: string, sid: string, taskType: TASK_TYPE, roles: RoleType[]) {
@@ -46,6 +46,7 @@ export async function checkTaskInEntry(serverId: number, roleId: string, sid: st
task.setParam(TASK_TYPE.LOGIN_SUM, {});
task.setParam(TASK_TYPE.LOGIN_SERIES, {});
await task.saveAndPush(sid);
checkPopUpConditionInEntry(serverId, roleId, sid);
}
export async function checkTaskInCreateHero(serverId: number, roleId: string, sid: string, heroNum: number, heroes: HeroType[]) {
@@ -122,6 +123,10 @@ export async function checkTaskInGuildTrain(serverId: number, roleId: string, si
task.setParam(TASK_TYPE.BATTLE_EXPEDITION, { warId, count: 1 });
task.setParam(TASK_TYPE.BATTLE_MAIN_ELITE, { warId, count: 1 });
await task.saveAndPush(sid);
let dicWar = gameData.war.get(warId);
if(dicWar && dicWar.warType == WAR_TYPE.NORMAL) {
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.MAIN_BATTLE, { warId }, sid);
}
}
@@ -157,12 +162,15 @@ export async function checkTaskInComBattleStart(roleStatus: RoleStatus[], capId:
}
}
export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: string, isSuccess: boolean, heroScores: HeroScores[]) {
export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: string, isSuccess: boolean, heroScores: HeroScores[], myRank: number) {
let task = new CheckTask(serverId, roleId);
task.setParam(TASK_TYPE.PVP_WIN, { isSuccess });
task.setParam(TASK_TYPE.PVP_WIN_SERIES, { isSuccess });
task.setParam(TASK_TYPE.PVP_HERO_SCORE, { heroScores });
await task.saveAndPush(sid);
if(myRank) {
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.PVP, { rank: myRank }, sid);
}
}
export async function checkTaskInGacha(serverId: number, roleId: string, sid: string, count: number, heroes: HeroType[]) {
@@ -207,7 +215,7 @@ export async function checkTaskInPutStone(serverId: number, roleId: string, sid:
await task.saveAndPush(sid);
}
export async function checkTaskInEquipStarUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpStar: boolean) {
export async function checkTaskInEquipStarUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpStar: boolean, equipStarSum: number) {
let task = new CheckTask(serverId, roleId);
if(isUpStar) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
@@ -216,6 +224,9 @@ export async function checkTaskInEquipStarUp(serverId: number, roleId: string, s
}
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT, { hid, ePlaceId });
await task.saveAndPush(sid);
if(isUpStar) {
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR, { equipStar: equipStarSum }, sid);
}
}
export async function checkTaskInEquipQualityUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpQuality: boolean) {