解决扫荡奖励爆表问题

back_recharge
duhui 2022-12-08 15:23:30 +08:00
parent 4e6bc9f165
commit b24ba14a0b
3 changed files with 50 additions and 18 deletions

View File

@ -227,7 +227,7 @@ public class CombatLogic {
err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10008,1);
}
}else{
err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10015,1);
err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10015,0);
}
if (!"".equals(err)){
throw new ErrorCodeException(ErrorCode.newDefineCode(err));
@ -277,7 +277,7 @@ public class CombatLogic {
}
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
ItemUtil.combineRewardByMainLine(user,false, true, randomRewardMin, times,itemObj,BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.combineRewardByMainLine(user,true, false,targetMainLevelConfig.getRandomReward(), times,itemRandomObj,BIReason.ADVENTURE_RANDOM_REWARDD);
ItemUtil.combineRewardByMainLine(user,true, false, targetMainLevelConfig.getRandomReward(), times,itemRandomObj,BIReason.ADVENTURE_RANDOM_REWARDD);
itemRandomObj.setEquipMap(equipAutoCombine(itemRandomObj.getEquipMap()));
//清除无用活动道具
removeNoUseItem(user,itemRandomObj.getItemMap());
@ -936,20 +936,17 @@ public class CombatLogic {
int adventureRefresh = gameSetting.getAdventureRefresh();
int vipTimeAdd = PlayerLogic.getInstance().getMaxCountByPrivilegeType(user, VipPrivilegeType.ADVENTURE_ADD_TIME);
int adventureOffline = (gameSetting.getAdventureOffline()+vipTimeAdd)*60*60/adventureRefresh;
ItemMap itemObj = new ItemMap();
ItemMap itemRandom = new ItemMap();
baseBuilder = CommonProto.Drop.newBuilder();
randomBuilder = CommonProto.Drop.newBuilder();
int takeTimes= 0;
ArrayList<int[][]> baseList = new ArrayList<>();
ArrayList<int[][]> randomList = new ArrayList<>();
for(Map.Entry<Integer,Integer> fightStateInfoItem : fightStateInfo.entrySet()){
Integer fightId = fightStateInfoItem.getKey();
Integer times = fightStateInfoItem.getValue();
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
int[] randomRewardMin = sMainLevelConfig.getRandomRewardMin();
ItemUtil.combineRewardByMainLine(user,true,true,randomRewardMin, times,itemObj,BIReason.ADVENTURE_BASE_REWARD);
if (!viewBaseReward){
ItemUtil.combineRewardByMainLine(user,true,false,sMainLevelConfig.getRandomReward(), times,itemRandom,BIReason.ADVENTURE_RANDOM_REWARDD);
}
baseList.add(new int[][]{sMainLevelConfig.getRandomRewardMin(),new int[]{times}});
randomList.add(new int[][]{sMainLevelConfig.getRandomReward(),new int[]{times}});
takeTimes+=times;
}
int fightId = mainLevelManager.getFightId();
@ -961,15 +958,17 @@ public class CombatLogic {
boolean reset = maxTimes<times;
if(maxTimes>0){
times = reset?maxTimes:times;
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
ItemUtil.combineRewardByMainLine(user,true,true,randomRewardMin, times,itemObj,BIReason.ADVENTURE_BASE_REWARD);
if (!viewBaseReward){
ItemUtil.combineRewardByMainLine(user,true,false,targetMainLevelConfig.getRandomReward(), times,itemRandom,BIReason.ADVENTURE_RANDOM_REWARDD);
}
baseList.add(new int[][]{targetMainLevelConfig.getRandomRewardMin(),new int[]{times}});
randomList.add(new int[][]{targetMainLevelConfig.getRandomReward(),new int[]{times}});
lastTimeTakes=times;
}
// ItemUtil.extraAddItem(user,itemObj.getItemMap(),BIReason.ADVENTURE_BASE_REWARD);
// ItemUtil.extraAddItem(user,itemRandom.getItemMap(),BIReason.ADVENTURE_RANDOM_REWARDD);
ItemMap itemObj = new ItemMap();
ItemMap itemRandom = new ItemMap();
ItemUtil.combineRewardByMainLine(user,true,true,baseList,itemObj,BIReason.ADVENTURE_BASE_REWARD);
if (!viewBaseReward){
ItemUtil.combineRewardByMainLine(user,true,false, randomList,itemRandom,BIReason.ADVENTURE_RANDOM_REWARDD);
}
//装备合成
itemRandom.setEquipMap(equipAutoCombine(itemRandom.getEquipMap()));
if(viewBaseReward){

View File

@ -995,7 +995,7 @@ public class CBean2Proto {
.build();
}
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse(User user ) throws Exception {
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse(User user ) throws Exception {
long nowMs = TimeUtils.now();
int now = (int)(nowMs/1000);
MainLevelManager mainLevelManager = user.getMainLevelManager();

View File

@ -358,6 +358,39 @@ public class ItemUtil {
extraAddItem(user,itemObj.getItemMap(),reason);
}
/**
* 线,
* @throws ErrorCodeException
*/
public static void combineRewardByMainLine(User user,boolean isLoop,boolean fiexdOrRandom, List<int[][]> groupList,ItemMap itemObj,int reason)throws ErrorCodeException{
for (int[][] list : groupList) {
int[] groups = list[0];
int time = list[1][0];
for (int id:groups){
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(id);
// 次数
long num = time / sRewardGroup.getDrapRate();
// 基础奖励和随机奖励
if (fiexdOrRandom){
combineRewardDropGroup(user, new int[]{id}, num,itemObj);
}else {
while (num-->0){
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
}
}
// 不足掉落的时间,看脸随机
int remainder = time % sRewardGroup.getDrapRate();
// 1-掉落时间,随机数值
int random = MathUtils.random(1, sRewardGroup.getDrapRate());
if (random <= remainder){
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
}
}
}
// 特权加成奖励
extraAddItem(user,itemObj.getItemMap(),reason);
}
public static void extraAddItem(User user, Map<Integer, Long> itemMap,int reason){
ItemManager itemManager = user.getItemManager();
for(Map.Entry<Integer,Long> item : itemMap.entrySet()){
@ -384,7 +417,7 @@ public class ItemUtil {
selectItemArr(itemArr,itemObj);
}
public static void drop(User user,CommonProto.Drop.Builder dropBuilder,ItemMap itemObj,int reason) throws Exception {
public static void drop(User user,CommonProto.Drop.Builder dropBuilder,ItemMap itemObj,int reason) throws Exception {
// useRandomItem(user, randomMap, reason);
mapToAdd(user,itemObj,dropBuilder,reason);
}