寻宝:修复匹配
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<number, number>(),
|
||||
btlBossHp: new Map<number, Array<{ dataId: number, hp: number, actorId: number }>>(),
|
||||
blueprtToWar: new Map<number, number>(),
|
||||
blueprt: blueprt,
|
||||
blueprt: blueprtWithQuality,
|
||||
blueprtWithQualityAndStar: blueprtWithQualityAndStar,
|
||||
fashion: dicFashions,
|
||||
fashionBySkinId: dicFashionsByHeroId,
|
||||
friendShips: friendShips,
|
||||
|
||||
@@ -110,13 +110,15 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
|
||||
}
|
||||
export const dicJewel = new Map<number, DicGoods>();
|
||||
export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprt = new Map<number, Array<number>>();
|
||||
export const blueprtWithQuality = new Map<number, Array<number>>();
|
||||
export const blueprtWithQualityAndStar = new Map<string, Array<number>>();
|
||||
export const figureCondition = new Map<number, { params: number[], id: number, gid: number }[]>(); // 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<number>();
|
||||
let arr = blueprtWithQualityAndStar.get(`${o.quality}_${o.equipLvl}`) || new Array<number>();
|
||||
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<number>();
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user