妖晶购买

master_0.05_yj
grimm 2024-05-27 15:03:49 +08:00
parent bb6b537567
commit cfbc6e00ef
2 changed files with 6 additions and 1 deletions

View File

@ -189,6 +189,7 @@ public enum ErrorCode implements IErrorCode {
RECHARGE_NUM_NOT(157,"充值金额不足"),
BEFORE_CONDITION_NOT(158,"前置条件不足"),
GIFT_NULL_ERROR(160,"礼包不存在"),
GIFT_PRICE_ERROR(161,"礼包需要rmb购买"),
ACCOUNT_ERROR(-104,"帐号异常,被封号"),
;

View File

@ -37,8 +37,12 @@ public class YaoJingBuyHandler extends BaseHandler<PlayerInfoProto.YaoJingBuyReq
if (config == null){
throw new ErrorCodeException(ErrorCode.GIFT_NULL_ERROR);//礼包不存在
}
int[] priceYaoJing = config.getPriceYaoJing();
if (priceYaoJing == null || priceYaoJing.length == 0){
throw new ErrorCodeException(ErrorCode.GIFT_PRICE_ERROR);//礼包需要rmb购买
}
// 道具是否足够
boolean cost = ItemUtil.itemCost(user, new int[][]{config.getPriceYaoJing()}, BIReason.YAOJING_BUY_GOOD_COST, 0);
boolean cost = ItemUtil.itemCost(user, new int[][]{priceYaoJing}, BIReason.YAOJING_BUY_GOOD_COST, 0);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}