活动:添加新任务类型
This commit is contained in:
@@ -19,6 +19,10 @@ export class TreasureHuntHandler {
|
|||||||
/************************寻宝骑兵活动****************************/
|
/************************寻宝骑兵活动****************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 每日物资:商店
|
||||||
|
寻宝备战:完成任务获得奖励,(奖品达到一定数量后开启 “寻宝大冒险”)
|
||||||
|
寻宝大冒险:完成战棋关卡获得奖励
|
||||||
|
天子宝库:物品兑换奖励
|
||||||
* @description 获取寻宝骑兵活动的数据
|
* @description 获取寻宝骑兵活动的数据
|
||||||
* @param {BackendSession} session
|
* @param {BackendSession} session
|
||||||
* @memberof TreasureHuntHandler
|
* @memberof TreasureHuntHandler
|
||||||
@@ -64,7 +68,7 @@ export class TreasureHuntHandler {
|
|||||||
if (!item) {
|
if (!item) {
|
||||||
return resResult(STATUS.ACTIVITY_MISSING, {});
|
return resResult(STATUS.ACTIVITY_MISSING, {});
|
||||||
}
|
}
|
||||||
if (item.price >= 0) {
|
if (item.price > 0) {
|
||||||
return resResult(STATUS.ACTIVITY_NEED_PAY, {});
|
return resResult(STATUS.ACTIVITY_NEED_PAY, {});
|
||||||
}
|
}
|
||||||
if (item.buyCount >= item.countMax) {
|
if (item.buyCount >= item.countMax) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export async function getPlayerTreasureHuntData(activityId: number, serverId: nu
|
|||||||
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
||||||
playerData.roundIndex = huntRoundIndex;
|
playerData.roundIndex = huntRoundIndex;
|
||||||
|
|
||||||
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(serverId, activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
||||||
playerData.shop.setPlayerRecords(playerShopRecord);
|
playerData.shop.setPlayerRecords(playerShopRecord);
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ export async function getPlayerTreasureHuntShopData(activityId: number, serverId
|
|||||||
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
||||||
playerData.roundIndex = huntRoundIndex;
|
playerData.roundIndex = huntRoundIndex;
|
||||||
|
|
||||||
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(serverId, activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
||||||
playerData.shop.setPlayerRecords(playerShopRecord);
|
playerData.shop.setPlayerRecords(playerShopRecord);
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class Activity_Treasure_Hunt_Shop extends ActivityShop {
|
|||||||
dayIndex: number; // 第几天
|
dayIndex: number; // 第几天
|
||||||
|
|
||||||
//根据活动id查询活动数据
|
//根据活动id查询活动数据
|
||||||
public static async findTreasureData(_serverId: number, activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
|
public static async findTreasureData(activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
|
||||||
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOne({ roleId, activityId, roundIndex, dayIndex }).lean(true);
|
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOne({ roleId, activityId, roundIndex, dayIndex }).lean(true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export class GrowthData extends ActivityBase {
|
|||||||
|
|
||||||
//解析玩家领取记录
|
//解析玩家领取记录
|
||||||
public async setPlayerRecords(data: ActivityGrowthModelType[], roleId: string, userHeroes: HeroType[]) {
|
public async setPlayerRecords(data: ActivityGrowthModelType[], roleId: string, userHeroes: HeroType[]) {
|
||||||
let { heroNum } = await RoleModel.findByRoleId(roleId);
|
let { heroNum, towerLv } = await RoleModel.findByRoleId(roleId);
|
||||||
for (let obj of this.list) {
|
for (let obj of this.list) {
|
||||||
let index = data.findIndex(record => { return obj.dayIndex == record.dayIndex && obj.cellIndex == record.cellIndex })
|
let index = data.findIndex(record => { return obj.dayIndex == record.dayIndex && obj.cellIndex == record.cellIndex })
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@@ -130,6 +130,8 @@ export class GrowthData extends ActivityBase {
|
|||||||
let lv = obj.taskParamArray[1];
|
let lv = obj.taskParamArray[1];
|
||||||
let heroes = userHeroes.filter(hero => { return hero.lv >= lv })
|
let heroes = userHeroes.filter(hero => { return hero.lv >= lv })
|
||||||
obj.totalCount = heroes.length;
|
obj.totalCount = heroes.length;
|
||||||
|
} else if (obj.taskType === TASK_TYPE.BATTLE_TOWER_LV) {
|
||||||
|
obj.totalCount = towerLv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export class TreasureHuntShopData {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let item of this.list) {
|
for (let item of this.list) {
|
||||||
let buyRecords = record.records.filter(obj => { obj.id === item.cellIndex });
|
let buyRecords = record.records.filter(obj => { return obj.id === item.cellIndex });
|
||||||
item.buyCount = buyRecords.length;
|
item.buyCount = buyRecords.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -696,7 +696,7 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TASK_TYPE.BATTLE_MAIN:
|
case TASK_TYPE.BATTLE_MAIN:
|
||||||
addCount = param[0] == paramObj.warId ? 1 : 0;
|
addCount = (param[1] == paramObj.warId) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case TASK_TYPE.EQUIP_JEWEL_SUM:
|
case TASK_TYPE.EQUIP_JEWEL_SUM:
|
||||||
addCount = count;
|
addCount = count;
|
||||||
@@ -794,6 +794,11 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
|||||||
addCount = count;
|
addCount = count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TASK_TYPE.BATTLE_TOWER_LV://{towerLv}
|
||||||
|
{
|
||||||
|
addCount = paramObj.towerLv;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
addCount = 0;
|
addCount = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user