身外化身限制添加

back_recharge
duhui 2022-08-18 17:13:35 +08:00
parent 4904e1fd05
commit 8508c685db
2 changed files with 12 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SChangingCard;
import config.SSpecialConfig;
import manager.STableManager;
import org.springframework.stereotype.Component;
import rpc.protocols.CommonProto;
@ -45,13 +46,20 @@ public class UpOrDownTransformationHandler extends BaseHandler<HeroInfoProto.UpO
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"该卡片版本错误");
}
// 返回值
HeroInfoProto.GetTransformationResponse.Builder builder = HeroInfoProto.GetTransformationResponse.newBuilder()
.addAllList(CBean2Proto.getTransformationInfoList(user));
HeroInfoProto.GetTransformationResponse.Builder builder = HeroInfoProto.GetTransformationResponse.newBuilder().addAllList(CBean2Proto.getTransformationInfoList(user));
Map<Integer, TransformationInfo> infoMap = user.getHeroManager().getTransformationList();
TransformationInfo info = infoMap.get(id);
if (info != null && info.getStatus() == 0){
// 上阵变身卡
int index = proto.getIndex();
int[] values = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.ChangingPosUnlock);
if (index > values.length){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"位置不存在");
}
int tLevel = user.getHeroManager().getTransformationForce()-1;
if (values[index-1] > tLevel){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"变身卡位置未解锁,化身之力等级不足");
}
// 上阵变身卡
for (TransformationInfo value : infoMap.values()) {
if (value.getIndex() == index){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"位置错误,该位置已存在变身卡信息");
@ -59,7 +67,6 @@ public class UpOrDownTransformationHandler extends BaseHandler<HeroInfoProto.UpO
}
info.setStatus(1);
info.setIndex(index);
//info = new TransformationInfo(id, index, 1);
}
else {
// 激活变身卡需要消耗道具

View File

@ -130,8 +130,8 @@ public class SSpecialConfig implements BaseConfig {
public static final String EXPLORERE_LIVETIME = "ExploreReliveTime";//探索时我方阵亡后复活时长
public static final String BUILDING_TIME_REDUCE = "BuildingTimeReduce";//浮生特权每日每次减少建筑升级时间:秒
public static final String CHANGE_CAMP_COST = "ChangeCampCost";//神转换阵营消耗
public static final String GodSignOpenStar = "GodSignOpenStar";//神印格子开启所需神将星级
public static final String ChangingPosUnlock = "ChangingPosUnlock";//3个变身卡化身位解锁所需的化身之力等级
@Override
public void init() throws Exception {