back_recharge
wangyuan 2019-11-25 14:14:03 +08:00
parent 8807cc06ea
commit 07210538c5
1 changed files with 17 additions and 18 deletions

View File

@ -185,13 +185,13 @@ public class HeroLogic {
}
}
boolean isSpecial = false;
if(sLotterySetting.getOrderBoxPool()!=null && sLotterySetting.getOrderBoxPool().length>0){
pooId = getOrderBoxPoolId(sLotterySetting);
if(pooId == 0){
throw new ErrorCodeException(ErrorCode.newDefineCode("pooId 0"));
}
isSpecial =true;
}
//检验消耗
@ -234,31 +234,26 @@ public class HeroLogic {
int j=0;
for(int i=0;i<perCount;i++){
randCount++;
poolCount++;
int randomPoolId = pooId;
int specialPoolId = getSpecialPoolByRandcount(sLotterySetting, randCount,poolCount);
if(specialPoolId == 0){
if(pooId==0){
pooId = getPooId(sLotterySetting, pooId);
if(randomPoolId==0){
randomPoolId = getPooId(sLotterySetting);
}
}else{
pooId =specialPoolId;
randomPoolId =specialPoolId;
}
LOGGER.info("the uid={},the type={},the poolId={}",uid,type,pooId);
totalCount++;
SLotteryRewardConfig sLotteryRewardConfig = randomHeroByPoolId(pooId, totalCount, user.getPlayerInfoManager().getLevel());
SLotteryRewardConfig sLotteryRewardConfig = randomHeroByPoolId(randomPoolId, totalCount, user.getPlayerInfoManager().getLevel());
LOGGER.info("the uid={},the type={},the poolId={},reward={},poolCount={}",uid,type,randomPoolId,sLotteryRewardConfig.getId(),poolCount);
if(sLotteryRewardConfig.getStar() == 1){
poolCount=0;
}else{
poolCount++;
}
int[] reward =sLotteryRewardConfig.getReward();
if(reward!=null){
dropHeroAndItem[j++] = reward;
}
if(!isSpecial){
pooId=0;
}
}
heroManager.updateRandPoolTypeCount(sLotterySetting.getMergePool(),poolCount);
@ -293,11 +288,13 @@ public class HeroLogic {
private int getSpecialPoolByRandcount(SLotterySetting sLotterySetting, int randCount,int poolCount) {
int id = sLotterySetting.getLotteryType();
List<SLotterySpecialConfig> list = SLotterySpecialConfig.getLotterySpecialConfigListByType(1,id);
boolean isMergePool = false;
if (list == null) {
list = SLotterySpecialConfig.getLotterySpecialConfigListByType(2,sLotterySetting.getMergePool());
if(list == null){
return 0;
}
isMergePool = true;
}
int poolId = 0;
@ -306,6 +303,9 @@ public class HeroLogic {
poolId = data.getpool_id();
break;
}
if(isMergePool){
continue;
}
if (randCount % data.getCount() != 0) {
continue;
}
@ -321,7 +321,7 @@ public class HeroLogic {
return poolId;
}
private int getPooId(SLotterySetting sLotterySetting, int pooId) throws Exception {
private int getPooId(SLotterySetting sLotterySetting) throws Exception {
int[][] diamondBoxContain = sLotterySetting.getDiamondBoxContain();
int totalWeight = 0;
for(int i=0;i<diamondBoxContain.length;i++){
@ -334,11 +334,10 @@ public class HeroLogic {
int[] poolWeightInfo = diamondBoxContain[i];
weight += poolWeightInfo[1];
if(randWeight<=weight){
pooId = poolWeightInfo[0];
break;
return poolWeightInfo[0];
}
}
return pooId;
return 0;
}
public int getOrderBoxPoolId(SLotterySetting sLotterySetting) throws Exception {