修改推送礼包

master_yuenan
DESKTOP-C3M45P4\dengdan 2025-04-03 17:41:05 +08:00
parent b13bf47de4
commit 5aa7a6b46e
2 changed files with 61 additions and 69 deletions

View File

@ -7183,7 +7183,17 @@ public class HeroLogic {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
hero.putPotentialLv(type, targetLv); hero.putPotentialLv(type, targetLv);
//推送礼包,判断下级材料是走足够,因为道具需求数量不确定,在该处判断逻辑是否推送,推送了礼包直接就弹
SPotentialNew config = lvMap.get(targetLv);
if (config != null || config.getConsume() != null) {
int itemId = config.getConsume()[0][0];
int num = config.getConsume()[0][1];
Item item = user.getItemManager().getItem(itemId);
//道具不足,推送
if(item == null || item.getItemNum() < num){
BuyGoodsNewLogic.openPush(iSession, user, PushRechargeType.QIANNENG_UP.getType(), SPackPushConfig.getPushCostItemId(PushRechargeType.QIANNENG_UP.getType()));
}
}
HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder(); HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder();
builder.setUpLv(hero.getPotentialLv(type)); builder.setUpLv(hero.getPotentialLv(type));
builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user)); builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user));

View File

@ -1021,7 +1021,7 @@ public class BuyGoodsNewLogic {
type == PushRechargeType.XUNAXIAN_ZHOAHUAN.getType() || type == PushRechargeType.XUNAXIAN_ZHOAHUAN.getType() ||
type == PushRechargeType.XIANDOU_ZHOAHUAN.getType() || type == PushRechargeType.XIANDOU_ZHOAHUAN.getType() ||
type == PushRechargeType.QIANNENG_UP.getType()){ type == PushRechargeType.QIANNENG_UP.getType()){
int[] bagIds = judgePushConditionMulti(user,con); int[] bagIds = judgePushConditionMulti(user,con,true);
// todo DayPushNum和AllPuthNum可以放到redis里操作 // todo DayPushNum和AllPuthNum可以放到redis里操作
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){ if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
continue; continue;
@ -1039,7 +1039,7 @@ public class BuyGoodsNewLogic {
break; break;
} }
}else{ }else{
bagId = judgePushCondition(user,con); bagId = judgePushCondition(user,con,false);
// todo DayPushNum和AllPuthNum可以放到redis里操作 // todo DayPushNum和AllPuthNum可以放到redis里操作
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){ if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
continue; continue;
@ -1069,55 +1069,20 @@ public class BuyGoodsNewLogic {
} }
} }
private static int judgePushCondition(User user,SPackPushConfig con){ private static int judgePushCondition(User user,SPackPushConfig con,boolean checkCondition){
int[] scope = con.getScopeId(); int[] scope = con.getScopeId();
switch (scope[0]){ //scope和condition条件类型复用,先检测scope
case 1://主线关卡 boolean result = checkPushCondition(scope,user);
int mainLevel = user.getMainLevelManager().getFightId(); if(!result){
if(mainLevel < scope[1]){
return -1; return -1;
} }
break; //scope条件满足之后还要做condition条件检测
case 2://爬塔 if(checkCondition){
int towerLevel = con.getConditionId()[1]; int[] condition = con.getConditionId();
if(towerLevel < scope[1]){ result = checkPushCondition(condition,user);
if(!result){
return -1; return -1;
} }
break;
case 3://玩家等级
int level = user.getPlayerInfoManager().getLevel();
if(level < scope[1]){
return -1;
}
break;
case 7://主线关卡
//此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE);
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(value);
if(mxr < scope[1]){
return -1;
}
break;
case 16://法宝召唤
case 17://寻仙召唤
int itemId = scope[1];
Item item = user.getItemManager().getItem(itemId);
//够10连不弹
if(item != null && item.getItemNum() >= 10){
return -1;
}
break;
case 18://仙豆
int xiandouId = scope[1];
Item xiandouItem = user.getItemManager().getItem(xiandouId);
//够抽就不用弹
if(xiandouItem!= null && xiandouItem.getItemNum() >= 1){
return -1;
}
break;
case 19://潜能
break;
default:break;
} }
//此处根据需求改成指定天数累计充值,之前的条件是历史累计充值 //此处根据需求改成指定天数累计充值,之前的条件是历史累计充值
double rr = user.getPlayerInfoManager().getNewRechargeInfo().GetAllRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SUM)); double rr = user.getPlayerInfoManager().getNewRechargeInfo().GetAllRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SUM));
@ -1134,58 +1099,75 @@ public class BuyGoodsNewLogic {
return con.getPacks()[index]; return con.getPacks()[index];
} }
private static int[] judgePushConditionMulti(User user,SPackPushConfig con){ private static int[] judgePushConditionMulti(User user,SPackPushConfig con,boolean checkCondition){
int[] scope = con.getScopeId(); int[] scope = con.getScopeId();
switch (scope[0]){ //scope和condition条件类型复用,先检测scope
boolean result = checkPushCondition(scope,user);
if(!result){
return null;
}
//scope条件满足之后还要做condition条件检测
if(checkCondition){
int[] condition = con.getConditionId();
result = checkPushCondition(condition,user);
if(!result){
return null;
}
}
//寻仙,法宝,仙豆,潜能等同时推多个礼包
return con.getPacks();
}
public static boolean checkPushCondition(int[] condition,User user){
switch (condition[0]){
case 1://主线关卡 case 1://主线关卡
int mainLevel = user.getMainLevelManager().getFightId(); int mainLevel = user.getMainLevelManager().getFightId();
if(mainLevel < scope[1]){ if(mainLevel < condition[1]){
return null; return false;
} }
break; break;
case 2://爬塔 case 2://爬塔
int towerLevel = con.getConditionId()[1]; int towerLevel = condition[1];
if(towerLevel < scope[1]){ if(towerLevel < condition[1]){
return null; return false;
} }
break; break;
case 3://玩家等级 case 3://玩家等级
int level = user.getPlayerInfoManager().getLevel(); int level = user.getPlayerInfoManager().getLevel();
if(level < scope[1]){ if(level < condition[1]){
return null; return false;
} }
break; break;
case 7://主线关卡 case 7://主线关卡
//此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单 //此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE); int value = SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE);
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(value); double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(value);
if(mxr < scope[1]){ if(mxr < condition[1]){
return null; return false;
} }
break; break;
case 16://法宝召唤 case 16://法宝召唤
case 17://寻仙召唤 case 17://寻仙召唤
int itemId = scope[1]; int itemId = condition[1];
Item item = user.getItemManager().getItem(itemId); Item item = user.getItemManager().getItem(itemId);
//够10连不弹 //够10连不弹
if(item != null && item.getItemNum() >= 10){ if(item != null && item.getItemNum() >= 10){
return null; return false;
} }
break; break;
case 18://仙豆 case 18://仙豆
int xiandouId = scope[1]; int xiandouId = condition[1];
Item xiandouItem = user.getItemManager().getItem(xiandouId); Item xiandouItem = user.getItemManager().getItem(xiandouId);
//够抽就不用弹 //够抽就不用弹
if(xiandouItem!= null && xiandouItem.getItemNum() >= 1){ if(xiandouItem!= null && xiandouItem.getItemNum() >= 1){
return null; return false;
} }
break; break;
case 19://潜能 case 19://潜能(触发了直接返回礼包,由外面判断)
break; break;
default:break; default:break;
} }
//寻仙,法宝,仙豆,潜能等同时推多个礼包 return true;
return con.getPacks();
} }
/** /**