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