修复等级条件类活动等级变更时不自动刷新的问题

master_yuenan
DESKTOP-C3M45P4\dengdan 2025-11-23 18:23:04 +08:00
parent b1ee021450
commit 972238a752
1 changed files with 29 additions and 0 deletions

View File

@ -159,6 +159,8 @@ public class ActivityLogic implements IEventHandler{
checkActivityIsFinish(user);
sendLuckWheelPool(user,iSession);
checkActivityOfUser(user, null);
//修复部分活动更改开启等级条件的活动,导致没有及时刷新(之前只有升级的时候才刷新)
this.refreshLevelActivty(user);
}
public static class Instance {
@ -2096,4 +2098,31 @@ public class ActivityLogic implements IEventHandler{
}
}
/**
* ,
* @param user
*/
public void refreshLevelActivty(User user){
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByOpenRules.getOrDefault(2,new ArrayList<>(0));
for(SGlobalActivity sGlobalActivity : sGlobalActivities){
int[] openRules = sGlobalActivity.getOpenRules();
if(openRules == null || openRules.length <=0){
continue;
}
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(sGlobalActivity.getId());
if(activityMission!=null && activityMission.getActivityState() == ActivityType.UNOPEN_STATE){
if(user.getPlayerInfoManager().getLevel()>=openRules[1]){
activityMission.setActivityState(ActivityType.OPEN_STATE);
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(user.getId(),sGlobalActivity.getId(),ActivityType.OPEN_STATE));
if(sGlobalActivity.getType() == ActivityType.GrowthFund){
ActivityTypeEnum.getActicityById(sGlobalActivity.getId()).update(user,user.getPlayerInfoManager().getLevel());
}
}
}
}
}
}