活动:修改活动bug
This commit is contained in:
@@ -30,6 +30,10 @@ export enum ACTIVITY_TYPE {
|
||||
DAILY_RMB_GIFTS = 22, // 每日特惠RMB购买,一次性购买7天礼包
|
||||
TREASURE_HUNT = 23, // 寻宝骑兵活动
|
||||
POP_UP_SHOP = 24, // 弹出商店
|
||||
FOURTEEN_DAY = 25, // 14天乐活动(虚)
|
||||
FOURTEEN_DAILY_DISCOUNT_GIFT = 26, // 14天乐活动,每日特惠礼包
|
||||
FOURTEEN_TASK_GROWTH = 27, // 14天乐成长任务活动
|
||||
FOURTEEN_TASK_DAILY_CHALLENGES = 28, // 14天乐今日挑战活动
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ export class GrowthFundItem {
|
||||
this.taskType = data.taskType;
|
||||
this.taskParam = data.taskParam;
|
||||
this.reward = data.reward;
|
||||
this.condition = data.conditon;
|
||||
this.condition = data.condition;
|
||||
this.isComplete = false;
|
||||
// this.isReceive = false;
|
||||
this.taskParamArray = splitString(data.taskParam, '&')
|
||||
@@ -80,10 +80,16 @@ export class GrowthFundData extends ActivityBase {
|
||||
break;
|
||||
}
|
||||
case ACTIVITY_TYPE.GROWTH_FUND_TOWER:
|
||||
case ACTIVITY_TYPE.GROWTH_FUND_TOWER_VIP:
|
||||
case ACTIVITY_TYPE.GROWTH_FUND_TOWER_VIP: {
|
||||
if (!this.isReceive(page.pageIndex, item.cellIndex) && item.condition <= condition) {
|
||||
item.isComplete = true;
|
||||
items.push(Object.assign(item, { pageIndex: page.pageIndex, activityId: this.activityId }))
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTIVITY_TYPE.GROWTH_FUND_MAIN_ELITE:
|
||||
case ACTIVITY_TYPE.GROWTH_FUND_MAIN_ELITE_VIP: {
|
||||
if (!this.isReceive(page.pageIndex, item.cellIndex) && item.condition <= condition) {
|
||||
if (!this.isReceive(page.pageIndex, item.cellIndex) && item.taskParamArray[1] <= condition) {
|
||||
item.isComplete = true;
|
||||
items.push(Object.assign(item, { pageIndex: page.pageIndex, activityId: this.activityId }))
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let taskArray = growthActivity.findTaskByType(taskType, growthActivity.today());
|
||||
for (let task of taskArray) {
|
||||
let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
||||
let recordData = taskRecord && taskRecord.data ? taskRecord.data : {}
|
||||
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
||||
if (addCount) {
|
||||
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE) {
|
||||
@@ -554,7 +554,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let taskArray = thirtyDaysActivity.findUncompleteTaskByType(taskType);
|
||||
for (let task of taskArray) {
|
||||
let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, thirtyDaysActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
||||
let recordData = taskRecord && taskRecord.data ? taskRecord.data : {}
|
||||
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
||||
if (addCount) {
|
||||
await ActivityThirtyDaysModel.addTaskCount(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.taskType, addCount);
|
||||
@@ -593,7 +593,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let buyRecords = await ActivityBuyRecordsModel.findRecordsByActivityId(activity.activityId, roleId);
|
||||
growthFundActivity.initBuyRecords(buyRecords);
|
||||
}
|
||||
let taskArray = growthFundActivity.unLockItem(parma.warId);
|
||||
let taskArray = growthFundActivity.unLockItem(parma.towerLv);
|
||||
//推送
|
||||
pushMessage = pushMessage.concat(taskArray);
|
||||
}
|
||||
@@ -609,7 +609,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let buyRecords = await ActivityBuyRecordsModel.findRecordsByActivityId(activity.activityId, roleId);
|
||||
growthFundActivity.initBuyRecords(buyRecords);
|
||||
}
|
||||
let taskArray = growthFundActivity.unLockItem(parma.warId);
|
||||
let taskArray = growthFundActivity.unLockItem(parma.mainEliteWarId);
|
||||
//推送
|
||||
pushMessage = pushMessage.concat(taskArray);
|
||||
}
|
||||
@@ -720,10 +720,10 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
||||
break;
|
||||
}
|
||||
if (recordData) {
|
||||
record = recordData;
|
||||
if (recordData.indexOf(hid) != -1) {
|
||||
break;
|
||||
}
|
||||
record = recordData;
|
||||
} else {
|
||||
record = [];
|
||||
}
|
||||
@@ -742,15 +742,20 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
||||
let hid = paramObj.hid;
|
||||
if (recordData) {
|
||||
record = recordData;
|
||||
if (record['hid']) {
|
||||
if (record['hid'] < param[1] && (record['hid'] + count >= param[1])) {
|
||||
let oldCount = record[hid];
|
||||
if (oldCount) {
|
||||
if (oldCount < param[1] && (oldCount + count >= param[1])) {
|
||||
addCount = count;
|
||||
record['hid'] += count;
|
||||
record[hid] = oldCount + count;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
record[hid] = count;
|
||||
}
|
||||
} else {
|
||||
record = {};
|
||||
record[hid] = count;
|
||||
}
|
||||
record['hid'] = count;
|
||||
break;
|
||||
}
|
||||
case TASK_TYPE.BATTLE_EXPEDITION:
|
||||
|
||||
@@ -1083,10 +1083,10 @@
|
||||
"id": 73,
|
||||
"name": "精英任务",
|
||||
"info": "精英通关第x关",
|
||||
"param": "warid&",
|
||||
"param": "count&warid&",
|
||||
"string": "关卡id",
|
||||
"content": 0,
|
||||
"condition": "warid",
|
||||
"condition": "count",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
|
||||
Reference in New Issue
Block a user