增加新的推送条件
parent
3801f5f97a
commit
c571826718
|
|
@ -87,4 +87,6 @@ public interface Global {
|
|||
int LUCK_RED_BACKPACK_MEDIUM = 1339;
|
||||
int LUCK_RED_BACKPACK_BIG = 1340;
|
||||
int LUCK_RED_BACKPACK_GIANT = 1341;
|
||||
|
||||
//推送道具相关
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class ChoiceDrawCardHandler extends BaseHandler<ActivityProto.choiceDrawC
|
|||
int activityId = proto.getActivityId();
|
||||
int type = proto.getType();
|
||||
|
||||
ActivityLogic.getInstance().choiceDrawCard(user,activityId,type);
|
||||
ActivityLogic.getInstance().choiceDrawCard(iSession,user,activityId,type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ import com.ljsd.jieling.logic.mission.MissionType;
|
|||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.tools.Utils;
|
||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||
|
|
@ -1615,7 +1617,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
/**
|
||||
* 心愿抽奖
|
||||
*/
|
||||
public void choiceDrawCard(User user,int activityId,int type) throws Exception {
|
||||
public void choiceDrawCard(ISession iSession,User user,int activityId,int type) throws Exception {
|
||||
// 初始值
|
||||
ActivityProto.choiceDrawCardResponse.Builder build = ActivityProto.choiceDrawCardResponse.newBuilder();
|
||||
SWishActivitySetting setting = getConfig(SWishActivitySetting.class).get(1);
|
||||
|
|
@ -1683,6 +1685,8 @@ public class ActivityLogic implements IEventHandler{
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.LIMIT_TIME_CHOICE_CARD, num);
|
||||
//冲榜活动
|
||||
Poster.getPoster().dispatchEvent(new OpenServerActivityEvent(user.getId(),num, RankEnum.XUNXIAN_RANK.getType()));
|
||||
//推送礼包
|
||||
BuyGoodsNewLogic.openPush(iSession, user, PushRechargeType.XUNAXIAN_ZHOAHUAN.getType(), SPackPushConfig.getPushCostItemId(PushRechargeType.XUNAXIAN_ZHOAHUAN.getType()));
|
||||
List<String> list = rewardArrayToList(markRewards);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CHOICE_DRAW_CARD.getType(), choiceRewardId, num, markReward[0], markReward[1], list);
|
||||
// 返回奖励信息
|
||||
|
|
|
|||
|
|
@ -760,6 +760,10 @@ public class HeroLogic {
|
|||
builder.setFabaoMustCount(fabaoRandomCount);
|
||||
//冲榜活动
|
||||
Poster.getPoster().dispatchEvent(new OpenServerActivityEvent(user.getId(),perCount, RankEnum.FABAO_RANK.getType()));
|
||||
//推送礼包
|
||||
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.FABAO_ZHOAHUAN.getType(), SPackPushConfig.getPushCostItemId(PushRechargeType.FABAO_ZHOAHUAN.getType()));
|
||||
user.getItemManager().getItem(10001);
|
||||
|
||||
}
|
||||
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.RANDOM_HERO, sLotterySetting.getLotteryType(), perCount);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
|
|
@ -171,7 +173,8 @@ public class SoldierLogic {
|
|||
ItemUtil.itemCost(user, new int[][]{lotteryCost}, BIReason.SOLDIER_LOTTERY_COST, 0);
|
||||
// 获得
|
||||
mainLevelManager.updateSoldier(soldier);
|
||||
|
||||
//推送礼包
|
||||
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.XIANDOU_ZHOAHUAN.getType(), SPackPushConfig.getPushCostItemId(PushRechargeType.XIANDOU_ZHOAHUAN.getType()));
|
||||
CommonProto.Soldier soldierProto = CBean2Proto.getSoldierProto(soldier);
|
||||
MapInfoProto.RecruitSoldierResponse.Builder builder = MapInfoProto.RecruitSoldierResponse.newBuilder().setSoldier(soldierProto);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.RecruitSoldierResponse_VALUE, builder.build(), true);
|
||||
|
|
@ -342,7 +345,6 @@ public class SoldierLogic {
|
|||
}
|
||||
|
||||
mainLevelManager.setSoldierMap(soldierMap);
|
||||
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,7 @@ import com.ljsd.jieling.logic.activity.ActivityType;
|
|||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.GmSingleActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.Order;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.VipInfo;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
|
|
@ -1015,23 +1012,46 @@ public class BuyGoodsNewLogic {
|
|||
int bagId = 0;
|
||||
boolean push = false;
|
||||
for(SPackPushConfig con : list){
|
||||
bagId = judgePushCondition(user,con);
|
||||
int conditionType=con.getConditionId()[0];
|
||||
int pushId = con.getId();
|
||||
int statistics = con.getStatistics();
|
||||
int count = con.getCount();
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
continue;
|
||||
}
|
||||
//条件成功
|
||||
if(bagId > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
||||
info.setDayPushNum(pushId,1);
|
||||
info.setAllPuthNum(pushId,1);
|
||||
push = createPushBag(bagId, user);
|
||||
break;
|
||||
//道具检测类礼包需要批量推送礼包
|
||||
if(type == PushRechargeType.FABAO_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.XUNAXIAN_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.XIANDOU_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.QIANNENG_UP.getType()){
|
||||
int[] bagIds = judgePushConditionMulti(user,con);
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
continue;
|
||||
}
|
||||
//条件成功
|
||||
if(bagIds !=null && bagIds.length > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
||||
info.setDayPushNum(pushId,1);
|
||||
info.setAllPuthNum(pushId,1);
|
||||
for(int _bagId : bagIds){
|
||||
push = createPushBag(bagId, user);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
bagId = judgePushCondition(user,con);
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
continue;
|
||||
}
|
||||
//条件成功
|
||||
if(bagId > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
||||
info.setDayPushNum(pushId,1);
|
||||
info.setAllPuthNum(pushId,1);
|
||||
push = createPushBag(bagId, user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||
|
|
@ -1077,6 +1097,25 @@ public class BuyGoodsNewLogic {
|
|||
return -1;
|
||||
}
|
||||
break;
|
||||
case 16://法宝召唤
|
||||
case 17://寻仙召唤
|
||||
int itemId = scope[1];
|
||||
Item item = user.getItemManager().getItem(itemId);
|
||||
//够10连不弹
|
||||
if(item != null && item.getItemNum() >= 10){
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 18://仙豆
|
||||
int xiandouId = scope[1];
|
||||
Item xiandouItem = user.getItemManager().getItem(xiandouId);
|
||||
//够抽就不用弹
|
||||
if(xiandouItem!= null && xiandouItem.getItemNum() >= 1){
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 19://潜能
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
//此处根据需求改成指定天数累计充值,之前的条件是历史累计充值
|
||||
|
|
@ -1094,6 +1133,60 @@ public class BuyGoodsNewLogic {
|
|||
return con.getPacks()[index];
|
||||
}
|
||||
|
||||
private static int[] judgePushConditionMulti(User user,SPackPushConfig con){
|
||||
int[] scope = con.getScopeId();
|
||||
switch (scope[0]){
|
||||
case 1://主线关卡
|
||||
int mainLevel = user.getMainLevelManager().getFightId();
|
||||
if(mainLevel < scope[1]){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 2://爬塔
|
||||
int towerLevel = con.getConditionId()[1];
|
||||
if(towerLevel < scope[1]){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 3://玩家等级
|
||||
int level = user.getPlayerInfoManager().getLevel();
|
||||
if(level < scope[1]){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 7://主线关卡
|
||||
//此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE);
|
||||
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(value);
|
||||
if(mxr < scope[1]){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 16://法宝召唤
|
||||
case 17://寻仙召唤
|
||||
int itemId = scope[1];
|
||||
Item item = user.getItemManager().getItem(itemId);
|
||||
//够10连不弹
|
||||
if(item != null && item.getItemNum() >= 10){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 18://仙豆
|
||||
int xiandouId = scope[1];
|
||||
Item xiandouItem = user.getItemManager().getItem(xiandouId);
|
||||
//够抽就不用弹
|
||||
if(xiandouItem!= null && xiandouItem.getItemNum() >= 1){
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case 19://潜能
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
//寻仙,法宝,仙豆,潜能等同时推多个礼包
|
||||
return con.getPacks();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼包结束时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ public enum PushRechargeType {
|
|||
XIANYUAN_BAOJING(13),
|
||||
FORE_SHILIAN(14),
|
||||
BAOWU_SHENYING(15),
|
||||
|
||||
FABAO_ZHOAHUAN(16),
|
||||
XUNAXIAN_ZHOAHUAN(17),
|
||||
XIANDOU_ZHOAHUAN(18),
|
||||
QIANNENG_UP(19),
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,13 @@ public class SPackPushConfig implements BaseConfig {
|
|||
public static Map<Integer,SPackPushConfig> configMap;
|
||||
public static Map<Integer,Map<Integer,List<SPackPushConfig>>> conditionMap;
|
||||
|
||||
public static Map<Integer,Integer> costItemIdMap;
|
||||
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SPackPushConfig> config = STableManager.getConfig(SPackPushConfig.class);
|
||||
Map<Integer,SPackPushConfig> tempConfigMap = new HashMap<>();
|
||||
Map<Integer,Map<Integer,List<SPackPushConfig>>> tempConditionMap = new HashMap<>();
|
||||
Map<Integer,Integer> tempCostItemIdMap = new HashMap<>();
|
||||
for(SPackPushConfig newConfig : config.values()){
|
||||
tempConfigMap.put(newConfig.getId(),newConfig);
|
||||
int[] conditionId = newConfig.getConditionId();
|
||||
|
|
@ -40,6 +43,7 @@ public class SPackPushConfig implements BaseConfig {
|
|||
tempConditionMap.get(conditionId[0]).put(conditionId[1],list);
|
||||
}
|
||||
}else{
|
||||
tempCostItemIdMap.put(conditionId[0],conditionId[1]);
|
||||
Map<Integer,List<SPackPushConfig>> map = new HashMap<>();
|
||||
List<SPackPushConfig> list = new ArrayList<>();
|
||||
list.add(newConfig);
|
||||
|
|
@ -50,6 +54,7 @@ public class SPackPushConfig implements BaseConfig {
|
|||
if(configMap == null){
|
||||
configMap = tempConfigMap;
|
||||
conditionMap = tempConditionMap;
|
||||
costItemIdMap = tempCostItemIdMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,4 +119,16 @@ public class SPackPushConfig implements BaseConfig {
|
|||
public int getPrivateCD() {
|
||||
return privateCD;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特定抽取条件需要检测的道具id
|
||||
* @param conditionType
|
||||
* @return
|
||||
*/
|
||||
public static int getPushCostItemId(int conditionType){
|
||||
if(costItemIdMap.containsKey(conditionType)){
|
||||
return costItemIdMap.get(conditionType);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue