diff --git a/game-server/app/servers/battle/handler/comBattleHandler.ts b/game-server/app/servers/battle/handler/comBattleHandler.ts index 614d0975e..9dbcee983 100644 --- a/game-server/app/servers/battle/handler/comBattleHandler.ts +++ b/game-server/app/servers/battle/handler/comBattleHandler.ts @@ -131,7 +131,7 @@ export class ComBattleHandler { if (!inQueue) return; await rmRoleFromQueue(roleId, sid, qualityArr, lvRange); // 创建队伍 - let blueprtId = getRandBlueprtId(qualityArr).pop(); + let blueprtId = getRandBlueprtId(qualityArr, lvRange).pop(); let comTeam: MemComBtlTeam = createComTeamData(teamCode, false, blueprtId, 'robot', 0) let { quality } = gameData.goods.get(blueprtId); diff --git a/game-server/app/services/comBattleService.ts b/game-server/app/services/comBattleService.ts index ad9c769d0..846268849 100644 --- a/game-server/app/services/comBattleService.ts +++ b/game-server/app/services/comBattleService.ts @@ -32,14 +32,16 @@ import { handleCost } from './rewardService'; * @param qualityArr 品质数组,在所有给定品质的藏宝图中筛选1 * @param cnt 返回藏宝图数量 */ -export function getRandBlueprtId(qualityArr: number[], cnt = 1) { +export function getRandBlueprtId(qualityArr: number[], lvRange: number, cnt = 1) { if (!qualityArr || !qualityArr.length) return null; let blueprtIdArr: number[] = []; for (let q of qualityArr) { - blueprtIdArr = blueprtIdArr.concat(gameData.blueprt.get(q)); + blueprtIdArr = blueprtIdArr.concat(gameData.blueprtWithQualityAndStar.get(`${q}_${lvRange}`)); } if (blueprtIdArr.length === 0) return null; + const res = getRandEelm(blueprtIdArr, cnt); + console.log('******** getRandBlueprtId', blueprtIdArr, cnt, res) return res; } diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index 0dd6a5807..f685d8463 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -1,5 +1,5 @@ import { dicHero, dicMyHeroes, loadHero } from "./dictionary/DicHero"; -import { dicGoods, blueprt, dicJewel, figureCondition, loadGoods } from "./dictionary/DicGoods"; +import { dicGoods, blueprtWithQuality, blueprtWithQualityAndStar, dicJewel, figureCondition, loadGoods } from "./dictionary/DicGoods"; import { dicBlueprtCompose, loadBlueprtCompose } from "./dictionary/DicBlueprtCompose"; import { dicBlueprtPossibility, loadBlueprtPossibility } from "./dictionary/DicBlueprtPossibility"; import { dicDaily, loadDaily } from "./dictionary/DicDaily"; @@ -132,7 +132,8 @@ export const gameData = { btlBossHpSum: new Map(), btlBossHp: new Map>(), blueprtToWar: new Map(), - blueprt: blueprt, + blueprt: blueprtWithQuality, + blueprtWithQualityAndStar: blueprtWithQualityAndStar, fashion: dicFashions, fashionBySkinId: dicFashionsByHeroId, friendShips: friendShips, diff --git a/shared/pubUtils/dictionary/DicGoods.ts b/shared/pubUtils/dictionary/DicGoods.ts index 31c2ef25d..8d9700d53 100644 --- a/shared/pubUtils/dictionary/DicGoods.ts +++ b/shared/pubUtils/dictionary/DicGoods.ts @@ -110,13 +110,15 @@ const DicGoodsKeys: KeysEnum = { } export const dicJewel = new Map(); export const dicGoods = new Map(); -export const blueprt = new Map>(); +export const blueprtWithQuality = new Map>(); +export const blueprtWithQualityAndStar = new Map>(); export const figureCondition = new Map(); // type => {params, id, gid} export function loadGoods() { dicJewel.clear(); dicGoods.clear(); - blueprt.clear(); + blueprtWithQuality.clear(); + blueprtWithQualityAndStar.clear(); figureCondition.clear(); let arr = readFileAndParse(FILENAME.DIC_GOODS); @@ -147,9 +149,12 @@ export function loadGoods() { dicGoods.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys))); if (o.itid == IT_TYPE.BLUEPRT) { - let arr = blueprt.get(o.quality) || new Array(); + let arr = blueprtWithQualityAndStar.get(`${o.quality}_${o.equipLvl}`) || new Array(); arr.push(o.good_id); - blueprt.set(o.quality, arr); + blueprtWithQualityAndStar.set(`${o.quality}_${o.equipLvl}`, arr); + let arr2 = blueprtWithQuality.get(o.quality) || new Array(); + arr.push(o.good_id); + blueprtWithQuality.set(o.quality, arr2); } else if (o.goodType == GOOD_TYPE.JEWEL) { let material = o.composeMaterial[0]; if (!!material && !!material.id) {