【家园功能1.1.3】

1、装备强化验证bug修改
back_recharge
duhui 2021-12-30 13:51:29 +08:00
parent 7c19af673d
commit 6b139b482e
1 changed files with 7 additions and 7 deletions

View File

@ -348,22 +348,22 @@ public class HomeLogic {
public void equipIntensify(ISession session, PlayerInfoProto.EquipIntensifyRequset proto) throws Exception{
User user = UserManager.getUser(session.getUid());
int type = proto.getType();
Map<Integer, SEquipRankUp> rankUpMap = STableManager.getConfig(SEquipRankUp.class);
Map<Integer, SEquipStrengthen> config = STableManager.getConfig(SEquipStrengthen.class);
// 突破
if (type == 0){
Map<Integer, SEquipRankUp> config = STableManager.getConfig(SEquipRankUp.class);
int up = user.getEquipManager().getEquipHomeRankUp();
int newUp = up+1;
// 验证配置表
SEquipRankUp oldRankUp = config.get(up);
SEquipRankUp newRankUp = config.get(newUp);
SEquipRankUp oldRankUp = rankUpMap.get(up);
SEquipRankUp newRankUp = rankUpMap.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);
Integer level = Optional.ofNullable(config.get(entry.getValue())).map(SEquipStrengthen::getLevel).orElse(0);
if (level < oldRankUp.getLimit()){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"强化等级不足,位置:"+entry.getKey()+",当前等级:"+entry.getValue());
}
@ -377,7 +377,6 @@ public class HomeLogic {
}
// 1-4 装备强化
if (type >= 1 && type <= 4){
Map<Integer, SEquipStrengthen> config = STableManager.getConfig(SEquipStrengthen.class);
Map<Integer, SHomeLandLevel> levelMap = STableManager.getConfig(SHomeLandLevel.class);
int nowId = user.getEquipManager().getEquipIntensifyMap().get(type);
int newId = nowId + 1;
@ -397,7 +396,7 @@ public class HomeLogic {
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",新等级:"+newId);
}
// 校验突破等级
int homeRankUp = user.getEquipManager().getEquipHomeRankUp();
int homeRankUp = Optional.ofNullable(rankUpMap.get(user.getEquipManager().getEquipHomeRankUp())).map(SEquipRankUp::getLevel).orElse(0);
if (oldStrengthen.getLimit2() > homeRankUp){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不足,位置:"+type+",当前突破等级:"+homeRankUp);
}
@ -408,6 +407,7 @@ public class HomeLogic {
}
user.getEquipManager().putEquipIntensifyMap(type,newStrengthen.getid());
}
// 返回装备强化信息
List<CommonProto.EquipIntensifyInfo> intensifyList = CBean2Proto.getEquipIntensifyList(user);
PlayerInfoProto.EquipIntensifyResponse.Builder builder = PlayerInfoProto.EquipIntensifyResponse.newBuilder()
.addAllInfos(intensifyList).setEquipRankUp(user.getEquipManager().getEquipHomeRankUp());