变身卡问题处理
parent
42b38b25a5
commit
2a51cb6da7
|
|
@ -63,7 +63,7 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
|
|||
}
|
||||
int[][] costItem = {{curConfig.getExp()[0], curConfig.getExp()[1]}};
|
||||
if (!ItemUtil.itemCost(user, costItem, BIReason.TRANSFORMATION_CARD_LEVEL_COST, 1)) {
|
||||
return;
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
info.setLevel(info.getLevel() + 1);
|
||||
user.getHeroManager().putTransformationList(info);
|
||||
|
|
@ -89,21 +89,17 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
|
|||
num = changingCard.getStarUpCost()[info.getStar()][1];
|
||||
quantity = changingCard.getStarUpCost()[info.getStar()][0];
|
||||
}
|
||||
for(Object itemId:costMap.keySet().toArray()){
|
||||
int itemid = (int)itemId;
|
||||
SItem sItem = SItem.getsItemMap().get(itemid);
|
||||
for (Integer itemId : costMap.keySet()) {
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
if(sItem == null || sItem.getQuantity() != quantity){
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TransformationUpGradeResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
}
|
||||
if(costMap.values().stream().mapToInt(Integer::intValue).sum() != num ){
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TransformationUpGradeResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
if(costMap.values().size() < num){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
if (!ItemUtil.itemCost(user, costMap, BIReason.TRANSFORMATION_CARD_STAR_COST, 1)) {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TransformationUpGradeResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
if (info != null) {
|
||||
info.setStar(info.getStar() + 1);
|
||||
|
|
|
|||
|
|
@ -69,23 +69,23 @@ public class UpOrDownTransformationHandler extends BaseHandler<HeroInfoProto.UpO
|
|||
info.setIndex(index);
|
||||
}
|
||||
else {
|
||||
// 激活变身卡需要消耗道具
|
||||
// 激活变身卡
|
||||
if (info == null){
|
||||
int[][] costItem = {{changingCard.getCardId(),1}};
|
||||
ItemUtil.itemCost(user,costItem, BIReason.TRANSFORMATION_CARD_COST,1);
|
||||
}
|
||||
// 激活或者卸下变身卡
|
||||
if(info == null){
|
||||
boolean cost = ItemUtil.itemCost(user, costItem, BIReason.TRANSFORMATION_CARD_COST, 1);
|
||||
if (!cost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"激活变身卡道具不足");
|
||||
}
|
||||
info = new TransformationInfo(id, 0, 0);
|
||||
info.setLevel(1);
|
||||
info.setStar(0);
|
||||
//激活给变身之力
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
int[][] dropItem = {changingCard.getExp()};
|
||||
|
||||
ItemUtil.drop(user, dropItem, drop, BIReason.TRANSFORMATION_CARD_ACTIVATION);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItem, BIReason.TRANSFORMATION_CARD_ACTIVATION);
|
||||
builder.setDrop(drop);
|
||||
}else {
|
||||
}
|
||||
// 卸下变身卡
|
||||
else {
|
||||
info.setStatus(0);
|
||||
info.setIndex(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue