新礼包灵兽礼包

back_recharge
mengchengzhen 2021-05-10 09:42:51 +08:00
parent a8c23221a0
commit e0462df216
3 changed files with 51 additions and 15 deletions

View File

@ -197,6 +197,9 @@ public class BuyGoodsNewLogic {
sendGoodsByType(user,config,dropByBag);
if(config.getAccumulativeRecharge() == 1){
if(info.getMaxSingleR() < price){
info.setMaxSingleR(price);
}
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
//处理月卡
user.getPlayerInfoManager().getMonthCard();
@ -677,13 +680,17 @@ public class BuyGoodsNewLogic {
return;
}
int popup = 0;
boolean push = false;
for(SPackPushConfig con : list){
int bagId = judgePushCondition(user,con);
//条件成功
if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()){
popup = bagId;
info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR);
createPushBag(bagId,user,num);
boolean tempPush = createPushBag(bagId,user,num);
if(!push){
push = tempPush;
}
}
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
@ -692,8 +699,7 @@ public class BuyGoodsNewLogic {
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
if(popup != 0){
if(isFiveStarBag(popup)){
if(info.getTEMP_LIMIT()<info.FIVESTARLIMIT){
info.setTEMP_LIMIT(info.getTEMP_LIMIT() + 1);
if(push){
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
}
@ -721,6 +727,11 @@ public class BuyGoodsNewLogic {
if(level < scope[1]){
return -1;
}
}else if(scope[0] == 7){
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR();
if(mxr < scope[1]){
return -1;
}
}
double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
int index = 0;
@ -820,7 +831,7 @@ public class BuyGoodsNewLogic {
return;
}
info.setLastRefreshTime(System.currentTimeMillis());
info.setTEMP_LIMIT(0);
info.getTempLimitMap().clear();
}
//是否属于五星成长礼
@ -831,8 +842,18 @@ public class BuyGoodsNewLogic {
return false;
}
public static void createPushBag(int bagId,User user,int num){
public static boolean createPushBag(int bagId,User user,int num){
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
if(info.getTempLimitMap().containsKey(bagId)){
int nn = info.getTempLimitMap().get(bagId);
if(nn >= info.FIVESTARLIMIT){
return false;
}else{
info.getTempLimitMap().put(bagId,nn+num);
}
}else{
info.getTempLimitMap().put(bagId,num);
}
if(isFiveStarBag(bagId) && info.getPushMap().get(bagId) != null){
AbstractWelfareBag bag = info.getPushMap().get(bagId);
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
@ -847,6 +868,7 @@ public class BuyGoodsNewLogic {
bag.setLimit(num);
}
}
return true;
}
/**

View File

@ -11,6 +11,7 @@ import java.util.Map;
public class NewRechargeInfo extends MongoBase {
private double rr;//累计充值
private double maxSingleR;//单次最大充值金额
private double monthRr ; //月卡累计总额
private double sMonthRr ; //豪华月卡累计总额
@ -30,8 +31,8 @@ public class NewRechargeInfo extends MongoBase {
private long nextPushTime; //上次推送时间
private long lastRefreshTime;
private int TEMP_LIMIT = 0;
public static int FIVESTARLIMIT = 2;//临时五星成长礼每天最多两次
private Map<Integer,Integer> tempLimitMap = new HashMap<>();//五星成长礼每天购买次数
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
@ -259,15 +260,6 @@ public class NewRechargeInfo extends MongoBase {
updateString("nextPushTime",nextPushTime);
}
public int getTEMP_LIMIT() {
return TEMP_LIMIT;
}
public void setTEMP_LIMIT(int TEMP_LIMIT) {
this.TEMP_LIMIT = TEMP_LIMIT;
updateString("TEMP_LIMIT",TEMP_LIMIT);
}
public long getLastRefreshTime() {
return lastRefreshTime;
}
@ -276,4 +268,21 @@ public class NewRechargeInfo extends MongoBase {
this.lastRefreshTime = lastRefreshTime;
updateString("lastRefreshTime",lastRefreshTime);
}
public double getMaxSingleR() {
return maxSingleR;
}
public void setMaxSingleR(double maxSingleR) {
this.maxSingleR = maxSingleR;
updateString("maxSingleR",maxSingleR);
}
public Map<Integer, Integer> getTempLimitMap() {
return tempLimitMap;
}
public void setTempLimitMap(Map<Integer, Integer> tempLimitMap) {
this.tempLimitMap = tempLimitMap;
}
}

View File

@ -32,6 +32,7 @@ import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
@ -1658,6 +1659,10 @@ public class ItemUtil {
}
dropBuilder.addPokemon(CBean2Proto.getPokemon(pokemon));
SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(entry.getKey());
if(animal.getQuality()== 5){
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,8,5,1);
}
ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(),entry.getKey(),animal.getQuality(),reason);
if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)&&reason!=BIReason.COMPOS_HERO_REWARD) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_get_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), animal.getName()},new int[]{0,1});