拍卖行:修改掉落
This commit is contained in:
75
shared/pubUtils/dictionary/DicAuctionReward.ts
Normal file
75
shared/pubUtils/dictionary/DicAuctionReward.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { decodeArrayListStr } from '../../pubUtils/util';
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface AuctionBasicPool {
|
||||
readonly id: number; // 物品id
|
||||
readonly count: number; // 数量
|
||||
readonly weight: number; // 随机权重
|
||||
}
|
||||
|
||||
export interface DicAuctionBasicPool {
|
||||
readonly id: number; // 唯一id
|
||||
readonly rewardBasicPool: AuctionBasicPool[];
|
||||
}
|
||||
|
||||
export interface DicAuctionReward {
|
||||
|
||||
readonly poolId: number;
|
||||
// 目标品质
|
||||
readonly rewardId: { id: number; count: number; }[]
|
||||
}
|
||||
|
||||
interface DicAuctionPool {
|
||||
readonly id: number; // basicPool的id
|
||||
readonly count: number; // 份数
|
||||
readonly basicPool: AuctionBasicPool[]; // 随机池
|
||||
}
|
||||
|
||||
export const dicAuctionPool = new Map<number, DicAuctionPool[]>(); // poolId => DicAuctionPool
|
||||
export function loadAuctionReward() {
|
||||
dicAuctionPool.clear();
|
||||
let basicPoolMap = new Map<number, AuctionBasicPool[]>(); // id => AuctionBasicPool
|
||||
let arr = readFileAndParse(FILENAME.DIC_AUCTION_BASIC_POOL);
|
||||
arr.forEach(o => {
|
||||
let rewardBasicPool = parseRewardBasicPool(o.rewardBasicPool);
|
||||
basicPoolMap.set(o.id, rewardBasicPool);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr2 = readFileAndParse(FILENAME.DIC_AUCTION_REWARD);
|
||||
arr2.forEach(o => {
|
||||
let rewardId = parseRewardId(o.rewardId);
|
||||
dicAuctionPool.set(o.poolId, rewardId.map(({ id, count }) => {
|
||||
let basicPool = basicPoolMap.get(id);
|
||||
return { id, count, basicPool}
|
||||
}));
|
||||
});
|
||||
arr2 = undefined;
|
||||
}
|
||||
|
||||
function parseRewardBasicPool(str: string) {
|
||||
let result = new Array<AuctionBasicPool>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [id, count, weight] of decodeArr) {
|
||||
if (isNaN(parseInt(id)) || isNaN(parseInt(count)) || isNaN(parseInt(weight))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ id: parseInt(id), count: parseInt(count), weight: parseInt(weight) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function parseRewardId(str: string) {
|
||||
let result = new Array<{id: number, count: number}>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [id, count] of decodeArr) {
|
||||
if (isNaN(parseInt(id)) || isNaN(parseInt(count))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ id: parseInt(id), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// 公会权限
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
|
||||
export interface DicGuildAuction {
|
||||
|
||||
@@ -12,7 +11,7 @@ export interface DicGuildAuction {
|
||||
// 最高名次
|
||||
readonly max: number;
|
||||
// 奖励
|
||||
readonly rewards: RewardInter[];
|
||||
readonly rewards: number;
|
||||
}
|
||||
|
||||
export const dicGuildAuction = new Map<number, DicGuildAuction[]>();
|
||||
@@ -21,7 +20,6 @@ export function loadGuildAuction() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_AUCTION);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.rewards = parseGoodStr(o.rewards);
|
||||
let rank = dicGuildAuction.get(o.id)||[];
|
||||
rank.push(o);
|
||||
dicGuildAuction.set(o.id, rank);
|
||||
|
||||
@@ -54,7 +54,7 @@ export interface DicBossBase {
|
||||
// 关卡id
|
||||
readonly wars: Array<{warId:number, bossHp:number}>;
|
||||
// 掉落的拍卖行奖励
|
||||
readonly reward: RewardInter[];
|
||||
readonly rewards: number;
|
||||
|
||||
readonly consume: number;
|
||||
|
||||
@@ -66,7 +66,7 @@ const DicBossKeys: KeysEnum<DicBossBase> = {
|
||||
level: true,
|
||||
bossLevel: true,
|
||||
wars: true,
|
||||
reward: true,
|
||||
rewards: true,
|
||||
consume: true,
|
||||
opencost: true
|
||||
};
|
||||
@@ -187,7 +187,6 @@ export function loadStructure() {
|
||||
let arrBoss = readFileAndParse(FILENAME.DIC_GUILD_BOSS_BASE);
|
||||
arrBoss.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.wars = o.warIdHP.split('|').map((warStrs)=> {
|
||||
if (!warStrs) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user