pvp:随机对手

This commit is contained in:
luying
2022-08-22 18:51:13 +08:00
parent 54a03584c7
commit 8c01ccbe43
4 changed files with 45 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ import { dicCityActivityReward, loadCityActivityReward } from "./dictionary/DicC
import { dicRaceActivity, dicRaceTypes, loadRaceActivity } from './dictionary/DicRaceActivity';
import { GUILDACTIVITY, RECRUIT } from "./dicParam";
import * as param from "./dicParam";
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, readTsFile, getRandEelmWithWeight } from "./util";
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, readTsFile, getRandEelmWithWeight, getRandSingleEelm } from "./util";
import { RACE_EVENT_TYPE } from "../consts";
import { dicShopByType, dicShopItem, loadShop } from "./dictionary/DicShop";
import { dicShopType, loadShopType } from "./dictionary/DicShopType";
@@ -425,6 +425,16 @@ export function getGoodById(gid: number) {
return gameData.goods.get(gid);
}
export function randomGoodsByItid(itid: number) {
let result: number[] = [];
for(let [id, dicGoods] of gameData.goods) {
if(dicGoods.randomShow == 1 && dicGoods.itid == itid) {
result.push(id);
}
}
return getRandSingleEelm(result)
}
export function getHeroJob(jobId: number) {
const job = gameData.job.get(jobId);
return job;