Merge branch 'dh_dev_cow' into master_test_gn
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.javaback_recharge
commit
2f4715b599
|
@ -110,7 +110,7 @@ public class TimeUtils {
|
|||
/**
|
||||
* 年月日 时分秒, 格式如: 20110111011059
|
||||
*/
|
||||
private static final String ymdhmsFormat_new = "yyyyMMddHHmmss";
|
||||
public static final String ymdhmsFormat_new = "yyyyMMddHHmmss";
|
||||
/**
|
||||
* 年月日 时分, 格式如: 2011-01-11 01:10
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ public class TimeUtils {
|
|||
/**
|
||||
* 年月日,格式如19700710
|
||||
*/
|
||||
private static final String ymdFormat = "yyyyMMdd";
|
||||
public static final String ymdFormat = "yyyyMMdd";
|
||||
/**
|
||||
* 年月日,格式如1970年07月10日
|
||||
*/
|
||||
|
|
|
@ -83,7 +83,7 @@ public class GameApplication {
|
|||
|
||||
private static void setRegisterTime() throws Exception {
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
if( null == serverConfigTmp ){
|
||||
if(serverConfigTmp == null){
|
||||
serverConfigTmp = new ServerConfig();
|
||||
if (GameApplication.serverProperties.isAutoOpen()) {
|
||||
int startbefore = 60; //开服白名单时间
|
||||
|
@ -94,23 +94,18 @@ public class GameApplication {
|
|||
LOGGER.error("预计" + sleepTime + "分钟后开服");
|
||||
Thread.sleep(1000 * 60);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("休眠异常", e.getMessage(), e);
|
||||
LOGGER.error("休眠异常:{}", e.getMessage(), e);
|
||||
}
|
||||
needtime = TimeUtils.differMintFromLast(RedisUtil.getInstence().getObject(GameApplication.serverId + RedisKey.Delimiter_colon + RedisKey.AUTOOPENTIME ,"",String.class,-1));
|
||||
}
|
||||
}
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
long serverOenTime = TimeUtils.getAppointTime(0);
|
||||
String format = simpleDateFormat.format(serverOenTime);
|
||||
serverConfigTmp.setOpenTime(format);
|
||||
serverConfigTmp.setOpenTime(TimeUtils.getTimeStamp2(serverOenTime));
|
||||
serverConfigTmp.setCacheOpenTime(serverOenTime);
|
||||
serverConfigTmp.setId(1);
|
||||
}else{
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String openTime = serverConfigTmp.getOpenTime();
|
||||
Date date = simpleDateFormat.parse(openTime);
|
||||
serverConfigTmp.setCacheOpenTime(date.getTime());
|
||||
long timeStamp2 = TimeUtils.stringToTimeLong2(serverConfigTmp.getOpenTime());
|
||||
serverConfigTmp.setCacheOpenTime(timeStamp2);
|
||||
}
|
||||
int version = STableManager.getConfig(SGameSetting.class).get(1).getWookbookVersion();
|
||||
serverConfigTmp.setVersion(version);
|
||||
|
|
|
@ -169,28 +169,20 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
if(time == ActivityType.OPEN_TYPE_MONTHS){
|
||||
//now = 当前是开服第几个月
|
||||
//开服日期
|
||||
String openTime = GameApplication.serverConfig.getOpenTime().split(" ")[0];
|
||||
String nowTime = TimeUtils.getTimeStampYMDnew(TimeUtils.now());
|
||||
//now = TimeUtils.getGapMonthsByTwoTime(openTime, nowTime)+1;
|
||||
}
|
||||
long startTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),0, 1);
|
||||
long endTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),0, 2);
|
||||
long gapEndTime = endTime+sGlobalActivity.getGapTime()*TimeUtils.DAY;
|
||||
if (now < startTime) {
|
||||
//如果没到活动开启时间,但是openActivityIds里有了这个活动,证明是热更延迟开启的活动,需要清除掉
|
||||
if (openActivityIds.contains(sGlobalActivity.getId())) {
|
||||
openActivityIds.remove(sGlobalActivity.getId());
|
||||
}
|
||||
openActivityIds.remove(sGlobalActivity.getId());
|
||||
continue;
|
||||
}
|
||||
int[] ifOpen = sGlobalActivity.getIfOpen();
|
||||
if(ifOpen!=null && ifOpen.length>0){
|
||||
if(ifOpen[0]==2){ //开服
|
||||
if(GameApplication.serverConfig.getCacheOpenTime() + ifOpen[1]*TimeUtils.ONE_DAY >TimeUtils.now()){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 开服条件判断
|
||||
boolean open = SGlobalActivity.checkActivityIfOpen(sGlobalActivity.getId(),0,GameApplication.serverConfig.getCacheOpenTime());
|
||||
if (!open){
|
||||
continue;
|
||||
}
|
||||
if (endTime != 0 && now > endTime) {
|
||||
if (!openActivityIds.contains(sGlobalActivity.getId())) {
|
||||
|
@ -213,8 +205,9 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (null == abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
if(openActivityIds.contains(sGlobalActivity.getId()))
|
||||
if(openActivityIds.contains(sGlobalActivity.getId())) {
|
||||
continue;
|
||||
}
|
||||
abstractActivity.onActivityStart();
|
||||
openActivityIds.add(sGlobalActivity.getId());
|
||||
}
|
||||
|
@ -327,7 +320,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
public LuckWheelMission getLuckWheel(ActivityManager activityManager, int type) {
|
||||
LuckWheelMission luckWheelMission = type == ActivityType.LUCK_WHEEL ? activityManager.getLuckWheel() : activityManager.getLuckWheelAdvance();
|
||||
if (null == luckWheelMission) {
|
||||
String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
// String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
if (type == ActivityType.LUCK_WHEEL) {
|
||||
luckWheelMission = new LuckWheelMission();
|
||||
activityManager.setLuckWheel(luckWheelMission);
|
||||
|
@ -342,7 +335,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
public void initLuckWheel(ActivityManager activityManager,int type) {
|
||||
LuckWheelMission luckWheelMission = type == ActivityType.LUCK_WHEEL ? activityManager.getLuckWheel() : activityManager.getLuckWheelAdvance();
|
||||
if (null != luckWheelMission) {
|
||||
String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
// String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
if (type == ActivityType.LUCK_WHEEL) {
|
||||
activityManager.setLuckWheel(luckWheelMission);
|
||||
} else {
|
||||
|
@ -365,11 +358,10 @@ public class ActivityLogic implements IEventHandler{
|
|||
for (Integer openActivityId : openActivityIds) {
|
||||
SGlobalActivity sGlobalActivity = sGlobalActivityMap.get(openActivityId);
|
||||
int[] ifOpen = sGlobalActivity.getIfOpen();
|
||||
if(ifOpen!=null && ifOpen.length>0){
|
||||
if(ifOpen[0]==1){ //创角
|
||||
if(userCreateTime + ifOpen[1]*TimeUtils.ONE_DAY - now >0){
|
||||
continue;
|
||||
}
|
||||
//创角
|
||||
if(ifOpen!=null && ifOpen.length>0 && ifOpen[0]==1){
|
||||
if(userCreateTime + ifOpen[1]*TimeUtils.ONE_DAY > now){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(openActivityId);
|
||||
|
@ -400,11 +392,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(!initOtherActivity(user, sGlobalActivity)){
|
||||
initAllActivityMission(activityManager.getActivityMissionMap(),openActivityId);
|
||||
// }
|
||||
|
||||
initAllActivityMission(activityManager.getActivityMissionMap(),openActivityId);
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(openActivityId);
|
||||
if (null==abstractActivity) {
|
||||
continue;
|
||||
|
@ -425,15 +413,13 @@ public class ActivityLogic implements IEventHandler{
|
|||
int activityId = sGlobalActivity.getId();
|
||||
if (openActivityIds.contains(activityId)) {
|
||||
int[] ifOpen = sGlobalActivity.getIfOpen();
|
||||
if(ifOpen!=null && ifOpen.length>0){
|
||||
if(ifOpen[0]==1){ //创角
|
||||
if(userCreateTime + ifOpen[1]*TimeUtils.ONE_DAY - now >0){
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if (ifOpen == null || ifOpen.length <= 0){
|
||||
continue;
|
||||
}
|
||||
if (ifOpen[0]!=1){
|
||||
continue;
|
||||
}
|
||||
if (userCreateTime + ifOpen[1]*TimeUtils.ONE_DAY > now){
|
||||
continue;
|
||||
}
|
||||
} else if (activityMissionMap.containsKey(activityId)) {
|
||||
|
@ -469,7 +455,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
// ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(activityId));
|
||||
abstractActivity.initActivity(user);
|
||||
// if(!initOtherActivity(user, sGlobalActivity)){
|
||||
initAllActivityMission(activityManager.getActivityMissionMap(),activityId);
|
||||
initAllActivityMission(activityManager.getActivityMissionMap(),activityId);
|
||||
//
|
||||
int activityOpenState = getActivityOpenState(user, activityId );
|
||||
abstractActivity.setOpenState(user,activityOpenState);
|
||||
|
@ -539,7 +525,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.LUCKWHEEL_POOL_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
public List<CommonProto.ActivityInfo> getActivityInfos(Map<Integer, ActivityMission> activityMissionMap, long createTime) {
|
||||
public List<CommonProto.ActivityInfo> getActivityInfos(Map<Integer, ActivityMission> activityMissionMap, long createTime) {
|
||||
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
||||
List<CommonProto.ActivityInfo> activityInfoList = new ArrayList<>(activityMissionMap.size());
|
||||
for (Map.Entry<Integer, ActivityMission> activityState : activityMissionMap.entrySet()) {
|
||||
|
@ -586,7 +572,6 @@ public class ActivityLogic implements IEventHandler{
|
|||
int endTime;
|
||||
if(sGlobalActivity.getGapTime()!=0){
|
||||
endTime = (int) (ToolsUtil.getEndTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createTime, sGlobalActivity.getGapTime()) / 1000);
|
||||
|
||||
}else{
|
||||
endTime = (int) (ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createTime, 2) / 1000);
|
||||
}
|
||||
|
@ -642,7 +627,8 @@ public class ActivityLogic implements IEventHandler{
|
|||
ActivityMission value = item.getValue();
|
||||
if (value.getOpenType() == 0) {
|
||||
value.setOpenType(1);
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
@ -12,20 +13,20 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.main.CowFlySkyMissionType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SArroGantFly;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalActivity;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CowFlySkyActivity extends AbstractActivity {
|
||||
|
||||
|
@ -35,6 +36,10 @@ public class CowFlySkyActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
boolean open = SGlobalActivity.checkActivityIfOpen(id, user.getPlayerInfoManager().getCreateTime(), GameApplication.serverConfig.getCacheOpenTime());
|
||||
if (!open){
|
||||
return;
|
||||
}
|
||||
ActivityMission mission = new ActivityMission();
|
||||
List<SActivityRewardConfig> rewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
ArrayList<Integer> integers = new ArrayList<>(rewardConfigs.size());
|
||||
|
|
|
@ -2273,9 +2273,7 @@ public class HeroLogic{
|
|||
if (!bookEnabled.isEmpty()){
|
||||
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
|
||||
for(int bootId:bookEnabled){
|
||||
SSpiritAnimalBook animalBook=config.get(bootId);
|
||||
if (animalBook==null)continue;
|
||||
int[][] activePara = animalBook.getActivePara();
|
||||
int[][] activePara = Optional.ofNullable(config.get(bootId)).map(SSpiritAnimalBook::getActivePara).orElse(new int[0][]);
|
||||
combinedAttribute(activePara,heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.ljsd.jieling.logic.mission.data.BaseDataManager;
|
|||
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
|
||||
import com.ljsd.jieling.logic.mission.main.*;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.luaj.vm2.ast.Str;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -60,10 +61,40 @@ public class MissionLoigc {
|
|||
getCowFlySkyMission(user,missionList);
|
||||
getEndlessMission(user,missionList);
|
||||
getMistyTripMission(user,missionList);
|
||||
// 此方法必须放在最后,对所有获取到的任务进行处理
|
||||
checkMissionTime(missionList);
|
||||
PlayerInfoProto.GetMissionResponse build = PlayerInfoProto.GetMissionResponse.newBuilder().addAllUserMissionInfo(missionList).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_MISSION_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容,校验成就时间
|
||||
* @param missionList
|
||||
*/
|
||||
private static void checkMissionTime(List<CommonProto.UserMissionInfo> missionList){
|
||||
// 配置表
|
||||
Map<Integer, SAchievementConfig> config = STableManager.getConfig(SAchievementConfig.class);
|
||||
// 玩家当前任务
|
||||
Iterator<CommonProto.UserMissionInfo> iterator = missionList.iterator();
|
||||
// 开服时间
|
||||
long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
// 遍历
|
||||
while (iterator.hasNext()){
|
||||
CommonProto.UserMissionInfo next = iterator.next();
|
||||
SAchievementConfig achievementConfig = config.get(next.getMissionId());
|
||||
// 配置表不存在的成就,可能删除了,代码去除
|
||||
if (achievementConfig == null){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
long time = TimeUtils.stringToTimeLong(String.valueOf(achievementConfig.getEffectData()), TimeUtils.ymdFormat);
|
||||
// 表中配置的,time之前开服的不显示改任务
|
||||
if (cacheOpenTime < time){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void getBloodyMisison(User user, List<CommonProto.UserMissionInfo> missionList){
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
BloodyMissionIdsType bloodyMissionIdsType = userMissionManager.getBloodyMissionIdsType();
|
||||
|
|
|
@ -16,6 +16,8 @@ public class SAchievementConfig implements BaseConfig {
|
|||
|
||||
private int[][] reward;
|
||||
|
||||
private int effectData;
|
||||
|
||||
public static Map<Integer, Set<Integer>> setTMap;
|
||||
public static Map<Integer, List<SAchievementConfig>> sTaskConfigByTypeMap;
|
||||
@Override
|
||||
|
@ -49,6 +51,10 @@ public class SAchievementConfig implements BaseConfig {
|
|||
return reward;
|
||||
}
|
||||
|
||||
public int getEffectData() {
|
||||
return effectData;
|
||||
}
|
||||
|
||||
public static Map<Integer, List<SAchievementConfig>> getsTaskConfigByTypeMap() {
|
||||
return sTaskConfigByTypeMap;
|
||||
}
|
||||
|
|
|
@ -81,11 +81,6 @@ public class SGlobalActivity implements BaseConfig {
|
|||
}
|
||||
sGlobalActivity.setStartTimeLong(Long.parseLong(startTime));
|
||||
sGlobalActivity.setEndTimeLong(Long.parseLong(endtime));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
sGlobalActivityMap = config;
|
||||
sGlobalActivityMapByType = sGlobalActivityMapByTypeTmp;
|
||||
|
@ -93,6 +88,60 @@ public class SGlobalActivity implements BaseConfig {
|
|||
sRechargeId2ActivityId = sRechargeId2ActivityIdTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验活动开启条件
|
||||
* @param activityId
|
||||
* @param value
|
||||
* 对应位置参数传0,表示不需要验证
|
||||
* 条件参数,第一位:创角时间
|
||||
* 第二位:开服时间
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkActivityIfOpen(int activityId, long... value){
|
||||
SGlobalActivity activity = sGlobalActivityMap.get(activityId);
|
||||
if (activity == null){
|
||||
return false;
|
||||
}
|
||||
// 开启条件
|
||||
int[] ifOpen = activity.getIfOpen();
|
||||
// 为空表示没有条件
|
||||
if (ifOpen == null || ifOpen.length <= 0){
|
||||
return true;
|
||||
}
|
||||
long now = TimeUtils.now();
|
||||
switch (ifOpen[0]){
|
||||
case 1:
|
||||
// 创角多少天后不开
|
||||
if (value[0] != 0 && value[0] + ifOpen[1]*TimeUtils.ONE_DAY > now){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// 开服后多少天不出现改活动
|
||||
if(value[1] != 0 && value[1] + ifOpen[1]*TimeUtils.ONE_DAY > now){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// 在某某时间之前开服不会出现
|
||||
long timeOpen3 = TimeUtils.stringToTimeLong(String.valueOf(ifOpen[1]), TimeUtils.ymdFormat);
|
||||
if (value[1] != 0 && value[1] < timeOpen3){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// 在某某时间之后开服不会出现
|
||||
long timeOpen4 = TimeUtils.stringToTimeLong(String.valueOf(ifOpen[1]), TimeUtils.ymdFormat);
|
||||
if (value[1] != 0 && value[1] > timeOpen4){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Map<Integer, SGlobalActivity> getsGlobalActivityMap() {
|
||||
return sGlobalActivityMap;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue