玉虚论道
parent
6890e0b2dc
commit
c367fce248
|
@ -0,0 +1,24 @@
|
|||
package com.ljsd.jieling.handler.crossServer;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.CrossYuXuLunDaoChallengeRequest> {
|
||||
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.CrossYuXuLunDaoChallengeRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, ArenaInfoProto.CrossYuXuLunDaoChallengeRequest request) throws Exception{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.crossServer;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
public class CrossYuxulundaoEnemyInfoHandler extends BaseHandler<ArenaInfoProto.CrossYuXuLunDaoChangeEnemyInfoRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.CrossYuXuLunDaoChangeEnemyInfoRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, ArenaInfoProto.CrossYuXuLunDaoChangeEnemyInfoRequest request) throws Exception{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.handler.crossServer;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.arena.CrossYuxulundaoLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* 玉虚论道 页面数据请求
|
||||
*/
|
||||
public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.CrossYuXuLunDaoGetInfoRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.CrossYuXuLunDaoGetInfoRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, ArenaInfoProto.CrossYuXuLunDaoGetInfoRequest request) throws Exception{
|
||||
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
ArenaInfoProto.CrossYuXuLunDaoGetInfoResponse.Builder builder = ArenaInfoProto.CrossYuXuLunDaoGetInfoResponse.newBuilder();
|
||||
long yuxulundaoTime = user.getPlayerInfoManager().getCrossYuxulundaoFirst();
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.CrossYuxulundao);
|
||||
if(null ==timeControllerOfFunction){
|
||||
return;
|
||||
}
|
||||
if(yuxulundaoTime >= timeControllerOfFunction.getStartTime() && yuxulundaoTime <= timeControllerOfFunction.getEndTime()){
|
||||
builder.setIsFirst(false);
|
||||
|
||||
}else {
|
||||
//赛季内第一次登陆请求
|
||||
builder.setIsFirst(true);
|
||||
user.getPlayerInfoManager().setCrossYuxulundaoFirst(System.currentTimeMillis());
|
||||
//TODO 重置段位发奖
|
||||
CrossYuxulundaoLogic.getInstance().resetSeason(user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package com.ljsd.jieling.logic.arena;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.CrossArenaEnemy;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
|
@ -19,11 +23,9 @@ import org.slf4j.LoggerFactory;
|
|||
import rpc.protocols.CommonProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
/**
|
||||
* 玉虚论道
|
||||
|
@ -34,6 +36,7 @@ public class CrossYuxulundaoLogic {
|
|||
|
||||
public CrossYuxulundaoLogic() {
|
||||
}
|
||||
|
||||
private static int state = 0;
|
||||
public final static int NORMAL_STATE = 1;
|
||||
public final static int BATTLE_STATE = 2;
|
||||
|
@ -92,19 +95,20 @@ public class CrossYuxulundaoLogic {
|
|||
RedisUtil.getInstence().putMapEntrys(RedisKey.CROSS_YUXULUNDAO_ROBOT_INFO, String.valueOf(crossGroup), robotInfo);
|
||||
|
||||
}
|
||||
private void checkState(){
|
||||
|
||||
private void checkState() {
|
||||
long now = System.currentTimeMillis();
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.CrossYuxulundao);
|
||||
if(null ==timeControllerOfFunction){
|
||||
if (null == timeControllerOfFunction) {
|
||||
return;
|
||||
}
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime()) / 1000;
|
||||
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(2);
|
||||
if (diff >= setting.getBattleTime()[0] && diff <= setting.getBattleTime()[1]){
|
||||
if (diff >= setting.getBattleTime()[0] && diff <= setting.getBattleTime()[1]) {
|
||||
|
||||
}else if (diff > setting.getBattleTime()[1] && diff <= setting.getRestTime()[1]){
|
||||
} else if (diff > setting.getBattleTime()[1] && diff <= setting.getRestTime()[1]) {
|
||||
|
||||
}else if (diff > setting.getRestTime()[1]){
|
||||
} else if (diff > setting.getRestTime()[1]) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -112,15 +116,14 @@ public class CrossYuxulundaoLogic {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//0-1-2 准备阶段 -活动挑战阶段 - 发奖阶段
|
||||
private void readying() {
|
||||
if(state != BATTLE_STATE){
|
||||
LOGGER.info("玉虚论道:准备阶段,nowstate:{} to BATTLE_STATE",state);
|
||||
initRank();
|
||||
setState(BATTLE_STATE);
|
||||
if (state != BATTLE_STATE) {
|
||||
LOGGER.info("玉虚论道:准备阶段,nowstate:{} to BATTLE_STATE", state);
|
||||
initRank();
|
||||
setState(BATTLE_STATE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -134,7 +137,6 @@ public class CrossYuxulundaoLogic {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public int getSeason() {
|
||||
return season;
|
||||
}
|
||||
|
@ -151,4 +153,94 @@ public class CrossYuxulundaoLogic {
|
|||
public static void setState(int state) {
|
||||
CrossYuxulundaoLogic.state = state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 赛季段位重置 发奖
|
||||
*/
|
||||
public void resetSeason(User user) {
|
||||
PlayerManager player = user.getPlayerInfoManager();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 匹配实力相近队手
|
||||
*/
|
||||
public void matchRivals(User user){
|
||||
|
||||
Set<Integer> robotIds = new HashSet<>(5);
|
||||
PlayerManager player = user.getPlayerInfoManager();
|
||||
int curLevel = player.getCrossYuxulundaoNewLevelId();//当前段位
|
||||
if(curLevel < 7){
|
||||
//什么段位以下全是机器人
|
||||
player.getCrossYuxulundaoNewLevelId();
|
||||
int poolId =0;
|
||||
List<SArenaRobotConfig> robotConfig = STableManager.getConfig(SArenaRobotConfig.class).values().stream().filter(n->n.getPoolId() == poolId).collect(Collectors.toList());
|
||||
robotConfig.subList(0,robotIds.size()).forEach(n->robotIds.add(n.getId()));
|
||||
}else {
|
||||
//正常按排行榜算
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取匹配队手信息
|
||||
*/
|
||||
public static CommonProto.ArenaPersonInfo getMatchRivalInfo(int enemyId, int rank, int score) throws Exception {
|
||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
if (robotConfigMap.containsKey(enemyId)) {
|
||||
SArenaRobotConfig sArenaRobotConfig = robotConfigMap.get(enemyId);
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemyId)
|
||||
.setLevel(sArenaRobotConfig.getRobotLevel())
|
||||
.setName(sArenaRobotConfig.getRobotName())
|
||||
.setHead(0)
|
||||
.setRank(rank)
|
||||
.setTotalForce(sArenaRobotConfig.getTotalForce()) //三个队伍的总战力 TODO
|
||||
.setHeadFrame(0)
|
||||
.setScore(score)
|
||||
.build();
|
||||
return personInfoBuild;
|
||||
}
|
||||
User user = UserManager.getUser(enemyId, true);
|
||||
if (null == user) {
|
||||
return null;
|
||||
}
|
||||
int totalForceOne = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_ONE, false);
|
||||
int totalForceTwo = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_TWO, false);
|
||||
int totalForceThree = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_THREE, false);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemyId)
|
||||
.setLevel(playerInfoManager.getLevel())
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setHead(playerInfoManager.getHead())
|
||||
.setRank(rank)
|
||||
.setTotalForce(totalForceOne + totalForceTwo + totalForceThree)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setScore(score)
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setGender(playerInfoManager.getSex())
|
||||
.setPracticeLevel(user.getHeroManager().getPracticeLevel())
|
||||
.build();
|
||||
return personInfoBuild;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -167,6 +167,13 @@ public class PlayerManager extends MongoBase {
|
|||
//是否拿到渠道服和猕猴桃 预约首发邮件;
|
||||
private boolean isGetOrderMail;
|
||||
|
||||
//跨服 玉虚论道
|
||||
private long crossYuxulundaoFirst; //是否当前赛季第一次请求
|
||||
private int crossYuxulundaoOldScore;
|
||||
private int crossYuxulundaoNewScore;
|
||||
private int crossYuxulundaoOldLevelId;
|
||||
private int crossYuxulundaoNewLevelId;
|
||||
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
@ -1133,4 +1140,49 @@ public class PlayerManager extends MongoBase {
|
|||
this.isGetOrderMail = getOrderMail;
|
||||
updateString("isGetOrderMail",isGetOrderMail);
|
||||
}
|
||||
|
||||
public long getCrossYuxulundaoFirst() {
|
||||
return crossYuxulundaoFirst;
|
||||
}
|
||||
|
||||
public void setCrossYuxulundaoFirst(long crossYuxulundaoFirst) {
|
||||
this.crossYuxulundaoFirst = crossYuxulundaoFirst;
|
||||
updateString("crossYuxulundaoFirst",crossYuxulundaoFirst);
|
||||
}
|
||||
|
||||
public int getCrossYuxulundaoOldScore() {
|
||||
return crossYuxulundaoOldScore;
|
||||
}
|
||||
|
||||
public void setCrossYuxulundaoOldScore(int crossYuxulundaoOldScore) {
|
||||
this.crossYuxulundaoOldScore = crossYuxulundaoOldScore;
|
||||
updateString("crossYuxulundaoOldScore",crossYuxulundaoOldScore);
|
||||
}
|
||||
|
||||
public int getCrossYuxulundaoNewScore() {
|
||||
return crossYuxulundaoNewScore;
|
||||
}
|
||||
|
||||
public void setCrossYuxulundaoNewScore(int crossYuxulundaoNewScore) {
|
||||
this.crossYuxulundaoNewScore = crossYuxulundaoNewScore;
|
||||
updateString("crossYuxulundaoNewScore",crossYuxulundaoNewScore);
|
||||
}
|
||||
|
||||
public int getCrossYuxulundaoOldLevelId() {
|
||||
return crossYuxulundaoOldLevelId;
|
||||
}
|
||||
|
||||
public void setCrossYuxulundaoOldLevelId(int crossYuxulundaoOldLevelId) {
|
||||
this.crossYuxulundaoOldLevelId = crossYuxulundaoOldLevelId;
|
||||
updateString("crossYuxulundaoOldLevelId",crossYuxulundaoOldLevelId);
|
||||
}
|
||||
|
||||
public int getCrossYuxulundaoNewLevelId() {
|
||||
return crossYuxulundaoNewLevelId;
|
||||
}
|
||||
|
||||
public void setCrossYuxulundaoNewLevelId(int crossYuxulundaoNewLevelId) {
|
||||
this.crossYuxulundaoNewLevelId = crossYuxulundaoNewLevelId;
|
||||
updateString("crossYuxulundaoNewLevelId",crossYuxulundaoNewLevelId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="MServerRankConfig")
|
||||
public class SMServerRankConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int rankId;
|
||||
|
||||
private int rankGrade;
|
||||
|
||||
private int rankLevel;
|
||||
|
||||
private int[][] firstReward;
|
||||
|
||||
private int[][] dailyReward;
|
||||
|
||||
private int scoreLow;
|
||||
|
||||
private int scoreUp;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRankId() {
|
||||
return rankId;
|
||||
}
|
||||
|
||||
public int getRankGrade() {
|
||||
return rankGrade;
|
||||
}
|
||||
|
||||
public int getRankLevel() {
|
||||
return rankLevel;
|
||||
}
|
||||
|
||||
public int[][] getFirstReward() {
|
||||
return firstReward;
|
||||
}
|
||||
|
||||
public int[][] getDailyReward() {
|
||||
return dailyReward;
|
||||
}
|
||||
|
||||
public int getScoreLow() {
|
||||
return scoreLow;
|
||||
}
|
||||
|
||||
public int getScoreUp() {
|
||||
return scoreUp;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue