抽卡:修改抽卡奖池逻辑
This commit is contained in:
+17
-22
@@ -5,13 +5,14 @@ import { isNumber } from 'underscore';
|
||||
const csprng = require('csprng');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
import { ABI_STAGE, GACHA_TO_FLOOR, REFRESH_TIME, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, WAR_TYPE, SHOP_REFRESH_TYPE } from '../consts';
|
||||
import { ABI_STAGE, REFRESH_TIME, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, WAR_TYPE, SHOP_REFRESH_TYPE, GACHA_TYPE, GACHA_FLOOR_TYPE } from '../consts';
|
||||
|
||||
import { findIndex } from 'underscore';
|
||||
import { getZeroPointD } from './timeUtil';
|
||||
import { Floor } from '../domain/activityField/gachaField';
|
||||
import { WhiteListModel } from '../db/RegionWhiteList';
|
||||
import { RewardInter } from './interface';
|
||||
import { gameData } from './data';
|
||||
const randomName = require("chinese-random-name");
|
||||
const moment = require('moment');
|
||||
const crypto = require('crypto');
|
||||
@@ -620,26 +621,6 @@ export function splitString(dataString: string, key: string) {
|
||||
return numberArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取抽卡保底状态
|
||||
* @param gachaId 招募类型
|
||||
* @param floor 玩家保底
|
||||
*/
|
||||
export function getFloorStatus(gachaId: number, floor: Floor[]) {
|
||||
let floorMap = new Map<number, number>();
|
||||
for (let { id, count } of floor) {
|
||||
floorMap.set(id, count);
|
||||
}
|
||||
let dicFloorType = GACHA_TO_FLOOR.get(gachaId);
|
||||
return dicFloorType.map(id => {
|
||||
return {
|
||||
id,
|
||||
count: floorMap.get(id) || 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function checkWhiteList(env: string, ip: string, uid: number, serverId: number) {
|
||||
if(ip) {
|
||||
let result = await WhiteListModel.checkIp(env, ip);
|
||||
@@ -818,4 +799,18 @@ export function addToMap<T>(map: Map<T, number>, id: T, value: number) {
|
||||
// }, 0);
|
||||
|
||||
// return { topLineup, topLineupCe };
|
||||
// }
|
||||
// }
|
||||
|
||||
export function getGachaRemainFloor(gachaId: number, userFloor: Floor[]) {
|
||||
let dicGacha = gameData.gacha.get(gachaId);
|
||||
if(dicGacha.gachaType != GACHA_TYPE.NORMAL) return 0;
|
||||
|
||||
for(let floorId of dicGacha.floor) {
|
||||
let dicGachaFloor = gameData.gachaFloor.get(floorId);
|
||||
if(dicGachaFloor && dicGachaFloor.floorType == GACHA_FLOOR_TYPE.MAIN_FLOOR) {
|
||||
let myFloor = userFloor.find(cur => cur.id == floorId);
|
||||
return dicGachaFloor.param - (myFloor?.count||0);
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user