feat(兼容): 配表使用后台隐藏物品

This commit is contained in:
luying
2022-11-09 18:01:02 +08:00
parent 5d0873630a
commit 53d4af4e09
54 changed files with 768 additions and 102 deletions

View File

@@ -1,7 +1,7 @@
import { DividendModel } from './../db/Dividend';
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_TIME, DIVIDEND_CODE_LEN, DIVIDEND_STATUS, LOT_STATUS, MAIL_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_RECEIVE_STATUS, AUCTION_BID_STATUS, DEBUG_MAGIC_WORD, AUCTION_SOURCE, TA_EVENT, getAuctionSourceTypeName, PUSH_ROUTE, GUILD_JOB } from './../consts';
import { DividendRec, } from "../domain/dbGeneral";
import { genCode, getRandSingleEelm } from '../pubUtils/util';
import { genCode, getRandEelmWithWeight, getRandSingleEelm } from '../pubUtils/util';
import Lot, { LotModel, LotParam, LotType } from '../db/Lot';
import { getCurDay, getSeconds, getTimeFunD, getTimeFunM, nowSeconds } from '../pubUtils/timeUtil';
import { gameData, getGoodById } from '../pubUtils/data';
@@ -19,6 +19,7 @@ import { isDebugTime } from '../pubUtils/sdkUtil';
import { pick } from 'underscore';
import { AuctionRewardInter } from '../domain/battleField/auction';
import { CounterLotsModel } from '../db/CounterAuction';
import { isGoodsHidden } from './dataService';
// ! 获取底价,假数据
export function getBasePrice(gid: number, count: number) {
@@ -568,4 +569,50 @@ export function processSingleLotFormat(lot: LotType) {
export function processLotsFormat(lots: LotType[]) {
return lots.map(processSingleLotFormat);
}
/**
* 根据军团活动排名获得奖励
* @param aid 活动id
* @param rank 排名
*/
function getGuildAuction(aid: number, rank: number, struLv: number, cityId: number = 0) {
let ranksReward = gameData.guildAuction.get(`${aid}_${struLv}_${cityId}`) || [];
return ranksReward.find(cur => {
return rank >= cur.min && (rank <= cur.max || cur.max == 0);
});
}
export function getGuildAuctionBasicNum(aid: number, rank: number, struLv: number, cityId: number = 0) {
let dic = getGuildAuction(aid, rank, struLv, cityId);
return dic?.basicDividend||0;
}
export function getGuildAuctionRewards(aid: number, rank: number, struLv: number, cityId: number = 0) {
let dic = getGuildAuction(aid, rank, struLv, cityId);
if(dic) {
return getAuctionRewardByPoolId(dic.rewards);
} else {
return new Map();
}
}
export function getAuctionRewardByPoolId(poolId: number) {
let pools = gameData.auctionPool.get(poolId);
let rewards: Map<number, AuctionRewardInter[]> = new Map();
for(let { count, basicPool } of pools) {
let { rewardBasicPool, basePrice, maxPrice, sort } = basicPool
for(let i = 0; i < count; i++) {
let result = getRandEelmWithWeight(rewardBasicPool);
if(result && result.dic) {
let { id, count } = result.dic;
if(isGoodsHidden(id)) continue;
if(!rewards.has(id)) {
rewards.set(id, []);
}
rewards.get(id).push({ goods: {id, count}, basePrice, maxPrice, sort });
}
}
}
return rewards;
}