山河社稷图一些优化

back_recharge
xuexinpeng 2021-05-28 14:41:28 +08:00
parent 87463b9b15
commit bf54d94986
3 changed files with 39 additions and 14 deletions

View File

@ -90,6 +90,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
node.setHasPass(true);
node.setState(1);
dropList.addAll(HardStageLogic.getFirstRewards(user, nodeConfig));
HardStageLogic.updateChapterAndNodeLevel(user,nodeConfig);
}
} else if (nodeConfig.getStageType() == 1 || nodeConfig.getStageType() == 3) {
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
@ -117,6 +118,12 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
resultNum[0] = (int) fight[1][1];
resultNum[1] = (int) fight[1][3];
resultNum[2] = (int) fight[1][5];
if(resultNum[0] == 1 && resultNum[1] ==1 && resultNum[2] == 1){
fightStartResponse.setCurrentIsHonour(true);
}else {
fightStartResponse.setCurrentIsHonour(false);
}
//System.err.print("0:" + resultNum[0] + " 1:" + resultNum[1] + " 2:" + resultNum[2]);
int resultCode = (int) fight[0][0];
if (resultCode == -1) {

View File

@ -25,9 +25,9 @@ public class HardStageManager extends MongoBase {
}
public Map<Integer, HardStageChapter> getChapterMap(User user) throws Exception {
if (null == chapterMap || chapterMap.size() < 1) {
if (null == chapterMap) {
Map<Integer, HardStageChapter> map = initChapterMap(user);
chapterMap = map;
setChapterMap(map);
}
return chapterMap;
}
@ -78,6 +78,7 @@ public class HardStageManager extends MongoBase {
});
}
setCurChapter(chapterId);
updateString("chapterMap." + chapter.getChapterId(), chapter);
return chapter;
}
@ -129,4 +130,13 @@ public class HardStageManager extends MongoBase {
this.noOpenId = noOpenId;
updateString("noOpenId", noOpenId);
}
public Map<Integer, HardStageChapter> getChapterMap() {
return chapterMap;
}
public void setChapterMap(Map<Integer, HardStageChapter> chapterMap) {
this.chapterMap = chapterMap;
updateString("chapterMap", chapterMap);
}
}

View File

@ -112,18 +112,11 @@ public class HardStageLogic {
StringBuffer currenState = StringUtil.intArrToStringArr(num);
//已存在的星星状态
StringBuffer existState = reformatBinary(currentStar);
//荣耀三星
if (currenState.toString().equals("111") && existState.toString().equals("000")) {
for (int rewardId : config.getReward1()) {
if (addDropAndStar(node, dropList, rewardId, user)) {
if (!node.isFirst()) {
node.setFirst(true);
}
}
//荣耀三星 上个人开始设计的时候就有欠考虑 暂时这么写死
if (currenState.toString().equals("111")) {
if(!node.isFirst()){
node.setFirst(true);
}
node.setState(7);
addStar += 3;
return addStar;
}
for (int i = 2; i >= 0; i--) {
if (currenState.charAt(i) == '1' && existState.charAt(i) == '0') {
@ -237,7 +230,7 @@ public class HardStageLogic {
if (!node.isHasPass()) {
node.setHasPass(true);
dropList.addAll(getFirstRewards(user, nodeConfig));//关卡通过奖励
user.getHardStageManager().setCurNode(nodeConfig.getSection());//通过的关卡
updateChapterAndNodeLevel(user,nodeConfig);
if (SHardStage.getPreList(nodeConfig.getId()) != null) {
SHardStage.getPreList(nodeConfig.getId()).stream().forEach(n -> {
if (n != null) {
@ -252,12 +245,27 @@ public class HardStageLogic {
if (!node.isHasPass()) {
node.setHasPass(true);
node.setState(1);
user.getHardStageManager().setCurNode(nodeConfig.getSection());//通过的关卡
dropList.addAll(getFirstRewards(user, nodeConfig));//关卡通过奖励
updateChapterAndNodeLevel(user,nodeConfig);
user.getHardStageManager().updateString("chapterMap." + nodeConfig.getChapter(), chapterMap.get(nodeConfig.getChapter()));
}
}
sendHardStageIndication(user);
}
public static void updateChapterAndNodeLevel(User user, SHardStage nodeConfig ){
if( nodeConfig.getChapter() >=user.getHardStageManager().getCurChapter()){
if(nodeConfig.getChapter() >user.getHardStageManager().getCurChapter()){
//通过新章节时候 全部更新
user.getHardStageManager().setCurChapter(nodeConfig.getChapter());//
user.getHardStageManager().setCurNode(nodeConfig.getSection());//通过的关卡
}
//仍在本章节时 更新小节
if(nodeConfig.getSection() > user.getHardStageManager().getCurNode()){
user.getHardStageManager().setCurNode(nodeConfig.getSection());//通过的关卡
}
}
}
/**
*