Merge branch 'master_test_gn' into master_prb_gn

back_recharge
duhui 2021-04-29 20:20:51 +08:00
commit 6c6767d9d6
15 changed files with 153 additions and 49 deletions

View File

@ -89,7 +89,9 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
//输
double lessBlood = 0.0;
if (checkResult[0] == 1){
if(checkResult[0]==-1){
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}else if (checkResult[0] == 1){
lessBlood = bossBlood;
}else {
// 输 checkResult第三位开始为血量下标0开始

View File

@ -74,6 +74,10 @@ public class ArenaChallengeHandler extends BaseHandler<ArenaInfoProto.ArenaChall
myscore=(int)(rank.getScoreById(uid, Integer.toString(curSeason)));
// myscore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, , Integer.toString(uid)).intValue();
}
//重置赛季后 上赛季有值 从上赛季80%值上累加
if(arenaManager.getCount()==0 && arenaManager.getSeason()==curSeason &&(int)(rank.getScoreById(uid, Integer.toString(curSeason)))>0){
myscore=(int)(rank.getScoreById(uid, Integer.toString(curSeason)));
}
user.getTeamPosManager().setCurTeamPosId(teamId);
ArenaInfoProto.ArenaChallengeResponse.Builder builder = ArenaInfoProto.ArenaChallengeResponse.newBuilder();

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

@ -9,6 +9,7 @@ import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
@ -17,6 +18,7 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.session.ISession;
import config.SCHero;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
@ -147,6 +149,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
//up miss
int[][] reward = sActivityRewardConfig.getReward();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
fiveStarPushByActivity(user,drop.getHero(0).getHeroId(),1);
checkAndSetProgress(activityMission, activityProgressInfo, missionId);
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if (null != sGlobalActivity && ActivityLogic.getInstance().checkActivityMissionFinishAndTaked(session.getUid(),id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
@ -375,4 +378,14 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
}
/**
*
*/
public static void fiveStarPushByActivity(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

@ -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

@ -570,20 +570,20 @@ public class ArenaLogic {
}
public String getRewardByRank(int rank,int type){
// Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
// for(SArenaReward sArenaReward : config.values()){
// int minRank = sArenaReward.getMinRank();
// int maxRank = sArenaReward.getMaxRank();
// if(rank>=minRank && rank<=maxRank){
// if(type == GlobalsDef.ARENA_DAILY_REWARD){
// int[][] dailyReward = sArenaReward.getDailyReward();
// return StringUtil.parseArrayToString(dailyReward);
// }else{
// int[][] seasonReward = sArenaReward.getSeasonReward();
// return StringUtil.parseArrayToString(seasonReward);
// }
// }
// }
Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
for(SArenaReward sArenaReward : config.values()){
int minRank = sArenaReward.getMinRank();
int maxRank = sArenaReward.getMaxRank();
if(rank>=minRank && rank<=maxRank){
if(type == GlobalsDef.ARENA_DAILY_REWARD){
int[][] dailyReward = sArenaReward.getDailyReward();
return StringUtil.parseArrayToString(dailyReward);
}else{
int[][] seasonReward = sArenaReward.getSeasonReward();
return StringUtil.parseArrayToString(seasonReward);
}
}
}
return "";
}

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);
@ -1117,10 +1118,8 @@ public class HeroLogic{
rankUpHeroExecute(targetHero);
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()));
}
if (targetHero.getStar()==5){
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(), targetHero.getStar(),1));
}
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
@ -2453,6 +2452,7 @@ public class HeroLogic{
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId, composeNum);
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap, BIReason.COMPOS_HERO_REWARD);
fiveStarPushByCombine(user,drop.getHero(0).getHeroId(), composeNum);
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
.newBuilder()
.setDrop(drop)
@ -4534,4 +4534,30 @@ 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 != null && scHero.getStar()==5){
fiveStarNum++;
}
}
if(fiveStarNum > 0){
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,7 @@ 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);
BuyGoodsNewLogic.sendGiftGooodsIndication(user.getId());
}
}

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,20 +648,29 @@ 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;
}
int popup = 0;
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);
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
initUnitWF(user,config);
createPushBag(bagId,user,num);
}
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
@ -669,9 +678,9 @@ public class BuyGoodsNewLogic {
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
if(popup != 0){
if(popup == 21 || popup == 400 || popup == 401 || popup == 402 ){
if(info.getTEMP_LIMIT()>0){
info.setTEMP_LIMIT(info.getTEMP_LIMIT() - 1);
if(isFiveStarBag(popup)){
if(info.getTEMP_LIMIT()<info.FIVESTARLIMIT){
info.setTEMP_LIMIT(info.getTEMP_LIMIT() + 1);
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
}
@ -782,9 +791,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");
@ -801,6 +807,48 @@ public class BuyGoodsNewLogic {
return;
}
info.setLastRefreshTime(System.currentTimeMillis());
info.setTEMP_LIMIT(2);
info.setTEMP_LIMIT(0);
}
//是否属于五星成长礼
public static boolean isFiveStarBag(int id){
if(id == 21 || id == 400 || id == 401 || id == 402 ){
return true;
}
return false;
}
public static void createPushBag(int bagId,User user,int num){
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
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));
bag.setStartTime(System.currentTimeMillis());
bag.setEndTime(bag.getStartTime() + getTime(bag) * TimeUtils.HOUR);
}else{
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
AbstractWelfareBag bag = initUnitWF(user,config);
if(num != 0 && num > info.FIVESTARLIMIT){
bag.setLimit(info.FIVESTARLIMIT);
}else{
bag.setLimit(num);
}
}
}
/**
*
* @param bag
* @return
*/
private static int getTime(AbstractWelfareBag bag){
int i = 2;
for(String[] s : bag.getCondition()){
if(s[0].equals("6")){
i = Integer.parseInt(s[1]);
break;
}
}
return i;
}
}

View File

@ -30,7 +30,8 @@ public class NewRechargeInfo extends MongoBase {
private long nextPushTime; //上次推送时间
private long lastRefreshTime;
private int TEMP_LIMIT = 2;//临时五星成长礼每天最多两次
private int TEMP_LIMIT = 0;
public static int FIVESTARLIMIT = 2;//临时五星成长礼每天最多两次
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){

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));
}