抽卡:提供内部接口
This commit is contained in:
@@ -131,9 +131,14 @@ export class GachaHandler {
|
||||
|
||||
// 任务
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.GASHA, count, true, {});
|
||||
|
||||
let resultRefFreeTime = 0;
|
||||
if(dicGacha.free.count > 0) {
|
||||
resultRefFreeTime = getAfterDateByDay(refFreeTime, dicGacha.free.day);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
gachaId, activityId,
|
||||
freeCount, refFreeTime: getAfterDateByDay(refFreeTime, dicGacha.free.day), count, point, floor,
|
||||
freeCount, refFreeTime: resultRefFreeTime, count, point, floor,
|
||||
heroes, result: resultList
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,39 +1,28 @@
|
||||
import { GachaData, Floor, GachaResult, Hope } from "../domain/activityField/gachaField";;
|
||||
import { ActivityModelType, ActivityModel } from "../db/Activity";
|
||||
import { ActivityModel } from "../db/Activity";
|
||||
import { DicGacha } from "../pubUtils/dictionary/DicGacha";
|
||||
import { UserGachaType, UserGachaModel } from "../db/UserGacha";
|
||||
import { shouldRefresh, getRandEelm, decodeArrayListStr, getRandomWithWeight, decodeIdCntArrayStr } from "../pubUtils/util";
|
||||
import { REFRESH_HOUR, GACHA_ID, GACHA_TO_FLOOR, GACHA_FLOOR_TYPE, GACHA_CONTENT_TYPE, HERO_QUALITY_TYPE, GACHA_OCCUPY_HID, IT_TYPE, ITID, CONSUME_TYPE, SPECIAL_ATTR } from "../consts";
|
||||
import { shouldRefresh, getRandEelm, getRandomWithWeight } from "../pubUtils/util";
|
||||
import { REFRESH_HOUR, GACHA_TO_FLOOR, GACHA_FLOOR_TYPE, GACHA_CONTENT_TYPE, HERO_QUALITY_TYPE, GACHA_OCCUPY_HID, IT_TYPE, ITID, CONSUME_TYPE, SPECIAL_ATTR } from "../consts";
|
||||
import { getNextDayByGap, getTodayZeroDate } from "../pubUtils/timeUtil";
|
||||
import { gameData, getDicGachaFloor } from "../pubUtils/data";
|
||||
import { RECRUIT } from "../pubUtils/dicParam";
|
||||
|
||||
/**
|
||||
* 获取活动页签里的限时卡池
|
||||
*
|
||||
* @param roleId 玩家id
|
||||
* @param aid 活动id
|
||||
*/
|
||||
export async function getLimitGacha(activityId: number) {
|
||||
export async function getLimitGacha(roleId: string, activityId: number) {
|
||||
|
||||
let activityData = await ActivityModel.findActivity(activityId, true);
|
||||
if(!activityData) return false;
|
||||
|
||||
let gachaData = new GachaData(activityData);
|
||||
|
||||
let { heroes, gachaId } = gachaData;
|
||||
|
||||
return {
|
||||
gachaId,
|
||||
heroes,
|
||||
pickHero: 0,
|
||||
freeCount: 0,
|
||||
refFreeTime: 0,
|
||||
count: 0,
|
||||
floor: [{
|
||||
id: 3,
|
||||
count: 0
|
||||
}]
|
||||
}
|
||||
let userGacha = await UserGachaModel.findByRole(roleId, gachaData.gachaId, activityId);
|
||||
userGacha = await refreshGacha(gameData.gacha.get(gachaData.gachaId), userGacha);
|
||||
gachaData.setUserGacha(userGacha);
|
||||
return gachaData
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -320,7 +320,6 @@ export async function createHeroes(roleId: string, roleName: string, sid: string
|
||||
|
||||
let newHeroInfo: CreateHeroParam[] = [], pieces: ItemInter[] = [];
|
||||
for(let h of heroInfo) {
|
||||
console.log('*****', JSON.stringify([...userHeroesMap]), h.hid)
|
||||
if(userHeroesMap.has(h.hid)) {
|
||||
let {pieceId, count} = transPiece(h.hid);
|
||||
pieces.push({ id: pieceId, count });
|
||||
|
||||
Reference in New Issue
Block a user