检测功能开启修改
parent
e266403589
commit
813ffebec6
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.core;
|
|||
import com.ljsd.jieling.core.function.ArenaFunction;
|
||||
import com.ljsd.jieling.core.function.DefaultFunction;
|
||||
import com.ljsd.jieling.core.function.EndlessFunction;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -25,13 +26,19 @@ import java.util.function.Function;
|
|||
* 14 聊天 Talking
|
||||
*/
|
||||
public enum FunctionIdEnum {
|
||||
Lottery(1,new DefaultFunction()),
|
||||
Team(2,new DefaultFunction()),
|
||||
DifferDemons(3,new DefaultFunction()),
|
||||
Lottery(1,new DefaultFunction(), MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE),
|
||||
Team(2,new DefaultFunction(),MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE),
|
||||
DifferDemons(3,new DefaultFunction(),MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_REQUEST_VALUE,MessageTypeProto.MessageType.POKEMON_ADVANCED_REQUEST_VALUE),
|
||||
Guild(4,new DefaultFunction()),
|
||||
WorkShop(5,new DefaultFunction()),
|
||||
Foods(6,new DefaultFunction()),
|
||||
Adventure(7,new DefaultFunction()),
|
||||
WorkShop(5,new DefaultFunction(),MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE),
|
||||
Foods(6,new DefaultFunction(),MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE),
|
||||
Adventure(7,new DefaultFunction(),
|
||||
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()),
|
||||
|
||||
DailyTasks(12,new DefaultFunction()),
|
||||
|
|
@ -42,29 +49,37 @@ public enum FunctionIdEnum {
|
|||
|
||||
Endless(46,new EndlessFunction()),
|
||||
Blood(47,new DefaultFunction()),
|
||||
ToBeStronger(48,new DefaultFunction()),
|
||||
SoulEquip(52,new DefaultFunction()),
|
||||
ToBeStronger(48,new DefaultFunction(),MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE),
|
||||
SoulEquip(52,new DefaultFunction(),
|
||||
MessageTypeProto.MessageType.SOUL_RAND_EQUIP_REQUEST_VALUE,
|
||||
MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST_VALUE),
|
||||
TopBattle(57,new DefaultFunction()),
|
||||
WorkShopTech(101,new DefaultFunction()),
|
||||
WorkShopTech(101,new DefaultFunction(),MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE),
|
||||
WorkShopCreateEquip(102,new DefaultFunction()),
|
||||
WorkShopCreateProtectEquip(103,new DefaultFunction()),
|
||||
WorkShopRebuildEquip(104,new DefaultFunction()),
|
||||
WorkShopRebuildEquip(104,new DefaultFunction(),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, FunctionManager manager) {
|
||||
private FunctionIdEnum(int functionId, FunctionManager manager,int... protos) {
|
||||
this.manager = manager;
|
||||
this.functionId = functionId;
|
||||
this.protos = protos;
|
||||
}
|
||||
|
||||
public int getFunctionId() {
|
||||
|
|
@ -75,6 +90,12 @@ public enum FunctionIdEnum {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ import com.ljsd.jieling.core.FunctionManager;
|
|||
* @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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue