Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
8c16c9d9c5
|
|
@ -1,5 +1,9 @@
|
|||
package com.ljsd.jieling.core;
|
||||
|
||||
import com.ljsd.jieling.core.function.ArenaFunction;
|
||||
import com.ljsd.jieling.core.function.EndlessFunction;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -20,51 +24,76 @@ import java.util.Map;
|
|||
* 14 聊天 Talking
|
||||
*/
|
||||
public enum FunctionIdEnum {
|
||||
Lottery(1),
|
||||
Team(2),
|
||||
DifferDemons(3),
|
||||
Guild(4),
|
||||
WorkShop(5),
|
||||
Foods(6),
|
||||
Adventure(7),
|
||||
Arena(8),
|
||||
|
||||
DailyTasks(12),
|
||||
WorldBoss(13),
|
||||
Talking(14),
|
||||
Lottery(1,null, MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE),
|
||||
Team(2,null,MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE),
|
||||
DifferDemons(3,null,MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_REQUEST_VALUE,MessageTypeProto.MessageType.POKEMON_ADVANCED_REQUEST_VALUE),
|
||||
Guild(4,null),
|
||||
WorkShop(5,null,MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE),
|
||||
Foods(6,null,MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE),
|
||||
Adventure(7,null,
|
||||
MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.ADVENTURE_REWARD_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_REQEUST_VALUE,
|
||||
MessageTypeProto.MessageType.ADVENTURE_BOSS_RANK_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE),
|
||||
Arena(8, new ArenaFunction()),
|
||||
|
||||
Store(20),
|
||||
DailyTasks(12,null),
|
||||
WorldBoss(13,null),
|
||||
Talking(14,null),
|
||||
|
||||
Endless(46),
|
||||
Blood(47),
|
||||
ToBeStronger(48),
|
||||
SoulEquip(52),
|
||||
TopBattle(57),
|
||||
WorkShopTech(101),
|
||||
WorkShopCreateEquip(102),
|
||||
WorkShopCreateProtectEquip(103),
|
||||
WorkShopRebuildEquip(104),
|
||||
Store(20,null),
|
||||
|
||||
Endless(46,new EndlessFunction()),
|
||||
Blood(47,null),
|
||||
ToBeStronger(48,null,MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE),
|
||||
SoulEquip(52,null,
|
||||
MessageTypeProto.MessageType.SOUL_RAND_EQUIP_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST_VALUE),
|
||||
TopBattle(57,null),
|
||||
WorkShopTech(101,null,MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE),
|
||||
WorkShopCreateEquip(102,null),
|
||||
WorkShopCreateProtectEquip(103,null),
|
||||
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
|
||||
|
||||
;
|
||||
|
||||
private int functionId;
|
||||
|
||||
private FunctionManager manager;
|
||||
private int[] protos;
|
||||
private static Map<Integer,FunctionIdEnum> functionIdEnumMap = new HashMap<>();
|
||||
private static Map<Integer,FunctionIdEnum> protoMap = new HashMap<>();
|
||||
static {
|
||||
FunctionIdEnum[] values = FunctionIdEnum.values();
|
||||
for(FunctionIdEnum functionIdEnum : values){
|
||||
functionIdEnumMap.put(functionIdEnum.getFunctionId(),functionIdEnum);
|
||||
for(int proto:functionIdEnum.getProtos()){
|
||||
protoMap.put(proto,functionIdEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FunctionIdEnum(int functionId) {
|
||||
private FunctionIdEnum(int functionId, FunctionManager manager,int... protos) {
|
||||
this.manager = manager;
|
||||
this.functionId = functionId;
|
||||
this.protos = protos;
|
||||
}
|
||||
|
||||
public int getFunctionId() {
|
||||
return functionId;
|
||||
}
|
||||
|
||||
public FunctionManager getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public int[] getProtos() {
|
||||
return protos;
|
||||
}
|
||||
public static FunctionIdEnum getFunctionIdEnumByProto(int protoId){
|
||||
return protoMap.get(protoId);
|
||||
}
|
||||
public static FunctionIdEnum getFunctionIdEnumById(int id) {
|
||||
return functionIdEnumMap.get(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ljsd.jieling.core;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe
|
||||
*/
|
||||
public interface FunctionManager {
|
||||
void startAction (TimeControllerOfFunction timeControllerOfFunction) throws Exception;
|
||||
|
||||
void closeAction () throws Exception;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.core;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.function.FunctionContext;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.exception.ErrorUtil;
|
||||
|
|
@ -226,85 +227,12 @@ public class HandlerLogicThread extends Thread{
|
|||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
Map<Integer,SGlobalSystemConfig> sGlobalSystemConfigMap = STableManager.getConfig(SGlobalSystemConfig.class);
|
||||
switch (msgId){
|
||||
case MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE: // 招募
|
||||
SGlobalSystemConfig sGlobalSystemConfig =sGlobalSystemConfigMap.get(FunctionIdEnum.Lottery.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE: //编队
|
||||
sGlobalSystemConfig =sGlobalSystemConfigMap.get(FunctionIdEnum.Team.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
// case MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE: //异妖
|
||||
case MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_REQUEST_VALUE:
|
||||
case MessageTypeProto.MessageType.POKEMON_ADVANCED_REQUEST_VALUE:
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.DifferDemons.getFunctionId());
|
||||
if (checkOpen(user, sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE: // 升级
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.WorkShop.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE: // 基础锻造
|
||||
case MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE: //武器打造 防具打造 特殊处理 业务逻辑自己处理
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.WorkShop.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE: // 科技树
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.WorkShopTech.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE: //武器重铸
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.WorkShopRebuildEquip.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE:
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.Foods.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
//case MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE: //冒险
|
||||
case MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE:
|
||||
case MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_REQUEST_VALUE:
|
||||
case MessageTypeProto.MessageType.ADVENTURE_REWARD_REQUEST_VALUE:
|
||||
// case MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE:
|
||||
case MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_REQEUST_VALUE:
|
||||
case MessageTypeProto.MessageType.ADVENTURE_BOSS_RANK_REQUEST_VALUE:
|
||||
case MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE:
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.Adventure.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE:
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.ToBeStronger.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MessageTypeProto.MessageType.SOUL_RAND_EQUIP_REQUEST_VALUE:
|
||||
case MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST_VALUE:
|
||||
sGlobalSystemConfig = sGlobalSystemConfigMap.get(FunctionIdEnum.SoulEquip.getFunctionId());
|
||||
if (checkOpen(user,sGlobalSystemConfig)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
FunctionIdEnum enumByProto = FunctionContext.getEnumByProto(msgId);
|
||||
if(enumByProto==null){
|
||||
return true;
|
||||
}
|
||||
SGlobalSystemConfig sGlobalSystemConfig = sGlobalSystemConfigMap.get(enumByProto.getFunctionId());
|
||||
return !checkOpen(user,sGlobalSystemConfig);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe
|
||||
*/
|
||||
public class ArenaFunction implements FunctionManager {
|
||||
|
||||
@Override
|
||||
public void closeAction ()throws Exception {
|
||||
ArenaLogic.getInstance().sendReward(GlobalsDef.ARENA_SEASON_REWARD);
|
||||
ArenaLogic.getInstance().updateArenaSeason(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAction(TimeControllerOfFunction timeControllerOfFunction) {
|
||||
ArenaLogic.getInstance().updateArenaSeason(timeControllerOfFunction.getTimes());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.ServerConfig;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import manager.STableManager;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe
|
||||
*/
|
||||
public class EndlessFunction implements FunctionManager {
|
||||
@Override
|
||||
public void closeAction() throws Exception {
|
||||
MapLogic.getInstance().resetEndlessInfo();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
int level = calWorldLevel();
|
||||
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
|
||||
serverConfigTmp.setWorldLevel(level);
|
||||
STableManager.getFigureConfig(MapStaticConfig.class).setDifficult();
|
||||
MongoUtil.getLjsdMongoTemplate().save(serverConfigTmp);
|
||||
MapLogic.getInstance().setEndlessMapId(GlobalDataManaager.getEndleeMapIdByLevel());
|
||||
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
|
||||
MapInfoProto.EndlessMapChange info = MapInfoProto.EndlessMapChange.newBuilder().setMapId(MapLogic.getEndlessMapId()).setWorldLevel(level).build();
|
||||
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
|
||||
MessageUtil.sendIndicationMessage(entry.getValue(),1, MessageTypeProto.MessageType.ENDLESS_MAP_CHANGE_INDICATION_VALUE,info,true);
|
||||
}
|
||||
}
|
||||
private static int calWorldLevel(){
|
||||
Query query = new Query();
|
||||
query.with(new Sort(Sort.Direction.DESC,"playerManager.level"));
|
||||
query.fields().include("playerManager.level");
|
||||
List<User> users = null;
|
||||
try {
|
||||
users = MongoUtil.getLjsdMongoTemplate().findAllByCondition(query, User.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int size = (int)(users.size()*0.85);
|
||||
if(size ==0){
|
||||
return 1;
|
||||
}
|
||||
int level = 0;
|
||||
for(int i = 0 ; i <size;i++){
|
||||
level+=users.get(i).getPlayerInfoManager().getLevel();
|
||||
}
|
||||
|
||||
// LOGGER.info("计算世界等级为{}",level/size);
|
||||
return level/size;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe
|
||||
*/
|
||||
public class FunctionContext {
|
||||
|
||||
public static FunctionManager getFunction(int type){
|
||||
return FunctionIdEnum.getFunctionIdEnumById(type).getManager();
|
||||
}
|
||||
public static FunctionIdEnum getEnumByProto(int protoId){
|
||||
return FunctionIdEnum.getFunctionIdEnumByProto(protoId);
|
||||
}
|
||||
}
|
||||
|
|
@ -440,13 +440,14 @@ public class MapLogic {
|
|||
//如果是无尽本
|
||||
if(initRandomPointMap.get(mapManager.getCurMapId())!=null){
|
||||
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())!=null){
|
||||
if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
|
||||
endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
|
||||
}else{
|
||||
List<Integer> points = new ArrayList<>();
|
||||
points.add(xy);
|
||||
endlessRandomPoint.put(mapPointConfig.getId(),points);
|
||||
}
|
||||
// if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
|
||||
// endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
|
||||
// }else{
|
||||
// List<Integer> points = new ArrayList<>();
|
||||
// points.add(xy);
|
||||
// endlessRandomPoint.put(mapPointConfig.getId(),points);
|
||||
// }
|
||||
endlessRandomPoint.computeIfAbsent(mapPointConfig.getId(),v->new ArrayList<>()).add(xy);
|
||||
}
|
||||
}else{
|
||||
newMap.put(xy, cellValue);
|
||||
|
|
|
|||
|
|
@ -734,10 +734,7 @@ public class MapManager extends MongoBase {
|
|||
if(endlessMapInfo.getMapSign()==null){
|
||||
endlessMapInfo.setMapSign(new HashMap<>());
|
||||
}
|
||||
if(!endlessMapInfo.getMapSign().containsKey(mapId)){
|
||||
endlessMapInfo.getMapSign().put(mapId,new HashMap<>());
|
||||
}
|
||||
endlessMapInfo.getMapSign().get(mapId).put(cellId,info);
|
||||
endlessMapInfo.getMapSign().computeIfAbsent(mapId,v->new HashMap<>()).put(cellId,info);
|
||||
updateString("endlessMapInfo.mapSign."+mapId+"."+cellId,info);
|
||||
}
|
||||
public void removeEndlessSign(int mapId,int cellId){
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
|||
import com.ljsd.jieling.config.json.KTSDKConstans;
|
||||
import com.ljsd.jieling.config.json.ServerProperties;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.function.FunctionContext;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
|
|
@ -171,7 +173,6 @@ public class GlobalDataManaager implements IManager {
|
|||
}
|
||||
|
||||
public void openAction(List<Integer> ids) throws Exception {
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
for(Integer openId : ids){
|
||||
int sameType = STableManager.getConfig(SGlobalSystemConfig.class).get(openId).getIsIDdSame();
|
||||
FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumById(sameType);
|
||||
|
|
@ -179,26 +180,9 @@ public class GlobalDataManaager implements IManager {
|
|||
continue;
|
||||
}
|
||||
TimeControllerOfFunction timeControllerOfFunction = openTimeOfFuntionCache.get(openId);
|
||||
switch (type){
|
||||
case Arena:
|
||||
ArenaLogic.getInstance().updateArenaSeason(timeControllerOfFunction.getTimes());
|
||||
break;
|
||||
case Endless:
|
||||
int level = calWorldLevel();
|
||||
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
|
||||
serverConfigTmp.setWorldLevel(level);
|
||||
STableManager.getFigureConfig(MapStaticConfig.class).setDifficult();
|
||||
MongoUtil.getLjsdMongoTemplate().save(serverConfigTmp);
|
||||
MapLogic.getInstance().setEndlessMapId(getEndleeMapIdByLevel());
|
||||
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
|
||||
MapInfoProto.EndlessMapChange info = MapInfoProto.EndlessMapChange.newBuilder().setMapId(MapLogic.getEndlessMapId()).setWorldLevel(level).build();
|
||||
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
|
||||
MessageUtil.sendIndicationMessage(entry.getValue(),1, MessageTypeProto.MessageType.ENDLESS_MAP_CHANGE_INDICATION_VALUE,info,true);
|
||||
}
|
||||
case TopBattle:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
FunctionManager function = FunctionContext.getFunction(sameType);
|
||||
if(function!=null){
|
||||
function.startAction(timeControllerOfFunction);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,22 +191,10 @@ public class GlobalDataManaager implements IManager {
|
|||
public void closeAction(List<Integer> ids) throws Exception {
|
||||
for(Integer closeId : ids){
|
||||
int sameType = STableManager.getConfig(SGlobalSystemConfig.class).get(closeId).getIsIDdSame();
|
||||
FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumById(sameType);
|
||||
switch (type){
|
||||
case Arena:
|
||||
ArenaLogic.getInstance().sendReward(GlobalsDef.ARENA_SEASON_REWARD);
|
||||
ArenaLogic.getInstance().updateArenaSeason(0);
|
||||
break;
|
||||
case Endless:
|
||||
MapLogic.getInstance().resetEndlessInfo();
|
||||
break;
|
||||
case Blood:
|
||||
BloodLogic.getInstance().bloodSeasonReward();
|
||||
break;
|
||||
case TopBattle:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumById(sameType).g;
|
||||
FunctionManager function = FunctionContext.getFunction(sameType);
|
||||
if(function!=null){
|
||||
function.closeAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -401,29 +373,8 @@ public class GlobalDataManaager implements IManager {
|
|||
}
|
||||
|
||||
|
||||
private static int calWorldLevel(){
|
||||
Query query = new Query();
|
||||
query.with(new Sort(Sort.Direction.DESC,"playerManager.level"));
|
||||
query.fields().include("playerManager.level");
|
||||
List<User> users = null;
|
||||
try {
|
||||
users = MongoUtil.getLjsdMongoTemplate().findAllByCondition(query, User.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int size = (int)(users.size()*0.85);
|
||||
if(size ==0){
|
||||
return 1;
|
||||
}
|
||||
int level = 0;
|
||||
for(int i = 0 ; i <size;i++){
|
||||
level+=users.get(i).getPlayerInfoManager().getLevel();
|
||||
}
|
||||
|
||||
LOGGER.info("计算世界等级为{}",level/size);
|
||||
return level/size;
|
||||
}
|
||||
private static int getEndleeMapIdByLevel() throws Exception {
|
||||
public static int getEndleeMapIdByLevel() throws Exception {
|
||||
ServerConfig config = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
int mapId = 4001;
|
||||
Map<Integer, SEndlessDifficulty> difficultyMap = STableManager.getConfig(SEndlessDifficulty.class);
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ public class WorkShopController extends MongoBase {
|
|||
}
|
||||
|
||||
public void updateTechLevel(int propession,int techId,int level){
|
||||
if(!this.technologyMap.containsKey(propession)){
|
||||
this.technologyMap.put(propession,new HashMap<>());
|
||||
}
|
||||
this.technologyMap.get(propession).put(techId,level);
|
||||
technologyMap.computeIfAbsent(propession,v->new HashMap<>()).put(techId,level);
|
||||
updateString("technologyMap." + propession + "." + techId,level);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,24 +35,15 @@ public class SAccomplishmentConfig implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sAccomplishmentConfigByMapIdMap = new HashMap<>();
|
||||
sAccomplishmentConfigByMapIdAndLogicMap = new HashMap<>();
|
||||
Map<Integer, SAccomplishmentConfig> config = STableManager.getConfig(SAccomplishmentConfig.class);
|
||||
Map<Integer, List<SAccomplishmentConfig>> sAccomplishmentConfigByMapIdMapTmp = new HashMap<>();
|
||||
Map<Integer,Map<Integer,List<SAccomplishmentConfig>>> sAccomplishmentConfigByMapIdAndLogicMapTmp = new HashMap<>();
|
||||
for(SAccomplishmentConfig sAccomplishmentConfig : config.values()){
|
||||
int mapId = sAccomplishmentConfig.getMapId();
|
||||
if(!sAccomplishmentConfigByMapIdMapTmp.containsKey(mapId)){
|
||||
sAccomplishmentConfigByMapIdMapTmp.put(mapId,new ArrayList<>());
|
||||
sAccomplishmentConfigByMapIdAndLogicMapTmp.put(mapId,new HashMap<>());
|
||||
}
|
||||
int logic = sAccomplishmentConfig.getLogic();
|
||||
if(!sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).containsKey(logic)){
|
||||
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).put(logic,new ArrayList<>());
|
||||
}
|
||||
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).get(logic).add(sAccomplishmentConfig);
|
||||
sAccomplishmentConfigByMapIdMapTmp.get(mapId).add(sAccomplishmentConfig);
|
||||
sAccomplishmentConfigByMapIdMap.computeIfAbsent(mapId,v->new ArrayList<>()).add(sAccomplishmentConfig);
|
||||
sAccomplishmentConfigByMapIdAndLogicMap.computeIfAbsent(mapId,v->new HashMap<>());
|
||||
sAccomplishmentConfigByMapIdAndLogicMap.get(mapId).computeIfAbsent(logic,v->new ArrayList<>()).add(sAccomplishmentConfig);
|
||||
}
|
||||
sAccomplishmentConfigByMapIdMap = sAccomplishmentConfigByMapIdMapTmp;
|
||||
sAccomplishmentConfigByMapIdAndLogicMap = sAccomplishmentConfigByMapIdAndLogicMapTmp;
|
||||
}
|
||||
|
||||
public static List<SAccomplishmentConfig> getsAccomplishmentConfigByMapIdAndLogic(int mapId,int logic) {
|
||||
|
|
|
|||
|
|
@ -38,10 +38,7 @@ public class SEquipTalismana implements BaseConfig {
|
|||
equipTalismanaMap = STableManager.getConfig(SEquipTalismana.class);
|
||||
equipTalismanaStarMap = new HashMap<>();
|
||||
for(Map.Entry<Integer,SEquipTalismana> entry: equipTalismanaMap.entrySet()){
|
||||
if(equipTalismanaStarMap.get(entry.getValue().getTalismanaId())==null){
|
||||
equipTalismanaStarMap.put(entry.getValue().getTalismanaId(),new HashMap<>());
|
||||
}
|
||||
equipTalismanaStarMap.get(entry.getValue().getTalismanaId()).put(entry.getValue().getLevel(),entry.getValue());
|
||||
equipTalismanaStarMap.computeIfAbsent(entry.getValue().getTalismanaId(),v->new HashMap<>()).put(entry.getValue().getLevel(),entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class SGlobalActivity implements BaseConfig {
|
|||
|
||||
private int[] openRules;
|
||||
|
||||
private int[] foreshow;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -136,4 +137,8 @@ public class SGlobalActivity implements BaseConfig {
|
|||
public int[] getOpenRules() {
|
||||
return openRules;
|
||||
}
|
||||
|
||||
public int[] getForeshow() {
|
||||
return foreshow;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,13 +29,9 @@ public class SHeroReturn implements BaseConfig {
|
|||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SHeroReturn> config = STableManager.getConfig(SHeroReturn.class);
|
||||
Map<Integer,Map<Integer,SHeroReturn>> sheroReturnMapTmp = new HashMap<>();
|
||||
sheroReturnMap = new HashMap<>();
|
||||
for(SHeroReturn sHeroReturn : config.values()){
|
||||
int heroId = sHeroReturn.getHeroId();
|
||||
if(!sheroReturnMapTmp.containsKey(heroId)){
|
||||
sheroReturnMapTmp.put(heroId,new HashMap<>());
|
||||
}
|
||||
Map<Integer, SHeroReturn> sHeroReturnMapByStar = sheroReturnMapTmp.get(heroId);
|
||||
int star = sHeroReturn.getStar();
|
||||
int[] rankupReturn = sHeroReturn.getRankupReturn();
|
||||
int[][] returnHero = sHeroReturn.getReturnHero();
|
||||
|
|
@ -48,9 +44,8 @@ public class SHeroReturn implements BaseConfig {
|
|||
returnMaterialsTmp[length-1][0] = rankupReturn[0];
|
||||
returnMaterialsTmp[length-1][1] = rankupReturn[1];
|
||||
sHeroReturn.setReturnMaterials(returnMaterialsTmp);
|
||||
sHeroReturnMapByStar.put(star,sHeroReturn);
|
||||
sheroReturnMap.computeIfAbsent(heroId,v->new HashMap<>()).put(star,sHeroReturn);
|
||||
}
|
||||
sheroReturnMap = sheroReturnMapTmp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class SLotterySetting implements BaseConfig {
|
|||
|
||||
private int mergePool;
|
||||
|
||||
private int[][] tenTimesMustGetBox;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -95,4 +97,8 @@ public class SLotterySetting implements BaseConfig {
|
|||
public int getMergePool() {
|
||||
return mergePool;
|
||||
}
|
||||
|
||||
public int[][] getTenTimesMustGetBox() {
|
||||
return tenTimesMustGetBox;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,16 +27,11 @@ public class SMysteryFoodPoolConfig implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, List<SMysteryFoodPoolConfig>> result = new HashMap<>();
|
||||
Map<Integer, SMysteryFoodPoolConfig> config = STableManager.getConfig(SMysteryFoodPoolConfig.class);
|
||||
sMysteryFoodPoolConfigByPoolMap = new HashMap<>();
|
||||
for(SMysteryFoodPoolConfig sMysteryFoodPoolConfig : config.values()){
|
||||
int pool = sMysteryFoodPoolConfig.getPool();
|
||||
if(!result.containsKey(pool)){
|
||||
result.put(pool,new ArrayList<>());
|
||||
}
|
||||
result.get(pool).add(sMysteryFoodPoolConfig);
|
||||
sMysteryFoodPoolConfigByPoolMap.computeIfAbsent(pool,v->new ArrayList<>()).add(sMysteryFoodPoolConfig);
|
||||
}
|
||||
sMysteryFoodPoolConfigByPoolMap = result;
|
||||
}
|
||||
|
||||
public static List<SMysteryFoodPoolConfig> getsMysteryFoodPoolConfigByPoold(int poolId) {
|
||||
|
|
|
|||
|
|
@ -29,16 +29,12 @@ public class SRingFireConfig implements BaseConfig {
|
|||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SRingFireConfig> config = STableManager.getConfig(SRingFireConfig.class);
|
||||
Map<Integer,Map<Integer,SRingFireConfig>> sRingFireByRingIdAndLevelMapTmp = new HashMap<>();
|
||||
sRingFireByRingIdAndLevelMap = new HashMap<>();
|
||||
for(SRingFireConfig sRingFireConfig : config.values()){
|
||||
int ringId = sRingFireConfig.getRingId();
|
||||
int ringLevel = sRingFireConfig.getRingLevel();
|
||||
if(!sRingFireByRingIdAndLevelMapTmp.containsKey(ringId)){
|
||||
sRingFireByRingIdAndLevelMapTmp.put(ringId,new HashMap<>());
|
||||
}
|
||||
sRingFireByRingIdAndLevelMapTmp.get(ringId).put(ringLevel,sRingFireConfig);
|
||||
sRingFireByRingIdAndLevelMap.computeIfAbsent(ringId,v->new HashMap<>()).put(ringLevel,sRingFireConfig);
|
||||
}
|
||||
sRingFireByRingIdAndLevelMap = sRingFireByRingIdAndLevelMapTmp;
|
||||
}
|
||||
|
||||
public static SRingFireConfig getsRingFireByRingIdAndLevel(int ringId,int ringLevel) {
|
||||
|
|
|
|||
|
|
@ -28,16 +28,12 @@ public class SRunesPoolConfig implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer,List<SRunesPoolConfig>> sRunesPoolConfigsByPoolNumTmp = new HashMap<>();
|
||||
Map<Integer, SRunesPoolConfig> config = STableManager.getConfig(SRunesPoolConfig.class);
|
||||
sRunesPoolConfigsByPoolNum = new HashMap<>();
|
||||
for(SRunesPoolConfig sRunesPoolConfig : config.values()){
|
||||
int poolNum = sRunesPoolConfig.getPoolNum();
|
||||
if(!sRunesPoolConfigsByPoolNumTmp.containsKey(poolNum)){
|
||||
sRunesPoolConfigsByPoolNumTmp.put(poolNum,new ArrayList<>());
|
||||
}
|
||||
sRunesPoolConfigsByPoolNumTmp.get(poolNum).add(sRunesPoolConfig);
|
||||
sRunesPoolConfigsByPoolNum.computeIfAbsent(poolNum,v->new ArrayList<>()).add(sRunesPoolConfig);
|
||||
}
|
||||
sRunesPoolConfigsByPoolNum = sRunesPoolConfigsByPoolNumTmp;
|
||||
}
|
||||
|
||||
public static List<SRunesPoolConfig> getsRunesPoolConfigsByPoolNum(int poolNum) {
|
||||
|
|
|
|||
|
|
@ -23,16 +23,12 @@ public class SSevenDaysScore implements BaseConfig {
|
|||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SSevenDaysScore> config = STableManager.getConfig(SSevenDaysScore.class);
|
||||
Map<Integer,Map<Integer,SSevenDaysScore>> SSevenDaysScoreByActivityIdAndScoreMapTmp= new HashMap<>();
|
||||
SSevenDaysScoreByActivityIdAndScoreMap = new HashMap<>();
|
||||
for(SSevenDaysScore sSevenDaysScore:config.values()){
|
||||
int activityId = sSevenDaysScore.getActivityId();
|
||||
int taskValue = sSevenDaysScore.getTaskValue();
|
||||
if(!SSevenDaysScoreByActivityIdAndScoreMapTmp.containsKey(activityId)){
|
||||
SSevenDaysScoreByActivityIdAndScoreMapTmp.put(activityId,new HashMap<>());
|
||||
}
|
||||
SSevenDaysScoreByActivityIdAndScoreMapTmp.get(activityId).put(taskValue,sSevenDaysScore);
|
||||
SSevenDaysScoreByActivityIdAndScoreMap.computeIfAbsent(activityId,v->new HashMap<>()).put(taskValue,sSevenDaysScore);
|
||||
}
|
||||
SSevenDaysScoreByActivityIdAndScoreMap = SSevenDaysScoreByActivityIdAndScoreMapTmp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,14 +37,8 @@ public class STreasureSunlongTaskConfig implements BaseConfig {
|
|||
sTreasureTaskConfigListByTypeMapTmp = new HashMap<>();
|
||||
for(Map.Entry<Integer,STreasureSunlongTaskConfig> entry:treasureTaskConfig.entrySet()){
|
||||
STreasureSunlongTaskConfig entryValue = entry.getValue();
|
||||
if(!taskTypeMap.containsKey(entryValue.getType())){
|
||||
taskTypeMap.put(entryValue.getType(),new ArrayList<>());
|
||||
}
|
||||
if(!sTreasureTaskConfigListByTypeMapTmp.containsKey(entryValue.getTaskType())){
|
||||
sTreasureTaskConfigListByTypeMapTmp.put(entryValue.getTaskType(),new ArrayList<>());
|
||||
}
|
||||
sTreasureTaskConfigListByTypeMapTmp.get(entryValue.getTaskType()).add(entryValue);
|
||||
taskTypeMap.get(entryValue.getType()).add(entry.getKey());
|
||||
taskTypeMap.computeIfAbsent(entryValue.getType(),v->new ArrayList<>()).add(entry.getKey());
|
||||
sTreasureTaskConfigListByTypeMapTmp.computeIfAbsent(entryValue.getTaskType(),v->new ArrayList<>()).add(entryValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue