generated from root/miduo_server
自选招募增加道具抽卡次数上限
parent
a4d4515479
commit
7ef17d2a45
|
@ -461,6 +461,7 @@ public enum ErrorCode implements IErrorCode {
|
|||
CHAT_NOT_REACHED_REAL_RECHARGE(90012, "发言未达到真充条件"),
|
||||
NEED_ACTIVITY_ACTIVATED_BEFORE(90013, "需要关联的活动开启过"),
|
||||
BASE_REWARD_CAN_NOT_REPEAT_OBTAIN(90014, "高级招募保底奖励不可重复领取"),
|
||||
SELF_SELECT_HERO_CARD_LIMIT(90015,"自选招募次数超过上线!"),
|
||||
|
||||
|
||||
RESOURCE_REFRESH_LIME_LIMIT(30203,"资源刷新次数超出上限"),
|
||||
|
|
|
@ -53,6 +53,11 @@ public final class ActivityManager extends MongoBase {
|
|||
private int heroRecruitGuaranteeTimes = 0;
|
||||
private Map<Integer, Integer> seasonSkillMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 自选招募卡当日抽卡次数
|
||||
*/
|
||||
private int heroCardRecruitTimes = 0;
|
||||
|
||||
public ActivityManager() {
|
||||
}
|
||||
|
||||
|
@ -350,4 +355,19 @@ public final class ActivityManager extends MongoBase {
|
|||
this.heroRecruitGuaranteeTimes = heroRecruitGuaranteeTimes;
|
||||
updateString("heroRecruitGuaranteeTimes", heroRecruitGuaranteeTimes);
|
||||
}
|
||||
|
||||
public int getHeroCardRecruitTimes() {
|
||||
return heroCardRecruitTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param heroCardRecruitTimes
|
||||
*/
|
||||
public void setHeroCardRecruitTimes(int heroCardRecruitTimes) {
|
||||
updateString("heroCardRecruitTimes",heroCardRecruitTimes);
|
||||
this.heroCardRecruitTimes = heroCardRecruitTimes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -407,6 +407,7 @@ public class GlobalDataManaager implements IManager {
|
|||
user.getPlayerInfoManager().getPrivilegeWheelInfo().resetAllWheelTimes();
|
||||
//自选招募每日次数重置
|
||||
user.getActivityManager().setHeroRecruitTimes(0);
|
||||
user.getActivityManager().setHeroCardRecruitTimes(0);
|
||||
//同步自选招募数据
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_SELF_SELECT_HERO_RAND_INDICATION_VALUE, null, true);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_PRIVILEGE_HERO_RAND_INDICATION_VALUE, null, true);
|
||||
|
|
|
@ -413,8 +413,10 @@ public class HeroLogic {
|
|||
if (CollectionUtils.isEmpty(selfSelectHeroIds)) {
|
||||
throw new ErrorCodeException(ErrorCode.MUST_SELECT_HERO_FIRST);
|
||||
}
|
||||
|
||||
//钻石抽卡当日抽卡次数
|
||||
int curTimes = user.getActivityManager().getHeroRecruitTimes();
|
||||
//自选招募卡当日抽卡次数
|
||||
int cardTimes = user.getActivityManager().getHeroCardRecruitTimes();
|
||||
SChosenPoolConfig chosenPoolConfig = SChosenPoolConfig.getChosePoolConfigByActId(actId);
|
||||
if(chosenPoolConfig == null) {
|
||||
throw new ErrorCodeException(ErrorCode.CONFIG_ERROR);
|
||||
|
@ -447,28 +449,60 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
boolean addDiamondCount = false;
|
||||
boolean addCardCount = false;
|
||||
if(type == 1) {
|
||||
//单次招募只能使用代币
|
||||
//判断代币抽卡次数上限
|
||||
if(cardTimes >= chosenPoolConfig.getAllDrawLimit()) {
|
||||
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_CARD_LIMIT);
|
||||
}
|
||||
boolean itemCost = ItemUtil.itemCost(user, sLotterySetting.getCostItem(), BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!itemCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
addCardCount = true;
|
||||
} else {
|
||||
//十连抽 优先消耗代币 代币不够才判断钻石
|
||||
//判断代币够不够
|
||||
boolean enoughCardCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[0]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughCardCost) {
|
||||
//钻石招募次数大于每日上限
|
||||
if(curTimes >= chosenPoolConfig.getGemDrawLimit() ) {
|
||||
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_TIME_LIMIT);
|
||||
//判断代币抽卡次数上限
|
||||
int total = cardTimes + 10;
|
||||
//超上限了
|
||||
if(total >= chosenPoolConfig.getAllDrawLimit()) {
|
||||
//不允许用钻石抽,直接提示道具抽到上限
|
||||
if(chosenPoolConfig.getGemDrawLimit() <= 0){
|
||||
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_CARD_LIMIT);
|
||||
}
|
||||
//判断代币够不够
|
||||
boolean enoughCardCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[0]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughCardCost) {
|
||||
//钻石招募次数大于每日上限
|
||||
if(curTimes >= chosenPoolConfig.getGemDrawLimit() ) {
|
||||
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_TIME_LIMIT);
|
||||
}
|
||||
|
||||
//判断钻石够不够
|
||||
boolean enoughDiamondCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[1]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughDiamondCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
//判断钻石够不够
|
||||
boolean enoughDiamondCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[1]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughDiamondCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
addDiamondCount = true;
|
||||
}
|
||||
addDiamondCount = true;
|
||||
}else{
|
||||
//判断代币够不够
|
||||
boolean enoughCardCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[0]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughCardCost) {
|
||||
//钻石招募次数大于每日上限
|
||||
if(curTimes >= chosenPoolConfig.getGemDrawLimit() ) {
|
||||
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_TIME_LIMIT);
|
||||
}
|
||||
|
||||
//判断钻石够不够
|
||||
boolean enoughDiamondCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[1]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
|
||||
if (!enoughDiamondCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
addDiamondCount = true;
|
||||
}
|
||||
addCardCount = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,8 +550,16 @@ public class HeroLogic {
|
|||
if(addDiamondCount) {
|
||||
user.getActivityManager().setHeroRecruitTimes(curTimes + sLotterySetting.getPerCount());
|
||||
}
|
||||
|
||||
builder.setDailyGemRandomTimes(user.getActivityManager().getHeroRecruitTimes());
|
||||
//设置每日招募次数
|
||||
if(addCardCount){
|
||||
user.getActivityManager().setHeroCardRecruitTimes(cardTimes + sLotterySetting.getPerCount());
|
||||
}
|
||||
//不允许用钻石招募,钻石招募记次也按照道具招募次数临时处理
|
||||
if(chosenPoolConfig.getGemDrawLimit()<=0){
|
||||
builder.setDailyGemRandomTimes(user.getActivityManager().getHeroCardRecruitTimes());
|
||||
}else {
|
||||
builder.setDailyGemRandomTimes(user.getActivityManager().getHeroRecruitTimes());
|
||||
}
|
||||
builder.setGuaranteeTimes(user.getActivityManager().getHeroRecruitGuaranteeTimes());
|
||||
fiveStarPushByRandom(user, resultRandom);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SELF_SELECT_HERO_RECRUIT_RESPONSE_VALUE, builder.build(), true);
|
||||
|
|
|
@ -14,7 +14,8 @@ public class SChosenPoolConfig implements BaseConfig {
|
|||
private int[] lotteryId; //卡池ID
|
||||
private int staticRewardNum; //保底次数
|
||||
private int[] changeCost; //更换卡牌消耗道具
|
||||
private int gemDrawLimit; //每日招募次数限制
|
||||
private int gemDrawLimit; //每日钻石招募次数限制
|
||||
private int allDrawLimit; //每日代币招募次数限制
|
||||
public static Map<Integer, SChosenPoolConfig> actId2SChosenPoolConfig = new HashMap<>();
|
||||
|
||||
@Override
|
||||
|
@ -69,4 +70,12 @@ public class SChosenPoolConfig implements BaseConfig {
|
|||
public void setGemDrawLimit(int gemDrawLimit) {
|
||||
this.gemDrawLimit = gemDrawLimit;
|
||||
}
|
||||
|
||||
public int getAllDrawLimit() {
|
||||
return allDrawLimit;
|
||||
}
|
||||
|
||||
public void setAllrawLimit(int allDrawLimit) {
|
||||
this.allDrawLimit = allDrawLimit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue