activity
parent
bbbd0d60d7
commit
bda2d610f0
|
|
@ -2246,7 +2246,7 @@ public class MapLogic {
|
|||
state =2;
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new FightMainEvent(user.getId(),fightId));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user.getId(), NewWelfareTypeEnum.LEVEL_FIGHT.getType(),fightId));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LEVEL_FIGHT.getType(),fightId));
|
||||
user.getMainLevelManager().updateFight(updateFightId,state);
|
||||
if(state == -1){
|
||||
//删除为0的
|
||||
|
|
|
|||
|
|
@ -320,4 +320,13 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void setOpenState(User user,int openState){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if(activityMission != null){
|
||||
activityMission.updateActivityState(openState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class ActivityLogic {
|
|||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_SUM_DAY);
|
||||
user.getPlayerInfoManager().setRechargedaily(0);
|
||||
updateActivityMissionProgress(user, ActivityType.SevenLogin, 1);
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user.getId(), NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
||||
|
||||
//幸运转盘活动刷新
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.LUCK_WHEEL);
|
||||
|
|
@ -211,14 +211,19 @@ public class ActivityLogic {
|
|||
if (activityMission != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(!initOtherActivity(user, sGlobalActivity)){
|
||||
activityManager.initAllActivityMission(openActivityId);
|
||||
// }
|
||||
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(openActivityId);
|
||||
if (null==abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
abstractActivity.initActivity(user);
|
||||
int activityOpenState = getActivityOpenState(user, openActivityId);
|
||||
abstractActivity.setOpenState(user,activityOpenState);
|
||||
//非角色活动开启通知
|
||||
openNewActivityIds.add(openActivityId);
|
||||
if(sGlobalActivity.getShopId()!=0){
|
||||
|
|
@ -277,6 +282,8 @@ public class ActivityLogic {
|
|||
// if(!initOtherActivity(user, sGlobalActivity)){
|
||||
activityManager.initAllActivityMission(activityId);
|
||||
// }
|
||||
int activityOpenState = getActivityOpenState(user, activityId );
|
||||
abstractActivity.setOpenState(user,activityOpenState);
|
||||
openNewActivityIds.add(activityId);
|
||||
checkNeedOpenStore(user,sGlobalActivity.getShopId(),startTime,endTime);
|
||||
} else {
|
||||
|
|
@ -299,20 +306,6 @@ public class ActivityLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 不走通用活动进度奖励配置的活动单独初始化
|
||||
*/
|
||||
// public boolean initOtherActivity(User user, SGlobalActivity sGlobalActivity) throws Exception {
|
||||
// int type = sGlobalActivity.getType();
|
||||
// switch (type) {
|
||||
// case ActivityType.BLESSACTIVITY:
|
||||
// blessInfoInit(user.getActivityManager(), sGlobalActivity.getId());
|
||||
// return true;
|
||||
// default:
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public static ActivityLogic getInstance() {
|
||||
return ActivityLogic.Instance.instance;
|
||||
|
|
@ -353,6 +346,9 @@ public class ActivityLogic {
|
|||
continue;
|
||||
}
|
||||
int activityStatus = activityMission.getActivityState();
|
||||
if(activityStatus == -1){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sGlobalActivityMap.get(activityId).getIsSaving()==0 && activityStatus != ActivityType.OPEN_STATE) {
|
||||
continue;
|
||||
|
|
@ -373,6 +369,28 @@ public class ActivityLogic {
|
|||
return activityInfoList;
|
||||
}
|
||||
|
||||
public void sendActivityInfo(User user,int activityId){
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if(session!=null){
|
||||
PlayerInfoProto.ActivityUpateIndication.Builder builder = PlayerInfoProto.ActivityUpateIndication.newBuilder();
|
||||
Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
||||
Map<Integer, ActivityMission> activityUpdateMap = new HashMap<>();
|
||||
boolean sendLuckWheelPool =false;
|
||||
if(ActivityType.LUCK_WHEEL == SGlobalActivity.getsGlobalActivityMap().get(activityId).getType()
|
||||
||ActivityType.LUCK_WHEEL_ADVANCE == SGlobalActivity.getsGlobalActivityMap().get(activityId).getType())
|
||||
sendLuckWheelPool=true;
|
||||
activityUpdateMap.put(activityId, activityMissionMap.get(activityId));
|
||||
List<CommonProto.ActivityInfo> activityInfos = getActivityInfos(activityUpdateMap, user.getPlayerInfoManager().getCreateTime());
|
||||
builder.addAllActivityInfo(activityInfos);
|
||||
if(sendLuckWheelPool){
|
||||
sendLuckWheelPool(user,session);
|
||||
}
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void openActivityReallyOpen(User user, int activityType) {
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
|
||||
|
|
@ -388,6 +406,33 @@ public class ActivityLogic {
|
|||
}
|
||||
}
|
||||
|
||||
public int getActivityOpenState(User user,int activityId){
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
int[] openRules = sGlobalActivity.getOpenRules();
|
||||
int state = ActivityType.OPEN_STATE;
|
||||
if(openRules!=null&&openRules.length>0){
|
||||
int openRuleType = openRules[0];
|
||||
int openRulleValue = openRules[1];
|
||||
if(openRuleType == 1){
|
||||
int virtureId = SMainLevelConfig.config.get(openRulleValue).getVirtureId();
|
||||
int fightId = user.getMainLevelManager().getFightId();
|
||||
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.fightPreMap.get(fightId);
|
||||
if(user.getMainLevelManager().getState() == 2 ){
|
||||
mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
|
||||
}
|
||||
if(mineMainLevelConfig!=null && virtureId > mineMainLevelConfig.getVirtureId()){
|
||||
state = ActivityType.UNOPEN_STATE;
|
||||
}
|
||||
}else{
|
||||
if(user.getPlayerInfoManager().getLevel()<openRulleValue){
|
||||
state = ActivityType.UNOPEN_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
public void updateActivityMissionProgress(User user, int activityType, int count) {
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.activity;
|
|||
|
||||
public interface ActivityType {
|
||||
|
||||
int UNOPEN_STATE = -1;
|
||||
int CLOSE_STATE = 0;
|
||||
int OPEN_STATE = 1;
|
||||
int FINISH_STATE = 2;
|
||||
|
|
|
|||
|
|
@ -6,10 +6,13 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.logic.activity.event.FightMainEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SGlobalActivity;
|
||||
import config.SGlobalSystemConfig;
|
||||
import config.SMainLevelConfig;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -41,5 +44,24 @@ public class FightMainEventHandler implements IEventHandler{
|
|||
}
|
||||
}
|
||||
|
||||
for(SGlobalActivity sGlobalActivity : SGlobalActivity.getsGlobalActivityMap().values()){
|
||||
int[] openRules = sGlobalActivity.getOpenRules();
|
||||
if(openRules!=null && openRules.length>0 && openRules[0] == 1){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(sGlobalActivity.getId());
|
||||
if(activityMission!=null && activityMission.getActivityState() == ActivityType.UNOPEN_STATE){
|
||||
int virtureId = SMainLevelConfig.config.get( openRules[1]).getVirtureId();
|
||||
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.fightPreMap.get(fightId);
|
||||
if(user.getMainLevelManager().getState() == 2 ){
|
||||
mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
|
||||
}
|
||||
if(mineMainLevelConfig!=null && virtureId > mineMainLevelConfig.getVirtureId()){
|
||||
activityMission.setOpenType(ActivityType.OPEN_STATE);
|
||||
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
|||
|
||||
public class NewWelfareActivity extends AbstractActivity {
|
||||
|
||||
private int loginTimes;//登陆次数
|
||||
public NewWelfareActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, NewWelfareEvent.class);
|
||||
|
|
@ -36,7 +35,7 @@ public class NewWelfareActivity extends AbstractActivity {
|
|||
return;
|
||||
}
|
||||
NewWelfareEvent newWelfareEvent = (NewWelfareEvent) event;
|
||||
User user = UserManager.getUser(newWelfareEvent.getUid());
|
||||
User user =newWelfareEvent.getUser();
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||
|
|
@ -83,6 +82,7 @@ public class NewWelfareActivity extends AbstractActivity {
|
|||
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
|
||||
activityProgressInfo.setState(2);
|
||||
}
|
||||
sendActivityProgress(session, activityMission, null);
|
||||
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sActivityRewardConfigs.get(0).getReward(), BIReason.TAKE_ACTIVITY_REWARD);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SGlobalActivity;
|
||||
import config.SGlobalSystemConfig;
|
||||
import config.SMainLevelConfig;
|
||||
import manager.STableManager;
|
||||
|
|
@ -39,6 +41,19 @@ public class UserLevelEventHandler implements IEventHandler{
|
|||
}
|
||||
|
||||
}
|
||||
for(SGlobalActivity sGlobalActivity : SGlobalActivity.getsGlobalActivityMap().values()){
|
||||
int[] openRules = sGlobalActivity.getOpenRules();
|
||||
if(openRules!=null && openRules.length>0 && openRules[0] == 2){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(sGlobalActivity.getId());
|
||||
if(activityMission!=null && activityMission.getActivityState() == ActivityType.UNOPEN_STATE){
|
||||
if(user.getPlayerInfoManager().getLevel()>=openRules[1]){
|
||||
activityMission.setOpenType(ActivityType.OPEN_STATE);
|
||||
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(sGlobalSystemConfigs == null){
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
public class NewWelfareEvent implements IEvent{
|
||||
private int uid;
|
||||
private User user;
|
||||
private int type;
|
||||
private int parm;
|
||||
|
||||
public NewWelfareEvent(int uid, int type, int parm) {
|
||||
this.uid = uid;
|
||||
public NewWelfareEvent(User user, int type, int parm) {
|
||||
this.user = user;
|
||||
this.type = type;
|
||||
this.parm = parm;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.NewWelfareEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.NewWelfareTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
|
|
@ -98,6 +101,7 @@ public class UserManager {
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ public class BuyGoodsLogic {
|
|||
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,orderId,resultRes.getResultCode(),price);
|
||||
notifyPaySuccessFul(uid,goodsId,amount != -999);
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user.getId(), NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
|
||||
return resultRes;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class SGlobalActivity implements BaseConfig {
|
|||
|
||||
private int openRanking;
|
||||
|
||||
private int[] openRules;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -130,4 +132,8 @@ public class SGlobalActivity implements BaseConfig {
|
|||
public int getOpenRanking() {
|
||||
return openRanking;
|
||||
}
|
||||
|
||||
public int[] getOpenRules() {
|
||||
return openRules;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue