军团活动:修改粮草先行道具分配

This commit is contained in:
luying
2022-02-25 14:13:23 +08:00
parent c5e5ca4b51
commit 153633b9f1
4 changed files with 131 additions and 34 deletions

View File

@@ -60,7 +60,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, getRandValueByMinMax, getRandEelm, readTsFile, getRandEelmWithWeight } from "./util";
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, readTsFile, getRandEelmWithWeight } from "./util";
import { RACE_EVENT_TYPE } from "../consts";
import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
@@ -187,7 +187,7 @@ export const gameData = {
raceActivityEvents: dicRaceActivity,
raceTypes: dicRaceTypes,
raceActivityEncounter: { events: new Map<number, number>(), eventNum: 0 },
raceNormalItems: new Array<{id: number, min: number, max: number}>(),
raceNormalItems: new Array<{id: number, total: number, max: number}>(),
raceEventItems: new Array<{id: number, count: number}>(),
shop: dicShop,
shopItem: dicShopItem,
@@ -617,14 +617,14 @@ function decodeRaceActivityEncounter() {
function decodeRaceNormalItems() {
let str = GUILDACTIVITY.RACEACTIVITY_NORMAL_ITEMS;
let result = new Array<{ id: number, min: number, max: number }>();
let result = new Array<{ id: number, total: number, max: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [id, min, max] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(min)) || isNaN(parseInt(max))) {
for (let [id, total, max] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(total)) || isNaN(parseInt(max))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), min: parseInt(min), max: parseInt(max) });
result.push({ id: parseInt(id), total: parseInt(total), max: parseInt(max) });
}
gameData.raceNormalItems = result;
}
@@ -635,15 +635,22 @@ function decodeRaceEventItems() {
}
export function getRaceEventItems() {
let items = gameData.raceNormalItems;
let result = new Array<RewardInter>();
for (let { id, min, max } of items) {
let count = getRandValueByMinMax(min, max, 0);
result.push({ id, count });
let items = new Map<number, { total: number, max: number }>();
for(let {id, total, max} of gameData.raceNormalItems) {
items.set(id, { total, max });
}
return result;
return items;
}
// export function getRaceEventItems(members: WoodenHorseMember[], items: { id: number, total: number, max: number }[]) {
// let result = new Array<RewardInter>();
// for (let { id, min, max } of items) {
// let count = getRandValueByMinMax(min, max, 0);
// result.push({ id, count });
// }
// return result;
// }
// 根据保底类型获得保底数量
export function getDicGachaFloor(id: number) {
let map = decodeIdCntArrayStr(RECRUIT.RECRUIT_MUST, 1);