抽卡活动修改,部分打点类型修改

back_recharge
lvxinran 2020-07-13 14:30:47 +08:00
parent cefd6ba749
commit da8d764a75
8 changed files with 130 additions and 118 deletions

View File

@ -322,7 +322,7 @@ public class ActivityLogic implements IEventHandler{
} }
abstractActivity.initActivity(user); abstractActivity.initActivity(user);
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(openActivityId)); // ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(openActivityId));
int activityOpenState = getActivityOpenState(user, openActivityId); int activityOpenState = getActivityOpenState(user, openActivityId);
abstractActivity.setOpenState(user,activityOpenState); abstractActivity.setOpenState(user,activityOpenState);
if(activityOpenState == ActivityType.UNOPEN_STATE){ if(activityOpenState == ActivityType.UNOPEN_STATE){
@ -365,7 +365,7 @@ public class ActivityLogic implements IEventHandler{
if (null==abstractActivity) { if (null==abstractActivity) {
continue; continue;
} }
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(activityId)); // ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(activityId));
abstractActivity.initActivity(user); abstractActivity.initActivity(user);
// if(!initOtherActivity(user, sGlobalActivity)){ // if(!initOtherActivity(user, sGlobalActivity)){
initAllActivityMission(activityManager.getActivityMissionMap(),activityId); initAllActivityMission(activityManager.getActivityMissionMap(),activityId);

View File

@ -49,7 +49,7 @@ public enum ActivityTypeEnum {
ECPEDITION_ACTIVITY(ActivityType.ECPEDITION_ACTIVITY,DefaultEmptyActivity::new), ECPEDITION_ACTIVITY(ActivityType.ECPEDITION_ACTIVITY,DefaultEmptyActivity::new),
COPY_PASS(ActivityType.COPY_PASS,ChapterRewardActivity::new), COPY_PASS(ActivityType.COPY_PASS,ChapterRewardActivity::new),
NEW_EIGHT_LOGIN(ActivityType.NEW_EIGHT_LOGIN,NewEightActivity::new), NEW_EIGHT_LOGIN(ActivityType.NEW_EIGHT_LOGIN,NewEightActivity::new),
BEAUTY_BAG(ActivityType.BEAUTY_BAG,DefaultEmptyActivity::new) BEAUTY_BAG(ActivityType.BEAUTY_BAG,LimitRandomCardActivity::new)
; ;
private int type; private int type;

View File

@ -50,121 +50,103 @@ public class LimitRandomCardActivity extends AbstractActivity {
public void onEvent(IEvent event) throws Exception { public void onEvent(IEvent event) throws Exception {
if(event instanceof RandomCardEvent){ if(event instanceof RandomCardEvent){
RandomCardEvent cardEvent =(RandomCardEvent) event; RandomCardEvent cardEvent =(RandomCardEvent) event;
if(cardEvent.getType()!=3){ if(cardEvent.getType()==0||cardEvent.getType()!=id){
return; return;
} }
if(UserManager.getUser(cardEvent.getUid()).getActivityManager().getActivityMissionMap().get(id)==null){ User user = UserManager.getUser(cardEvent.getUid());
if(user.getActivityManager().getActivityMissionMap().get(id)==null){
return; return;
} }
Map<Integer, SLotterySetting> config = STableManager.getConfig(SLotterySetting.class);
SLotterySetting sLotterySetting = config.get(cardEvent.getType()); Map<Integer, Integer> mustAppear = cardEvent.getMustAppear();
int allCount = 0;
if(mustAppear.size()>2){
return;
}
int index = 1;
for(Map.Entry<Integer,Integer> entry:mustAppear.entrySet()){
int key = entry.getKey();
List<SLotterySpecialConfig> lotterySpecialConfigListByType = SLotterySpecialConfig.getLotteryListByDifferentType(key);
if(lotterySpecialConfigListByType==null||lotterySpecialConfigListByType.isEmpty()){
continue;
}
for(SLotterySpecialConfig config:lotterySpecialConfigListByType){
if(config==null||config.getIsNeedShow()==0){
continue;
}
allCount +=entry.getValue()*index;
index*=1000;
}
}
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
// if(sLotterySetting.getActivityId()!=id){ activityMission.setV(allCount);
// return; update(UserManager.getUser(cardEvent.getUid()),cardEvent.getCount());
// }
update(UserManager.getUser(cardEvent.getUid()),cardEvent.isMustAppear()?0:1);
// AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType());
// int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid(),String.valueOf(id))).intValue();
// if(scoreById==-1){
// scoreById=0;
// }
// randomRank.addRank(cardEvent.getUid(),String.valueOf(id),scoreById+cardEvent.getScore());
// Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13);
// Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(),String.valueOf(id), TimeUtils.now()/1000,a[0],a[1]);
// Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer);
} }
// else if(event instanceof RandomMustCardEvent){
// RandomMustCardEvent cardEvent =(RandomMustCardEvent) event;
// int activityId = sLotterySetting.getActivityId();
// if(activityId!=id){
// return;
// }
//
// }
} }
@Override @Override
public void onActivityEnd() throws Exception { public void onActivityEnd() throws Exception {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id); // SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id); // List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
if(null==sActivityRankingReward) // if(null==sActivityRankingReward)
return; // return;
int maxRank = 0; // int maxRank = 0;
int maxRewardId = 0; // int maxRewardId = 0;
Map<Integer, Integer> rank2miss = new HashMap<>(); // Map<Integer, Integer> rank2miss = new HashMap<>();
for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) { // for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
if(sActivityRankingReward1.getMaxRank()==-1){ // if(sActivityRankingReward1.getMaxRank()==-1){
maxRank =-1; // maxRank =-1;
maxRewardId = sActivityRankingReward1.getId(); // maxRewardId = sActivityRankingReward1.getId();
continue; // continue;
} // }
//
// if(maxRank!=-1)
// {
// maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank());
// }
//
// for (Integer rank : getRankSet(sActivityRankingReward1.getMinRank(), sActivityRankingReward1.getMaxRank())) {
// rank2miss.put(rank, sActivityRankingReward1.getId());
// }
// }
if(maxRank!=-1) // Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.RANDOM_CARD_RANK, Integer.toString(id), 0, (maxRank==-1?0:maxRank) - 1);
{ // int rank = 1;
maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank()); // int nowTime = (int) (TimeUtils.now() / 1000);
} // for (ZSetOperations.TypedTuple<String> item : rankInfo) {
// String value = item.getValue();
for (Integer rank : getRankSet(sActivityRankingReward1.getMinRank(), sActivityRankingReward1.getMaxRank())) { // int uid = Integer.parseInt(value);
rank2miss.put(rank, sActivityRankingReward1.getId()); // User user = UserManager.getUser(uid, true);
} // if (null == user) {
} // continue;
// }
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.RANDOM_CARD_RANK, Integer.toString(id), 0, (maxRank==-1?0:maxRank) - 1); // ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
int rank = 1; // if (activityMission == null || activityMission.getOpenType() == 0) {
int nowTime = (int) (TimeUtils.now() / 1000); // continue;
for (ZSetOperations.TypedTuple<String> item : rankInfo) { // }
String value = item.getValue(); // int missionId;
int uid = Integer.parseInt(value); // if (rank2miss.containsKey(rank)) {
User user = UserManager.getUser(uid, true); // missionId = rank2miss.get(rank);
if (null == user) { // } else {
continue; // if (maxRank == -1) {
} // missionId = maxRewardId;
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id); // } else {
if (activityMission == null || activityMission.getOpenType() == 0) { // continue;
continue; // }
} // }
int missionId; //
if (rank2miss.containsKey(rank)) { // //checkAndUpdate value
missionId = rank2miss.get(rank); // SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
} else { // //sendmail
if (maxRank == -1) { //
missionId = maxRewardId; // String title = SErrorCodeEerverConfig.getI18NMessage("east_fairy_title", new Object[]{sGlobalActivity.getSesc()});
} else { // String content = SErrorCodeEerverConfig.getI18NMessage("east_fairy_txt", new Object[]{rank++});
continue; // String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
} // MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
} // }
//checkAndUpdate value
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
//sendmail
String title = SErrorCodeEerverConfig.getI18NMessage("east_fairy_title", new Object[]{sGlobalActivity.getSesc()});
String content = SErrorCodeEerverConfig.getI18NMessage("east_fairy_txt", new Object[]{rank++});
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
}
} }
@Override
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
if(count==0){
activityMission.setV(0);
}else{
activityMission.setV(activityMission.getV()+count);
}
super.updateProgressWithUser(user, activityMission, 1);
}
@Override
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
User user = UserManager.getUser(session.getUid());
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
return sActivityRewardConfig.getValues()[0][0]<=activityMission.getV();
}
} }

