奇门遁甲消耗
parent
29df3cbddd
commit
fd888a7141
|
@ -339,5 +339,6 @@ public interface BIReason {
|
|||
int CHOICE_DRAW_CARD = 1102;//心愿抽奖
|
||||
|
||||
int QIMENDUNJIA_DRAW = 1103;//奇门遁甲
|
||||
int QIMENDUNJIA_DRAW_CONSUME = 1104;//奇门遁甲消耗
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ public class QiMenDunJiaDrawHandler extends BaseHandler<ActivityProto.qiMenDunJi
|
|||
return MessageTypeProto.MessageType.qiMenDunJiaDrawRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, ActivityProto.qiMenDunJiaDrawRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
|
|
|
@ -1679,6 +1679,9 @@ public class ActivityLogic implements IEventHandler{
|
|||
* @throws Exception
|
||||
*/
|
||||
public ActivityProto.qiMenDunJiaDrawResponse qiMenDunJiaDraw(User user,int activityId) throws Exception {
|
||||
// 道具消耗
|
||||
qiMenConsume(user);
|
||||
// 抽奖逻辑
|
||||
ActivityProto.qiMenDunJiaDrawResponse.Builder response = ActivityProto.qiMenDunJiaDrawResponse.newBuilder();
|
||||
ArrayList<Integer> hits = new ArrayList<>();
|
||||
List<int[]> list = new ArrayList<>();
|
||||
|
@ -1698,6 +1701,25 @@ public class ActivityLogic implements IEventHandler{
|
|||
return response.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇门遁甲消耗
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private void qiMenConsume(User user) throws Exception {
|
||||
// 获取抽奖消耗配置
|
||||
int[][] value = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.LING_LONG_COST);
|
||||
// 计算数量
|
||||
int num = (int)MathUtils.calABX(1,value[1]);
|
||||
// 拼装
|
||||
int[][] cost = {{value[0][0], num}};
|
||||
// 消耗验证
|
||||
boolean result = ItemUtil.itemCost(user, cost, BIReason.QIMENDUNJIA_DRAW_CONSUME, 0);
|
||||
if (!result){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"奇门遁甲消耗道具不足!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇门遁甲随机奖励
|
||||
* @param user 玩家
|
||||
|
|
|
@ -102,6 +102,8 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String YIJIANGOUMAI = "YiJianGouMai";//一件购买
|
||||
public static final String WELFAREREDPACKET_LIMIT = "RedPackMaxGainNum";//每日领取红包数量上限
|
||||
public static final String SWEEP_ONEKEY = "floodprivilegeid";//一键扫荡
|
||||
|
||||
public static final String LING_LONG_COST = "LingLongCost";//玲珑宝镜消耗道具ID
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue