福星高照刷新问题, 心愿抽奖免费抽奖次数优化

duhui 2021-06-02 00:01:58 +08:00
parent bf54d94986
commit df2d2bb6e6
1 changed files with 30 additions and 29 deletions

View File

@ -92,6 +92,8 @@ public class ActivityLogic implements IEventHandler{
//更新累计充值天数
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_SUM_DAY);
ActivityLogic.getInstance().resumeActivity(user, ActivityType.LUCKY_GET);
ActivityLogic.getInstance().resumeActivity(user,ActivityType.JADE_DYNASTY_MISSION);
user.getPlayerInfoManager().setRechargedaily(0);
user.getPlayerInfoManager().setLuckWheelLimitTime(0);
@ -1536,47 +1538,46 @@ public class ActivityLogic implements IEventHandler{
if (!check1){
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT, "抽奖次数不足");
}
CommonProto.Drop.Builder drop;
CommonProto.Drop.Builder drop = null;
// 单抽
if (num == 1){
// 验证免费特权
boolean check = PlayerLogic.getInstance().checkAndUpdate(user, setting.getFreeTimes(), num);
if (check){
drop = getDrawReward(user, activityId, num);
// 发送奖励
build.setDrop(drop);
MessageUtil.sendMessage(user.getId(),1, MessageTypeProto.MessageType.choiceDrawCardResponse_VALUE,build.build(),true);
return;
}
}
// 十连抽还是单抽消耗物品获取
int[][] item = type == 1?setting.getCostItemMul():setting.getCostItemSingle();
// 验证道具消耗
int[][] cost = new int[][]{{item[0][0],item[0][1]}};
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.CHOICE_DRAW_CARD, 0);
// 道具抽奖
if (itemCost){
drop = getDrawReward(user, activityId, num);
}
// 妖晶抽奖
else {
// 验证妖晶购买特权
boolean check = PlayerLogic.getInstance().check(user, setting.getDiamondMaxTimes(), num);
if (!check){
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"妖晶抽奖次数不足");
// 消费抽取
if (drop == null){
// 十连抽还是单抽消耗物品获取
int[][] item = type == 1?setting.getCostItemMul():setting.getCostItemSingle();
// 验证道具消耗
int[][] cost = new int[][]{{item[0][0],item[0][1]}};
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.CHOICE_DRAW_CARD, 0);
// 道具抽奖
if (itemCost){
drop = getDrawReward(user, activityId, num);
}
// 妖晶抽奖
else {
// 验证妖晶购买特权
boolean check = PlayerLogic.getInstance().check(user, setting.getDiamondMaxTimes(), num);
if (!check){
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"妖晶抽奖次数不足");
}
// 验证妖晶消耗
int[][] cost2 = new int[][]{{item[1][0],item[1][1]}};
boolean itemCost2 = ItemUtil.itemCost(user, cost2, BIReason.CHOICE_DRAW_CARD, 0);
if (!itemCost2){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
// 验证妖晶消耗
int[][] cost2 = new int[][]{{item[1][0],item[1][1]}};
boolean itemCost2 = ItemUtil.itemCost(user, cost2, BIReason.CHOICE_DRAW_CARD, 0);
if (!itemCost2){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
//特权次数消耗
PlayerLogic.getInstance().checkAndUpdate(user, setting.getDiamondMaxTimes(), num);
drop = getDrawReward(user, activityId, num);
}
//特权次数消耗
PlayerLogic.getInstance().checkAndUpdate(user, setting.getDiamondMaxTimes(), num);
drop = getDrawReward(user, activityId, num);
}
// 特权消耗