地图探索度 删除无效协议
parent
3a9daeb6eb
commit
1074c36d6f
|
|
@ -175,22 +175,4 @@ public class GMRequestHandler extends BaseHandler{
|
||||||
itemMap.put(itemId,itemNum);
|
itemMap.put(itemId,itemNum);
|
||||||
ItemUtil.addItem(cUser,itemMap,dropBuilder);
|
ItemUtil.addItem(cUser,itemMap,dropBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFininshMapMission( MapManager mapManager,int mapId){
|
|
||||||
List<SAccomplishmentConfig> sAccomplishmentConfigs = SAccomplishmentConfig.getsAccomplishmentConfigByMapId(mapId);
|
|
||||||
if( sAccomplishmentConfigs == null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<Integer,Integer> missionProgress = new HashMap<>();
|
|
||||||
int totalWeight = 0;
|
|
||||||
for(SAccomplishmentConfig sAccomplishmentConfig : sAccomplishmentConfigs){
|
|
||||||
int id = sAccomplishmentConfig.getId();
|
|
||||||
int value = sAccomplishmentConfig.getValues()[1][0];
|
|
||||||
missionProgress.put(id,value);
|
|
||||||
totalWeight+=sAccomplishmentConfig.getScore();
|
|
||||||
}
|
|
||||||
MapMission mapMission = new MapMission(mapId,missionProgress);
|
|
||||||
mapMission.setTotalWeight(totalWeight);
|
|
||||||
mapManager.addMapMission(mapMission);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +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.MessageTypeProto;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class GetMapAccoumpHandler extends BaseHandler {
|
|
||||||
@Override
|
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
|
||||||
return MessageTypeProto.MessageType.GET_ALL_MAP_ACCOMPLISH_REQUEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
|
||||||
MapLogic.getInstance().getMapMisionDetail(iSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -167,6 +167,13 @@ public class MapLogic {
|
||||||
if (mapManager.getTemporaryItems() != null) {
|
if (mapManager.getTemporaryItems() != null) {
|
||||||
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||||
}
|
}
|
||||||
|
MapMission mapMissionProgres = mapManager.getMapMissionProgres();
|
||||||
|
Map<Integer, Integer> allMissionProgress = mapMissionProgres.getAllMissionProgress();
|
||||||
|
List<CommonProto.ExploreDetail> exploreDetailList = new ArrayList<>(allMissionProgress.size());
|
||||||
|
for(Map.Entry<Integer,Integer> item : allMissionProgress.entrySet()){
|
||||||
|
exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(item.getKey()).setProgress(item.getValue()).build());
|
||||||
|
}
|
||||||
|
mapEnterResponse.addAllExploreDetail(exploreDetailList);
|
||||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,7 +686,7 @@ public class MapLogic {
|
||||||
|
|
||||||
public void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
public void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
mapManager.clearMapMission();
|
mapManager.setMapMissionProgres(null);
|
||||||
mapManager.setMapInfo(new HashMap<>());
|
mapManager.setMapInfo(new HashMap<>());
|
||||||
mapManager.setTypeEight(new HashMap<>());
|
mapManager.setTypeEight(new HashMap<>());
|
||||||
mapManager.setWalkCells(new HashSet<>());
|
mapManager.setWalkCells(new HashSet<>());
|
||||||
|
|
@ -864,7 +871,7 @@ public class MapLogic {
|
||||||
|
|
||||||
public void initMapMission( MapManager mapManager){
|
public void initMapMission( MapManager mapManager){
|
||||||
int mapId = mapManager.getCurMapId();
|
int mapId = mapManager.getCurMapId();
|
||||||
if(mapManager.getAllMissionProgress().containsKey(mapId)){
|
if(mapManager.getMapMissionProgres()!=null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<SAccomplishmentConfig> sAccomplishmentConfigs = SAccomplishmentConfig.getsAccomplishmentConfigByMapId(mapId);
|
List<SAccomplishmentConfig> sAccomplishmentConfigs = SAccomplishmentConfig.getsAccomplishmentConfigByMapId(mapId);
|
||||||
|
|
@ -878,7 +885,7 @@ public class MapLogic {
|
||||||
missionProgress.put(id,0);
|
missionProgress.put(id,0);
|
||||||
}
|
}
|
||||||
MapMission mapMission = new MapMission(mapId,missionProgress);
|
MapMission mapMission = new MapMission(mapId,missionProgress);
|
||||||
mapManager.addMapMission(mapMission);
|
mapManager.setMapMissionProgres(mapMission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -887,7 +894,7 @@ public class MapLogic {
|
||||||
if(mapId==0){
|
if(mapId==0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MapMission mapMission = mapManager.getAllMissionProgress().get(mapId);
|
MapMission mapMission = mapManager.getMapMissionProgres();
|
||||||
if(mapMission == null){
|
if(mapMission == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1002,24 +1009,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getMapMisionDetail(ISession session) throws Exception {
|
|
||||||
int uid = session.getUid();
|
|
||||||
User user = UserManager.getUser(uid);
|
|
||||||
MapManager mapManager = user.getMapManager();
|
|
||||||
Map<Integer, MapMission> allMapMissionProgress = mapManager.getAllMissionProgress();
|
|
||||||
if(allMapMissionProgress == null || allMapMissionProgress.isEmpty()){
|
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_ALL_MAP_ACCOMPLISH_RESPONSE_VALUE,null,true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<CommonProto.MapAccomplishInfo> mapAccomplishInfos = new ArrayList<>(allMapMissionProgress.size());
|
|
||||||
for(MapMission mapMission : allMapMissionProgress.values()){
|
|
||||||
mapAccomplishInfos.add( CBean2Proto.getMapAccomplishInfo(mapMission));
|
|
||||||
}
|
|
||||||
|
|
||||||
MapInfoProto.GetMapAccomplishResponse build = MapInfoProto.GetMapAccomplishResponse.newBuilder().addAllMapAccomplishInfo(mapAccomplishInfos).build();
|
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_ALL_MAP_ACCOMPLISH_RESPONSE_VALUE,build,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLeftTime(User user) throws Exception {
|
public int getLeftTime(User user) throws Exception {
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||||
long startExporeTime = user.getMapManager().getStartExporeTime();
|
long startExporeTime = user.getMapManager().getStartExporeTime();
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ public class MapManager extends MongoBase {
|
||||||
|
|
||||||
private Map<Integer,Integer> foodBufferMap = new HashMap<>();
|
private Map<Integer,Integer> foodBufferMap = new HashMap<>();
|
||||||
|
|
||||||
private Map<Integer, MapMission> allMissionProgress = new ConcurrentHashMap<>();
|
private MapMission mapMissionProgres;
|
||||||
|
|
||||||
private int energy;
|
private int energy;
|
||||||
|
|
||||||
private int lastUpdateEnergyTime;
|
private int lastUpdateEnergyTime;
|
||||||
|
|
@ -193,22 +192,6 @@ public class MapManager extends MongoBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, MapMission> getAllMissionProgress() {
|
|
||||||
return allMissionProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMapMission(MapMission mapMission) {
|
|
||||||
mapMission.init(this.getRootId(),getMongoKey() + ".allMissionProgress." + mapMission.getMapId());
|
|
||||||
updateString( "allMissionProgress." + mapMission.getMapId(), mapMission);
|
|
||||||
allMissionProgress.put(mapMission.getMapId(),mapMission);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearMapMission(){
|
|
||||||
removeString( getMongoKey()+".allMissionProgress." + curMapId);
|
|
||||||
allMissionProgress.remove(curMapId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void getEnergy(User user) throws Exception {
|
public static void getEnergy(User user) throws Exception {
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
|
|
@ -304,4 +287,13 @@ public class MapManager extends MongoBase {
|
||||||
updateString("canMoveTime", canMoveTime);
|
updateString("canMoveTime", canMoveTime);
|
||||||
this.canMoveTime = canMoveTime;
|
this.canMoveTime = canMoveTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapMission getMapMissionProgres() {
|
||||||
|
return mapMissionProgres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapMissionProgres(MapMission mapMissionProgres) {
|
||||||
|
this.mapMissionProgres = mapMissionProgres;
|
||||||
|
updateString("mapMissionProgres", mapMissionProgres);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,22 +190,6 @@ public class CBean2Proto {
|
||||||
return monsterBuilder.build();
|
return monsterBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommonProto.MapAccomplishInfo getMapAccomplishInfo(MapMission mapMission){
|
|
||||||
int totalWeight = mapMission.getTotalWeight();
|
|
||||||
Map<Integer, Integer> allMissionProgress = mapMission.getAllMissionProgress();
|
|
||||||
List<CommonProto.ExploreDetail> exploreDetailList = new ArrayList<>();
|
|
||||||
for(Map.Entry<Integer,Integer> missionItem : allMissionProgress.entrySet()){
|
|
||||||
exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(missionItem.getKey())
|
|
||||||
.setProgress(missionItem.getValue())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
int mapId = mapMission.getMapId();
|
|
||||||
return CommonProto.MapAccomplishInfo.newBuilder() .setMapId(mapId)
|
|
||||||
.addAllExploreDetail(exploreDetailList)
|
|
||||||
.setTotalWeight(totalWeight)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommonProto.FoodBuffer getFoodBuffer(int buffId, int leftStep) {
|
public static CommonProto.FoodBuffer getFoodBuffer(int buffId, int leftStep) {
|
||||||
return CommonProto.FoodBuffer
|
return CommonProto.FoodBuffer
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue