礼物升星
parent
d2bcfe7d6b
commit
c0ddc38d70
|
@ -633,12 +633,12 @@ public class EquipLogic {
|
||||||
ArrayList<int[][]> costList = new ArrayList<>();
|
ArrayList<int[][]> costList = new ArrayList<>();
|
||||||
costList.add(config.getFormula());
|
costList.add(config.getFormula());
|
||||||
costList.add(config.getResource());
|
costList.add(config.getResource());
|
||||||
|
boolean cost = ItemUtil.checkCost(user, costList);
|
||||||
boolean cost = ItemUtil.itemCost(user, costList, BIReason.GIFT_UP_STAR_COST, 1);
|
|
||||||
if (!cost){
|
if (!cost){
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{giftId, 1}}, BIReason.GIFT_UP_STAR_GET);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{giftId, 1}}, BIReason.GIFT_UP_STAR_GET);
|
||||||
|
ItemUtil.itemCost(user, costList, BIReason.GIFT_EQUIP_UP_COST, 0);
|
||||||
HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop);
|
HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop);
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GiftEquipUpStarResponse_VALUE, builder.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GiftEquipUpStarResponse_VALUE, builder.build(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1508,6 +1508,20 @@ public class ItemUtil {
|
||||||
return checkCostLong(user,longMap);
|
return checkCostLong(user,longMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkCost(User user, List<int[][]> item) throws Exception {
|
||||||
|
HashMap<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
for (int[][] ints : item) {
|
||||||
|
selectCost(ints,itemMap);
|
||||||
|
}
|
||||||
|
return checkCost(user,itemMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkCost(User user, int[][] item) throws Exception {
|
||||||
|
HashMap<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
selectCost(item,itemMap);
|
||||||
|
return checkCost(user,itemMap);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean checkCostLong(User user, Map<Integer, Long> itemMap) throws Exception {
|
public static boolean checkCostLong(User user, Map<Integer, Long> itemMap) throws Exception {
|
||||||
if (itemMap == null || itemMap.isEmpty()) {
|
if (itemMap == null || itemMap.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue