新礼包每天刷新,推送时间

back_recharge
mengchengzhen 2021-04-29 17:16:39 +08:00
parent e3c2f157f2
commit 95a338f07f
10 changed files with 69 additions and 25 deletions

View File

@ -2146,7 +2146,7 @@ public class MapLogic {
Poster.getPoster().dispatchEvent(new FightMainEvent(user.getId(),fightId));
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LEVEL_FIGHT.getType(),fightId));
user.getMainLevelManager().updateFight(updateFightId,state);
BuyGoodsNewLogic.openPush(session,user,1,fightId);
BuyGoodsNewLogic.openPush(session,user,1,fightId,0);
if(state == -1){
//删除为0的
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
@ -2251,7 +2251,7 @@ public class MapLogic {
ReportUtil.onReportEvent(user,ReportEventEnum.COMPLETE_XINMO.getType(),checkFightId,sFloodConfig.getMonster(),MonsterUtil.getMonsterForce(new int[]{sFloodConfig.getMonster()}),new Date(),"",null,null,"失败");
return;
}
BuyGoodsNewLogic.openPush(session,user,2,sFloodConfig.getId());
BuyGoodsNewLogic.openPush(session,user,2,sFloodConfig.getId(),0);
//排行榜
// String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false);
// RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), checkFightId);

View File

@ -8,12 +8,16 @@ package com.ljsd.jieling.logic.activity.event;
public class HeroFiveStarGetEvent implements IEvent {
private int uid;
private int star;
private int num;
public HeroFiveStarGetEvent(int uid, int star) {
public HeroFiveStarGetEvent(int uid, int star, int num) {
this.uid = uid;
this.star = star;
this.num = num;
}
public int getNum(){return num;}
public int getStar() {
return star;
}

View File

@ -31,14 +31,11 @@ public class HeroFiveStarGetEventHandler implements IEventHandler {
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof HeroFiveStarGetEvent))
return;
if(((HeroFiveStarGetEvent) event).getStar()!=5){
return;
}
//动态控制购买数量
User user = UserManager.getUser(((HeroFiveStarGetEvent) event).getUid());
int star = ((HeroFiveStarGetEvent) event).getStar();
int num = ((HeroFiveStarGetEvent) event).getNum();
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,4,star);
BuyGoodsNewLogic.openPush(session,user,4,star,num);
}
}

View File

@ -343,6 +343,7 @@ public class HeroLogic{
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
heroManager.updateRandCount(type,perCount);
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, resultRandom,BIReason.HERO_RANDOM);
fiveStarPushByRandom(user,resultRandom);
builder.setDrop(drop);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
// System.out.println(System.currentTimeMillis()-time);
@ -1119,7 +1120,7 @@ public class HeroLogic{
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getTemplateId(),targetHero.getStar()));
if (targetHero.getStar()==5&&targetHero.getStar()!=15){
if (SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5) {
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(), targetHero.getStar()));
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(), targetHero.getStar(),1));
}
}
@ -2452,6 +2453,7 @@ public class HeroLogic{
}
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId, composeNum);
fiveStarPushByCombine(user,itemId, composeNum);
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap, BIReason.COMPOS_HERO_REWARD);
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
.newBuilder()
@ -4534,4 +4536,28 @@ public class HeroLogic{
return heroes.get(0);
}
/**
*
*/
public static void fiveStarPushByRandom(User user,int[][] getHeros){
int fiveStarNum = 0;
for(int[] i : getHeros){
SCHero scHero = SCHero.getsCHero().get(i[0]);
if(scHero.getStar()==5){
fiveStarNum++;
}
}
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),5,fiveStarNum));
}
/**
*
*/
public static void fiveStarPushByCombine(User user,int itemId,int num){
SCHero scHero = SCHero.getsCHero().get(itemId);
if(scHero != null && scHero.getStar()==5){
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),5,num));
}
}
}

View File

