精英副本难度记录实现
parent
9e74d3dbc4
commit
1d17e074d1
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
|
|
@ -1257,7 +1258,9 @@ public class MapLogic {
|
|||
}
|
||||
// if(mapManager.getBossType()==1)
|
||||
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
fightEndResponse.setLastTowerTime((int)(mapManager.getTowerStartTime()/1000));
|
||||
int time = (int)((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
LOGGER.info("此层为最后一层,使用时间为{}",time);
|
||||
fightEndResponse.setLastTowerTime(time);
|
||||
}else{
|
||||
fightEndResponse.setLastTowerTime(0);
|
||||
}
|
||||
|
|
@ -2427,6 +2430,16 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), FbStarRewardResponse.build(), true);
|
||||
|
||||
}
|
||||
|
||||
public void recordDifficultMap(ISession session ,int fbId,int difficultyId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
MapManager mapManager = UserManager.getUser(session.getUid()).getMapManager();
|
||||
if(mapManager.getDifficultyOptions()!=null){
|
||||
if(fbId!=0&&difficultyId!=0){
|
||||
mapManager.addDiffcultyOptions(fbId,difficultyId);
|
||||
}else{
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"参数不能为0");
|
||||
}
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public class MapManager extends MongoBase {
|
|||
// 副本星级奖励领取进度 challengeStarBox id
|
||||
private int starReward;
|
||||
|
||||
private Map<Integer,Integer> difficultyOptions = new HashMap<>();
|
||||
//已玩普通副本地图
|
||||
private Set<Integer> playGenMaps = new HashSet<>();
|
||||
|
||||
|
|
@ -591,4 +592,15 @@ public class MapManager extends MongoBase {
|
|||
playGenMaps.add(mapId);
|
||||
updateString("playGenMaps",playGenMaps);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getDifficultyOptions() {
|
||||
return difficultyOptions;
|
||||
}
|
||||
|
||||
public void addDiffcultyOptions(int fbId ,int difficultId){
|
||||
updateString("difficultyOptions."+fbId,difficultId);
|
||||
difficultyOptions.put(fbId,difficultId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.handler.map.mapHandler;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DifficultRecordHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.DIFFICULT_MAP_OPTION_RECORD_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.DifficultMapOption difficultMapOption = MapInfoProto.DifficultMapOption.parseFrom(message);
|
||||
difficultMapOption.getId();
|
||||
difficultMapOption.getMapdifficulty();
|
||||
MapLogic.getInstance().recordDifficultMap(iSession,difficultMapOption.getId(),difficultMapOption.getMapdifficulty(),MessageTypeProto.MessageType.DIFFICULT_MAP_OPTION_RECORD_RESPONSE);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue