镇念塔:修复派遣任务无奖励显示
This commit is contained in:
@@ -85,7 +85,7 @@ export async function getTasks(role: RoleType) {
|
||||
let { roleId, roleName, towerLv, towerTaskRefTime, towerTaskReCnt = 0 } = role;
|
||||
|
||||
// towerLv:从1开始,下次打得层数,dicParam内的:从0开始,打过的层数
|
||||
if(towerLv - 1 <= dicParam.TOWER_SEARCH.TOWER_SEARCH_STARTLIMITED) {
|
||||
if(towerLv - 1 < dicParam.TOWER_SEARCH.TOWER_SEARCH_STARTLIMITED) {
|
||||
return {curTasks: [], refRemainTime: 0, nextCostGold: 0}
|
||||
}
|
||||
|
||||
@@ -415,16 +415,17 @@ export async function refreshTasks(towerLv: number, batchCode: string, roleId: s
|
||||
for(let i = 1; i <= dicParam.TOWER_SEARCH.TOWER_SEARCH_LIMITED; i++) {
|
||||
positions.set(i, null);
|
||||
}
|
||||
let tasks: TowerTaskRecType[] = [];
|
||||
for(let task of oldTasks) {
|
||||
if( task.status == TOWER_TASK_STATUS.WAITING ) {
|
||||
positions.set(task.position, task);
|
||||
} else {
|
||||
positions.delete(task.position);
|
||||
ridTaskIds.push(task.taskId);
|
||||
tasks.push(task);
|
||||
}
|
||||
}
|
||||
|
||||
let tasks: TowerTaskRecType[] = [];
|
||||
for(let [ position, task ] of positions) {
|
||||
let dicOldTask = task? gameData.towerTask.get(task.taskId): null;
|
||||
|
||||
@@ -506,12 +507,14 @@ export function getRemainTime(curTime: Date) {
|
||||
return Math.floor((nextTime - curTime.getTime()) / 1000);
|
||||
}
|
||||
|
||||
export function treatTask(recs: Array<any>, curTime: Date) {
|
||||
export function treatTask(recs: Array<TowerTaskRecType>, curTime: Date) {
|
||||
return recs.map(cur => {
|
||||
let { heroes, batchCode, taskId, taskCode, status, completeTime } = cur;
|
||||
let { heroes, batchCode, taskId, taskCode, status, completeTime, position } = cur;
|
||||
|
||||
let getStatusResult = getTaskStatus(status, completeTime, curTime);
|
||||
return { heroes, batchCode, taskId, taskCode, completeTime, ...getStatusResult }
|
||||
return { position, heroes, batchCode, taskId, taskCode, completeTime, ...getStatusResult }
|
||||
}).sort((a, b) => {
|
||||
return a.position - b.position;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { RScriptRecordModel } from '../db/RScriptRecord';
|
||||
import { setAp } from './actionPointService';
|
||||
import { resResult } from '../pubUtils/util';
|
||||
|
||||
export async function roleLevelup(roleId: string, kingExp: number, session: BackendSession) {
|
||||
export async function roleLevelup(roleId: string, kingExp: number = 0, session: BackendSession) {
|
||||
const serverId = session.get('serverId');
|
||||
const sid = session.get('sid');
|
||||
const funcs = session.get('funcs');
|
||||
|
||||
@@ -7,7 +7,7 @@ import { pushCalPlayerCe, pushCalAllHeroCe, calPlayerCeAndSave } from './playerC
|
||||
import { ItemModel } from '../db/Item';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { pinus } from 'pinus';
|
||||
import { addEquips, addBags, addSkin, addFigure, unlockFigure as pubUnlockFigure, createHeroes as pubCreateHeroes, transPiece } from '../pubUtils/itemUtils';
|
||||
import { addEquips, addBags, addSkin, addFigure, unlockFigure as pubUnlockFigure, createHeroes as pubCreateHeroes, transPiece, getGoldObject, getCoinObject, getApObject } from '../pubUtils/itemUtils';
|
||||
import { ItemInter, RewardInter, } from '../pubUtils/interface';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { uniq } from 'underscore';
|
||||
@@ -147,6 +147,16 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerDataChange', resResult(STATUS.SUCCESS, {
|
||||
gold: role.gold, coin: role.coin, ap: addAp
|
||||
}), uids);
|
||||
if(gold.length > 0) {
|
||||
let goldCount = gold.reduce((pre, cur) => { return pre + cur.count }, 0)
|
||||
showItems.push(getGoldObject(goldCount));
|
||||
}
|
||||
if(coin > 0) {
|
||||
showItems.push(getCoinObject(coin));
|
||||
}
|
||||
if(ap > 0) {
|
||||
showItems.push(getApObject(ap));
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 皮肤处理
|
||||
@@ -158,7 +168,6 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
|
||||
for (let skinId of skins) {//皮肤推送
|
||||
let result = await addSkin(roleId, roleName, skinId, false);
|
||||
console.log(result)
|
||||
if (!!result) {
|
||||
showItems.push({ id: skinId, count: 1 });
|
||||
figureInfos.push(result.figureInfo);
|
||||
|
||||
@@ -149,6 +149,13 @@ export function getCoinObject(count: number) {
|
||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.COIN), count };
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取体力物品 { id, count }
|
||||
* @param count 体力数量
|
||||
*/
|
||||
export function getApObject(count: number) {
|
||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.ACTION_POINT), count };
|
||||
}
|
||||
/**
|
||||
* @description 获取友情点物品 { id, count }
|
||||
* @param count 友情点数量
|
||||
|
||||
Reference in New Issue
Block a user