部分表字段初始化代码修改

back_recharge
lvxinran 2019-11-25 17:11:21 +08:00
parent 0e18ea70da
commit 2c35bf1b38
11 changed files with 21 additions and 73 deletions

View File

@ -441,13 +441,14 @@ public class MapLogic {
//如果是无尽本
if(initRandomPointMap.get(mapManager.getCurMapId())!=null){
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())!=null){
if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
}else{
List<Integer> points = new ArrayList<>();
points.add(xy);
endlessRandomPoint.put(mapPointConfig.getId(),points);
}
// if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
// endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
// }else{
// List<Integer> points = new ArrayList<>();
// points.add(xy);
// endlessRandomPoint.put(mapPointConfig.getId(),points);
// }
endlessRandomPoint.computeIfAbsent(mapPointConfig.getId(),v->new ArrayList<>()).add(xy);
}
}else{
newMap.put(xy, cellValue);

View File

@ -734,10 +734,7 @@ public class MapManager extends MongoBase {
if(endlessMapInfo.getMapSign()==null){
endlessMapInfo.setMapSign(new HashMap<>());
}
if(!endlessMapInfo.getMapSign().containsKey(mapId)){
endlessMapInfo.getMapSign().put(mapId,new HashMap<>());
}
endlessMapInfo.getMapSign().get(mapId).put(cellId,info);
endlessMapInfo.getMapSign().computeIfAbsent(mapId,v->new HashMap<>()).put(cellId,info);
updateString("endlessMapInfo.mapSign."+mapId+"."+cellId,info);
}
public void removeEndlessSign(int mapId,int cellId){

View File

@ -37,10 +37,7 @@ public class WorkShopController extends MongoBase {
}
public void updateTechLevel(int propession,int techId,int level){
if(!this.technologyMap.containsKey(propession)){
this.technologyMap.put(propession,new HashMap<>());
}
this.technologyMap.get(propession).put(techId,level);
technologyMap.computeIfAbsent(propession,v->new HashMap<>()).put(techId,level);
updateString("technologyMap." + propession + "." + techId,level);
}

View File

@ -36,23 +36,12 @@ public class SAccomplishmentConfig implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer, SAccomplishmentConfig> config = STableManager.getConfig(SAccomplishmentConfig.class);
Map<Integer, List<SAccomplishmentConfig>> sAccomplishmentConfigByMapIdMapTmp = new HashMap<>();
Map<Integer,Map<Integer,List<SAccomplishmentConfig>>> sAccomplishmentConfigByMapIdAndLogicMapTmp = new HashMap<>();
for(SAccomplishmentConfig sAccomplishmentConfig : config.values()){
int mapId = sAccomplishmentConfig.getMapId();
if(!sAccomplishmentConfigByMapIdMapTmp.containsKey(mapId)){
sAccomplishmentConfigByMapIdMapTmp.put(mapId,new ArrayList<>());
sAccomplishmentConfigByMapIdAndLogicMapTmp.put(mapId,new HashMap<>());
}
int logic = sAccomplishmentConfig.getLogic();
if(!sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).containsKey(logic)){
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).put(logic,new ArrayList<>());
}
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).get(logic).add(sAccomplishmentConfig);
sAccomplishmentConfigByMapIdMapTmp.get(mapId).add(sAccomplishmentConfig);
sAccomplishmentConfigByMapIdMap.computeIfAbsent(mapId,v->new ArrayList<>()).add(sAccomplishmentConfig);
sAccomplishmentConfigByMapIdAndLogicMap.computeIfAbsent(mapId,v->new HashMap<>());
sAccomplishmentConfigByMapIdAndLogicMap.get(mapId).computeIfAbsent(logic,v->new ArrayList<>()).add(sAccomplishmentConfig);
}
sAccomplishmentConfigByMapIdMap = sAccomplishmentConfigByMapIdMapTmp;
sAccomplishmentConfigByMapIdAndLogicMap = sAccomplishmentConfigByMapIdAndLogicMapTmp;
}
public static List<SAccomplishmentConfig> getsAccomplishmentConfigByMapIdAndLogic(int mapId,int logic) {

View File

@ -38,10 +38,7 @@ public class SEquipTalismana implements BaseConfig {
equipTalismanaMap = STableManager.getConfig(SEquipTalismana.class);
equipTalismanaStarMap = new HashMap<>();
for(Map.Entry<Integer,SEquipTalismana> entry: equipTalismanaMap.entrySet()){
if(equipTalismanaStarMap.get(entry.getValue().getTalismanaId())==null){
equipTalismanaStarMap.put(entry.getValue().getTalismanaId(),new HashMap<>());
}
equipTalismanaStarMap.get(entry.getValue().getTalismanaId()).put(entry.getValue().getLevel(),entry.getValue());
equipTalismanaStarMap.computeIfAbsent(entry.getValue().getTalismanaId(),v->new HashMap<>()).put(entry.getValue().getLevel(),entry.getValue());
}
}

View File

@ -29,13 +29,8 @@ public class SHeroReturn implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer, SHeroReturn> config = STableManager.getConfig(SHeroReturn.class);
Map<Integer,Map<Integer,SHeroReturn>> sheroReturnMapTmp = new HashMap<>();
for(SHeroReturn sHeroReturn : config.values()){
int heroId = sHeroReturn.getHeroId();
if(!sheroReturnMapTmp.containsKey(heroId)){
sheroReturnMapTmp.put(heroId,new HashMap<>());
}
Map<Integer, SHeroReturn> sHeroReturnMapByStar = sheroReturnMapTmp.get(heroId);
int star = sHeroReturn.getStar();
int[] rankupReturn = sHeroReturn.getRankupReturn();
int[][] returnHero = sHeroReturn.getReturnHero();
@ -48,9 +43,8 @@ public class SHeroReturn implements BaseConfig {
returnMaterialsTmp[length-1][0] = rankupReturn[0];
returnMaterialsTmp[length-1][1] = rankupReturn[1];
sHeroReturn.setReturnMaterials(returnMaterialsTmp);
sHeroReturnMapByStar.put(star,sHeroReturn);
sheroReturnMap.computeIfAbsent(heroId,v->new HashMap<>()).put(star,sHeroReturn);
}
sheroReturnMap = sheroReturnMapTmp;
}

View File

@ -27,16 +27,10 @@ public class SMysteryFoodPoolConfig implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer, List<SMysteryFoodPoolConfig>> result = new HashMap<>();
Map<Integer, SMysteryFoodPoolConfig> config = STableManager.getConfig(SMysteryFoodPoolConfig.class);
for(SMysteryFoodPoolConfig sMysteryFoodPoolConfig : config.values()){
int pool = sMysteryFoodPoolConfig.getPool();
if(!result.containsKey(pool)){
result.put(pool,new ArrayList<>());
}
result.get(pool).add(sMysteryFoodPoolConfig);
sMysteryFoodPoolConfigByPoolMap.computeIfAbsent(pool,v->new ArrayList<>()).add(sMysteryFoodPoolConfig);
}
sMysteryFoodPoolConfigByPoolMap = result;
}
public static List<SMysteryFoodPoolConfig> getsMysteryFoodPoolConfigByPoold(int poolId) {

View File

@ -29,16 +29,11 @@ public class SRingFireConfig implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer, SRingFireConfig> config = STableManager.getConfig(SRingFireConfig.class);
Map<Integer,Map<Integer,SRingFireConfig>> sRingFireByRingIdAndLevelMapTmp = new HashMap<>();
for(SRingFireConfig sRingFireConfig : config.values()){
int ringId = sRingFireConfig.getRingId();
int ringLevel = sRingFireConfig.getRingLevel();
if(!sRingFireByRingIdAndLevelMapTmp.containsKey(ringId)){
sRingFireByRingIdAndLevelMapTmp.put(ringId,new HashMap<>());
}
sRingFireByRingIdAndLevelMapTmp.get(ringId).put(ringLevel,sRingFireConfig);
sRingFireByRingIdAndLevelMap.computeIfAbsent(ringId,v->new HashMap<>()).put(ringLevel,sRingFireConfig);
}
sRingFireByRingIdAndLevelMap = sRingFireByRingIdAndLevelMapTmp;
}
public static SRingFireConfig getsRingFireByRingIdAndLevel(int ringId,int ringLevel) {

View File

@ -28,16 +28,11 @@ public class SRunesPoolConfig implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer,List<SRunesPoolConfig>> sRunesPoolConfigsByPoolNumTmp = new HashMap<>();
Map<Integer, SRunesPoolConfig> config = STableManager.getConfig(SRunesPoolConfig.class);
for(SRunesPoolConfig sRunesPoolConfig : config.values()){
int poolNum = sRunesPoolConfig.getPoolNum();
if(!sRunesPoolConfigsByPoolNumTmp.containsKey(poolNum)){
sRunesPoolConfigsByPoolNumTmp.put(poolNum,new ArrayList<>());
}
sRunesPoolConfigsByPoolNumTmp.get(poolNum).add(sRunesPoolConfig);
sRunesPoolConfigsByPoolNum.computeIfAbsent(poolNum,v->new ArrayList<>()).add(sRunesPoolConfig);
}
sRunesPoolConfigsByPoolNum = sRunesPoolConfigsByPoolNumTmp;
}
public static List<SRunesPoolConfig> getsRunesPoolConfigsByPoolNum(int poolNum) {

View File

@ -23,16 +23,11 @@ public class SSevenDaysScore implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer, SSevenDaysScore> config = STableManager.getConfig(SSevenDaysScore.class);
Map<Integer,Map<Integer,SSevenDaysScore>> SSevenDaysScoreByActivityIdAndScoreMapTmp= new HashMap<>();
for(SSevenDaysScore sSevenDaysScore:config.values()){
int activityId = sSevenDaysScore.getActivityId();
int taskValue = sSevenDaysScore.getTaskValue();
if(!SSevenDaysScoreByActivityIdAndScoreMapTmp.containsKey(activityId)){
SSevenDaysScoreByActivityIdAndScoreMapTmp.put(activityId,new HashMap<>());
}
SSevenDaysScoreByActivityIdAndScoreMapTmp.get(activityId).put(taskValue,sSevenDaysScore);
SSevenDaysScoreByActivityIdAndScoreMap.computeIfAbsent(activityId,v->new HashMap<>()).put(taskValue,sSevenDaysScore);
}
SSevenDaysScoreByActivityIdAndScoreMap = SSevenDaysScoreByActivityIdAndScoreMapTmp;
}

View File

@ -37,14 +37,8 @@ public class STreasureSunlongTaskConfig implements BaseConfig {
sTreasureTaskConfigListByTypeMapTmp = new HashMap<>();
for(Map.Entry<Integer,STreasureSunlongTaskConfig> entry:treasureTaskConfig.entrySet()){
STreasureSunlongTaskConfig entryValue = entry.getValue();
if(!taskTypeMap.containsKey(entryValue.getType())){
taskTypeMap.put(entryValue.getType(),new ArrayList<>());
}
if(!sTreasureTaskConfigListByTypeMapTmp.containsKey(entryValue.getTaskType())){
sTreasureTaskConfigListByTypeMapTmp.put(entryValue.getTaskType(),new ArrayList<>());
}
sTreasureTaskConfigListByTypeMapTmp.get(entryValue.getTaskType()).add(entryValue);
taskTypeMap.get(entryValue.getType()).add(entry.getKey());
taskTypeMap.computeIfAbsent(entryValue.getType(),v->new ArrayList<>()).add(entry.getKey());
sTreasureTaskConfigListByTypeMapTmp.computeIfAbsent(entryValue.getTaskType(),v->new ArrayList<>()).add(entryValue);
}
}