特权修改时发送挂机奖励

back_recharge
lvxinran 2020-01-14 13:41:22 +08:00
parent bedd39c0a2
commit 4148f0d9ee
4 changed files with 43 additions and 7 deletions

View File

@ -138,8 +138,8 @@ public class TimeUtils {
public static final String Stand_CeHua_Data_format = "yyyyMMdd HHmmss";
public static void main(String[] args) {
// long lastHour = getLastHour(5);
// System.out.println(lastHour);
long lastHour = getLastHour(now(),5);
System.out.println(lastHour);
}
/**
* (HH:mm:ss)
@ -228,6 +228,10 @@ public class TimeUtils {
return System.currentTimeMillis();
}
public static int nowInt(){
return (int)(now()/1000);
}
// /**
// * 获取当天零点时间
// *

View File

@ -0,0 +1,7 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.dao.root.User;
public interface IPrivilegeChange {
void change(User user, int level) throws Exception;
}

View File

@ -2,13 +2,16 @@ package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
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.logic.fight.CombatLogic;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.ToolsUtil;
import config.SGlobalActivity;
@ -16,11 +19,13 @@ import config.SGlobalSystemConfig;
import config.SMainLevelConfig;
import config.SPrivilegeTypeConfig;
import manager.STableManager;
import util.TimeUtils;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class UserLevelEventHandler implements IEventHandler{
public class UserLevelEventHandler implements IEventHandler,IPrivilegeChange{
public UserLevelEventHandler() {
Poster.getPoster().listenEvent(this, UserLevelEvent.class);
@ -30,12 +35,14 @@ public class UserLevelEventHandler implements IEventHandler{
if (!(event instanceof UserLevelEvent))
return;
UserLevelEvent userLevelEvent = (UserLevelEvent) event;
//检测是否有增益特权修改
change(UserManager.getUser(userLevelEvent.getUid()),userLevelEvent.getLevel());
int level = userLevelEvent.getLevel();
List<SGlobalSystemConfig> sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(2).get(level);
int uid = userLevelEvent.getUid();
User user = UserManager.getUser(uid);
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,user.getPlayerInfoManager().getLevel());
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,userLevelEvent.getLevel());
int state = user.getMainLevelManager().getState();
if(state == -1 ){
int fightId = user.getMainLevelManager().getFightId();
@ -50,7 +57,7 @@ public class UserLevelEventHandler implements IEventHandler{
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]){
if(userLevelEvent.getLevel()>=openRules[1]){
activityMission.updateActivityState(ActivityType.OPEN_STATE);
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
if(sGlobalActivity.getShopId()!=0){
@ -73,4 +80,22 @@ public class UserLevelEventHandler implements IEventHandler{
}
}
}
@Override
public void change(User user,int level) throws Exception {
List<SPrivilegeTypeConfig> adventurePrivilege = SPrivilegeTypeConfig.privilegeByType.get(VipPrivilegeType.ADVENTURE_BASE_REWARD);
if (adventurePrivilege.isEmpty()){
return;
}
for(SPrivilegeTypeConfig config:adventurePrivilege){
if(config.getUnlockType()!= GlobalsDef.LEVEL_UNLOCK_PRIVILEGE){
continue;
}
Integer value= SPrivilegeTypeConfig.conditionMap.get(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE).get(config.getId()).get(level);
if(value==null){
continue;
}
CombatLogic.getInstance().getNewAdventureReward(user,true, TimeUtils.nowInt());
}
}
}

View File

@ -620,8 +620,8 @@ public class ItemUtil {
} else {
if (curExp >= sPlayerLevelConfig.getExp()) {
curExp = curExp - sPlayerLevelConfig.getExp();
playerInfoManager.setLevel(playerInfoManager.getLevel() + 1);
Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(),playerInfoManager.getLevel()));
Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(),playerInfoManager.getLevel()+1));
playerInfoManager.setLevel(playerInfoManager.getLevel()+1);
sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(playerInfoManager.getLevel());
levelUpExp = sPlayerLevelConfig.getExp();
}