parent
dc71d70ad2
commit
7c19af673d
|
@ -355,19 +355,16 @@ public class HomeLogic {
|
|||
int newUp = up+1;
|
||||
// 验证配置表
|
||||
SEquipRankUp oldRankUp = config.get(up);
|
||||
if (oldRankUp == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不存在,当前突破等级:"+up);
|
||||
}
|
||||
SEquipRankUp equipRankUp = config.get(newUp);
|
||||
if (equipRankUp == null){
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"突破等级不存在,新突破等级:"+newUp);
|
||||
SEquipRankUp newRankUp = config.get(newUp);
|
||||
if (oldRankUp == null || newRankUp == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不存在,新突破等级:"+newUp);
|
||||
}
|
||||
// 强化等级验证
|
||||
Map<Integer, Integer> intensifyMap = user.getEquipManager().getEquipIntensifyMap();
|
||||
Map<Integer, SEquipStrengthen> map = STableManager.getConfig(SEquipStrengthen.class);
|
||||
for (Map.Entry<Integer, Integer> entry : intensifyMap.entrySet()) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +373,7 @@ public class HomeLogic {
|
|||
if (!cost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
user.getEquipManager().setEquipHomeRankUp(equipRankUp.getid());
|
||||
user.getEquipManager().setEquipHomeRankUp(newRankUp.getid());
|
||||
}
|
||||
// 1-4 装备强化
|
||||
if (type >= 1 && type <= 4){
|
||||
|
@ -386,25 +383,22 @@ public class HomeLogic {
|
|||
int newId = nowId + 1;
|
||||
// 校验配置表
|
||||
SEquipStrengthen oldStrengthen = config.get(nowId);
|
||||
if (oldStrengthen == null){
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"数据库等级不存在,当前等级:"+nowId);
|
||||
}
|
||||
SEquipStrengthen newStrengthen = config.get(newId);
|
||||
if (newStrengthen == null){
|
||||
if (oldStrengthen == null || newStrengthen == null){
|
||||
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){
|
||||
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());
|
||||
if (landLevel == null || landLevel.getlevel() < newStrengthen.getLimit()[1]){
|
||||
if (landLevel == null || landLevel.getlevel() < oldStrengthen.getLimit()[1]){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",新等级:"+newId);
|
||||
}
|
||||
// 校验突破等级
|
||||
int homeRankUp = user.getEquipManager().getEquipHomeRankUp();
|
||||
if (newStrengthen.getLimit2() > homeRankUp){
|
||||
if (oldStrengthen.getLimit2() > homeRankUp){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不足,位置:"+type+",当前突破等级:"+homeRankUp);
|
||||
}
|
||||
// 校验并消耗
|
||||
|
|
Loading…
Reference in New Issue