探索度 删除不必要的协议
parent
39bff04d03
commit
3a9daeb6eb
|
@ -674,17 +674,12 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
resetMapInfo(user, true);
|
||||
MapMission mapMission = mapManager.getAllMissionProgress().get(mapId);
|
||||
if(mapMission!=null){
|
||||
MapInfoProto.MapOutResponse build = MapInfoProto.MapOutResponse.newBuilder().setMapAccomplishInfo(CBean2Proto.getMapAccomplishInfo(mapMission)).build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
||||
return;
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||
}
|
||||
|
||||
public void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.clearMapMission();
|
||||
mapManager.setMapInfo(new HashMap<>());
|
||||
mapManager.setTypeEight(new HashMap<>());
|
||||
mapManager.setWalkCells(new HashSet<>());
|
||||
|
@ -1025,34 +1020,6 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_ALL_MAP_ACCOMPLISH_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
|
||||
public void takeMissionBoxReward(ISession session,int mapId,int boxWeight) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
MapMission mapMission = mapManager.getAllMissionProgress().get(mapId);
|
||||
if(mapMission == null ){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
SAccomplishmentBox sAccomplishmentBox = SAccomplishmentBox.getsAccomplishmentBoxByMapId(mapId);
|
||||
int totalWeight = mapMission.getTotalWeight();
|
||||
Integer rewaedGroupId = sAccomplishmentBox.getBoxMap().get(boxWeight);
|
||||
if(rewaedGroupId == null || totalWeight < boxWeight ){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
if(mapMission.getHadTakeRewardIds().contains(boxWeight)){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,"hadTaked");
|
||||
return;
|
||||
}
|
||||
mapMission.getHadTakeRewardIds().add(boxWeight);
|
||||
mapMission.setHadTakeRewardIds(mapMission.getHadTakeRewardIds());
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{rewaedGroupId}, 1.0f, 0);
|
||||
MapInfoProto.TakeMapBoxResponse build = MapInfoProto.TakeMapBoxResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
public int getLeftTime(User user) throws Exception {
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
long startExporeTime = user.getMapManager().getStartExporeTime();
|
||||
|
|
|
@ -203,6 +203,11 @@ public class MapManager extends MongoBase {
|
|||
allMissionProgress.put(mapMission.getMapId(),mapMission);
|
||||
}
|
||||
|
||||
public void clearMapMission(){
|
||||
removeString( getMongoKey()+".allMissionProgress." + curMapId);
|
||||
allMissionProgress.remove(curMapId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void getEnergy(User user) throws Exception {
|
||||
|
|
|
@ -13,8 +13,6 @@ public class MapMission extends MongoBase {
|
|||
|
||||
private Map<Integer,Integer> allMissionProgress;
|
||||
|
||||
private Set<Integer> hadTakeRewardIds;
|
||||
|
||||
private int totalWeight;
|
||||
|
||||
public int getMapId() {
|
||||
|
@ -31,7 +29,6 @@ public class MapMission extends MongoBase {
|
|||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.mapId = mapId;
|
||||
this.allMissionProgress = missionProgress;
|
||||
this.hadTakeRewardIds = new HashSet<>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,9 +41,6 @@ public class MapMission extends MongoBase {
|
|||
this.allMissionProgress = allMissionProgress;
|
||||
}
|
||||
|
||||
public Set<Integer> getHadTakeRewardIds() {
|
||||
return hadTakeRewardIds;
|
||||
}
|
||||
|
||||
public void setTotalWeight(int totalWeight) {
|
||||
updateString("totalWeight",totalWeight);
|
||||
|
@ -57,8 +51,4 @@ public class MapMission extends MongoBase {
|
|||
return totalWeight;
|
||||
}
|
||||
|
||||
public void setHadTakeRewardIds(Set<Integer> hadTakeRewardIds) {
|
||||
updateString("hadTakeRewardIds",hadTakeRewardIds);
|
||||
this.hadTakeRewardIds = hadTakeRewardIds;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
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 TakeMapBoxRewardHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
MapInfoProto.TakeMapBoxRequest takeMapBoxRequest = MapInfoProto.TakeMapBoxRequest.parseFrom(bytes);
|
||||
int boxWeight = takeMapBoxRequest.getBoxWeight();
|
||||
int mapId = takeMapBoxRequest.getMapId();
|
||||
MapLogic.getInstance().takeMissionBoxReward(iSession,mapId,boxWeight);
|
||||
}
|
||||
}
|
|
@ -42,4 +42,9 @@ public class AdventureManager extends MongoBase {
|
|||
public Map<Integer, AdventureStateInfo> getAdventureStateInfoMap() {
|
||||
return adventureStateInfoMap;
|
||||
}
|
||||
|
||||
public void clearStation(int position) {
|
||||
removeString(getMongoKey()+".adventureStateInfoMap." + position);
|
||||
adventureStateInfoMap.remove(position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,28 +49,34 @@ public class CombatLogic {
|
|||
}
|
||||
|
||||
public void adventureStation(ISession session,int position,List<String> heroIds) throws Exception {
|
||||
if(heroIds == null || heroIds.isEmpty()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
int uid = session.getUid();
|
||||
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getSAdventureConfigByPosition(position);
|
||||
if(sAdventureConfig.getOpenLevel() > user.getPlayerInfoManager().getLevel()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"等级不够");
|
||||
return;
|
||||
}
|
||||
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
//检验
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
if(heroIds == null || heroIds.isEmpty()){
|
||||
if(!adventureStateInfoMap.containsKey(position)){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
calAdvenrureReward(user,true,position);
|
||||
adventureManager.clearStation(position);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,null,true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(heroIds.size()>sAdventureConfig.getMaxNum()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"英雄数量大于规定数量");
|
||||
return;
|
||||
}
|
||||
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
//检验
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
|
||||
|
||||
for(AdventureStateInfo adventureStateInfoTmp:adventureStateInfoMap.values()){
|
||||
int positionTmp = adventureStateInfoTmp.getPosition();
|
||||
|
|
|
@ -203,7 +203,6 @@ public class CBean2Proto {
|
|||
return CommonProto.MapAccomplishInfo.newBuilder() .setMapId(mapId)
|
||||
.addAllExploreDetail(exploreDetailList)
|
||||
.setTotalWeight(totalWeight)
|
||||
.addAllHadTakedId(mapMission.getHadTakeRewardIds())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue