轩辕宝镜提交
parent
5cd1a592e0
commit
ee0c50242b
|
|
@ -2,11 +2,37 @@ package com.ljsd.jieling.logic;
|
|||
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightDispatcher;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import config.SDailyChallengeConfig;
|
||||
import config.SMainLevelConfig;
|
||||
import config.SRaceTowerConfig;
|
||||
import config.SSpecialConfig;
|
||||
import manager.STableManager;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -37,7 +63,7 @@ public class SituationLogic {
|
|||
private void checkStatus(){
|
||||
if(status==null||overTime==null||openConfig==null){
|
||||
status = new int[4];
|
||||
openConfig = new int[4][];
|
||||
openConfig = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.XUANYUAN_OPEN_TIME);
|
||||
overTime = new int[4];
|
||||
doCheck();
|
||||
}else{
|
||||
|
|
@ -68,12 +94,114 @@ public class SituationLogic {
|
|||
}
|
||||
|
||||
|
||||
public void getAllSituationStatus(ISession session){
|
||||
public void getAllSituationStatus(ISession session, MessageTypeProto.MessageType messageType){
|
||||
|
||||
MapInfoProto.GetAllSituationInfoResponse.Builder response = MapInfoProto.GetAllSituationInfoResponse.newBuilder();
|
||||
for(int i = 0 ; i < status.length;i++){
|
||||
if(status[i]==0){
|
||||
continue;
|
||||
}
|
||||
CommonProto.SituationInfo info = CommonProto.SituationInfo.newBuilder().setId(i+1).setOverTime(overTime[i]).build();
|
||||
response.addInfos(info);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
public void situationsChallenge(){
|
||||
public void situationsChallenge(ISession session, int id, int type , MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapInfoProto.SituationChallengeResponse.Builder builder= MapInfoProto.SituationChallengeResponse.newBuilder();
|
||||
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)){
|
||||
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?"挑战":"扫荡");
|
||||
// }
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_CHALLENGE,sDailyChallengeConfig.getType());
|
||||
// MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private String ip;
|
||||
|
||||
private Set<Integer> situationPass = new HashSet<>();
|
||||
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
|
@ -774,4 +776,12 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("bundle_id",bundle_id);
|
||||
|
||||
}
|
||||
|
||||
public Set<Integer> getSituationPass() {
|
||||
return situationPass;
|
||||
}
|
||||
public void updateSituationPass(Set<Integer> dailyPass){
|
||||
this.dailyPass = dailyPass;
|
||||
updateString("situationPass",situationPass);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String DISCOUNT_LEVEL= "discount_level";//限时折扣推送等级#推送间隔等级
|
||||
public static final String GUILD_WAR_ISOPEN = "Guild_war_isopen";//老公会战是否开启
|
||||
public static final String LUCKYTURNDAILYLIMIT = "LuckyTurnDailyLimit";//幸运探宝每日上限
|
||||
public static final String XUANYUAN_OPEN_TIME = "xuanyuan_open_time";//轩辕开始时间(星期)
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue