弹出礼包:装备精炼计算方式修改

This commit is contained in:
luying
2022-10-01 17:30:46 +08:00
parent 963456b1ba
commit ee9bd6174e
5 changed files with 62 additions and 7 deletions
@@ -310,7 +310,7 @@ export class EquipHandler {
// console.log('### incEquipStarSum', incEquipStarSum)
let { curRole } = await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STAR, roleId, serverId, sid, hid, update, { ePlaceId, skinId: hero.skinId, roleIncUpdate: { equipStarSum: incEquipStarSum } });
await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar, curRole.equipStarSum, count, hero.skinId);
checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar, count, hero.skinId);
pushEquipStarMax(roleId, roleName, serverId, hid, newEquip, isUpStar);
const curHero = {
@@ -14,6 +14,7 @@ import { getRandEelm, getRandSingleEelm } from '../../pubUtils/util';
import { getAllOnlineRoles } from '../redisService';
import { GachaResultIndb } from '../../domain/activityField/gachaField';
import { gameData } from '../../pubUtils/data';
import { ActivityPopUpShopRecModel } from '../../db/ActivityPopUpShopRec';
/**
* 玩家活动数据
@@ -98,8 +99,15 @@ export async function checkPopUpConditions(serverId: number, roleId: string, con
if( !pkg.checkPackageCanPush(conditionType)) { // 筛选推送
continue;
}
let effectTimes = await pkg.getEffectTime();
if(conditionType == POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR) {
let result = await ActivityPopUpShopRecModel.addRecord(serverId, activityId, roleId, pkg.id, effectTimes.effectBeginTime, effectTimes.effectEndTime, conditionType, param.equipStar);
param.equipStarSum = result.num;
}
let items = pkg.getItemsByCondition(param);
if(items.length > 0) {
let map = new Map<string, PopShopItem[]>();
for(let item of items) {
if(!map.has(item.param)) {
@@ -108,7 +116,6 @@ export async function checkPopUpConditions(serverId: number, roleId: string, con
map.get(item.param).push(item);
}
for(let [_, items] of map) {
let effectTimes = await pkg.getEffectTime();
let popUpShopRec = await ActivityPopUpShopModel.createRecord({
serverId, activityId, roleId, id: pkg.id,
...effectTimes,
@@ -120,12 +127,12 @@ export async function checkPopUpConditions(serverId: number, roleId: string, con
}
}
}
console.log('##### 5', pushItems.length)
// console.log('##### 5', pushItems.length)
if(pushItems.length > 0) {
pushData.push({ activityId, activityType, param: { popUpShopItems: pushItems } });
}
}
console.log('##### 6', pushData.length)
// console.log('##### 6', pushData.length)
return await pushActivities(pushData, roleId, sid);
}
+3 -2
View File
@@ -20,6 +20,7 @@ import { checkPopUpCondition, checkPopUpConditionInCreateHero, checkPopUpConditi
import { sendMessageToUserWithSuc } from '../pushService';
import { getGoldId } from '../role/rewardService';
import { GachaResultIndb } from '../../domain/activityField/gachaField';
import { ActivityPopUpShopRecModel } from '../../db/ActivityPopUpShopRec';
export async function checkTaskWithRoles(serverId: number, roleId: string, sid: string, taskType: TASK_TYPE, roles: RoleType[]) {
for (let role of roles) {
@@ -269,7 +270,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, equipStarSum: number, count: number, skinId: number) {
export async function checkTaskInEquipStarUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpStar: boolean, count: number, skinId: number) {
let task = new CheckTask(serverId, roleId);
if(isUpStar) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
@@ -280,7 +281,7 @@ export async function checkTaskInEquipStarUp(serverId: number, roleId: string, s
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT_SUM, { count });
await task.saveAndPush(sid);
if(isUpStar) {
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR, { equipStar: equipStarSum }, sid);
checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.EQUIP_STAR, { equipStar: count }, sid);
}
}