Merge branch 'master_test_gn' into master_test_gn_xxp

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java
back_recharge
xuexinpeng 2021-10-16 11:44:24 +08:00
commit ecba1854dd
22 changed files with 460 additions and 123 deletions

View File

@ -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";
/**
* 19700710
*/

View File

@ -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);

View File

@ -254,6 +254,9 @@ public class BehaviorUtil {
hero = helpHero.getHero();
}
}
if (hero == null) {
continue;
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString();

View File

@ -477,6 +477,9 @@ public class GlobalDataManaager implements IManager {
HeroLogic.getInstance().resetWishDrawCardInfoMap(user);
//玉虚论道每日刷新
user.getArenaManager().setCrossYuxulundaoDailyRewad(new ArrayList<>(Arrays.asList(0,0,0)));
///清空当天推送的礼包次数
user.getPlayerInfoManager().getNewRechargeInfo().ClearDayPushMap();
}
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
}

View File

@ -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);
} }
}
}
}
}

View File

@ -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());

View File

@ -3,13 +3,52 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class ItemManager extends MongoBase {
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
///兼容线上数据,计算统计装备(为了做白金装备图鉴,需要初始化统计一次用户身上所有装备)true:已经计算过了 false未计算
private boolean isAbsEquip;
public boolean getIsAbsEquip() {
return isAbsEquip;
}
public void setAbsEquip(boolean absEquip) {
isAbsEquip = absEquip;
updateString("isAbsEquip", isAbsEquip);
}
private Map<Integer, Long> equipBookMap = new HashMap<>();
public Map<Integer, Long> getEquipBookMap() {
return equipBookMap;
}
public void setEquipBookMap(int equipId,long addNum) {
long _num=addNum;
if (this.equipBookMap.containsKey(equipId)){
_num+=this.equipBookMap.get(equipId);
}
this.equipBookMap.put(equipId,_num);
updateString("equipBookMap." + equipId, _num);
}
private Set<Integer> equipBookEnabled = new HashSet<>();
public Set<Integer> getEquipBookEnabled() {
return equipBookEnabled;
}
public void addEquipBookEnabled(int bookId) {
this.equipBookEnabled.add(bookId);
updateString("equipBookEnabled", equipBookEnabled);
}
public ItemManager() {
this.setRootCollection(User._COLLECTION_NAME);

View File

@ -783,7 +783,9 @@ public class CombatLogic {
}
}
}
if (hero == null) {
continue;
}
List<Integer> heroSkillListTmp = HeroLogic.getInstance().getHeroSkillList(user, hero);
heroSkillListTmp.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);

View File

@ -94,6 +94,9 @@ public class SevenWorldFightHandler implements IFightEventProcesor {
hero = helpHero.getHero();
}
}
if (hero == null) {
continue;
}
StringBuilder propertySb = new StringBuilder();
String heroSkill = getHeroSkills(user,hero,teamPosHeroInfo.getPosition()).toString();
String property = HeroLogic.getInstance().getHeroProperty(user,hero,propertySb,true,teamId).toString();

View File

