限时神装

back_recharge
lvxinran 2021-03-15 11:09:03 +08:00
parent 75336f12d9
commit 8966f25c5b
3 changed files with 24 additions and 14 deletions

View File

@ -22,7 +22,7 @@ class RechargeTotalActivity extends AbstractActivity {
User user = UserManager.getUser(session.getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int days = TimeUtils.differentDaysByHour(rechargeInfo.getCreateTime(), now,0) + 1;
if (missionProgress/1000 < values[0][0] || days < values[0][1]) {
if (missionProgress <= 0 || days < values[0][1]) {
return false;
}
return true;

View File

@ -32,18 +32,26 @@ public class LeveGiftEventHander implements IEventHandler {
public void onEvent(IEvent event) throws Exception {
if(event instanceof UserLevelEvent){
User user = UserManager.getUser(((UserLevelEvent) event).getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int[] shenZhuangRule = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SHEN_ZHUANG);
if(((UserLevelEvent) event).getLevel()==shenZhuangRule[0]){
rechargeInfo.addDyGoodsCanBuyTimes(10001);
rechargeInfo.putLevelAndMoneyBagMap(-1,System.currentTimeMillis());
// rechargeInfo.putLevelAndMoneyBagMap(shenZhuangRule[1],System.currentTimeMillis());
giftIndication(user,new ArrayList<>(1));
}
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.DISCOUNT_LEVEL);
int start = onceArrayValue[0];
int inter = onceArrayValue[1];
if(((UserLevelEvent) event).getLevel()<start){
return;
}
User user = UserManager.getUser(((UserLevelEvent) event).getUid());
boolean b = (((UserLevelEvent) event).getLevel() - start) % inter == 0;
if(!b){
return;
}
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
double saveAmt = rechargeInfo.getSaveAmt();
Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry((int)saveAmt);
SRechargeCommodityConfig orDefault = STableManager.getConfig(SRechargeCommodityConfig.class).getOrDefault(entry.getValue(), null);
@ -67,18 +75,19 @@ public class LeveGiftEventHander implements IEventHandler {
// BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
giftIndication(user,goodsBagInfo);
}
}
private void giftIndication(User user,List<CommonProto.GiftGoodsInfo> goodsBagInfo) throws Exception {
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
}
}
}

View File

@ -96,6 +96,7 @@ public class SSpecialConfig implements BaseConfig {
public static final String SKILL_EFFECT_TGMB = "skill_effect_tgmb";//天宫秘宝购买特权带来的攻击提升万分比(只在天宫生效)
public static final String GUILD_LEADER_PASS_TIME = "GuildLeaderPassTime";//会长不上线移交时长
public static final String GUILD_DISMISS_TIME ="GuildDismissTime";//公会全员不上线解散时长
public static final String SHEN_ZHUANG = "ShenZhuang";//神装礼包推送等级
@Override
public void init() throws Exception {