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

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

View File

@ -49,7 +49,7 @@ public enum ActivityTypeEnum {
ECPEDITION_ACTIVITY(ActivityType.ECPEDITION_ACTIVITY,DefaultEmptyActivity::new),
COPY_PASS(ActivityType.COPY_PASS,ChapterRewardActivity::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;

View File

@ -50,121 +50,103 @@ public class LimitRandomCardActivity extends AbstractActivity {
public void onEvent(IEvent event) throws Exception {
if(event instanceof RandomCardEvent){
RandomCardEvent cardEvent =(RandomCardEvent) event;
if(cardEvent.getType()!=3){
if(cardEvent.getType()==0||cardEvent.getType()!=id){
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;
}
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){
// return;
// }
activityMission.setV(allCount);
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
public void onActivityEnd() throws Exception {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
if(null==sActivityRankingReward)
return;
int maxRank = 0;
int maxRewardId = 0;
Map<Integer, Integer> rank2miss = new HashMap<>();
for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
if(sActivityRankingReward1.getMaxRank()==-1){
maxRank =-1;
maxRewardId = sActivityRankingReward1.getId();
continue;
}
// SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
// List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
// if(null==sActivityRankingReward)
// return;
// int maxRank = 0;
// int maxRewardId = 0;
// Map<Integer, Integer> rank2miss = new HashMap<>();
// for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
// if(sActivityRankingReward1.getMaxRank()==-1){
// maxRank =-1;
// maxRewardId = sActivityRankingReward1.getId();
// 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)
{
maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank());
}
for (Integer rank : getRankSet(sActivityRankingReward1.getMinRank(), sActivityRankingReward1.getMaxRank())) {
rank2miss.put(rank, sActivityRankingReward1.getId());
}
}
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.RANDOM_CARD_RANK, Integer.toString(id), 0, (maxRank==-1?0:maxRank) - 1);
int rank = 1;
int nowTime = (int) (TimeUtils.now() / 1000);
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
String value = item.getValue();
int uid = Integer.parseInt(value);
User user = UserManager.getUser(uid, true);
if (null == user) {
continue;
}
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
if (activityMission == null || activityMission.getOpenType() == 0) {
continue;
}
int missionId;
if (rank2miss.containsKey(rank)) {
missionId = rank2miss.get(rank);
} else {
if (maxRank == -1) {
missionId = maxRewardId;
} else {
continue;
}
}
//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);
}
// Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.RANDOM_CARD_RANK, Integer.toString(id), 0, (maxRank==-1?0:maxRank) - 1);
// int rank = 1;
// int nowTime = (int) (TimeUtils.now() / 1000);
// for (ZSetOperations.TypedTuple<String> item : rankInfo) {
// String value = item.getValue();
// int uid = Integer.parseInt(value);
// User user = UserManager.getUser(uid, true);
// if (null == user) {
// continue;
// }
// ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
// if (activityMission == null || activityMission.getOpenType() == 0) {
// continue;
// }
// int missionId;
// if (rank2miss.containsKey(rank)) {
// missionId = rank2miss.get(rank);
// } else {
// if (maxRank == -1) {
// missionId = maxRewardId;
// } else {
// continue;
// }
// }
//
// //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;
import java.util.Map;
/**
* @author lvxinran
* @date 2019/11/27
@ -8,11 +10,13 @@ package com.ljsd.jieling.logic.activity.event;
public class RandomCardEvent implements IEvent {
private int uid;
private int type;
private boolean mustAppear;
public RandomCardEvent(int uid,int type,boolean mustAppear) {
private Map<Integer,Integer> mustAppear;
private int count;
public RandomCardEvent(int uid,int type,Map<Integer,Integer> mustAppear,int count) {
this.uid = uid;
this.type = type;
this.mustAppear = mustAppear;
this.count = count;
}
public int getType() {
@ -31,11 +35,19 @@ public class RandomCardEvent implements IEvent {
this.uid = uid;
}
public boolean isMustAppear() {
public Map<Integer, Integer> getMustAppear() {
return mustAppear;
}
public void setMustAppear(boolean mustAppear) {
public void setMustAppear(Map<Integer, Integer> 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++) {
resultRandom[i+index+1] = tenTimesMustGetItem[i];
}
Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(),sLotterySetting.getActivityId(),heroManager.getRandomPoolByType().get(sLotterySetting.getMergePool()),sLotterySetting.getPerCount()));
// //1群英招募
HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder();
if(sLotterySetting.getLotteryType() == 1){
@ -364,7 +365,6 @@ public class HeroLogic{
}
heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool));
int result = sLotteryRewardConfig.getId();
Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(),sLotterySetting.getLotteryType(),isBestCard));
return result;
}
@ -2343,11 +2343,17 @@ public class HeroLogic{
heroManager.removeHero(uid,heroId);
int[] returnMaterials = sHeroReturn.getRankupReturn();
int[][] returnHero = sHeroReturn.getReturnHero();
int returnHero = sHeroReturn.getHeroId();
//进阶材料返还乘万分比
returnMaterials[1]*=(double)returnPercent/10000;
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());
int[][] levelUpReturn = sHeroLevlConfig.getSumConsume();
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);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,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;
}
if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务
@ -443,7 +443,7 @@ public class MissionLoigc {
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
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();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);

View File

@ -76,7 +76,7 @@ public class BuyGoodsLogic {
if(isDiscount!=0){
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);
}

View File

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