diff --git a/game-server/app/servers/connector/remote/connectorRemote.ts b/game-server/app/servers/connector/remote/connectorRemote.ts index 18a8c5777..91f6a15d1 100644 --- a/game-server/app/servers/connector/remote/connectorRemote.ts +++ b/game-server/app/servers/connector/remote/connectorRemote.ts @@ -24,7 +24,7 @@ export class ConnectorRemote { let roleId = session.get('roleId'); let sid = session.get('sid'); let uids = [{ uid: roleId, sid }]; - this.channelService.pushMessageByUids('onRemoteLogin', resResult(STATUS.SERVER_MAINTENANCE), uids); + this.channelService.pushMessageByUids('onRemoteLogin', resResult(STATUS.LOGIN_ERR), uids); }); } await sessionService.akick(uid); diff --git a/game-server/app/servers/role/handler/equipHandler.ts b/game-server/app/servers/role/handler/equipHandler.ts index d347c380f..fb9c23224 100644 --- a/game-server/app/servers/role/handler/equipHandler.ts +++ b/game-server/app/servers/role/handler/equipHandler.ts @@ -511,7 +511,7 @@ export class EquipHandler { return resResult(STATUS.WRONG_PARMS); if (goodInfo.lvLimited > hero.lv) return resResult(STATUS.EQUIP_LEVEL_LIMIT); - if(checkEquipCanPut(hid, equip.id)) + if(!checkEquipCanPut(hid, equip.id)) return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO); let index = findIndex(hero.ePlace, { id }); if (index < 0) @@ -572,7 +572,9 @@ export class EquipHandler { let sortedAndSuitEquips = sortEquips.filter(equipInfos => { // 筛选可穿的 let { id, lvLimited, ePlaceId } = equipInfos; return lv >= lvLimited && checkEquipCanPut(hid, id) && curEPlace.id == ePlaceId; - }).sort((a, b) => { // 排序按:战力 => 根据位置看个别属性 => 品质 + }) + console.log('sortedAndSuitEquips', JSON.stringify(sortedAndSuitEquips, null, 4)) + sortedAndSuitEquips = sortedAndSuitEquips.sort((a, b) => { // 排序按:战力 => 根据位置看个别属性 => 品质 if (b.ce - a.ce != 0) return b.ce - a.ce; let abilityA = a.goodsAbility.get(sortAttrId) || 0; let abilityB = b.goodsAbility.get(sortAttrId) || 0; diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index 152cfdbf9..761f62efd 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -29,7 +29,7 @@ import { dicRandomEffectPool, loadRandomEffectPool } from './dictionary/DicRando import { dicStrengthenCost, loadStrengthenCost } from './dictionary/DicStrengthenCost'; import { dicRefine, loadRefine } from './dictionary/DicRefine'; import { dicHeroEquip, loadHeroEquip } from './dictionary/DicHeroEquip'; -import { dicSuit, loadSuit } from './dictionary/DicSuit'; +import { dicSuit, dicSuitByTypeAndLv, loadSuit } from './dictionary/DicSuit'; import { dicTitle, loadTitle } from './dictionary/DicTitle'; import { dicTeraph, loadTeraph } from './dictionary/DicTeraph'; import { dicSchool, loadSchool } from './dictionary/DicSchool'; @@ -133,6 +133,7 @@ export const gameData = { jewels: dicJewel, dicHeroEquip: dicHeroEquip, suit: dicSuit, + suitByTypeAndLv: dicSuitByTypeAndLv, title: dicTitle, teraphs: dicTeraph, school: dicSchool, @@ -679,6 +680,7 @@ function getHeroTransPiece() { gameData.heroTransPiece = newMap } + // 根据groupId获得当前大区名 export function getServerGroupName(groupId: number) { let name = gameData.serverGroupNames.get(groupId); @@ -717,6 +719,10 @@ export function getDicApByLv(level: number) { } } +export function getDicSuitByTypeAndLv(suitType: number, starLevel: number) { + return gameData.suitByTypeAndLv.get(`${suitType}_${starLevel}`); +} + // 初始加载 function initDatas() { parseDicParam(); diff --git a/shared/pubUtils/dictionary/DicSuit.ts b/shared/pubUtils/dictionary/DicSuit.ts index 528c33ce0..d40685352 100644 --- a/shared/pubUtils/dictionary/DicSuit.ts +++ b/shared/pubUtils/dictionary/DicSuit.ts @@ -5,6 +5,10 @@ import { FILENAME } from '../../consts'; export interface DicSuit { // 套装id readonly id: number; + // 套装类型,相同suitType效果可跨级用 + readonly suitType: number; + // 星级,相同suitType starLevel较高的套装可覆盖较低的效果 + readonly starLevel: number; // 包含关卡 readonly name: string; // 总件数 @@ -16,6 +20,7 @@ export interface DicSuit { export const dicSuit = new Map(); +export const dicSuitByTypeAndLv = new Map(); export function loadSuit() { let arr = readFileAndParse(FILENAME.DIC_SUIT); @@ -23,6 +28,7 @@ export function loadSuit() { o.effect = parseSuitEffect(o.effect); o.tireInfo = parseNumberList(o.tireInfo); dicSuit.set(o.id, o); + dicSuitByTypeAndLv.set(`${o.suitType}_${o.starLevel}`, o); }); arr = undefined; } diff --git a/shared/pubUtils/playerCe.ts b/shared/pubUtils/playerCe.ts index 2ee288e65..d57b618d2 100644 --- a/shared/pubUtils/playerCe.ts +++ b/shared/pubUtils/playerCe.ts @@ -9,7 +9,7 @@ import { HeroModel, HeroType, HeroUpdate } from '../db/Hero'; import { RoleModel, RoleType, RoleUpdate } from '../db/Role'; import { CeAttrData, CeAttrDataRole, Attribute } from '../domain/roleField/attribute'; import { ABI_STAGE, SEID_TYPE } from '../consts'; -import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getTeraph } from './data'; +import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getTeraph, getDicSuitByTypeAndLv } from './data'; import { DicSe } from './dictionary/DicSe'; import { EquipType } from '../db/Equip'; import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool'; @@ -19,6 +19,7 @@ import { PvpDefenseModel } from '../db/PvpDefense'; import { findIndex } from 'underscore'; import { GuildModel } from '../db/Guild'; import { DicJob } from './dictionary/DicJob'; +import { DicSuit } from './dictionary/DicSuit'; // 修改并下发战力 export async function calPlayerCeAndSave(type: number, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array) { @@ -646,34 +647,11 @@ export function calEquipPutOnOffIncAttr(hero: HeroType, seids: Array, ad let heroAttrs = calHeroEquipIncAttr(hero); // 计算被动技能 - let { ePlace } = hero; - let suits = new Map(); - - for (let { equip } of ePlace) { - if (equip) { - let e = equip; - for (let { seid, rand } of e.randSe) { - addSeidList.push(seid, rand); - } - if (e.suitId > 0) { - if (suits.has(e.suitId)) { - suits.set(e.suitId, suits.get(e.suitId) + 1); - } else { - suits.set(e.suitId, 1); - } - } - } + let resultSeid = calEquipSeids(hero); + for(let seid of resultSeid) { + addSeidList.push(seid); } - suits.forEach((count, suitId) => { - let { effect } = gameData.suit.get(suitId); - for (let e of effect) { - if (count >= e.count) { - addSeidList.push(e.seid, 0); - } - } - }); - for (let seid of seids) { removeSeidList.push(seid) } @@ -689,7 +667,7 @@ export function calEquipSeids(hero: HeroType) { let seids: number[] = []; // 计算被动技能 let { ePlace } = hero; - let suits = new Map(); + let suits = new Map>(); // suitType => starLevel => DicSuit for (let { equip } of ePlace) { if (equip) { @@ -700,22 +678,43 @@ export function calEquipSeids(hero: HeroType) { } } if (e.suitId > 0) { - if (suits.has(e.suitId)) { - suits.set(e.suitId, suits.get(e.suitId) + 1); - } else { - suits.set(e.suitId, 1); + let { suitType, starLevel } = gameData.suit.get(e.suitId); + if (!suits.has(suitType)) { + suits.set(suitType, new Map()); } + for(let lv = 1; lv <= starLevel; lv++) { + let dicSuit = getDicSuitByTypeAndLv(suitType, lv); // 计算同type的低阶套装 + if(dicSuit) { + if(!suits.get(suitType).has(lv)) { + suits.get(suitType).set(lv, { dic: dicSuit, count: 0 }); + } + suits.get(suitType).get(lv).count ++; + } + } + } } } - suits.forEach((count, suitId) => { - let { effect } = gameData.suit.get(suitId); - for (let e of effect) { - if (count >= e.count) { - seids.push(e.seid, 0); + console.log('################') + console.log('#####1', JSON.stringify([...suits])); + + for(let [ _suitType, map ] of suits) { + console.log('#####2', _suitType, JSON.stringify([...map])); + let effectSeid = new Map(); // count => { starLevel, seid } + for(let [ starLevel, { dic: { effect }, count } ] of map) { + for(let { count: effectCount, seid} of effect) { + if(count >= effectCount ) { // 生效 + if(!effectSeid.has(effectCount) || effectSeid.get(effectCount).starLevel < starLevel) { // 没有同数量效果 + effectSeid.set(effectCount, { starLevel, seid }); + } + } } } - }); + for(let [_count, { seid }] of effectSeid) { + seids.push(seid, 0); + } + console.log('#####3', _suitType, JSON.stringify([...effectSeid])); + } return seids; }