七天乐:升星任务
This commit is contained in:
@@ -288,6 +288,7 @@ export class CheckSingleTask {
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityThirtyDaysModel.setOrIncTask(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.tab, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
task.setPlayerRecord(rec);
|
||||
this.addActivityTaskPushMessage({ ...task, totalCount: rec.totalCount, activityId });
|
||||
}
|
||||
}
|
||||
@@ -394,7 +395,7 @@ export class CheckSingleTask {
|
||||
let records = await getRecord();
|
||||
let count = 0, index = -1;
|
||||
for(let i = 0; i < records.length; i++) {
|
||||
let arr = records[i].split('|');
|
||||
let arr = records[i].split('_');
|
||||
if(parseInt(arr[0]) == hero.hid) {
|
||||
count = parseInt(arr[1]);
|
||||
index = i;
|
||||
@@ -470,7 +471,7 @@ export class CheckSingleTask {
|
||||
let records = await getRecord();
|
||||
let count = 0, index = -1;
|
||||
for(let i = 0; i < records.length; i++) {
|
||||
let arr = records[i].split('|');
|
||||
let arr = records[i].split('_');
|
||||
if(parseInt(arr[0]) == hero.hid) {
|
||||
count = parseInt(arr[1]);
|
||||
index = i;
|
||||
@@ -519,7 +520,7 @@ export class CheckSingleTask {
|
||||
let records = await getRecord();
|
||||
let count = 0, index = -1;
|
||||
for(let i = 0; i < records.length; i++) {
|
||||
let arr = records[i].split('|');
|
||||
let arr = records[i].split('_');
|
||||
if(parseInt(arr[0]) == hero.hid) {
|
||||
count = parseInt(arr[1]);
|
||||
index = i;
|
||||
@@ -1001,11 +1002,11 @@ export class CheckSingleTask {
|
||||
}
|
||||
case TASK_TYPE.EQUIP_STAR_UP_CNT: // 91. x件装备升星X次
|
||||
{
|
||||
let { hid, ePlaceId } = param;
|
||||
let { hid, ePlaceId, count: paramCount } = param;
|
||||
let records = await getRecord();
|
||||
let count = 0, index = -1;
|
||||
for(let i = 0; i < records.length; i++) {
|
||||
let arr = records[i].split('|');
|
||||
let arr = records[i].split('_');
|
||||
if(parseInt(arr[0]) == hid && parseInt(arr[1]) == ePlaceId) {
|
||||
count = parseInt(arr[2]);
|
||||
index = i;
|
||||
@@ -1014,11 +1015,11 @@ export class CheckSingleTask {
|
||||
}
|
||||
|
||||
if(index == -1) {
|
||||
records.push(`${hid}_${ePlaceId}_${count + 1}`);
|
||||
records.push(`${hid}_${ePlaceId}_${count + paramCount}`);
|
||||
} else {
|
||||
records[index] = `${hid}_${ePlaceId}_${count + 1}`;
|
||||
records[index] = `${hid}_${ePlaceId}_${count + paramCount}`;
|
||||
}
|
||||
if(count + 1 >= dicTaskParam[1]) {
|
||||
if(count < dicTaskParam[1] && count + paramCount >= dicTaskParam[1]) {
|
||||
result = { inc: 1, records }
|
||||
} else {
|
||||
result = { records }
|
||||
|
||||
@@ -225,7 +225,7 @@ export async function checkTaskInEquipStarUp(serverId: number, roleId: string, s
|
||||
task.setParam(TASK_TYPE.EQUIP_STAR_UP_TO, { oldEquip, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_SUIT_SEID_NUM, { oldEplace, newEplace, ePlaceId, hid });
|
||||
}
|
||||
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT, { hid, ePlaceId });
|
||||
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT, { hid, ePlaceId, count });
|
||||
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT_SUM, { count });
|
||||
await task.saveAndPush(sid);
|
||||
if(isUpStar) {
|
||||
|
||||
@@ -117,7 +117,6 @@ export const PUSH_ROUTE = {
|
||||
GUILD_RACE_UPDATE: 'onRaceHorseUpdate', /// 更新木牛流马
|
||||
GUILD_RACE_JOIN: 'onRaceHorseJoin',
|
||||
GUILD_RACE_EVENT: 'onRaceEventUpdate', /// 更新木牛流马
|
||||
GUILD_POP_UP_ACTIVITY: 'onActivityTaskUpdate', /// 向军团成员发送弹窗礼包
|
||||
GUILD_TRAIN_RESET: 'onGuildTainReset', // 试炼场重置
|
||||
GUILD_BOSS_ENCOURAGE: 'onGuildBossEncourage', // 鼓舞
|
||||
ACTIVITY_UPDATE: 'onActivityUpdate',
|
||||
|
||||
@@ -42,6 +42,10 @@ export default class Activity_Daily_Challenges extends BaseModel {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.inc, param.records);
|
||||
} else if (param.records){
|
||||
let result: ActivityDailyChallengesModelType = await ActivityDailyChallengesModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $set: { records: param.records, taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,12 @@ export class ThirtyDaysItem {
|
||||
this.taskParamArray = splitString(data.taskParam, '&')
|
||||
}
|
||||
|
||||
public setPlayerRecord(record: ActivityThirtyDaysModelType) {
|
||||
this.isReceive = record.isReceive === true;
|
||||
this.totalCount = record.totalCount ? record.totalCount : 0;
|
||||
this.isComplete = record.totalCount >= this.condition;
|
||||
}
|
||||
|
||||
public canReceive(): boolean {
|
||||
return !this.isReceive;
|
||||
}
|
||||
@@ -215,9 +221,7 @@ export class ThirtyDaysData extends ActivityBase {
|
||||
for (let record of data) {
|
||||
let itemData = this.findThirtyDaysItem(record.pageIndex, record.cellIndex, record.tab)
|
||||
if (itemData) {
|
||||
itemData.isReceive = record.isReceive === true;
|
||||
itemData.totalCount = record.totalCount ? record.totalCount : 0;
|
||||
itemData.isComplete = record.totalCount >= itemData.condition;
|
||||
itemData.setPlayerRecord(record);
|
||||
if (itemData.isReceive) {
|
||||
this.totalPoint += itemData.point;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user