diff --git a/game-server/app/services/gachaService.ts b/game-server/app/services/gachaService.ts index 79c8113dd..f499a5e6e 100644 --- a/game-server/app/services/gachaService.ts +++ b/game-server/app/services/gachaService.ts @@ -225,9 +225,10 @@ export function getAllHeroByQuality(quality: number) { if(quality == 0) return [ GACHA_OCCUPY_HID ]; let allHero: number[] = []; - for(let [id, dicHero] of gameData.hero) { - if(dicHero.recruit && dicHero.quality == quality) { - allHero.push(id); + for(let { actorId } of gameData.recruit) { + let dicHero = gameData.hero.get(actorId); + if(dicHero.quality == quality) { + allHero.push(actorId); } } return allHero; diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index de7c0e0d6..807b7ff11 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -483,6 +483,7 @@ export const FILENAME = { DIC_GACHA: 'dic_zyz_gacha', DIC_GACHA_CONTENT: 'dic_zyz_recruitContent', DIC_GIFT_PACKAGE: 'dic_zyz_giftPackage', + DIC_RECRUIT: 'dic_zyz_recruit', } export const WAR_RELATE_TABLES = [ diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index 41665ddee..42fd32fad 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -79,6 +79,7 @@ import { dicTaskBox } from './dictionary/DicTaskBox'; import { dicGacha } from "./dictionary/DicGacha"; import { dicGachaContent, dicGachaContentHero } from "./dictionary/DicGachaContent"; import { dicGiftPackage } from "./dictionary/DicGiftPackage"; +import { dicRecruit } from './dictionary/DicRecruit'; export const gameData = { blurprtCompose: dicBlueprtCompose, @@ -195,7 +196,8 @@ export const gameData = { gachaTurntable: getGachaTurntablePercent(), heroTransPiece: getHeroTransPiece(), giftPackage: dicGiftPackage, - comBtlLvRange: parseComBtlLvRange() + comBtlLvRange: parseComBtlLvRange(), + recruit: dicRecruit }; // 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据 diff --git a/shared/pubUtils/dictionary/DicRecruit.ts b/shared/pubUtils/dictionary/DicRecruit.ts new file mode 100644 index 000000000..26f8169b4 --- /dev/null +++ b/shared/pubUtils/dictionary/DicRecruit.ts @@ -0,0 +1,26 @@ +// 排行榜表 +import { readJsonFile } from '../util' +import { FILENAME } from '../../consts' + +export interface DicRecruit { + + // id + readonly id: number; + // 武将id + readonly actorId: number; + // 权重 + readonly weight: number; + +} + + +const str = readJsonFile(FILENAME.DIC_RECRUIT); +let arr = JSON.parse(str); + +export const dicRecruit = new Array(); + +arr.forEach(o => { + dicRecruit.push(o); +}); + +arr = undefined; \ No newline at end of file