拍卖行:价格修改
This commit is contained in:
@@ -92,7 +92,7 @@ import { dicQuenchByQuality, dicQuenchRangeByQuality, dicQuenchRangeByQualityAnd
|
||||
import { dicQuenchConsume, loadQuenchConsume } from './dictionary/DicQuenchConsume';
|
||||
import { dicHoliday, loadHoliday } from './dictionary/DicHoliday';
|
||||
import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExpeditionSubAttr';
|
||||
import { dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward';
|
||||
import { DicAuctionBasicPool, dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward';
|
||||
import { dicGuildTrainInfo, loadGuildTrainInfo } from './dictionary/DicGuildTrainInfo';
|
||||
import { pick } from "underscore";
|
||||
|
||||
@@ -596,12 +596,13 @@ export function getGuildAuctionRewards(aid: number, rank: number) {
|
||||
|
||||
export function getAuctionRewardByPoolId(poolId: number) {
|
||||
let pools = gameData.auctionPool.get(poolId);
|
||||
let rewards: RewardInter[] = [];
|
||||
let rewards: { goods: RewardInter, basePrice: number, maxPrice: number }[] = [];
|
||||
for(let { count, basicPool } of pools) {
|
||||
let { rewardBasicPool, basePrice, maxPrice } = basicPool
|
||||
for(let i = 0; i < count; i++) {
|
||||
let result = getRandEelmWithWeight(basicPool);
|
||||
let result = getRandEelmWithWeight(rewardBasicPool);
|
||||
if(result && result.dic) {
|
||||
rewards.push(pick(result.dic, ['id', 'count']));
|
||||
rewards.push({ goods: pick(result.dic, ['id', 'count']), basePrice, maxPrice });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readFileAndParse } from '../util'
|
||||
import { parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { decodeArrayListStr } from '../../pubUtils/util';
|
||||
|
||||
@@ -11,6 +11,8 @@ export interface AuctionBasicPool {
|
||||
export interface DicAuctionBasicPool {
|
||||
readonly id: number; // 唯一id
|
||||
readonly rewardBasicPool: AuctionBasicPool[];
|
||||
readonly basePrice: number;
|
||||
readonly maxPrice: number;
|
||||
}
|
||||
|
||||
export interface DicAuctionReward {
|
||||
@@ -23,17 +25,20 @@ export interface DicAuctionReward {
|
||||
interface DicAuctionPool {
|
||||
readonly id: number; // basicPool的id
|
||||
readonly count: number; // 份数
|
||||
readonly basicPool: AuctionBasicPool[]; // 随机池
|
||||
readonly basicPool: DicAuctionBasicPool; // 随机池
|
||||
}
|
||||
|
||||
export const dicAuctionPool = new Map<number, DicAuctionPool[]>(); // poolId => DicAuctionPool
|
||||
export function loadAuctionReward() {
|
||||
dicAuctionPool.clear();
|
||||
let basicPoolMap = new Map<number, AuctionBasicPool[]>(); // id => AuctionBasicPool
|
||||
let basicPoolMap = new Map<number, DicAuctionBasicPool>(); // id => AuctionBasicPool
|
||||
let arr = readFileAndParse(FILENAME.DIC_AUCTION_BASIC_POOL);
|
||||
arr.forEach(o => {
|
||||
let rewardBasicPool = parseRewardBasicPool(o.rewardBasicPool);
|
||||
basicPoolMap.set(o.id, rewardBasicPool);
|
||||
console.log(o)
|
||||
o.rewardBasicPool = parseRewardBasicPool(o.rewardBasicPool);
|
||||
o.basePrice = parsePrice(o.basePrice);
|
||||
o.maxPrice = parsePrice(o.maxPrice);
|
||||
basicPoolMap.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr2 = readFileAndParse(FILENAME.DIC_AUCTION_REWARD);
|
||||
@@ -60,6 +65,14 @@ function parseRewardBasicPool(str: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
function parsePrice(str: string) {
|
||||
let arr = str.split('&');
|
||||
if(arr.length != 2) return 0;
|
||||
let price = parseInt(arr[1]);
|
||||
if(isNaN(price)) throw new Error('price format wrong');
|
||||
return price;
|
||||
}
|
||||
|
||||
function parseRewardId(str: string) {
|
||||
let result = new Array<{id: number, count: number}>();
|
||||
if (!str) return result;
|
||||
|
||||
Reference in New Issue
Block a user