通关星级替换

back_recharge
jiahuiwen 2019-04-26 15:25:21 +08:00
parent 0132a2ff2c
commit c76e2278d1
2 changed files with 35 additions and 4 deletions

View File

@ -527,12 +527,17 @@ public class MapLogic {
updateMapMission(mapManager,EventType.updateOptionalEvent, optionId,0);
int totalWeight = updateMapMission(mapManager,EventType.updatePonintEvent, pointId,0);
if (totalWeight >= 100) {
Set<Integer> stars = mapManager.getStars();
if (stars == null) {
stars = new HashSet<>(3);
}
stars.add(STAR_3);
mapManager.setStars(stars);
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
if (crossInfo == null) {
crossInfo = new CrossInfo();
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
}
crossInfo.getStars().add(STAR_3);
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
}
CommonProto.Drop.Builder dropBuilder = null;
if (sOptionConfig.getReward().length > 0) {
@ -721,6 +726,14 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
if (mapManager.getStars() != null && crossInfo != null) {
if (mapManager.getStars().size() >= crossInfo.getStars().size()) {
crossInfo.getStars().clear();
crossInfo.getStars().addAll(mapManager.getStars());
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
}
}
resetMapInfo(user, true);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
}
@ -738,6 +751,7 @@ public class MapLogic {
mapManager.setTriggerXY(0);
mapManager.setDieCount(0);
mapManager.setCanMoveTime(0);
mapManager.setStars(null);
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
mapManager.setMission(null);
if (temporaryItems != null) {
@ -1305,10 +1319,16 @@ public class MapLogic {
if (useTime < crossInfo.getLeastTime()) {
crossInfo.setLeastTime(useTime);
}
crossInfo.getStars().add(STAR_1);
Set<Integer> stars = mapManager.getStars();
if (stars == null) {
stars = new HashSet<>();
}
stars.add(STAR_1);
mapManager.setStars(stars);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
if (useTime > 0 && useTime <= sChallengeConfig.getTime()) {
crossInfo.getStars().add(STAR_2);
stars.add(STAR_2);
mapManager.setStars(stars);
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
int heroForces = 0;
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {

View File

@ -59,6 +59,8 @@ public class MapManager extends MongoBase {
private int buyFightCount;
private Set<Integer> stars;
public MapManager() {
this.setRootCollection(User._COLLECTION_NAME);
}
@ -318,4 +320,13 @@ public class MapManager extends MongoBase {
updateString("heroAllAttributeMap" , heroAllAttributeMap);
this.heroAllAttributeMap = heroAllAttributeMap;
}
public Set<Integer> getStars() {
return stars;
}
public void setStars(Set<Integer> stars) {
updateString("stars" , stars);
this.stars = stars;
}
}