View File

@ -1,5 +1,7 @@
package com.ljsd.jieling.logic.activity.event; package com.ljsd.jieling.logic.activity.event;
import java.util.Map;
/** /**
* @author lvxinran * @author lvxinran
* @date 2019/11/27 * @date 2019/11/27
@ -8,11 +10,13 @@ package com.ljsd.jieling.logic.activity.event;
public class RandomCardEvent implements IEvent { public class RandomCardEvent implements IEvent {
private int uid; private int uid;
private int type; private int type;
private boolean mustAppear; private Map<Integer,Integer> mustAppear;
public RandomCardEvent(int uid,int type,boolean mustAppear) { private int count;
public RandomCardEvent(int uid,int type,Map<Integer,Integer> mustAppear,int count) {
this.uid = uid; this.uid = uid;
this.type = type; this.type = type;
this.mustAppear = mustAppear; this.mustAppear = mustAppear;
this.count = count;
} }
public int getType() { public int getType() {
@ -31,11 +35,19 @@ public class RandomCardEvent implements IEvent {
this.uid = uid; this.uid = uid;
} }
public boolean isMustAppear() { public Map<Integer, Integer> getMustAppear() {
return mustAppear; return mustAppear;
} }
public void setMustAppear(boolean mustAppear) { public void setMustAppear(Map<Integer, Integer> mustAppear) {
this.mustAppear = mustAppear; this.mustAppear = mustAppear;
} }
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
} }

View File

@ -253,6 +253,7 @@ public class HeroLogic{
for(int i = 0;i<tenTimesMustGetItem.length;i++) { for(int i = 0;i<tenTimesMustGetItem.length;i++) {
resultRandom[i+index+1] = tenTimesMustGetItem[i]; resultRandom[i+index+1] = tenTimesMustGetItem[i];
} }
Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(),sLotterySetting.getActivityId(),heroManager.getRandomPoolByType().get(sLotterySetting.getMergePool()),sLotterySetting.getPerCount()));
// //1群英招募 // //1群英招募
HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder(); HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder();
if(sLotterySetting.getLotteryType() == 1){ if(sLotterySetting.getLotteryType() == 1){
@ -364,7 +365,6 @@ public class HeroLogic{
} }
heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool)); heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool));
int result = sLotteryRewardConfig.getId(); int result = sLotteryRewardConfig.getId();
Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(),sLotterySetting.getLotteryType(),isBestCard));
return result; return result;
} }
@ -2343,11 +2343,17 @@ public class HeroLogic{
heroManager.removeHero(uid,heroId); heroManager.removeHero(uid,heroId);
int[] returnMaterials = sHeroReturn.getRankupReturn(); int[] returnMaterials = sHeroReturn.getRankupReturn();
int[][] returnHero = sHeroReturn.getReturnHero(); int returnHero = sHeroReturn.getHeroId();
//进阶材料返还乘万分比 //进阶材料返还乘万分比
returnMaterials[1]*=(double)returnPercent/10000; returnMaterials[1]*=(double)returnPercent/10000;
CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{returnMaterials}, BIReason.HERO_BACK_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{returnMaterials}, BIReason.HERO_BACK_REWARD);
ItemUtil.drop(user, returnHero,drop, BIReason.HERO_BACK_REWARD); ItemUtil.drop(user, new int[][]{{returnHero,1}},drop, BIReason.HERO_BACK_REWARD);
CommonProto.Hero.Builder heroProto = drop.getHero(0).toBuilder();
String createHeroId = heroProto.getId();
heroProto.setStar(star);
drop.setHero(0,heroProto.build());
Hero newHero = user.getHeroManager().getHeroMap().get(createHeroId);
newHero.setStar(star);
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()); SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel());
int[][] levelUpReturn = sHeroLevlConfig.getSumConsume(); int[][] levelUpReturn = sHeroLevlConfig.getSumConsume();
ItemUtil.drop(user, ItemLogic.getInstance().itemReturnPercent(levelUpReturn,returnPercent),drop, BIReason.HERO_BACK_REWARD); ItemUtil.drop(user, ItemLogic.getInstance().itemReturnPercent(levelUpReturn,returnPercent),drop, BIReason.HERO_BACK_REWARD);

View File

@ -365,7 +365,7 @@ public class MissionLoigc {
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true); MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId); // KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
// Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,""); // Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),missionId,GameMisionType.BLOODYMISSION.toString(),rewardGroup); ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),missionId,GameMisionType.BLOODYMISSION.toString());
return; return;
} }
if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务 if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务
@ -443,7 +443,7 @@ public class MissionLoigc {
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){ if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,missionId); user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,missionId);
ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),String.valueOf(missionId),type,missionStateChangeInfos.get(0).getRewwardGroups()); ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),String.valueOf(missionId),type);
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build(); PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true); MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId); // KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);

View File

@ -76,7 +76,7 @@ public class BuyGoodsLogic {
if(isDiscount!=0){ if(isDiscount!=0){
price=(int)(sRechargeCommodityConfig.getPrice() * (10 + isDiscount)/10f); price=(int)(sRechargeCommodityConfig.getPrice() * (10 + isDiscount)/10f);
} }
ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),"",price,"","","","",sRechargeCommodityConfig.getBaseReward()); ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),"",price,"","","","",String.valueOf(goodsId),sRechargeCommodityConfig.getBaseReward());
// KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,System.currentTimeMillis()+"",result.getResultCode(),price*10); // KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,System.currentTimeMillis()+"",result.getResultCode(),price*10);
} }

View File

@ -25,14 +25,20 @@ public class SLotterySpecialConfig implements BaseConfig {
private int pool_id; private int pool_id;
private int isNeedShow;
private static Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMap; private static Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMap;
private static Map<Integer, List<SLotterySpecialConfig>> lotteryDifferentConfigMap;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer, SLotterySpecialConfig> config = STableManager.getConfig(SLotterySpecialConfig.class); Map<Integer, SLotterySpecialConfig> config = STableManager.getConfig(SLotterySpecialConfig.class);
Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMapTmp = new HashMap<>(); Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMapTmp = new HashMap<>();
Map<Integer, List<SLotterySpecialConfig>> lotteryDifferentTypeMapTmp = new HashMap<>();
for(SLotterySpecialConfig sLotterySpecialConfig : config.values()){ for(SLotterySpecialConfig sLotterySpecialConfig : config.values()){
// int differentType = sLotterySpecialConfig.getDifferentType(); // int differentType = sLotterySpecialConfig.getDifferentType();
// if(!lotterySpecialConfigMapTmp.containsKey(differentType)){ // if(!lotterySpecialConfigMapTmp.containsKey(differentType)){
@ -44,15 +50,17 @@ public class SLotterySpecialConfig implements BaseConfig {
// } // }
// lotterySpecialConfigMapTmp.get(differentType).get(type).add(sLotterySpecialConfig); // lotterySpecialConfigMapTmp.get(differentType).get(type).add(sLotterySpecialConfig);
lotterySpecialConfigMapTmp.computeIfAbsent(sLotterySpecialConfig.getType(),n->new ArrayList<>()).add(sLotterySpecialConfig); lotterySpecialConfigMapTmp.computeIfAbsent(sLotterySpecialConfig.getType(),n->new ArrayList<>()).add(sLotterySpecialConfig);
lotteryDifferentTypeMapTmp.computeIfAbsent(sLotterySpecialConfig.getDifferentType(),n->new ArrayList<>()).add(sLotterySpecialConfig);
} }
lotterySpecialConfigMap = lotterySpecialConfigMapTmp; lotterySpecialConfigMap = lotterySpecialConfigMapTmp;
lotteryDifferentConfigMap = lotteryDifferentTypeMapTmp;
} }
public static List<SLotterySpecialConfig> getLotterySpecialConfigListByType(int type) { public static List<SLotterySpecialConfig> getLotterySpecialConfigListByType(int type) {
if(!lotterySpecialConfigMap.containsKey(type)){ return lotterySpecialConfigMap.getOrDefault(type,null);
return null; }
} public static List<SLotterySpecialConfig> getLotteryListByDifferentType(int type) {
return lotterySpecialConfigMap.get(type); return lotteryDifferentConfigMap.getOrDefault(type,null);
} }
public int getId() { public int getId() {
@ -82,4 +90,8 @@ public class SLotterySpecialConfig implements BaseConfig {
public int getDifferentType() { public int getDifferentType() {
return differentType; return differentType;
} }
public int getIsNeedShow() {
return isNeedShow;
}
} }