灵脉秘境
parent
b791353eb9
commit
0b75d24326
|
|
@ -27,6 +27,7 @@ public enum FightType {
|
|||
FourChallenge(21),//四灵试炼
|
||||
QIJIE_FIGHT(23), //七界试炼
|
||||
CrossYuxulundaoFight(24),//玉虚论道
|
||||
CrossLingMaiSecretFight(25),//灵脉秘境
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
|||
|
|
@ -1427,6 +1427,7 @@ public class RedisUtil {
|
|||
RedisKey.WORLD_ARENA_MY_PRON.equals(type)||RedisKey.WORLD_ARENA_RRECORD.equals(type)||
|
||||
RedisKey.CROSS_YUXULUNDAO_RANK.equals(type)||RedisKey.CROSS_YUXULUNDAO_ROBOT_INFO.equals(type)||
|
||||
RedisKey.CROSS_YUXULUNDAO_RECORD.equals(type)|| RedisKey.CROSS_YUXULUNDAO_RANK_PERSON.equals(type)
|
||||
||RedisKey.CROSS_LINGMAISECRET_INFO.equals(type)
|
||||
) {
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,27 @@
|
|||
package com.ljsd.jieling.handler.crossServer;
|
||||
|
||||
import com.ljsd.fight.LingMaiSecretArea;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.ArenaManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightDispatcher;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SLodeConfig;
|
||||
import config.SMServerLodeSetting;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CrossLingmaiSecretAreaBattleHandler extends BaseHandler<ArenaInfoProto.CrossLingmaiSecretAreaRequest> {
|
||||
|
||||
@Override
|
||||
|
|
@ -14,6 +31,37 @@ public class CrossLingmaiSecretAreaBattleHandler extends BaseHandler<ArenaInfoPr
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession session, ArenaInfoProto.CrossLingmaiSecretAreaRequest request) throws Exception{
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
ArenaInfoProto.CrossLingmaiSecretAreaResponse.Builder res = ArenaInfoProto.CrossLingmaiSecretAreaResponse.newBuilder();
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup == -1) {
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossLingmaiSecretAreaResponse.getNumber(), res.build(), true);
|
||||
return;
|
||||
}
|
||||
int id = request.getId();//灵脉id
|
||||
ArenaManager arenaManager = user.getArenaManager();
|
||||
int group = SMServerLodeSetting.getGroupByLevel(arenaManager.getCrossLingmaiFirstLevel());
|
||||
//CROSS_LINGMAISECRET_INFO:跨服分组:分组
|
||||
Map<String, LingMaiSecretArea> lingMaiMap = RedisUtil.getInstence().getMapValues(RedisKey.CROSS_LINGMAISECRET_INFO, crossGroup+RedisKey.Delimiter_colon+group, String.class, LingMaiSecretArea.class);
|
||||
if(!lingMaiMap.containsKey(String.valueOf(id))){
|
||||
//TODO
|
||||
return;
|
||||
}
|
||||
//组装机器人数据
|
||||
// 组装真人数据
|
||||
// 战斗逻辑
|
||||
SLodeConfig config = SLodeConfig.lodeConfig.get(id);
|
||||
if(config == null){
|
||||
return;
|
||||
}
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.CROSS_LING_MAI_SECRET_AREA.getTeamId(), 20, "", GameFightType.CrossLingMaiSecretFight, config.getGuard(), 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
//response.setFightData(fightResult.getFightData());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,26 @@ import com.ljsd.fight.LingMaiSecretArea;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.arena.CrossYuxulundaoLogic;
|
||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||
import com.ljsd.jieling.logic.dao.ArenaManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SLodeConfig;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import config.SMServerLodeSetting;
|
||||
|
||||
public class CrossLingmaiSecretAreaInfoHandler extends BaseHandler<ArenaInfoProto.CrossLingmaiSecretAreaInfoRequest> {
|
||||
|
||||
|
|
@ -37,25 +43,54 @@ public class CrossLingmaiSecretAreaInfoHandler extends BaseHandler<ArenaInfoProt
|
|||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
ArenaInfoProto.CrossLingmaiSecretAreaInfoResponse.Builder res = ArenaInfoProto.CrossLingmaiSecretAreaInfoResponse.newBuilder();
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup == -1) {
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossLingmaiSecretAreaInfoResponse.getNumber(), res.build(), true);
|
||||
return;
|
||||
}
|
||||
ArenaManager arenaManager = user.getArenaManager();
|
||||
long lingmaiFirst = arenaManager.getCrossLingmaiFirst();
|
||||
|
||||
if(!TimeUtils.isSameDay(lingmaiFirst,TimeUtils.now())){
|
||||
arenaManager.setCrossLingmaiFirst(TimeUtils.now());
|
||||
arenaManager.setCrossLingmaiFirstLevel(user.getPlayerInfoManager().getLevel());
|
||||
}
|
||||
int group = SMServerLodeSetting.getGroupByLevel(arenaManager.getCrossLingmaiFirstLevel());
|
||||
int page = request.getPage();
|
||||
List<SLodeConfig> pageConfig= SLodeConfig.getByGroupAndPageNo(group,page);
|
||||
if(pageConfig==null){
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossLingmaiSecretAreaInfoResponse.getNumber(), res.build(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
int myOccupyId = 0;
|
||||
int myOccupyTime = 0;
|
||||
Map<String, LingMaiSecretArea> lingMaiMap = RedisUtil.getInstence().getMapValues(RedisKey.CROSS_LINGMAISECRET_INFO, "", String.class, LingMaiSecretArea.class);
|
||||
//CROSS_LINGMAISECRET_INFO:跨服分组:分组
|
||||
Map<String, LingMaiSecretArea> lingMaiMap = RedisUtil.getInstence().getMapValues(RedisKey.CROSS_LINGMAISECRET_INFO, crossGroup+RedisKey.Delimiter_colon+group, String.class, LingMaiSecretArea.class);
|
||||
|
||||
//自己相关的
|
||||
List<LingMaiSecretArea> matchMyInfoList = lingMaiMap.values().stream().filter(n->n.getUid()==uid).collect(Collectors.toList());
|
||||
if(matchMyInfoList!=null&&matchMyInfoList.size()>0){
|
||||
myOccupyId = matchMyInfoList.get(0).getId();
|
||||
myOccupyTime = (int)matchMyInfoList.get(0).getGetAwardTimeOrOccupyTime();
|
||||
|
||||
}
|
||||
|
||||
ArenaInfoProto.CrossLingmaiSecretAreaInfoResponse.Builder res = ArenaInfoProto.CrossLingmaiSecretAreaInfoResponse.newBuilder();
|
||||
//RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
|
||||
//当前页面数据
|
||||
for(SLodeConfig config:pageConfig){
|
||||
if(lingMaiMap.containsKey(config.getId())){
|
||||
CommonProto.LingMaiSecret lingMaiSecret =CommonProto.LingMaiSecret.newBuilder().
|
||||
setGetAwardTimeOrOccupyTime((int)lingMaiMap.get(config.getId()).getGetAwardTimeOrOccupyTime()).
|
||||
setId(lingMaiMap.get(config.getId()).getId()).
|
||||
setUid(lingMaiMap.get(config.getId()).getUid()).
|
||||
setServerName(lingMaiMap.get(config.getId()).getServerName()).
|
||||
setUserName(lingMaiMap.get(config.getId()).getName()).build();
|
||||
res.addRecordData(lingMaiSecret);
|
||||
}
|
||||
}
|
||||
res.setMyOccupyId(myOccupyId);
|
||||
res.setMyOccupyTime(myOccupyTime);
|
||||
res.setRemainChangeTimes(1);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossLingmaiSecretAreaInfoResponse.getNumber(), res.build(), true);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ public class ArenaManager extends MongoBase {
|
|||
private int crossMatchTimes;//换一匹对手次数
|
||||
private List<Integer> crossYuxulundaoDailyRewad = new ArrayList<>(Arrays.asList(0,0,0)); //日常奖励状态
|
||||
|
||||
//跨服 灵脉秘境
|
||||
private long crossLingmaiFirst;//当天第一次请求数据时间
|
||||
private int crossLingmaiFirstLevel;//当天第一次请求数据时的等级
|
||||
|
||||
public void updateChallenge(int fightResult){
|
||||
if(fightResult == 1){
|
||||
successNums ++;
|
||||
|
|
@ -218,4 +222,22 @@ public class ArenaManager extends MongoBase {
|
|||
this.crossYuxulundaoDailyRewad = crossYuxulundaoDailyRewad;
|
||||
updateString("crossYuxulundaoDailyRewad",crossYuxulundaoDailyRewad);
|
||||
}
|
||||
|
||||
public long getCrossLingmaiFirst() {
|
||||
return crossLingmaiFirst;
|
||||
}
|
||||
|
||||
public void setCrossLingmaiFirst(long crossLingmaiFirst) {
|
||||
this.crossLingmaiFirst = crossLingmaiFirst;
|
||||
updateString("crossLingmaiFirst",crossLingmaiFirst);
|
||||
}
|
||||
|
||||
public int getCrossLingmaiFirstLevel() {
|
||||
return crossLingmaiFirstLevel;
|
||||
}
|
||||
|
||||
public void setCrossLingmaiFirstLevel(int crossLingmaiFirstLevel) {
|
||||
this.crossLingmaiFirstLevel = crossLingmaiFirstLevel;
|
||||
updateString("crossLingmaiFirstLevel",crossLingmaiFirstLevel);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public enum TeamEnum {
|
|||
CROSS_YU_XU_LUN_DAO_ONE(2001,"玉虚论道第一编队",1,1),
|
||||
CROSS_YU_XU_LUN_DAO_TWO(2002,"玉虚论道第二编队",1,1),
|
||||
CROSS_YU_XU_LUN_DAO_THREE(2003,"玉虚论道第三编队",1,1),
|
||||
CROSS_LING_MAI_SECRET_AREA(2004,"灵脉秘境编队",1,1),
|
||||
FOURCHALLENGE_PEOPLE_TEAM(3001,"四灵试炼-人"),
|
||||
FOURCHALLENGE_BUDDHA_TEAM(3002,"四灵试炼-佛"),
|
||||
FOURCHALLENGE_MONSTER_TEAM(3003,"四灵试炼-妖"),
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public enum GameFightType {
|
|||
CrossYuxulundaoFight(FightType.CrossYuxulundaoFight,new PVPFightHandler(),null),
|
||||
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
SevenWorld(FightType.QIJIE_FIGHT,new SevenWorldFightHandler(),null),
|
||||
CrossLingMaiSecretFight(FightType.CrossLingMaiSecretFight,new PVPFightHandler(),null),
|
||||
;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="LodeConfig")
|
||||
|
|
@ -22,10 +25,34 @@ public class SLodeConfig implements BaseConfig {
|
|||
|
||||
private int guard;
|
||||
|
||||
|
||||
public static Map<Integer, SLodeConfig> lodeConfig;
|
||||
public static Map<Integer, Map<Integer, List<SLodeConfig>>> lodeConfigMap;//组 页码
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
lodeConfig = STableManager.getConfig(SLodeConfig.class);
|
||||
Map<Integer, Map<Integer, List<SLodeConfig>>> tempLodeConfigMap = new HashMap<Integer, Map<Integer, List<SLodeConfig>>>() ;
|
||||
for(SLodeConfig config:lodeConfig.values()){
|
||||
if(!tempLodeConfigMap.containsKey(config.getGroup())){
|
||||
tempLodeConfigMap.put(config.getGroup(),new HashMap<Integer, List<SLodeConfig>>());
|
||||
}
|
||||
if(!tempLodeConfigMap.get(config.getGroup()).containsKey(config.getPageNo())){
|
||||
tempLodeConfigMap.get(config.getGroup()).put(config.getPageNo(),new ArrayList<SLodeConfig>());
|
||||
}
|
||||
tempLodeConfigMap.get(config.getGroup()).get(config.getPageNo()).add(config);
|
||||
|
||||
}
|
||||
if(tempLodeConfigMap!=null){
|
||||
lodeConfigMap = tempLodeConfigMap;
|
||||
}
|
||||
|
||||
}
|
||||
public static List<SLodeConfig> getByGroupAndPageNo(int group,int page){
|
||||
if(lodeConfigMap.containsKey(group)){
|
||||
if(lodeConfigMap.get(group).containsKey(page)){
|
||||
return lodeConfigMap.get(group).get(page);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,28 @@ public class SMServerLodeSetting implements BaseConfig {
|
|||
private int[][] qualityList;
|
||||
|
||||
private int[][] group;
|
||||
|
||||
public static Map<Integer, SMServerLodeSetting> lodeConfig;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
lodeConfig = STableManager.getConfig(SMServerLodeSetting.class);
|
||||
}
|
||||
|
||||
//通过等级得到分组
|
||||
public static int getGroupByLevel(int level){
|
||||
SMServerLodeSetting config = lodeConfig.get(1);
|
||||
if(config==null){
|
||||
return 0;
|
||||
}
|
||||
int[][]group = config.getGroup();
|
||||
if(level>=group[0][1]&&level<=group[0][2]){
|
||||
return group[0][0];
|
||||
}
|
||||
if(level>=group[1][1]&&level<=group[1][2]){
|
||||
return group[1][0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue