初始:修复提前初始远征数据bug

This commit is contained in:
luying
2021-06-24 15:18:09 +08:00
parent de89b01886
commit bdd7edaeaf
6 changed files with 28 additions and 21 deletions

View File

@@ -33,6 +33,7 @@ export class ExpeditionBattleHandler {
let roleName = session.get('roleName');
let res = await getExpeditionStatus(roleId, roleName);
if(!res) return resResult(STATUS.ROLE_IS_NOT_INIT);
return resResult(STATUS.SUCCESS, res);
}

View File

@@ -90,7 +90,7 @@ export class EntryHandler {
checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SUM, role);
checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SERIES, role);
// 推送数据
pushData(role, session);
if(role.hasInit) pushData(role, session);
role['heros'] = heros;
role['equips'] = equips;

View File

@@ -20,6 +20,7 @@ import { checkTaskWithHero, checkTask, checkTaskWithArgs, checkActivityTask } fr
import { getGoldObject, getCoinObject } from '../../../pubUtils/itemUtils';
import { RScriptRecordModel } from '../../../db/RScriptRecord';
import { checkPvp } from '../../../services/pvpService';
import { pushData } from '../../../services/connectorService';
export default function (app: Application) {
return new RoleHandler(app);
@@ -63,6 +64,7 @@ export class RoleHandler {
await RScriptRecordModel.setScript(roleId, battleId, warInfo.warType, 2, SCRIPT.SCRIPT_NAME);
await checkPvp(role);
return resResult(STATUS.SUCCESS, {
roleId, roleName, heroes
})

View File

@@ -51,7 +51,7 @@ export async function pushData(role: RoleType, session: FrontendOrBackendSession
modules.push('auction', 'train', 'boss', 'wishPool', 'guildActivity', 'donate');
}
let notIncludeModule: string[] = [];
if (pushType == 'refresh') {
if (pushType == 'refresh') { // 每天5点刷新的时候不推送
notIncludeModule = ['rank', 'mail', 'school', 'auction', 'train', 'chat', 'battle'];
}

View File

@@ -18,6 +18,9 @@ import { ExpeditionRecordModel } from '../db/ExpeditionRecord';
* @param roleName
*/
export async function getExpeditionStatus(roleId: string, roleName: string) {
// 重置次数
let role = await RoleModel.findByRoleId(roleId);
if(!role.hasInit) return false
// 获取远征关卡状态
let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId);
if (!expeditionRecord) { // 首次新建一条记录
@@ -37,8 +40,6 @@ export async function getExpeditionStatus(roleId: string, roleName: string) {
curLv = expeditionWarRecord[expeditionWarRecord.length - 1].expeditionId;
}
// 重置次数
let role = await RoleModel.findByRoleId(roleId);
let curTime = new Date();
let { resetCnt } = await getResetRemainCnt(curTime, roleId, role);
@@ -145,23 +146,25 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
let hero = heroes[heroIndex];
if(hero) {
let h = <HeroType>hero.hero;
let { star, lv, attr: heroAttrs, ce } = h;
let dicHero = gameData.hero.get(hero.actorId);
let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs);
let heroInfo = {
actorId: hero.actorId,
actorName: dicHero.name,
skill:0,
seid:'&',
star,
spine: 0,
attribute: newAttribute,
lv,
ce
};
enemyObj.enemies.push({...json, ...heroInfo});
heroIndex ++;
if(h) {
let { star, lv, attr: heroAttrs, ce } = h;
let dicHero = gameData.hero.get(hero.actorId);
let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs);
let heroInfo = {
actorId: hero.actorId,
actorName: dicHero.name,
skill:0,
seid:'&',
star,
spine: 0,
attribute: newAttribute,
lv,
ce
};
enemyObj.enemies.push({...json, ...heroInfo});
heroIndex ++;
}
}
}
}

View File

@@ -220,6 +220,7 @@ export const STATUS = {
REWARD_HAS_RECEIVED: { code: 30003, simStr: '奖励已领取' },
NOT_CONSUME_GOODS: { code: 30004, simStr: '非消耗品' },
AP_IS_FULL: { code: 30005, simStr: '满体力不可使用道具' },
ROLE_IS_NOT_INIT: { code: 30006, simStr: '玩家未初始化' },
// 武将养成通用 30100 - 30199