@ -2225,6 +2225,17 @@ public class HeroLogic{
num-=1;
}
}
// 坐骑技能
for(Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserMountValidTime().entrySet()){
if(!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())){
continue;
}
SPlayerHeadIcon sPlayerHeadIcon = SPlayerHeadIcon.getHeadIconMap().get(entry.getKey());
if (sPlayerHeadIcon.getSkill() == null || sPlayerHeadIcon.getSkill().length <= 0){
continue;
}
sb.append(sPlayerHeadIcon.getSkill()[0][0]).append(DIVISION);
}
return sb;
}
@ -2466,7 +2477,7 @@ public class HeroLogic{
if (!bookEnabled.isEmpty()){
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
for(int bootId:bookEnabled){
int[][] activePara = config.get(bootId).getActivePara();
int[][] activePara = Optional.ofNullable(config.get(bootId)).map(SSpiritAnimalBook::getActivePara).orElse(new int[0][]);
combinedAttribute(activePara,heroAllAttribute);
}
}
@ -2510,6 +2521,9 @@ public class HeroLogic{
//魂印图鉴加成
Set<Integer> equipBookEnabled = equipManager.getEquipBookEnabled();
bonuses(equipBookEnabled,heroAllAttribute);
//白金装备加成
Set<Integer> whiteBookEnabled = user.getItemManager().getEquipBookEnabled();
bonuses(whiteBookEnabled,heroAllAttribute);
//英雄皮肤加成 记得判断皮肤过期
int skin = hero.getSkin();
if(skin!=0){
@ -4111,9 +4125,33 @@ public class HeroLogic{
for (int enabled:user.getEquipManager().getEquipBookEnabled()){
builder.addAllBookEnabled(enabled);
}
//添加白金装备羁绊
for (Integer enabled : user.getItemManager().getEquipBookEnabled()) {
builder.addAllBookEnabled(enabled);
}
for (Integer equip:equipManager.getEquipList()) {
builder.addEquipGot(equip);
}
if (!user.getItemManager().getIsAbsEquip()) {
for (Map.Entry<Integer, Item> equipEntry : user.getItemManager().getItemMap().entrySet()) {
if (SItem.getsItemMap().get(equipEntry.getKey()).getItemType()==3) {
user.getItemManager().setEquipBookMap(equipEntry.getValue().getItemId(),equipEntry.getValue().getItemNum());
}
}
for (Map.Entry<String, Hero> stringHeroEntry : user.getHeroManager().getHeroMap().entrySet()) {
for (Map.Entry<Integer, Integer> entry : stringHeroEntry.getValue().getEquipByPositionMap().entrySet()) {
user.getItemManager().setEquipBookMap(entry.getValue(),1);
}
}
user.getItemManager().setAbsEquip(true);
}
for (Map.Entry<Integer, Long> entry : user.getItemManager().getEquipBookMap().entrySet()) {
CommonProto.EquipBookInfo equipBook=CommonProto.EquipBookInfo.newBuilder()
.setEquipId(entry.getKey())
.setNum(entry.getValue().intValue())
.build();
builder.addEquipList(equipBook);
}
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE_VALUE,builder.build(),true);
}
@ -4134,7 +4172,7 @@ public class HeroLogic{
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] teamers = bookConfig.getTeamers();
int[][] teamers = bookConfig.getTeamers();
int[][] reward = bookConfig.getReward();
CommonProto.Drop.Builder drop = null;
//神将激活
@ -4152,9 +4190,8 @@ public class HeroLogic{
}
}
//判断羁绊神将是否在集合
for(int tmp:teamers){
if(!hero.contains(tmp)){
System.out.println(tmp);
for(int[]tmp:teamers){
if(!hero.contains(tmp[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
@ -4169,8 +4206,8 @@ public class HeroLogic{
if(equipManager.getEquipBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for (int equip:teamers){
if (!equipManager.getEquipList().contains(equip)){
for (int[]equip:teamers){
if (!equipManager.getEquipList().contains(equip[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
@ -4184,14 +4221,29 @@ public class HeroLogic{
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for(int pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon)){
for(int[]pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
pokemonManager.addPokemonBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
//白金装备激活
if(bookConfig.getFetterType()==4){
ItemManager itemManager = user.getItemManager();
if(itemManager.getEquipBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for(int[]pokemon:teamers){
if(!itemManager.getEquipBookMap().containsKey(pokemon[0])||itemManager.getEquipBookMap().get(pokemon[0])<pokemon[1]){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
itemManager.addEquipBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
PlayerInfoProto.UseAndPriceItemResponse.Builder useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder();
if (drop != null) {
useAndPriceItemResponse.setDrop(drop);

View File

@ -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();
@ -514,7 +545,12 @@ public class MissionLoigc {
Set<Integer> doingMissionIds = achievementMissionTypMap.getDoingMissionIds();
Set<Integer> finishMissionIds = achievementMissionTypMap.getFinishMissionIds();
BitSet rewardedMissionIds = achievementMissionTypMap.getRewardedMissionIds();
// 过滤出 配置日期(不含)前开服的可见
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
for (SAchievementConfig sAchievementConfig : STableManager.getConfig(SAchievementConfig.class).values()) {
if (sAchievementConfig.getEffectTime() != 0 && openTime >= sAchievementConfig.getEffectTime()) {
continue;
}
int state = 2;
int missionId = sAchievementConfig.getId();
int progrss = sAchievementConfig.getValues()[1][0];

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.mission.event;
import com.ljsd.GameApplication;
import config.*;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
@ -13,6 +14,7 @@ import com.ljsd.jieling.util.MessageUtil;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.HashMap;
@ -622,6 +624,7 @@ public class MissionEventDistributor {
if(missionStateChangeInfos.isEmpty()){
return;
}
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
for(MissionStateChangeInfo missionStateChangeInfo : missionStateChangeInfos){
MissionState missionState = missionStateChangeInfo.getMissionState();
int state = missionState.getState();
@ -665,8 +668,11 @@ public class MissionEventDistributor {
}
if(gameMisionType == GameMisionType.ACHIEVEMISSION){
SAchievementConfig achievementConfig = STableManager.getConfig(SAchievementConfig.class).get(missionStateChangeInfo.getMissionId());
progress= achievementConfig.getValues()[1][0];
SAchievementConfig sAchievementConfig = STableManager.getConfig(SAchievementConfig.class).get(missionStateChangeInfo.getMissionId());
if (sAchievementConfig.getEffectTime() != 0 && openTime >= sAchievementConfig.getEffectTime()) {
continue;
}
progress= sAchievementConfig.getValues()[1][0];
}
if(gameMisionType == GameMisionType.SEVENMISSION){

View File

@ -208,6 +208,7 @@ public class BuyGoodsNewLogic {
info.setMaxSingleR(price);
}
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
info.setRechargeList(TimeUtils.now(),price);
//处理月卡
user.getPlayerInfoManager().getMonthCard();
activeMonthCard(user,price,info);
@ -810,18 +811,32 @@ public class BuyGoodsNewLogic {
if(list == null){
return;
}
Collections.sort(list, new Comparator<SPackPushConfig>(){
@Override
public int compare(SPackPushConfig o1, SPackPushConfig o2) {
return Integer.compare(o1.getPriority(), o2.getPriority());
}
});
int popup = 0;
boolean push = false;
for(SPackPushConfig con : list){
int bagId = judgePushCondition(user,con);
int conditionType=con.getConditionId()[0];
int pushId=con.getId();
if (con.getStatistics()>0&&info.getDayPushNum(pushId)>=con.getStatistics())continue;
if (con.getCount()>0&&info.getAllPuthNum(pushId)>=con.getCount())continue;
//条件成功
if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()){
if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()&& info.getTypePushTimeMap(conditionType) < System.currentTimeMillis()){
popup = bagId;
info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR);
info.setTypePushTimeMap(conditionType,System.currentTimeMillis() + con.getPrivateCD() * TimeUtils.HOUR);
info.setDayPushNum(pushId,1);
info.setAllPuthNum(pushId,1);
boolean tempPush = createPushBag(bagId,user,num);
if(!push){
push = tempPush;
}
break;
}
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
@ -861,12 +876,16 @@ public class BuyGoodsNewLogic {
return -1;
}
}else if(scope[0] == 7){
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR();
//此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单
//double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR();
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE));
if(mxr < scope[1]){
return -1;
}
}
double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
//double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
//此处根据需求改成指定天数累计充值,之前的条件是历史累计充值
double rr = user.getPlayerInfoManager().getNewRechargeInfo().GetAllRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SUM));
int index = 0;
for(int i = 1;i<con.getPersonas().length;i++){
if(con.getPersonas()[i] > rr){

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.store.newRechargeInfo;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.HashMap;
@ -20,6 +21,8 @@ public class NewRechargeInfo extends MongoBase {
private long firstTime;//首冲时间
private int isDayFirst;
private Map<Long,Double>rechargeList=new HashMap<>();//充值记录
private Map<Integer,AbstractWelfareBag> perpetualMap = new HashMap<>();//永久礼包
private Map<Integer,AbstractWelfareBag> timeLimitMap = new HashMap<>();//限时刷新礼包
private Map<Integer,AbstractWelfareBag> receiveMap = new HashMap<>();//限时刷新礼包
@ -30,6 +33,12 @@ public class NewRechargeInfo extends MongoBase {
private int towerLost; //记录爬塔失败次数
private long nextPushTime; //上次推送时间
private Map<Integer,Long>typePushTimeMap=new HashMap<>();//记录推送条件类型cd时间
private Map<Integer,Integer> dayPushNumMap =new HashMap<>();//记录当天推送次数
private Map<Integer,Integer> allPushNumMap =new HashMap<>();//记录历史推送次数
private long lastRefreshTime;
public static int FIVESTARLIMIT = 2;//临时五星成长礼每天最多两次
private Map<Integer,Integer> tempLimitMap = new HashMap<>();//五星成长礼每天购买次数
@ -254,12 +263,60 @@ public class NewRechargeInfo extends MongoBase {
public long getNextPushTime() {
return nextPushTime;
}
public void setNextPushTime(long nextPushTime) {
this.nextPushTime = nextPushTime;
updateString("nextPushTime",nextPushTime);
}
public long getTypePushTimeMap(int pushType) {
if (typePushTimeMap.containsKey(pushType)){
return typePushTimeMap.get(pushType);
}
return 0;
}
public void setTypePushTimeMap(int pushType,long nextPushTime) {
this.typePushTimeMap.put(pushType,nextPushTime);
updateString("typePushTimeMap."+pushType,nextPushTime);
}
public int getDayPushNum(int pushId) {
if (dayPushNumMap.containsKey(pushId)){
return dayPushNumMap.get(pushId);
}
return 0;
}
public void setDayPushNum(int pushId,int addNum) {
int pushNum=addNum;
if (dayPushNumMap.containsKey(pushId)){
pushNum+= dayPushNumMap.get(pushId);
}
this.dayPushNumMap.put(pushId,pushNum);
updateString("dayPushNumMap."+pushId,pushNum);
}
public void ClearDayPushMap(){
dayPushNumMap.clear();
updateString("dayPushNumMap", dayPushNumMap);
}
public int getAllPuthNum(int pushId) {
if (allPushNumMap.containsKey(pushId)){
return allPushNumMap.get(pushId);
}
return 0;
}
public void setAllPuthNum(int pushId,int addNum) {
int pushNum=addNum;
if (allPushNumMap.containsKey(pushId)){
pushNum+= allPushNumMap.get(pushId);
}
this.allPushNumMap.put(pushId,pushNum);
updateString("allPushNumMap."+pushId,pushNum);
}
public long getLastRefreshTime() {
return lastRefreshTime;
}
@ -278,6 +335,41 @@ public class NewRechargeInfo extends MongoBase {
updateString("maxSingleR",maxSingleR);
}
public Map<Long, Double> getRechargeList() {
return rechargeList;
}
public void setRechargeList(long _rechargeTime,double _rechargePrice) {
this.rechargeList.put(_rechargeTime,_rechargePrice);
updateString("rechargeList",this.rechargeList);
}
///获取指定天数内累计充值金额
public double GetAllRechargeNum(int _deyNum){
double rechargeNum=0;
long limitTime= TimeUtils.now()-TimeUtils.ONE_DAY*_deyNum;
for (Map.Entry<Long, Double> entry : rechargeList.entrySet()) {
if (entry.getKey()>limitTime) {
rechargeNum+=entry.getValue();
}
}
return rechargeNum;
}
///获取指定天数内单笔最大充值金额
public double GetSingleMaxRechargeNum(int _deyNum){
double rechargeNum=0;
long limitTime= TimeUtils.now()-TimeUtils.ONE_DAY*_deyNum;
for (Map.Entry<Long, Double> entry : rechargeList.entrySet()) {
if (entry.getKey()>limitTime) {
if (entry.getValue()>rechargeNum){
rechargeNum=entry.getValue();
}
}
}
return rechargeNum;
}
public Map<Integer, Integer> getTempLimitMap() {
return tempLimitMap;
}
@ -285,4 +377,5 @@ public class NewRechargeInfo extends MongoBase {
public void setTempLimitMap(Map<Integer, Integer> tempLimitMap) {
this.tempLimitMap = tempLimitMap;
}
}

View File

@ -101,7 +101,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
//检查一下 是否有getMessageCode()返回null 或者就没有定义handler
try {
MessageUtil.sendErrorResponse(session, 0, session.getLastMsgId() + 1,"request unknow commond : 通知服务器开发人员");
}catch (Exception e){}
}catch (Exception e){
LOGGER.info("processMessage uid={} e={} unknow={}", session.getUid(), e, packetNetData.getMsgId());
}
LOGGER.info("request unknow commond : " + packetNetData.getMsgId());
return;
} else {

View File

@ -33,6 +33,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import config.SGameSetting;
@ -598,12 +599,19 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();
if(itemNum <= 0){
@ -680,6 +688,9 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -720,12 +731,19 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();
@ -803,6 +821,10 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -826,8 +848,25 @@ public class ItemUtil {
return 1;
}
///发送装备图鉴修改推送
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
if (_equipList==null||_equipList.isEmpty())return;
List<CommonProto.EquipBookInfo>equipList=new ArrayList<>();
for (Integer integer : _equipList) {
if (_itemManage.getEquipBookMap().containsKey(integer)) {
CommonProto.EquipBookInfo equipInfo=CommonProto.EquipBookInfo.newBuilder()
.setEquipId(integer)
.setNum(_itemManage.getEquipBookMap().get(integer).intValue())
.build();
equipList.add(equipInfo);
}
}
HeroInfoProto.EquipBookIndication build=HeroInfoProto.EquipBookIndication.newBuilder()
.addAllChangeEquipList(equipList)
.build();
ISession sessionByUid = OnlineUserManager.getSessionByUid(_uid);
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.EQUIP_BOOK_INDICATION_VALUE,build,true);
}
/**
* //zsx 保留 TODO 由事件分发到 playlogic 去处理

View File

@ -2,6 +2,7 @@ package config;
import manager.STableManager;
import manager.Table;
import util.TimeUtils;
import java.util.*;
@ -16,7 +17,10 @@ public class SAchievementConfig implements BaseConfig {
private int[][] reward;
public static Map<Integer, Set<Integer>> setTMap;
private String effectData;
private long effectTime;
public static Map<Integer, List<SAchievementConfig>> sTaskConfigByTypeMap;
@Override
public void init() throws Exception {
@ -24,6 +28,10 @@ public class SAchievementConfig implements BaseConfig {
Map<Integer, List<SAchievementConfig>> configListTmp = new HashMap<>();
for(SAchievementConfig sAchievementConfig : configTmp.values()){
int taskType = sAchievementConfig.getType();
String effectData = sAchievementConfig.getEffectData();
if (effectData != null && !effectData.isEmpty()) {
sAchievementConfig.setEffectTime(TimeUtils.parseTimeToMiles(effectData,TimeUtils.Stand_CeHua_Data_format));
}
if(!configListTmp.containsKey(taskType)){
configListTmp.put(taskType,new ArrayList<>());
}
@ -49,11 +57,15 @@ public class SAchievementConfig implements BaseConfig {
return reward;
}
public static Map<Integer, List<SAchievementConfig>> getsTaskConfigByTypeMap() {
return sTaskConfigByTypeMap;
public long getEffectTime() {
return effectTime;
}
public static void setsTaskConfigByTypeMap(Map<Integer, List<SAchievementConfig>> sTaskConfigByTypeMap) {
SAchievementConfig.sTaskConfigByTypeMap = sTaskConfigByTypeMap;
public void setEffectTime(long effectTime) {
this.effectTime = effectTime;
}
public String getEffectData() {
return effectData;
}
}

View File

@ -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;
}

View File

@ -19,6 +19,8 @@ public class SPackPushConfig implements BaseConfig {
private int[] packs;
private int statistics;
private int privateCD;
public static Map<Integer,SPackPushConfig> configMap;
public static Map<Integer,Map<Integer,List<SPackPushConfig>>> conditionMap;
@ -66,79 +68,50 @@ public class SPackPushConfig implements BaseConfig {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public int[] getScopeId() {
return scopeId;
}
public void setScopeId(int[] scopeId) {
this.scopeId = scopeId;
}
public int[] getConditionId() {
return conditionId;
}
public void setConditionId(int[] conditionId) {
this.conditionId = conditionId;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public int getcDTime() {
return cDTime;
}
public void setcDTime(int cDTime) {
this.cDTime = cDTime;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int[] getPersonas() {
return personas;
}
public void setPersonas(int[] personas) {
this.personas = personas;
}
public int[] getPacks() {
return packs;
}
public void setPacks(int[] packs) {
this.packs = packs;
}
public int getStatistics() {
return statistics;
}
public void setStatistics(int statistics) {
this.statistics = statistics;
public int getPrivateCD() {
return privateCD;
}
}

View File

@ -23,6 +23,12 @@ public class SPlayerHeadIcon implements BaseConfig {
private int effectiveRule;
private int[][] skill;
private int[] fitList;
private int[] fitList2;
/**
* id
*/
@ -40,7 +46,7 @@ public class SPlayerHeadIcon implements BaseConfig {
public static int MountType = 4;
// 时装类型
public static int SkinType = 5;
@Override
public void init() throws Exception {
Map<Integer, SPlayerHeadIcon> config = STableManager.getConfig(SPlayerHeadIcon.class);
@ -91,4 +97,16 @@ public class SPlayerHeadIcon implements BaseConfig {
public int getEffectiveRule() {
return effectiveRule;
}
public int[][] getSkill() {
return skill;
}
public int[] getFitList() {
return fitList;
}
public int[] getFitList2() {
return fitList2;
}
}

View File

@ -115,6 +115,8 @@ public class SSpecialConfig implements BaseConfig {
public static final String QIJIEHOLYCONFIG = "QIJIEHOLYCONFIG";//七界试炼遗物开启层数
public static final String LIKE_ABILITY = "LikeAbility";//好感度功能,每日赠予礼物次数上限
public static final String DAYS_FOR_RECHARGE_SUM = "DaysForRechargeSum";//近期累计充值金额累计时长
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
@Override
public void init() throws Exception {

View File

@ -10,7 +10,7 @@ public class SSpiritAnimalBook implements BaseConfig {
private int id;
private int[] teamers;
private int[][] teamers;
private int[][] activePara;
@ -33,7 +33,7 @@ public class SSpiritAnimalBook implements BaseConfig {
return id;
}
public int[] getTeamers() {
public int[][] getTeamers() {
return teamers;
}