diff --git a/game-server/app/servers/battle/handler/expeditionBattleHandler.ts b/game-server/app/servers/battle/handler/expeditionBattleHandler.ts index e52557bfb..5f0b177c5 100644 --- a/game-server/app/servers/battle/handler/expeditionBattleHandler.ts +++ b/game-server/app/servers/battle/handler/expeditionBattleHandler.ts @@ -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); } diff --git a/game-server/app/servers/connector/handler/entryHandler.ts b/game-server/app/servers/connector/handler/entryHandler.ts index 2d2c8c95a..6398a6968 100644 --- a/game-server/app/servers/connector/handler/entryHandler.ts +++ b/game-server/app/servers/connector/handler/entryHandler.ts @@ -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; diff --git a/game-server/app/servers/role/handler/roleHandler.ts b/game-server/app/servers/role/handler/roleHandler.ts index 645ce9196..8df004e99 100644 --- a/game-server/app/servers/role/handler/roleHandler.ts +++ b/game-server/app/servers/role/handler/roleHandler.ts @@ -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 }) diff --git a/game-server/app/services/connectorService.ts b/game-server/app/services/connectorService.ts index 2cc93be05..0767085ca 100644 --- a/game-server/app/services/connectorService.ts +++ b/game-server/app/services/connectorService.ts @@ -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']; } diff --git a/game-server/app/services/expeditionService.ts b/game-server/app/services/expeditionService.ts index b60cce2c9..efd030308 100644 --- a/game-server/app/services/expeditionService.ts +++ b/game-server/app/services/expeditionService.ts @@ -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 = 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 ++; + } } } } diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index 4a8de737c..5fcdc2153 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -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