任务:修复任务无法达成bug
This commit is contained in:
@@ -260,7 +260,7 @@ export async function handleComBtlProgress(teamStatus, robotHurtTimer: Map<strin
|
||||
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result}));
|
||||
|
||||
// 任务
|
||||
await checkTaskInComBattleEnd(roleIds, capId, quality);
|
||||
await checkTaskInComBattleEnd(roleIds.filter(roleId => {}), capId, quality);
|
||||
|
||||
teamMap.delete(teamCode);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export async function changeEquip(roleId: string, sid: string, equipA: EquipType
|
||||
if (!!hid) //需要卸下或者替换的武将
|
||||
heroB = await HeroModel.findByHidAndRoleWithEquip(hid, roleId);//需要替换的武将
|
||||
|
||||
if (!!equipA) {//需要卸下的装备
|
||||
if (!!equipA) {//需要卸下的装备
|
||||
if (!!heroB) {
|
||||
let goodInfo = getGoodById(equipA.id);
|
||||
if (goodInfo.lvLimited > heroB.lv) {
|
||||
@@ -76,8 +76,10 @@ export async function changeEquip(roleId: string, sid: string, equipA: EquipType
|
||||
let res = await dressEquip(roleId, sid, heroB, equipA, funcs);//替换给武将,并计算战力
|
||||
return res;
|
||||
} else {
|
||||
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
|
||||
return res;
|
||||
if(equipB) {
|
||||
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} else if (!!heroB) {//从穿戴装备的武将上卸下装备
|
||||
await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
|
||||
@@ -99,8 +101,8 @@ export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, he
|
||||
|
||||
// 任务
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.EQUIP_SUM, 1, true, {});
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [1]);
|
||||
await checkTaskWithEquip(roleId, sid, funcs, TASK_TYPE.EQUIP_QUALITY, equip, [1]);
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [-1]);
|
||||
await checkTaskWithEquip(roleId, sid, funcs, TASK_TYPE.EQUIP_QUALITY, equip, [-1]);
|
||||
|
||||
return { seqId: equip.seqId, hid: 0};
|
||||
}
|
||||
@@ -119,8 +121,8 @@ export async function dressEquip(roleId: string, sid: string, hero:HeroType, equ
|
||||
|
||||
// 任务
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.EQUIP_SUM, -1, true, {});
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [-1]);
|
||||
await checkTaskWithEquip(roleId, sid, funcs, TASK_TYPE.EQUIP_QUALITY, equip, [-1]);
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [1]);
|
||||
await checkTaskWithEquip(roleId, sid, funcs, TASK_TYPE.EQUIP_QUALITY, equip, [1]);
|
||||
|
||||
return { seqId: equip.seqId, hid: hero.hid };
|
||||
}
|
||||
@@ -31,7 +31,8 @@ export async function increaseFrdCnt(role1: RoleType, role2: RoleType, originalF
|
||||
return getResStr(STATUS.FRIEND_THEY_CNT_MAX);
|
||||
}
|
||||
originalFriendCnt = incMyFrdCnt.friendCnt;
|
||||
role1 = incMyFrdCnt; role2 = incHisFrdCnt;
|
||||
role1.friendCnt = incMyFrdCnt.friendCnt;
|
||||
role2.friendCnt = incHisFrdCnt.friendCnt;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export async function switchOnFunc(roleId: string, type: number, param: number,
|
||||
*/
|
||||
export async function chackFunOpenWhenLogin(role: any, session: BackendSession|FrontendSession) {
|
||||
await switchOnFunc(role.roleId, FUNC_OPT_TYPE.LEVEL_UP, role.lv, session);
|
||||
|
||||
await checkResetTrain(role.roleId, role.serverId);
|
||||
await getUserGuildWithRefActive(role.roleId, '', true)
|
||||
}
|
||||
@@ -209,8 +209,10 @@ function getPoolByHope(hope: Hope[], qualtiy: number) {
|
||||
let hopeMap = new Map<number, Hope>();
|
||||
let hasGetHope: number[] = [];
|
||||
for(let h of hope) {
|
||||
hopeMap.set(h.id, h);
|
||||
if(h.hasGet) hasGetHope.push(h.id);
|
||||
if(h.hid > 0) {
|
||||
hopeMap.set(h.id, h);
|
||||
if(h.hasGet) hasGetHope.push(h.id);
|
||||
}
|
||||
}
|
||||
|
||||
let list = gameData.gachaHope.map(cur => {
|
||||
|
||||
@@ -312,7 +312,7 @@ export async function pushFigureUpdate(roleId: string, sid: string, figureInfo:
|
||||
* @param serverId
|
||||
* @param heroInfo
|
||||
*/
|
||||
export async function createHeroes(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam[]) {
|
||||
export async function createHeroes(roleId: string, roleName: string, sid: string, serverId: number, funcs: number[], heroInfo: CreateHeroParam[]) {
|
||||
|
||||
let hids = heroInfo.map(cur => cur.hid);
|
||||
let userHeroesMap = await HeroModel.findMapByHidRange(hids, roleId);
|
||||
@@ -332,7 +332,7 @@ export async function createHeroes(roleId: string, roleName: string, sid: string
|
||||
let resultHeroes: HeroType[] = [], resultItems: ItemInter[] = [];
|
||||
if(newHeroInfo.length > 0) {
|
||||
|
||||
let { heroes, role, figureInfo, calHeroResults, calAllHeroResults, taskPushMessage } = await pubCreateHeroes(roleId, roleName, serverId, newHeroInfo);
|
||||
let { heroes, role, figureInfo, calHeroResults, calAllHeroResults, taskPushMessage } = await pubCreateHeroes(roleId, roleName, serverId, newHeroInfo, funcs);
|
||||
|
||||
let r = new Rank(REDIS_KEY.HERO_NUM_RANK, { serverId });
|
||||
await r.setRankWithRoleInfo(roleId, role.heroNum, role.heroNumUpdatedAt, role);
|
||||
@@ -357,7 +357,7 @@ export async function createHeroes(roleId: string, roleName: string, sid: string
|
||||
return { heroes: resultHeroes, goods: resultItems }
|
||||
}
|
||||
|
||||
export async function createHero(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam) {
|
||||
let result = await createHeroes(roleId, roleName, sid, serverId, [heroInfo]);
|
||||
export async function createHero(roleId: string, roleName: string, sid: string, serverId: number, funcs: number[], heroInfo: CreateHeroParam) {
|
||||
let result = await createHeroes(roleId, roleName, sid, serverId, funcs, [heroInfo]);
|
||||
return result;
|
||||
}
|
||||
@@ -92,6 +92,7 @@ export async function checkTaskInBattleEnd(roleId: string, sid: string, funcs: n
|
||||
}
|
||||
|
||||
export async function checkTaskInComBattleEnd(roleIds: string[], capId: string, quality: number) {
|
||||
console.log('********', roleIds, capId, quality)
|
||||
for (let roleId of roleIds) {
|
||||
if (roleId == capId && roleIds.length > 1) { // 招募队友
|
||||
await checkTask(roleId, null, null, TASK_TYPE.COM_BATTLE_CREATE_TEAM, 1, true, {});
|
||||
|
||||
Reference in New Issue
Block a user