逍遥游数据删除
parent
005483bbf1
commit
75d86b8203
|
@ -138,7 +138,7 @@ public class JourneyMap {
|
||||||
}
|
}
|
||||||
CommonProto.JourneyInfo info = CommonProto.JourneyInfo.newBuilder()
|
CommonProto.JourneyInfo info = CommonProto.JourneyInfo.newBuilder()
|
||||||
.setMapId(k)
|
.setMapId(k)
|
||||||
.setProcess(v.getCurrentPath()*100/v.getAllPathInfo().length).setProcess(redPoint).build();
|
.setProcess(v.getCurrentPath()*100/v.getAllPathInfo().length).setRedPoint(redPoint).build();
|
||||||
response.addInfos(info);
|
response.addInfos(info);
|
||||||
});
|
});
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||||
|
@ -161,7 +161,7 @@ public class JourneyMap {
|
||||||
}
|
}
|
||||||
MapInfoProto.JourneyGetOneInfoResponse.Builder response = MapInfoProto.JourneyGetOneInfoResponse.newBuilder();
|
MapInfoProto.JourneyGetOneInfoResponse.Builder response = MapInfoProto.JourneyGetOneInfoResponse.newBuilder();
|
||||||
PathInfo pathInfo = journeyInfo.get(mapId);
|
PathInfo pathInfo = journeyInfo.get(mapId);
|
||||||
clearByTime(pathInfo);//清除过期信息
|
clearByTime(user,mapId,pathInfo);//清除过期信息
|
||||||
if(pathInfo.getCurrentPath()>=pathInfo.getAllPathInfo().length){
|
if(pathInfo.getCurrentPath()>=pathInfo.getAllPathInfo().length){
|
||||||
init(user,mapId);
|
init(user,mapId);
|
||||||
|
|
||||||
|
@ -216,11 +216,13 @@ public class JourneyMap {
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||||
}
|
}
|
||||||
private void clearByTime(PathInfo info){
|
private void clearByTime(User user,int mapId,PathInfo info){
|
||||||
|
boolean isClear = false;
|
||||||
if(info.getRemainRandomTime()<TimeUtils.nowInt()){
|
if(info.getRemainRandomTime()<TimeUtils.nowInt()){
|
||||||
info.setRandomReward(null);
|
info.setRandomReward(null);
|
||||||
info.setRemainRandomTime(0);
|
info.setRemainRandomTime(0);
|
||||||
info.setRamainRandomAmount(0);
|
info.setRamainRandomAmount(0);
|
||||||
|
isClear = true;
|
||||||
}
|
}
|
||||||
Set<Integer> removeId = new HashSet<>();
|
Set<Integer> removeId = new HashSet<>();
|
||||||
if(!info.getMonsterMap().isEmpty()){
|
if(!info.getMonsterMap().isEmpty()){
|
||||||
|
@ -233,6 +235,7 @@ public class JourneyMap {
|
||||||
info.removeMonster(id);
|
info.removeMonster(id);
|
||||||
}
|
}
|
||||||
removeId = new HashSet<>();
|
removeId = new HashSet<>();
|
||||||
|
isClear = true;
|
||||||
}
|
}
|
||||||
if(!info.getGoodsMap().isEmpty()) {
|
if(!info.getGoodsMap().isEmpty()) {
|
||||||
for(Map.Entry<Integer,JourneyGoods> entry:info.getGoodsMap().entrySet()){
|
for(Map.Entry<Integer,JourneyGoods> entry:info.getGoodsMap().entrySet()){
|
||||||
|
@ -243,7 +246,12 @@ public class JourneyMap {
|
||||||
for(int id:removeId){
|
for(int id:removeId){
|
||||||
info.removeGoods(id);
|
info.removeGoods(id);
|
||||||
}
|
}
|
||||||
|
isClear = true;
|
||||||
}
|
}
|
||||||
|
if(isClear){
|
||||||
|
user.getMapManager().updateJourneyInfoByMapId(mapId,info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,9 +273,9 @@ public class JourneyMap {
|
||||||
SFreeTravel travelConfig = SFreeTravel.journeyMapByMapId.get(mapId);
|
SFreeTravel travelConfig = SFreeTravel.journeyMapByMapId.get(mapId);
|
||||||
int[] consume = travelConfig.getConsume();
|
int[] consume = travelConfig.getConsume();
|
||||||
Map<Integer, Integer> map = ItemUtil.arrayToMap(new int[][]{consume});
|
Map<Integer, Integer> map = ItemUtil.arrayToMap(new int[][]{consume});
|
||||||
if(!ItemUtil.checkCost(user,map)){
|
// if(!ItemUtil.checkCost(user,map)){
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
// throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
// }
|
||||||
int diceNum = pathInfo.getDiceNum();
|
int diceNum = pathInfo.getDiceNum();
|
||||||
List<Integer> randomNum = new ArrayList<>();
|
List<Integer> randomNum = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -288,13 +296,13 @@ public class JourneyMap {
|
||||||
//取总点数和最大格子数,算出走的步数
|
//取总点数和最大格子数,算出走的步数
|
||||||
diceAmount =Math.min(diceAmount,pathInfo.getAllPathInfo().length-pathInfo.getCurrentPath());
|
diceAmount =Math.min(diceAmount,pathInfo.getAllPathInfo().length-pathInfo.getCurrentPath());
|
||||||
|
|
||||||
// diceAmount = 1;
|
diceAmount = 1;
|
||||||
if(diceAmount==0){
|
if(diceAmount==0){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// randomNum.clear();
|
randomNum.clear();
|
||||||
// randomNum.add(1);
|
randomNum.add(1);
|
||||||
pathInfo.setCurrentPath(pathInfo.getCurrentPath()+diceAmount);
|
pathInfo.setCurrentPath(pathInfo.getCurrentPath()+diceAmount);
|
||||||
Path arrivePath = pathInfo.getAllPathInfo()[pathInfo.getCurrentPath() - 1];
|
Path arrivePath = pathInfo.getAllPathInfo()[pathInfo.getCurrentPath() - 1];
|
||||||
int mapPointId = arrivePath.getMapPointId();
|
int mapPointId = arrivePath.getMapPointId();
|
||||||
|
|
Loading…
Reference in New Issue