import { PublicShared } from './public'; export class TanXianShared { /**根据时间获取挂机奖励 */ static getGuaJiPrize(time: number, mapId: number, isClient = true, addBuff: { /**收藏品 */ shoucangpin?: k_v; } = {}) { if (time > G.gc.tanxian_com.maxGuaJiTime) time = G.gc.tanxian_com.maxGuaJiTime; const conf = G.gc.tanxian[mapId || 1]; const pNum = Math.floor(time / G.gc.tanxian_com.guaJiPrizeInterval); const dNum = Math.floor(time / G.gc.tanxian_com.guaJiDlzInterval); const gjPrize = conf.gjPrize.map(p => { return { a: p.a, t: p.t, n: Math.floor(p.n * pNum) }; }); let buff = {}; // if (addBuff.shoucangpin) { // for (let id in addBuff.shoucangpin) { // PublicShared.mergeProperty(buff, G.gc.shoucangpin[id][addBuff.shoucangpin[id]].teshubuff); // } // } gjPrize.forEach(prize => { if (buff[prize.t]) { prize.n = Math.floor(prize.n + prize.n * (buff[prize.t] / 100)); } }); return { prize: gjPrize, dlz: isClient ? conf.dlz.map(d => G.gc.diaoluo[d]).reduce((a, b) => a.concat(b)) : (dNum && conf.dlz.length > 0 ? conf.dlz.map(d => PublicShared.randomDropGroup(d, dNum)).reduce((a, b) => a.concat(b)) : []) }; } }