弹出礼包:金将类型逻辑
This commit is contained in:
@@ -99,7 +99,7 @@ export class GachaHandler {
|
||||
});
|
||||
|
||||
await UserGachaRecModel.createRec(roleId, gachaId, activityId, count, resultList);
|
||||
await checkTaskInGacha(serverId, roleId, sid, count, resultHeroes);
|
||||
await checkTaskInGacha(serverId, roleId, sid, count, resultHeroes, resultList, false);
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
gachaId, activityId,
|
||||
freeCount, refFreeTime: userGacha.refFreeTime, count: userGacha.count, point: userGacha.point, floor, hope,
|
||||
@@ -464,7 +464,7 @@ export class GachaHandler {
|
||||
await UserGachaRecModel.createRec(roleId, gachaId, 0, count, resultList);
|
||||
|
||||
// 任务
|
||||
await checkTaskInGacha(serverId, roleId, sid, count, resultHeroes);
|
||||
await checkTaskInGacha(serverId, roleId, sid, count, resultHeroes, resultList, true);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
hasInit: !!role.gachaHasGuide,
|
||||
|
||||
@@ -12,6 +12,8 @@ import { HeroType } from '../../db/Hero';
|
||||
import { pinus } from 'pinus';
|
||||
import { getRandEelm, getRandSingleEelm } from '../../pubUtils/util';
|
||||
import { getAllOnlineRoles } from '../redisService';
|
||||
import { GachaResult } from '../../domain/activityField/gachaField';
|
||||
import { gameData } from '../../pubUtils/data';
|
||||
|
||||
/**
|
||||
* 玩家活动数据
|
||||
@@ -42,8 +44,11 @@ export async function getPopUpShopDataShow(activityId: number, serverId: number,
|
||||
return null
|
||||
}
|
||||
|
||||
export async function checkPopUpConditionInCreateHero(serverId: number, roleId: string, heroes: HeroType[]) {
|
||||
let conditions = heroes.map(hero => ({ conditionType: POP_UP_SHOP_CONDITION_TYPE.GET_HERO_BY_QUALITY, param: { quality: hero.quality } }));
|
||||
export async function checkPopUpConditionInCreateHero(serverId: number, roleId: string, result: GachaResult[]) {
|
||||
let conditions = result.map(gachaResult => {
|
||||
let dicHero = gameData.hero.get(gachaResult?.hid);
|
||||
return { conditionType: POP_UP_SHOP_CONDITION_TYPE.GET_HERO_BY_QUALITY, param: { quality: dicHero?.quality } };
|
||||
});
|
||||
return await checkPopUpConditions(serverId, roleId, conditions);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import { JewelType } from '../../db/Jewel';
|
||||
import { checkPopUpCondition, checkPopUpConditionInCreateHero, checkPopUpConditionInEntry } from '../activity/popUpShopService';
|
||||
import { sendMessageToUserWithSuc } from '../pushService';
|
||||
import { getGoldId } from '../role/rewardService';
|
||||
import { GachaResult } from '../../domain/activityField/gachaField';
|
||||
|
||||
export async function checkTaskWithRoles(serverId: number, roleId: string, sid: string, taskType: TASK_TYPE, roles: RoleType[]) {
|
||||
for (let role of roles) {
|
||||
@@ -57,7 +58,6 @@ export async function checkTaskInCreateHero(serverId: number, roleId: string, si
|
||||
task.setParam(TASK_TYPE.HERO_QUALITY_STAR_UP, { heroes });
|
||||
task.setParam(TASK_TYPE.HERO_LV, { heroes });
|
||||
await task.saveAndPush(sid);
|
||||
await checkPopUpConditionInCreateHero(serverId, roleId, heroes);
|
||||
}
|
||||
|
||||
export async function checkTaskInHeroStarUp(serverId: number, roleId: string, sid: string, hero: HeroType, oldStar: number) {
|
||||
@@ -219,11 +219,12 @@ export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: s
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkTaskInGacha(serverId: number, roleId: string, sid: string, count: number, heroes: HeroType[]) {
|
||||
export async function checkTaskInGacha(serverId: number, roleId: string, sid: string, count: number, heroes: HeroType[], result: GachaResult[], isGuide: boolean) {
|
||||
let task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.GACHA, { count });
|
||||
task.setParam(TASK_TYPE.GACHA_QUALITY_COUNT, { heroes });
|
||||
await task.saveAndPush(sid);
|
||||
if(!isGuide) checkPopUpConditionInCreateHero(serverId, roleId, result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ import { RewardInter } from "./interface";
|
||||
import { CreateHeroParam } from "../domain/roleField/hero";
|
||||
import { ACTIVITY_RESOURCES_TYPE } from "../consts";
|
||||
import { gameData } from "./data";
|
||||
import { ActivityTaskPassModel } from "@db/ActivityTaskPass";
|
||||
import { ActivityTaskPassModel } from "../db/ActivityTaskPass";
|
||||
|
||||
export async function deletRole(roleId: string) {
|
||||
let role = await RoleModel.findByRoleId(roleId, null, true, true);
|
||||
|
||||
Reference in New Issue
Block a user