山河社稷图
parent
75e526697a
commit
ea4d1e03d6
|
@ -329,5 +329,5 @@ public interface BIReason {
|
||||||
int EQUIP_UPLEVEL_COST = 1092;//装备升星消耗
|
int EQUIP_UPLEVEL_COST = 1092;//装备升星消耗
|
||||||
int EQUIP_UPLEVEL_REWARD = 1093;//装备升星获得
|
int EQUIP_UPLEVEL_REWARD = 1093;//装备升星获得
|
||||||
int TA_SUI_LING_XIAO = 1094;//踏碎凌霄
|
int TA_SUI_LING_XIAO = 1094;//踏碎凌霄
|
||||||
int HARD_STAGE = 1095;
|
int HARD_STAGE_GET = 1095;
|
||||||
}
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.ljsd.jieling.handler.hardStage;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import rpc.protocols.CommonProto;
|
||||||
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
|
public class HardStageInfoRequestHandler extends BaseHandler<PlayerInfoProto.HardStageRequest> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.HARD_STAGE_INFO_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, PlayerInfoProto.HardStageRequest proto) throws Exception {
|
||||||
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
|
CommonProto.HardStageInfo.Builder info = HardStageLogic.getInfo(user);
|
||||||
|
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
|
||||||
|
response.setInfo(info);
|
||||||
|
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,20 +12,20 @@ import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.fight.FightRecordLogic;
|
||||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
import com.ljsd.jieling.logic.hardStage.HardStageChapter;
|
import com.ljsd.jieling.logic.hardStage.HardStageChapter;
|
||||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.util.FightDataUtil;
|
import com.ljsd.jieling.util.FightDataUtil;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import com.ljsd.jieling.util.MonsterUtil;
|
import com.ljsd.jieling.util.MonsterUtil;
|
||||||
import config.SHardStage;
|
import config.SHardStage;
|
||||||
import org.luaj.vm2.LuaValue;
|
import org.luaj.vm2.LuaValue;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.*;
|
||||||
import rpc.protocols.Expedition;
|
|
||||||
import rpc.protocols.MessageTypeProto;
|
|
||||||
import rpc.protocols.PlayerInfoProto;
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
int nodeId = proto.getNodeId();
|
int nodeId = proto.getNodeId();
|
||||||
int teamId = proto.getTeamId();
|
int teamId = proto.getTeamId();
|
||||||
|
List<CommonProto.Drop.Builder> dropList = new ArrayList<>();
|
||||||
SHardStage nodeConfig = SHardStage.getConfigMap().get(nodeId);
|
SHardStage nodeConfig = SHardStage.getConfigMap().get(nodeId);
|
||||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
||||||
if(!chapterMap.containsKey(nodeConfig.getChapter()) || chapterMap.get(nodeConfig.getChapter()).getNode(nodeId) == null){
|
if(!chapterMap.containsKey(nodeConfig.getChapter()) || chapterMap.get(nodeConfig.getChapter()).getNode(nodeId) == null){
|
||||||
|
@ -50,6 +51,10 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
|
||||||
}
|
}
|
||||||
|
if(nodeConfig.getStageType() == 2){//直接发奖励
|
||||||
|
HardStageLogic.passNode(iSession,nodeConfig,0,dropList);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int seed = (int)(System.currentTimeMillis()/1000);
|
int seed = (int)(System.currentTimeMillis()/1000);
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = HardStageLogic.getFightTeamInfo(user,teamId,nodeConfig);
|
CommonProto.FightTeamInfo fightTeamInfo = HardStageLogic.getFightTeamInfo(user,teamId,nodeConfig);
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterfightTeamInfos = MonsterUtil.getHardStageMonsterByGroup(nodeConfig);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterfightTeamInfos = MonsterUtil.getHardStageMonsterByGroup(nodeConfig);
|
||||||
|
@ -66,9 +71,9 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
||||||
}
|
}
|
||||||
|
|
||||||
if(resultCode == 1){//通过
|
if(resultCode == 1){//通过
|
||||||
HardStageLogic.passNode(iSession,nodeConfig,0);
|
HardStageLogic.passNode(iSession,nodeConfig,0,dropList);
|
||||||
}else{
|
}else{
|
||||||
HardStageLogic.passNode(iSession,nodeConfig,0);
|
HardStageLogic.passNode(iSession,nodeConfig,0,dropList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,11 +81,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
||||||
String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
||||||
RedisUtil.getInstence().set(key, fightInfo, -1);
|
RedisUtil.getInstence().set(key, fightInfo, -1);
|
||||||
|
|
||||||
FightResult.Builder builder = FightResult.newBuilder();
|
PlayerInfoProto.HardStageFightResponse.Builder fightStartResponse = PlayerInfoProto.HardStageFightResponse.newBuilder();
|
||||||
builder.setCheckResult(fightResult);
|
|
||||||
builder.setSeed(seed);
|
|
||||||
builder.setFightTeamInfo(fightTeamInfo);
|
|
||||||
builder.setMonsterTeamList(monsterGroupList);
|
|
||||||
String fightId = FightUtil.getFightId(user.getId(),FightType.HardStage.getType());
|
String fightId = FightUtil.getFightId(user.getId(),FightType.HardStage.getType());
|
||||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||||
.setFightType(FightType.HardStage.getType())
|
.setFightType(FightType.HardStage.getType())
|
||||||
|
@ -90,7 +91,12 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
||||||
.setFightMaxTime(20)
|
.setFightMaxTime(20)
|
||||||
.setFightId(fightId)
|
.setFightId(fightId)
|
||||||
.build();
|
.build();
|
||||||
builder.setFightData(fightData);
|
fightStartResponse.setFightData(fightData);
|
||||||
|
for(CommonProto.Drop.Builder drop : dropList){
|
||||||
|
fightStartResponse.addDrop(drop);
|
||||||
|
}
|
||||||
|
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.HARD_STAGE_FIGHT_START_RESPONSE.getNumber(), fightStartResponse.build(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class HardStageManager extends MongoBase {
|
||||||
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||||
chapter.addNodeList(node);
|
chapter.addNodeList(node);
|
||||||
|
map.put(chapter.getChapterId(),chapter);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ public class HardStageManager extends MongoBase {
|
||||||
List<SHardStageReward> reward = SHardStageReward.getChapterConfigMap().get(chapterId);
|
List<SHardStageReward> reward = SHardStageReward.getChapterConfigMap().get(chapterId);
|
||||||
for(SHardStageReward config : reward){
|
for(SHardStageReward config : reward){
|
||||||
chapter.getRewardMap().put(config.getStarReward(),Boolean.FALSE);
|
chapter.getRewardMap().put(config.getStarReward(),Boolean.FALSE);
|
||||||
|
chapter.updateRewardMap();
|
||||||
}
|
}
|
||||||
return chapter;
|
return chapter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,17 @@ public class HardStageChapter extends MongoBase {
|
||||||
return stars;
|
return stars;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStars(int stars) {
|
public void addStars(int stars) {
|
||||||
this.stars = stars;
|
this.stars += stars;
|
||||||
|
updateString("stars" , this.stars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, Boolean> getRewardMap() {
|
public Map<Integer, Boolean> getRewardMap() {
|
||||||
return rewardMap;
|
return rewardMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRewardMap(Map<Integer, Boolean> rewardMap) {
|
public void updateRewardMap() {
|
||||||
this.rewardMap = rewardMap;
|
updateString("rewardMap" , this.rewardMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HardStageNode getNode(int id){
|
public HardStageNode getNode(int id){
|
||||||
|
|
|
@ -30,7 +30,26 @@ public class HardStageLogic {
|
||||||
* 获取山河社稷图信息
|
* 获取山河社稷图信息
|
||||||
*/
|
*/
|
||||||
public static CommonProto.HardStageInfo.Builder getInfo(User user){
|
public static CommonProto.HardStageInfo.Builder getInfo(User user){
|
||||||
|
Map<Integer, HardStageChapter> map = user.getHardStageManager().getChapterMap();
|
||||||
CommonProto.HardStageInfo.Builder builder = CommonProto.HardStageInfo.newBuilder();
|
CommonProto.HardStageInfo.Builder builder = CommonProto.HardStageInfo.newBuilder();
|
||||||
|
for(Map.Entry<Integer,HardStageChapter> entry : map.entrySet()){
|
||||||
|
CommonProto.HardStageChapter.Builder chapterBuilder = CommonProto.HardStageChapter.newBuilder();
|
||||||
|
for(HardStageNode node : entry.getValue().getNodeList()){
|
||||||
|
CommonProto.HardStageNode.Builder nodeBuilder = CommonProto.HardStageNode.newBuilder();
|
||||||
|
nodeBuilder.setNodeId(node.getId());
|
||||||
|
nodeBuilder.setType(node.getType());
|
||||||
|
nodeBuilder.setState(node.getState());
|
||||||
|
chapterBuilder.addNode(nodeBuilder);
|
||||||
|
}
|
||||||
|
chapterBuilder.setChapterId(entry.getKey());
|
||||||
|
chapterBuilder.setStars(entry.getValue().getStars());
|
||||||
|
for(Map.Entry<Integer,Boolean> entry1 : entry.getValue().getRewardMap().entrySet()){
|
||||||
|
CommonProto.HardStageChapterReward.Builder rewardBuilder = CommonProto.HardStageChapterReward.newBuilder();
|
||||||
|
rewardBuilder.setId(entry1.getKey());
|
||||||
|
rewardBuilder.setState(entry1.getValue()?1:0);
|
||||||
|
}
|
||||||
|
builder.addChapter(chapterBuilder);
|
||||||
|
}
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +77,32 @@ public class HardStageLogic {
|
||||||
/**
|
/**
|
||||||
* 判断奖励
|
* 判断奖励
|
||||||
*/
|
*/
|
||||||
public static String passReward(){
|
public static int passReward(User user,HardStageNode node,int num,List<CommonProto.Drop.Builder> dropList) throws Exception{
|
||||||
return "";
|
int addStar = 0;
|
||||||
|
SHardStage config = SHardStage.getConfigMap().get(node.getId());
|
||||||
|
if(num>>2 == 1){//第一星
|
||||||
|
int rewardId = config.getReward1()[0];
|
||||||
|
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||||
|
node.setState(node.getState()+4);
|
||||||
|
addStar++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if((num&2) == 2){//第二星
|
||||||
|
int rewardId = config.getReward1()[1];
|
||||||
|
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||||
|
node.setState(node.getState()+2);
|
||||||
|
addStar++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(num<<2 == 1){//第三星
|
||||||
|
int rewardId = config.getReward1()[2];
|
||||||
|
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||||
|
node.setState(node.getState()+1);
|
||||||
|
addStar++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return addStar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,29 +157,62 @@ public class HardStageLogic {
|
||||||
/**
|
/**
|
||||||
* 通过节点
|
* 通过节点
|
||||||
*/
|
*/
|
||||||
public static void passNode(ISession iSession, SHardStage nodeConfig, int resultNum) throws Exception{
|
public static void passNode(ISession iSession, SHardStage nodeConfig, int resultNum,List<CommonProto.Drop.Builder> dropList) throws Exception{
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
||||||
HardStageNode node = chapterMap.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
HardStageNode node = chapterMap.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
||||||
if(node.getType() == 1){
|
if(node.getType() == 1){//大节点
|
||||||
|
int star = passReward(user,node,resultNum,dropList);
|
||||||
|
chapterMap.get(nodeConfig.getChapter()).addStars(star);
|
||||||
|
if(!node.isHasPass()){
|
||||||
|
node.setHasPass(true);
|
||||||
|
dropList.addAll(getFirstRewards(user,nodeConfig));
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(node.isHasPass()){
|
if(node.isHasPass()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder drop = getFirstPassReward(user,nodeConfig);
|
node.setHasPass(true);
|
||||||
|
dropList.addAll(getFirstRewards(user,nodeConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
|
||||||
|
for(SHardStage stage : openList){
|
||||||
|
user.getHardStageManager().openNewNode(stage);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首通奖励
|
* 首通奖励
|
||||||
*/
|
*/
|
||||||
public static CommonProto.Drop.Builder getFirstPassReward(User user,SHardStage nodeConfig) throws Exception{
|
public static List<CommonProto.Drop.Builder> getFirstRewards(User user,SHardStage nodeConfig) throws Exception{
|
||||||
SRewardGroup rewardGroup = SRewardGroup.getsRewardItemMap().get(nodeConfig.getPassReward());
|
List<CommonProto.Drop.Builder> dropList = new ArrayList<>();
|
||||||
|
for(int rewardId : nodeConfig.getPassReward()){
|
||||||
|
dropList.add(getReward(user,rewardId));
|
||||||
|
}
|
||||||
|
return dropList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取奖励
|
||||||
|
*/
|
||||||
|
public static CommonProto.Drop.Builder getReward(User user,int rewardId) throws Exception{
|
||||||
|
SRewardGroup rewardGroup = SRewardGroup.getsRewardItemMap().get(rewardId);
|
||||||
ItemMap itemObj = new ItemMap();
|
ItemMap itemObj = new ItemMap();
|
||||||
int[] dropList = rewardGroup.getRewardItem();
|
int[] dropList = rewardGroup.getRewardItem();
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.HARD_STAGE);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.HARD_STAGE_GET);
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean addDropAndStar(HardStageNode node,List<CommonProto.Drop.Builder> dropList,int rewardId,User user) throws Exception{
|
||||||
|
if(!node.getRewardMap().get(rewardId)){
|
||||||
|
dropList.add(getReward(user,rewardId));
|
||||||
|
node.getRewardMap().put(rewardId,true);
|
||||||
|
node.updateRewardMap();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.hardStage;
|
||||||
|
|
||||||
import com.ljsd.common.mogodb.MongoBase;
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class HardStageNode extends MongoBase {
|
public class HardStageNode extends MongoBase {
|
||||||
|
@ -9,7 +10,7 @@ public class HardStageNode extends MongoBase {
|
||||||
private int id;
|
private int id;
|
||||||
private int type;
|
private int type;
|
||||||
private int state;
|
private int state;
|
||||||
private Map<Integer,Boolean> rewardMap;//三星奖励情况
|
private Map<Integer,Boolean> rewardMap = new HashMap<>();//三星奖励情况
|
||||||
private boolean hasPass;//是否通过
|
private boolean hasPass;//是否通过
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -40,8 +41,8 @@ public class HardStageNode extends MongoBase {
|
||||||
return rewardMap;
|
return rewardMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRewardMap(Map<Integer, Boolean> rewardMap) {
|
public void updateRewardMap() {
|
||||||
this.rewardMap = rewardMap;
|
updateString("rewardMap" , this.rewardMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasPass() {
|
public boolean isHasPass() {
|
||||||
|
|
|
@ -3,6 +3,9 @@ package config;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import manager.Table;
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Table(name ="HardStage")
|
@Table(name ="HardStage")
|
||||||
|
@ -14,7 +17,7 @@ public class SHardStage implements BaseConfig {
|
||||||
|
|
||||||
private int section;
|
private int section;
|
||||||
|
|
||||||
private int picture ;
|
private String picture ;
|
||||||
|
|
||||||
private int repeat ;
|
private int repeat ;
|
||||||
|
|
||||||
|
@ -39,13 +42,27 @@ public class SHardStage implements BaseConfig {
|
||||||
private int[] reward1;
|
private int[] reward1;
|
||||||
|
|
||||||
private static Map<Integer,SHardStage> configMap ;
|
private static Map<Integer,SHardStage> configMap ;
|
||||||
|
private static Map<Integer, List<SHardStage>> preConfigMap;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
Map<Integer, SHardStage> tempConfig = STableManager.getConfig(SHardStage.class);
|
Map<Integer, SHardStage> tempConfig = STableManager.getConfig(SHardStage.class);
|
||||||
|
Map<Integer, List<SHardStage>> tempPreConfigMap = new HashMap<>();
|
||||||
|
for(SHardStage stage : tempConfig.values()){
|
||||||
|
if(stage.getNextLevel() > 0){
|
||||||
|
if(tempPreConfigMap.containsKey(stage.getNextLevel())){
|
||||||
|
tempPreConfigMap.get(stage.getNextLevel()).add(stage);
|
||||||
|
}else{
|
||||||
|
List<SHardStage> list = new ArrayList<>();
|
||||||
|
list.add(stage);
|
||||||
|
tempPreConfigMap.put(stage.getNextLevel(),list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(null == configMap){
|
if(null == configMap){
|
||||||
configMap = tempConfig;
|
configMap = tempConfig;
|
||||||
|
preConfigMap = tempPreConfigMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +79,7 @@ public class SHardStage implements BaseConfig {
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPicture () {
|
public String getPicture () {
|
||||||
return picture ;
|
return picture ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,4 +130,12 @@ public class SHardStage implements BaseConfig {
|
||||||
public static Map<Integer, SHardStage> getConfigMap() {
|
public static Map<Integer, SHardStage> getConfigMap() {
|
||||||
return configMap;
|
return configMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, List<SHardStage>> getPreConfigMap() {
|
||||||
|
return preConfigMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<SHardStage> getPreList(int id){
|
||||||
|
return preConfigMap.get(id);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ import manager.Table;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Table(name ="SHardStageBuff")
|
@Table(name ="HardStageBuff")
|
||||||
public class SHardStageBuff implements BaseConfig {
|
public class SHardStageBuff implements BaseConfig {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
Loading…
Reference in New Issue