feat(活动): 节日活动-火神祭祀

This commit is contained in:
luying
2023-03-16 17:25:31 +08:00
parent f6a19fdc01
commit 04cecc2d5d
24 changed files with 566 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ import { recordGuildFund } from './timeLimitRankService';
import { filterGoods, isGoodsHidden, isHeroHidden } from '../dataService';
import { DicGiftPackagePlan } from '../../pubUtils/dictionary/DicGiftPackagePlan';
import { Floor, GiftPackageFloorModel } from '../../db/GiftPackageFloor';
import { isNumber } from 'underscore';
@@ -127,7 +128,7 @@ export function rewardItemData(reward: Array<RewardParam>) {
heroes.push({ hid: obj.id, count: obj.count })
break;
case ACTIVITY_RESOURCES_TYPE.GOODS:
goods.push({ id: obj.id, count: obj.count })
goods.push({ id: obj.id, count: obj.count, expireTime: obj.expireTime })
break;
case ACTIVITY_RESOURCES_TYPE.GIFTPACKAGE://配置成礼包会立刻兑换,配置成物品会把礼包放入背包中
let goodData = gameData.goods.get(obj.id);//礼包物品
@@ -274,15 +275,19 @@ async function randomSelectedData(pool: DicGiftPackagePlan[], roleId: string, gi
}
//数据格式转换'类型&id&数量|类型&id&数量|' ->> Array<RewardParam> 活动奖励
export function stringToRewardParam(rewardStr: string): Array<RewardParam> {
let result = new Array<{ type: number, id: number, count: number }>();
export function stringToRewardParam(rewardStr: string, expireTime?: number): Array<RewardParam> {
let result = new Array<{ type: number, id: number, count: number, expireTime?: number }>();
if (!rewardStr) return result;
let decodeArr = decodeArrayListStr(rewardStr);
for (let [type, id, count] of decodeArr) {
if (isNaN(parseInt(type)) || isNaN(parseInt(id)) || isNaN(parseInt(count))) {
continue;
}
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
if(expireTime && isNumber(expireTime)) {
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count), expireTime: Math.floor(expireTime/1000) });
} else {
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
}
}
return result
}