拍卖行:修改掉落
This commit is contained in:
@@ -8,7 +8,7 @@ import { pinus } from 'pinus';
|
|||||||
import { STATUS } from '../consts/statusCode';
|
import { STATUS } from '../consts/statusCode';
|
||||||
import { deepCopy, resResult } from '../pubUtils/util';
|
import { deepCopy, resResult } from '../pubUtils/util';
|
||||||
import { BattleRecordModel } from '../db/BattleRecord';
|
import { BattleRecordModel } from '../db/BattleRecord';
|
||||||
import { getArmyBossRank, gameData } from '../pubUtils/data';
|
import { getArmyBossRank, gameData, getAuctionRewardByPoolId } from '../pubUtils/data';
|
||||||
import { sendMailByContent } from '../services/mailService';
|
import { sendMailByContent } from '../services/mailService';
|
||||||
import { pushMail } from '../pubUtils/interface';
|
import { pushMail } from '../pubUtils/interface';
|
||||||
import { MAIL_TYPE, AUCTION_SOURCE } from '../consts';
|
import { MAIL_TYPE, AUCTION_SOURCE } from '../consts';
|
||||||
@@ -126,8 +126,6 @@ export async function bossResult(code: string, serverId: number, dataName: strin
|
|||||||
return b.score - a.score + a.time - b.time;
|
return b.score - a.score + a.time - b.time;
|
||||||
});
|
});
|
||||||
//下发邮件奖励
|
//下发邮件奖励
|
||||||
let mails = new Array<MailType>();
|
|
||||||
let pushMessage = new Array<pushMail>();
|
|
||||||
recordRanks.forEach(async function({ roleId }, index){
|
recordRanks.forEach(async function({ roleId }, index){
|
||||||
let rankLv = index + 1;
|
let rankLv = index + 1;
|
||||||
let goods = getArmyBossRankReward(rankLv);
|
let goods = getArmyBossRankReward(rankLv);
|
||||||
@@ -140,7 +138,8 @@ export async function bossResult(code: string, serverId: number, dataName: strin
|
|||||||
// 加入拍卖行
|
// 加入拍卖行
|
||||||
let dicBossBase = gameData.bossBaseByBossLv.get(bossLv);
|
let dicBossBase = gameData.bossBaseByBossLv.get(bossLv);
|
||||||
if(dicBossBase) {
|
if(dicBossBase) {
|
||||||
await genAuction(code, AUCTION_SOURCE.BOSS, bossCode, serverId, dicBossBase.reward);
|
let rewards = getAuctionRewardByPoolId(dicBossBase.rewards);
|
||||||
|
await genAuction(code, AUCTION_SOURCE.BOSS, bossCode, serverId, rewards);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -467,6 +467,8 @@ export const FILENAME = {
|
|||||||
DIC_QUENCH_CONSUME: 'dic_zyz_quench_consume',
|
DIC_QUENCH_CONSUME: 'dic_zyz_quench_consume',
|
||||||
DIC_HOLIDAY: 'dic_holiday',
|
DIC_HOLIDAY: 'dic_holiday',
|
||||||
DIC_EXPEDITION_SUB_ATTR: 'dic_expedition_subattr',
|
DIC_EXPEDITION_SUB_ATTR: 'dic_expedition_subattr',
|
||||||
|
DIC_AUCTION_BASIC_POOL: 'dic_zyz_auction_basicPool',
|
||||||
|
DIC_AUCTION_REWARD: 'dic_zyz_auctionReward',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WAR_RELATE_TABLES = [
|
export const WAR_RELATE_TABLES = [
|
||||||
|
|||||||
+25
-3
@@ -68,7 +68,7 @@ import { dicCityActivityReward, loadCityActivityReward } from "./dictionary/DicC
|
|||||||
import { dicRaceActivity, dicRaceTypes, loadRaceActivity } from './dictionary/DicRaceActivity';
|
import { dicRaceActivity, dicRaceTypes, loadRaceActivity } from './dictionary/DicRaceActivity';
|
||||||
import { GUILDACTIVITY, RECRUIT } from "./dicParam";
|
import { GUILDACTIVITY, RECRUIT } from "./dicParam";
|
||||||
import * as param from "./dicParam";
|
import * as param from "./dicParam";
|
||||||
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandValueByMinMax, getRandEelm, readTsFile } from "./util";
|
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandValueByMinMax, getRandEelm, readTsFile, getRandEelmWithWeight } from "./util";
|
||||||
import { RACE_EVENT_TYPE } from "../consts";
|
import { RACE_EVENT_TYPE } from "../consts";
|
||||||
import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
|
import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
|
||||||
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
|
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
|
||||||
@@ -92,6 +92,8 @@ import { dicQuenchByQuality, dicQuenchRangeByQuality, dicQuenchRangeByQualityAnd
|
|||||||
import { dicQuenchConsume, loadQuenchConsume } from './dictionary/DicQuenchConsume';
|
import { dicQuenchConsume, loadQuenchConsume } from './dictionary/DicQuenchConsume';
|
||||||
import { dicHoliday, loadHoliday } from './dictionary/DicHoliday';
|
import { dicHoliday, loadHoliday } from './dictionary/DicHoliday';
|
||||||
import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExpeditionSubAttr';
|
import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExpeditionSubAttr';
|
||||||
|
import { dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward';
|
||||||
|
import { pick } from "underscore";
|
||||||
|
|
||||||
export const gameData = {
|
export const gameData = {
|
||||||
blurprtCompose: dicBlueprtCompose,
|
blurprtCompose: dicBlueprtCompose,
|
||||||
@@ -228,7 +230,8 @@ export const gameData = {
|
|||||||
equipAttributeRatio: new Map<number, number>(),
|
equipAttributeRatio: new Map<number, number>(),
|
||||||
ceRatio: new Array<{type: number, val: number}>(),
|
ceRatio: new Array<{type: number, val: number}>(),
|
||||||
holiday: dicHoliday,
|
holiday: dicHoliday,
|
||||||
expeditionSubAttr: dicExpeditionSubAttr
|
expeditionSubAttr: dicExpeditionSubAttr,
|
||||||
|
auctionPool: dicAuctionPool
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||||
@@ -579,7 +582,25 @@ export function getGuildAuctionRewards(aid: number, rank: number) {
|
|||||||
let dic = ranksReward.find(cur => {
|
let dic = ranksReward.find(cur => {
|
||||||
return rank >= cur.min && (rank <= cur.max || cur.max == 0);
|
return rank >= cur.min && (rank <= cur.max || cur.max == 0);
|
||||||
});
|
});
|
||||||
return dic ? dic.rewards : new Array<RewardInter>();
|
if(dic) {
|
||||||
|
return getAuctionRewardByPoolId(dic.rewards);
|
||||||
|
} else {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAuctionRewardByPoolId(poolId: number) {
|
||||||
|
let pools = gameData.auctionPool.get(poolId);
|
||||||
|
let rewards: RewardInter[] = [];
|
||||||
|
for(let { count, basicPool } of pools) {
|
||||||
|
for(let i = 0; i < count; i++) {
|
||||||
|
let result = getRandEelmWithWeight(basicPool);
|
||||||
|
if(result && result.dic) {
|
||||||
|
rewards.push(pick(result.dic, ['id', 'count']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rewards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -872,6 +893,7 @@ function loadDatas() {
|
|||||||
loadEquipAttributeRatio();
|
loadEquipAttributeRatio();
|
||||||
loadHoliday();
|
loadHoliday();
|
||||||
loadExpeditionSubAttr();
|
loadExpeditionSubAttr();
|
||||||
|
loadAuctionReward();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重载dicParam
|
// 重载dicParam
|
||||||
|
|||||||
@@ -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 { FILENAME } from '../../consts'
|
||||||
import { RewardInter } from '../../pubUtils/interface';
|
|
||||||
|
|
||||||
export interface DicGuildAuction {
|
export interface DicGuildAuction {
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ export interface DicGuildAuction {
|
|||||||
// 最高名次
|
// 最高名次
|
||||||
readonly max: number;
|
readonly max: number;
|
||||||
// 奖励
|
// 奖励
|
||||||
readonly rewards: RewardInter[];
|
readonly rewards: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dicGuildAuction = new Map<number, DicGuildAuction[]>();
|
export const dicGuildAuction = new Map<number, DicGuildAuction[]>();
|
||||||
@@ -21,7 +20,6 @@ export function loadGuildAuction() {
|
|||||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_AUCTION);
|
let arr = readFileAndParse(FILENAME.DIC_GUILD_AUCTION);
|
||||||
|
|
||||||
arr.forEach(o => {
|
arr.forEach(o => {
|
||||||
o.rewards = parseGoodStr(o.rewards);
|
|
||||||
let rank = dicGuildAuction.get(o.id)||[];
|
let rank = dicGuildAuction.get(o.id)||[];
|
||||||
rank.push(o);
|
rank.push(o);
|
||||||
dicGuildAuction.set(o.id, rank);
|
dicGuildAuction.set(o.id, rank);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export interface DicBossBase {
|
|||||||
// 关卡id
|
// 关卡id
|
||||||
readonly wars: Array<{warId:number, bossHp:number}>;
|
readonly wars: Array<{warId:number, bossHp:number}>;
|
||||||
// 掉落的拍卖行奖励
|
// 掉落的拍卖行奖励
|
||||||
readonly reward: RewardInter[];
|
readonly rewards: number;
|
||||||
|
|
||||||
readonly consume: number;
|
readonly consume: number;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ const DicBossKeys: KeysEnum<DicBossBase> = {
|
|||||||
level: true,
|
level: true,
|
||||||
bossLevel: true,
|
bossLevel: true,
|
||||||
wars: true,
|
wars: true,
|
||||||
reward: true,
|
rewards: true,
|
||||||
consume: true,
|
consume: true,
|
||||||
opencost: true
|
opencost: true
|
||||||
};
|
};
|
||||||
@@ -187,7 +187,6 @@ export function loadStructure() {
|
|||||||
let arrBoss = readFileAndParse(FILENAME.DIC_GUILD_BOSS_BASE);
|
let arrBoss = readFileAndParse(FILENAME.DIC_GUILD_BOSS_BASE);
|
||||||
arrBoss.forEach(o => {
|
arrBoss.forEach(o => {
|
||||||
setStructureConsume(o);
|
setStructureConsume(o);
|
||||||
o.reward = parseGoodStr(o.reward);
|
|
||||||
o.wars = o.warIdHP.split('|').map((warStrs)=> {
|
o.wars = o.warIdHP.split('|').map((warStrs)=> {
|
||||||
if (!warStrs) {
|
if (!warStrs) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user