parent
bd9c2e002a
commit
2707c018f0
|
@ -79,6 +79,12 @@ public class HomeLogic {
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"浮生门建筑升级,前置建筑等级不足,升级建筑levelId:"+info.getId()+",前置建筑levelId:"+info1.getId());
|
||||
}
|
||||
}
|
||||
// 特殊情况
|
||||
if (info.getUpLvEndTime() <= now){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
}
|
||||
//
|
||||
if (type == 1 && info.getUpLvEndTime() == 0){
|
||||
// 最高等级
|
||||
int maxId = config.values().stream().filter(v->v.getPoolID()==landLevel.getPoolID()).mapToInt(SHomeLandLevel::getlevel).max().orElse(0);
|
||||
if (info.getId() == maxId) {
|
||||
|
@ -86,7 +92,7 @@ public class HomeLogic {
|
|||
}
|
||||
// 需要消耗的道具
|
||||
int[][] items = landLevel.getCost();
|
||||
boolean cost = ItemUtil.checkCostLong(user, items, 1);
|
||||
boolean cost = ItemUtil.itemCost(user, items, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||
if (!cost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"浮生门建筑升级,建筑升级要求道具不足,建筑levelId:"+info.getId()+",道具要求:"+Arrays.toString(items));
|
||||
}
|
||||
|
@ -95,18 +101,24 @@ public class HomeLogic {
|
|||
int endTime = landLevel.getTime();
|
||||
info.setUpLvEndTime(now + endTime);
|
||||
}
|
||||
// 特殊情况
|
||||
if (info.getUpLvEndTime() <= now){
|
||||
// 升级
|
||||
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||
// 可以继续升级
|
||||
if (info.getId() < maxId){
|
||||
SHomeLandLevel landLevel1 = config.get(info.getId());
|
||||
info.setUpLvEndTime(landLevel1.getTime() + now);
|
||||
}
|
||||
}
|
||||
// 立即完成
|
||||
if (type == 2){
|
||||
// 最高等级
|
||||
int maxId = config.values().stream().filter(v->v.getPoolID()==landLevel.getPoolID()).mapToInt(SHomeLandLevel::getlevel).max().orElse(0);
|
||||
if (info.getId() == maxId) {
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"浮生门建筑升级,建筑等级最高,升级建筑levelId:"+info.getId());
|
||||
}
|
||||
boolean ifType = false;
|
||||
int[][] items = landLevel.getCost();
|
||||
// quick up level
|
||||
if (info.getUpLvEndTime() == 0){
|
||||
boolean cost = ItemUtil.checkCostLong(user, items, 1);
|
||||
if (!cost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"浮生门建筑升级,建筑升级要求道具不足,建筑levelId:"+info.getId()+",道具要求:"+Arrays.toString(items));
|
||||
}
|
||||
ifType = true;
|
||||
}
|
||||
// 条件: 单位/s 道具id 道具数量
|
||||
int[] intValues = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.HONGMENG_LATTICE_PRICE);
|
||||
// 立即升级消耗的道具
|
||||
|
@ -121,6 +133,9 @@ public class HomeLogic {
|
|||
if (!itemCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑升级,立刻升级失败道具不足,建筑levelId:" + info.getId() + ",道具要求:" + Arrays.toString(cost1));
|
||||
}
|
||||
if (ifType){
|
||||
ItemUtil.itemCost(user, items, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||
}
|
||||
}
|
||||
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||
}
|
||||
|
@ -129,7 +144,7 @@ public class HomeLogic {
|
|||
info.setUpLvEndTime(0);
|
||||
}
|
||||
// 特权加速
|
||||
if (type == 4){
|
||||
if (type == 4 && info.getId() > 0){
|
||||
// 验证特权次数
|
||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.HOME_DAY_TIME_NUM, 1);
|
||||
if (!countBol) {
|
||||
|
@ -145,7 +160,6 @@ public class HomeLogic {
|
|||
info.setUpLvEndTime(time);
|
||||
}
|
||||
}
|
||||
ItemUtil.itemCost(user, items, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||
// 最后更新
|
||||
user.getPlayerInfoManager().putArchitectureInfo(landLevel.getPoolID(),info);
|
||||
// 需要更新的建筑信息
|
||||
|
|
Loading…
Reference in New Issue