【家园功能1.1.2】

1、装备强化表数据修改
back_recharge
duhui 2021-12-29 18:20:43 +08:00
parent dc71d70ad2
commit 7c19af673d
1 changed files with 10 additions and 16 deletions

View File

@ -355,19 +355,16 @@ public class HomeLogic {
int newUp = up+1; int newUp = up+1;
// 验证配置表 // 验证配置表
SEquipRankUp oldRankUp = config.get(up); SEquipRankUp oldRankUp = config.get(up);
if (oldRankUp == null){ SEquipRankUp newRankUp = config.get(newUp);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不存在,当前突破等级:"+up); if (oldRankUp == null || newRankUp == null){
} throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不存在,新突破等级:"+newUp);
SEquipRankUp equipRankUp = config.get(newUp);
if (equipRankUp == null){
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"突破等级不存在,新突破等级:"+newUp);
} }
// 强化等级验证 // 强化等级验证
Map<Integer, Integer> intensifyMap = user.getEquipManager().getEquipIntensifyMap(); Map<Integer, Integer> intensifyMap = user.getEquipManager().getEquipIntensifyMap();
Map<Integer, SEquipStrengthen> map = STableManager.getConfig(SEquipStrengthen.class); Map<Integer, SEquipStrengthen> map = STableManager.getConfig(SEquipStrengthen.class);
for (Map.Entry<Integer, Integer> entry : intensifyMap.entrySet()) { for (Map.Entry<Integer, Integer> entry : intensifyMap.entrySet()) {
Integer level = Optional.ofNullable(map.get(entry.getValue())).map(SEquipStrengthen::getLevel).orElse(0); Integer level = Optional.ofNullable(map.get(entry.getValue())).map(SEquipStrengthen::getLevel).orElse(0);
if (level < equipRankUp.getLimit()){ if (level < oldRankUp.getLimit()){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"强化等级不足,位置:"+entry.getKey()+",当前等级:"+entry.getValue()); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"强化等级不足,位置:"+entry.getKey()+",当前等级:"+entry.getValue());
} }
} }
@ -376,7 +373,7 @@ public class HomeLogic {
if (!cost){ if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
user.getEquipManager().setEquipHomeRankUp(equipRankUp.getid()); user.getEquipManager().setEquipHomeRankUp(newRankUp.getid());
} }
// 1-4 装备强化 // 1-4 装备强化
if (type >= 1 && type <= 4){ if (type >= 1 && type <= 4){
@ -386,25 +383,22 @@ public class HomeLogic {
int newId = nowId + 1; int newId = nowId + 1;
// 校验配置表 // 校验配置表
SEquipStrengthen oldStrengthen = config.get(nowId); SEquipStrengthen oldStrengthen = config.get(nowId);
if (oldStrengthen == null){
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"数据库等级不存在,当前等级:"+nowId);
}
SEquipStrengthen newStrengthen = config.get(newId); SEquipStrengthen newStrengthen = config.get(newId);
if (newStrengthen == null){ if (oldStrengthen == null || newStrengthen == null){
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"强化等级不存在,位置:"+type+",新等级:"+newId); throw new ErrorCodeException(ErrorCode.LEVE_MAX,"强化等级不存在,位置:"+type+",新等级:"+newId);
} }
// 校验建筑等级 // 校验建筑等级
ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(newStrengthen.getLimit()[0]); ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(oldStrengthen.getLimit()[0]);
if (info == null){ if (info == null){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑未解锁,建筑id:"+newStrengthen.getLimit()[0]); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑未解锁,建筑id:"+oldStrengthen.getLimit()[0]);
} }
SHomeLandLevel landLevel = levelMap.get(info.getId()); SHomeLandLevel landLevel = levelMap.get(info.getId());
if (landLevel == null || landLevel.getlevel() < newStrengthen.getLimit()[1]){ if (landLevel == null || landLevel.getlevel() < oldStrengthen.getLimit()[1]){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",新等级:"+newId); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",新等级:"+newId);
} }
// 校验突破等级 // 校验突破等级
int homeRankUp = user.getEquipManager().getEquipHomeRankUp(); int homeRankUp = user.getEquipManager().getEquipHomeRankUp();
if (newStrengthen.getLimit2() > homeRankUp){ if (oldStrengthen.getLimit2() > homeRankUp){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不足,位置:"+type+",当前突破等级:"+homeRankUp); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不足,位置:"+type+",当前突破等级:"+homeRankUp);
} }
// 校验并消耗 // 校验并消耗