购买妖精双倍添加

back_recharge
lvxinran 2021-04-26 19:40:57 +08:00
parent 2de2762b5d
commit 3eb625070f
2 changed files with 32 additions and 4 deletions

View File

@ -178,8 +178,9 @@ public class BuyGoodsNewLogic {
pbag.setBuyTimes(pbag.getBuyTimes()+1);
}
}
int[][] dropByBag = bag.getDropByBag();
//发货
sendGoodsByType(user,config);
sendGoodsByType(user,config,dropByBag);
if(config.getAccumulativeRecharge() == 1){
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
@ -212,7 +213,7 @@ public class BuyGoodsNewLogic {
MongoUtil.getLjsdMongoTemplate().lastUpdate();
sendGiftGoodsWithoutJudge(uid);
onChargeSuccess(user,price,0,orderId,cfgType);//充值成功上报
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(config.getBaseReward());
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(dropByBag);
if(price>0){
MessageUtil.sendIndicationMessage(session,1,
MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
@ -315,10 +316,10 @@ public class BuyGoodsNewLogic {
/**
*
*/
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config) throws Exception{
public static void sendGoodsByType(User user,SRechargeCommodityNewConfig config,int[][] dropArray) throws Exception{
ISession session = OnlineUserManager.getSessionByUid(user.getId());
int type = config.getType();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getBaseReward(), BIReason.DIRECT_BUY);
CommonProto.Drop.Builder drop = ItemUtil.drop(user,dropArray, BIReason.DIRECT_BUY);
//直购礼包
if(type == GiftGoodsType.DIRECTBAG){

View File

@ -90,6 +90,31 @@ public class AbstractWelfareBag extends MongoBase{
setLastBuyTime(System.currentTimeMillis());
return true;
}
public int[][] getDropByBag() throws Exception{
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
int[][] baseReward = config.getBaseReward();
int[][] firstMultiple = config.getFirstMultiple();
int length = baseReward.length;
int[][] result ;
if(buyTimes == 1){
length += firstMultiple.length;
result = new int[length][];
int i=0;
for(;i<baseReward.length;i++){
result[i] =baseReward[i];
}
for(int j=0;j<firstMultiple.length;j++){
result[i++] = firstMultiple[j];
}
}else{
result = new int[length][];
int i=0;
for(;i<baseReward.length;i++){
result[i] =baseReward[i];
}
}
return result;
}
/**
*
@ -231,4 +256,6 @@ public class AbstractWelfareBag extends MongoBase{
isUserBuyRefresh = userBuyRefresh;
updateString("isUserBuyRefresh",isUserBuyRefresh);
}
}