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