抽卡:修复新人卡池特殊处理问题
This commit is contained in:
@@ -56,15 +56,14 @@ export class GachaHandler {
|
||||
|
||||
let dicGacha = gameData.gacha.get(gachaId);
|
||||
if (!dicGacha) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
if (!dicGacha.count.includes(count)) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let userGacha = await UserGachaModel.findByRole(roleId, gachaId, activityId);
|
||||
userGacha = await refreshGacha(dicGacha, userGacha);
|
||||
let { freeCount, point, pickHero, refFreeTime, count: historyCount } = userGacha;
|
||||
if ((gachaId == GACHA_TYPE.ASSIGN || gachaId == GACHA_TYPE.ACTIVITY) && !pickHero) return resResult(STATUS.GACHA_NOT_ASSIGN);
|
||||
if ((dicGacha.gachaType == GACHA_TYPE.ASSIGN || dicGacha.gachaType == GACHA_TYPE.ACTIVITY) && !pickHero) return resResult(STATUS.GACHA_NOT_ASSIGN);
|
||||
|
||||
dicGacha = getDicGachaByGachaCnt(dicGacha, historyCount);
|
||||
if (!dicGacha) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
if (!dicGacha.count.includes(count)) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let gachaPull = new GachaPull(dicGacha, userGacha);
|
||||
let userHeroes = await HeroModel.findByRole(roleId);
|
||||
@@ -469,4 +468,60 @@ export class GachaHandler {
|
||||
result: resultList
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async test(msg: { gachaId: number, count: number, isGuide: boolean }, session: BackendSession) {
|
||||
const { gachaId, count, isGuide } = msg;
|
||||
const roleId: string = session.get('roleId');
|
||||
const sid: string = session.get('sid');
|
||||
const dicGacha = gameData.gacha.get(gachaId);
|
||||
console.log(`====== map of content ${gachaId} ====== start`)
|
||||
|
||||
let mapOfContent = new Map<number, number>();
|
||||
|
||||
let hope = [];
|
||||
let floor = [];
|
||||
|
||||
let n = Math.ceil(count/10/200);
|
||||
let sum = 0;
|
||||
|
||||
function cal(num: number) {
|
||||
for(let i = 0; i < 200; i++) {
|
||||
console.log(num, i)
|
||||
let gachaPull = new GachaPull(dicGacha, { ...new UserGachaModel().toJSON(), floor, hope, pickHero: 1 });
|
||||
let { resultList } = gachaPull.pull(10, []);
|
||||
let { hope: _hope, floor: _floor } = gachaPull.getUserGachaParam();
|
||||
floor = _floor;
|
||||
hope = _hope;
|
||||
|
||||
gachaPull = undefined;
|
||||
|
||||
for(let { planId } of resultList ) {
|
||||
if(!mapOfContent.has(planId)) {
|
||||
mapOfContent.set(planId, 1);
|
||||
} else {
|
||||
mapOfContent.set(planId, mapOfContent.get(planId) + 1);
|
||||
}
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let num = 0;
|
||||
cal(num);
|
||||
let interval = setInterval(() => {
|
||||
if (++num < n) {
|
||||
cal(num);
|
||||
} else {
|
||||
console.log(`====== map of content ${gachaId} sum: ${sum} ======`)
|
||||
console.log('planId \t count')
|
||||
for(let [ planId, count ] of mapOfContent) {
|
||||
console.log(`${planId} \t ${count}`);
|
||||
}
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 50)
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user