挑战 扫荡 逻辑
parent
b5a0c8de0e
commit
424b64e6c9
|
@ -113,95 +113,54 @@ public class SituationLogic {
|
|||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
// //次数校验
|
||||
SRaceTowerConfig sRaceTowerConfig = STableManager.getConfig(SRaceTowerConfig.class).get(id);
|
||||
int openRules = sRaceTowerConfig.getOpenRules();
|
||||
Set<Integer> situationPass = playerInfoManager.getSituationPass();
|
||||
if(openRules!=0&&!situationPass.contains(openRules)){
|
||||
|
||||
|
||||
|
||||
boolean consumeCount = false;
|
||||
if(type==2){
|
||||
if(!situationPass.contains(id)){
|
||||
throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sRaceTowerConfig.getReward(), 1, 0, 1);
|
||||
builder.setDrop(drop);
|
||||
consumeCount = true;
|
||||
}else if(type==1){
|
||||
// //判断上一关是否已过
|
||||
int openRules = sRaceTowerConfig.getOpenRules();
|
||||
if(openRules!=0&&!situationPass.contains(openRules)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.FORMATION_NORMAL, 1000, "", GameFightType.DailyChallenge, sRaceTowerConfig.getMonsterId(), 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(20)
|
||||
.setFightSeed(fightResult.getSeed())
|
||||
.setHeroFightInfos(fightResult.getFightTeamInfo())
|
||||
.addAllMonsterList(fightResult.getMonsterTeamList())
|
||||
.build();
|
||||
int[] checkResult = fightResult.getCheckResult();
|
||||
builder.setFightData(fightData);
|
||||
if(checkResult[0]>0){
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sRaceTowerConfig.getFirstReward(), 1, 0, 1);
|
||||
builder.setDrop(drop);
|
||||
situationPass.add(id);
|
||||
playerInfoManager.updateSituationPass(situationPass);
|
||||
consumeCount = true;
|
||||
}
|
||||
}else{
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
|
||||
// boolean consumeCount = false;
|
||||
// boolean isFailed = false;
|
||||
// Set<Integer> dailyPass = playerInfoManager.getDailyPass();
|
||||
// if(type==2){
|
||||
// if(!dailyPass.contains(id)){
|
||||
// throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
|
||||
// }
|
||||
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
// builder.setDrop(drop);
|
||||
// consumeCount = true;
|
||||
// }else if(type==1){
|
||||
// if(dailyPass.contains(id)){
|
||||
// throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
|
||||
// }
|
||||
// //判断上一关是否已过
|
||||
// if(lastChange!=null&&lastChange.getType()==sDailyChallengeConfig.getType()){
|
||||
// if(!dailyPass.contains(id - 1)){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
// int[][] openRules = sDailyChallengeConfig.getOpenRules();
|
||||
// boolean open = true;
|
||||
// for(int[] rule:openRules){
|
||||
// switch (rule[0]){
|
||||
// case 1:
|
||||
// open = playerInfoManager.getLevel()>=rule[1];
|
||||
// break;
|
||||
// case 2:
|
||||
// open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),rule[1]);
|
||||
// break;
|
||||
// case 3:
|
||||
// open = playerInfoManager.getMaxForce()>=rule[1];
|
||||
// break;
|
||||
// }
|
||||
// if(!open){
|
||||
// throw new ErrorCodeException(ErrorCode.DAILY_NO_OPEN);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.FORMATION_NORMAL, 1000, "", GameFightType.DailyChallenge, sDailyChallengeConfig.getMonsterId(), 3);
|
||||
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
// CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
// .setFightMaxTime(20)
|
||||
// .setFightSeed(fightResult.getSeed())
|
||||
// .setHeroFightInfos(fightResult.getFightTeamInfo())
|
||||
// .addAllMonsterList(fightResult.getMonsterTeamList())
|
||||
// .build();
|
||||
// int[] checkResult = fightResult.getCheckResult();
|
||||
// builder.setFightData(fightData);
|
||||
// if(checkResult[0]>0){
|
||||
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||
// builder.setDrop(drop);
|
||||
// playerInfoManager.addDailyPass(id);
|
||||
// consumeCount = true;
|
||||
// }else{
|
||||
// isFailed = true;
|
||||
// }
|
||||
// }else{
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// ReportUtil.onReportEvent(user, ReportEventEnum.START_DAILY_DUNGEON.getType(),id,sDailyChallengeConfig.getMonsterId(), MonsterUtil.getMonsterForce(new int[]{sDailyChallengeConfig.getMonsterId()}),"",0);
|
||||
// if(consumeCount){
|
||||
// boolean consume = PlayerLogic.getInstance().checkAndUpdate(user, sDailyChallengeConfig.getPrivilegeId()[1], 1);
|
||||
// if(!consume){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
// CommonProto.Drop drop = builder.getDrop();
|
||||
// if(!isFailed){
|
||||
// List<CommonProto.Item> itemDrop = drop.getItemlistList();
|
||||
// List<Integer> itemIdList = new ArrayList<>();
|
||||
// List<Integer> itemNumList = new ArrayList<>();
|
||||
// itemDrop.forEach(item->{
|
||||
// itemIdList.add(item.getItemId());
|
||||
// itemIdList.add(item.getItemNum());
|
||||
// });
|
||||
// ReportUtil.onReportEvent(user,ReportEventEnum.COMPLETE_DAILY_DUNGEON.getType(),id,sDailyChallengeConfig.getMonsterId(),MonsterUtil.getMonsterForce(new int[]{sDailyChallengeConfig.getMonsterId()}),new Date(),"",0,itemIdList,itemNumList,type==1?"挑战":"扫荡");
|
||||
// }
|
||||
if(consumeCount){
|
||||
boolean consume = PlayerLogic.getInstance().checkAndUpdate(user, sRaceTowerConfig.getPrivilege()[1], 1);
|
||||
if(!consume){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_CHALLENGE,sDailyChallengeConfig.getType());
|
||||
// MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build());
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue