grimm 2024-12-08 16:23:22 +08:00
commit a0a7d2926e
5 changed files with 88 additions and 15 deletions

View File

@ -461,6 +461,7 @@ public enum ErrorCode implements IErrorCode {
CHAT_NOT_REACHED_REAL_RECHARGE(90012, "发言未达到真充条件"), CHAT_NOT_REACHED_REAL_RECHARGE(90012, "发言未达到真充条件"),
NEED_ACTIVITY_ACTIVATED_BEFORE(90013, "需要关联的活动开启过"), NEED_ACTIVITY_ACTIVATED_BEFORE(90013, "需要关联的活动开启过"),
BASE_REWARD_CAN_NOT_REPEAT_OBTAIN(90014, "高级招募保底奖励不可重复领取"), BASE_REWARD_CAN_NOT_REPEAT_OBTAIN(90014, "高级招募保底奖励不可重复领取"),
SELF_SELECT_HERO_CARD_LIMIT(90015,"自选招募次数超过上线!"),
RESOURCE_REFRESH_LIME_LIMIT(30203,"资源刷新次数超出上限"), RESOURCE_REFRESH_LIME_LIMIT(30203,"资源刷新次数超出上限"),

View File

@ -53,6 +53,11 @@ public final class ActivityManager extends MongoBase {
private int heroRecruitGuaranteeTimes = 0; private int heroRecruitGuaranteeTimes = 0;
private Map<Integer, Integer> seasonSkillMap = new HashMap<>(); private Map<Integer, Integer> seasonSkillMap = new HashMap<>();
/**
*
*/
private int heroCardRecruitTimes = 0;
public ActivityManager() { public ActivityManager() {
} }
@ -350,4 +355,19 @@ public final class ActivityManager extends MongoBase {
this.heroRecruitGuaranteeTimes = heroRecruitGuaranteeTimes; this.heroRecruitGuaranteeTimes = heroRecruitGuaranteeTimes;
updateString("heroRecruitGuaranteeTimes", heroRecruitGuaranteeTimes); updateString("heroRecruitGuaranteeTimes", heroRecruitGuaranteeTimes);
} }
public int getHeroCardRecruitTimes() {
return heroCardRecruitTimes;
}
/**
*
* @param heroCardRecruitTimes
*/
public void setHeroCardRecruitTimes(int heroCardRecruitTimes) {
updateString("heroCardRecruitTimes",heroCardRecruitTimes);
this.heroCardRecruitTimes = heroCardRecruitTimes;
}
} }

View File

@ -407,6 +407,7 @@ public class GlobalDataManaager implements IManager {
user.getPlayerInfoManager().getPrivilegeWheelInfo().resetAllWheelTimes(); user.getPlayerInfoManager().getPrivilegeWheelInfo().resetAllWheelTimes();
//自选招募每日次数重置 //自选招募每日次数重置
user.getActivityManager().setHeroRecruitTimes(0); 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_SELF_SELECT_HERO_RAND_INDICATION_VALUE, null, true);
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_PRIVILEGE_HERO_RAND_INDICATION_VALUE, null, true); MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_PRIVILEGE_HERO_RAND_INDICATION_VALUE, null, true);

View File

@ -413,8 +413,10 @@ public class HeroLogic {
if (CollectionUtils.isEmpty(selfSelectHeroIds)) { if (CollectionUtils.isEmpty(selfSelectHeroIds)) {
throw new ErrorCodeException(ErrorCode.MUST_SELECT_HERO_FIRST); throw new ErrorCodeException(ErrorCode.MUST_SELECT_HERO_FIRST);
} }
//钻石抽卡当日抽卡次数
int curTimes = user.getActivityManager().getHeroRecruitTimes(); int curTimes = user.getActivityManager().getHeroRecruitTimes();
//自选招募卡当日抽卡次数
int cardTimes = user.getActivityManager().getHeroCardRecruitTimes();
SChosenPoolConfig chosenPoolConfig = SChosenPoolConfig.getChosePoolConfigByActId(actId); SChosenPoolConfig chosenPoolConfig = SChosenPoolConfig.getChosePoolConfigByActId(actId);
if(chosenPoolConfig == null) { if(chosenPoolConfig == null) {
throw new ErrorCodeException(ErrorCode.CONFIG_ERROR); throw new ErrorCodeException(ErrorCode.CONFIG_ERROR);
@ -447,28 +449,60 @@ public class HeroLogic {
} }
} }
boolean addDiamondCount = false; boolean addDiamondCount = false;
boolean addCardCount = false;
if(type == 1) { 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); boolean itemCost = ItemUtil.itemCost(user, sLotterySetting.getCostItem(), BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
if (!itemCost) { if (!itemCost) {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
addCardCount = true;
} else { } else {
//十连抽 优先消耗代币 代币不够才判断钻石 //十连抽 优先消耗代币 代币不够才判断钻石
//判断代币够不够 //判断代币抽卡次数上限
boolean enoughCardCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[0]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type); int total = cardTimes + 10;
if (!enoughCardCost) { //超上限了
//钻石招募次数大于每日上限 if(total >= chosenPoolConfig.getAllDrawLimit()) {
if(curTimes >= chosenPoolConfig.getGemDrawLimit() ) { //不允许用钻石抽,直接提示道具抽到上限
throw new ErrorCodeException(ErrorCode.SELF_SELECT_HERO_TIME_LIMIT); 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); boolean enoughDiamondCost = ItemUtil.itemCost(user, new int[][]{sLotterySetting.getCostItem()[1]}, BIReason.SELF_SELECT_HERO_RECRUIT_CONSUME, type);
if (!enoughDiamondCost) { if (!enoughDiamondCost) {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); 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) { if(addDiamondCount) {
user.getActivityManager().setHeroRecruitTimes(curTimes + sLotterySetting.getPerCount()); 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()); builder.setGuaranteeTimes(user.getActivityManager().getHeroRecruitGuaranteeTimes());
fiveStarPushByRandom(user, resultRandom); fiveStarPushByRandom(user, resultRandom);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SELF_SELECT_HERO_RECRUIT_RESPONSE_VALUE, builder.build(), true); MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SELF_SELECT_HERO_RECRUIT_RESPONSE_VALUE, builder.build(), true);

View File

@ -14,7 +14,8 @@ public class SChosenPoolConfig implements BaseConfig {
private int[] lotteryId; //卡池ID private int[] lotteryId; //卡池ID
private int staticRewardNum; //保底次数 private int staticRewardNum; //保底次数
private int[] changeCost; //更换卡牌消耗道具 private int[] changeCost; //更换卡牌消耗道具
private int gemDrawLimit; //每日招募次数限制 private int gemDrawLimit; //每日钻石招募次数限制
private int allDrawLimit; //每日代币招募次数限制
public static Map<Integer, SChosenPoolConfig> actId2SChosenPoolConfig = new HashMap<>(); public static Map<Integer, SChosenPoolConfig> actId2SChosenPoolConfig = new HashMap<>();
@Override @Override
@ -69,4 +70,12 @@ public class SChosenPoolConfig implements BaseConfig {
public void setGemDrawLimit(int gemDrawLimit) { public void setGemDrawLimit(int gemDrawLimit) {
this.gemDrawLimit = gemDrawLimit; this.gemDrawLimit = gemDrawLimit;
} }
public int getAllDrawLimit() {
return allDrawLimit;
}
public void setAllrawLimit(int allDrawLimit) {
this.allDrawLimit = allDrawLimit;
}
} }