@ -23,6 +23,6 @@ public class UserLevelEventProcessor implements BaseGameEventProcessor{
int upLevel = (int)parm[1];
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,3,upLevel);
BuyGoodsNewLogic.openPush(session,user,3,upLevel,0);
}
}

View File

@ -434,9 +434,9 @@ public class BuyGoodsNewLogic {
for(String[] I : bag.getCondition()){
if(I[0].equals("3")){
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(I[1]))){
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(Integer.parseInt(I[1]));
bag.setStartTime(sGlobalActivity.getStartTimeLong());
bag.setEndTime(sGlobalActivity.getEndTimeLong());
long[] time = ActivityLogic.getStartAndEndTime(user,Integer.parseInt(I[1]));
bag.setStartTime(time[0]);
bag.setEndTime(time[1]);
bag.setOpen(true);
result = true;
}
@ -648,9 +648,18 @@ public class BuyGoodsNewLogic {
}
}
public static void openPush(ISession session,User user,int type,int num) throws Exception{
/**
*
* @param session
* @param user
* @param type
* @param star
* @param num
* @throws Exception
*/
public static void openPush(ISession session,User user,int type,int star,int num) throws Exception{
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,num);
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,star);
if(list == null){
return;
}
@ -661,7 +670,10 @@ public class BuyGoodsNewLogic {
popup = bagId;
info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR);
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
initUnitWF(user,config);
AbstractWelfareBag bag = initUnitWF(user,config);
if(num != 0 && num > info.getTEMP_LIMIT()){
bag.setLimit(info.getTEMP_LIMIT());
}
}
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
@ -782,9 +794,6 @@ public class BuyGoodsNewLogic {
int nowTime = (int)(System.currentTimeMillis()/1000);
for(int i = 1;i<=cDay;i++){
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
if(fund==null){
continue;
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
String reward = ItemUtil.getMailReward(fund.getreward());
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title");

View File

@ -133,7 +133,7 @@ public class AbstractWelfareBag extends MongoBase{
}else{
for(String[] I : getCondition()){
if(I[0].equals("4")){
setRefreshTime(System.currentTimeMillis() + getDailyUpdate() * TimeUtils.DAY);
setRefreshTime(TimeUtils.getTodayZero() + getDailyUpdate() * TimeUtils.DAY);
break;
}
}

View File

@ -29,6 +29,7 @@ public class PerpetualWelfareBag extends AbstractWelfareBag {
}
}
if(getDailyUpdate() > 0){
setStartTime(TimeUtils.getTodayZero());
setRefreshTime(getStartTime()+ getDailyUpdate() * TimeUtils.DAY);
}
if(config.getTime() == 7){//自然周

View File

@ -14,7 +14,7 @@ public class PushWelfareBag extends AbstractWelfareBag {
public PushWelfareBag(User user, SRechargeCommodityNewConfig config){
super(user,config);
setStartTime(System.currentTimeMillis());
setEndTime(System.currentTimeMillis() + 2 * TimeUtils.HOUR);
setEndTime(System.currentTimeMillis() + getTime() * TimeUtils.HOUR);
setOpen(true);
user.getPlayerInfoManager().getNewRechargeInfo().addPush(this);
}
@ -30,4 +30,15 @@ public class PushWelfareBag extends AbstractWelfareBag {
setOpen(false);
return true;
}
private int getTime(){
int i = 2;
for(String[] s : getCondition()){
if(s[0].equals("6")){
i = Integer.parseInt(s[1]);
break;
}
}
return i;
}
}

View File

@ -1282,10 +1282,6 @@ public class ItemUtil {
}
}
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
if(scHero.getStar()==5){
if(SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5)
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),scHero.getStar()));
}
// KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,cardId,1,heroStar[1]);
ReportUtil.onReportEvent(user,ReportEventEnum.GET_HERO.getType(),String.valueOf(cardId),String.valueOf(hero.getStar()),String.valueOf(reason));
}