巅峰赛数据
parent
f49bfe6f1f
commit
95b94c95f2
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,9 +2,10 @@ package com.ljsd.common.mogodb;
|
||||||
|
|
||||||
import org.springframework.data.annotation.Transient;
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
//使用下划线,是为了在json转换时,能转为正确的值
|
//使用下划线,是为了在json转换时,能转为正确的值
|
||||||
public abstract class MongoBase {
|
public abstract class MongoBase implements Serializable {
|
||||||
public static final String _COLLECTION_NAME = "user";
|
public static final String _COLLECTION_NAME = "user";
|
||||||
|
|
||||||
private int rootId;
|
private int rootId;
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class RedisKey {
|
||||||
public final static String CHAMPION_JOIN = "CHAMPION_JOIN";
|
public final static String CHAMPION_JOIN = "CHAMPION_JOIN";
|
||||||
public final static String CHAMPION_ARENA_RECORD = "CHAMPION_ARENA_RECORD";
|
public final static String CHAMPION_ARENA_RECORD = "CHAMPION_ARENA_RECORD";
|
||||||
public final static String CHAMPION_CUR_JOIN_IDS = "CHAMPION_CUR_JOIN_IDS";
|
public final static String CHAMPION_CUR_JOIN_IDS = "CHAMPION_CUR_JOIN_IDS";
|
||||||
|
public final static String CHAMPION_FINAL_JOIN_IDS = "CHAMPION_CUR_JOIN_IDS";
|
||||||
public final static String CHAMPION_MY_BATTLLE_IDS = "CHAMPION_MY_BATTLLE_IDS";
|
public final static String CHAMPION_MY_BATTLLE_IDS = "CHAMPION_MY_BATTLLE_IDS";
|
||||||
|
|
||||||
public final static String CHAMPION_CUR_BETID = "CHAMPION_CUR_BETID";
|
public final static String CHAMPION_CUR_BETID = "CHAMPION_CUR_BETID";
|
||||||
|
@ -208,7 +209,7 @@ public class RedisKey {
|
||||||
public final static String CHAMPION_CHOSE_TEAM_INFO = "CHAMPION_CHOSE_TEAM_INFO";
|
public final static String CHAMPION_CHOSE_TEAM_INFO = "CHAMPION_CHOSE_TEAM_INFO";
|
||||||
public final static String CHAMPION_FINAL_TEAM_INFO = "CHAMPION_FINAL_TEAM_INFO";
|
public final static String CHAMPION_FINAL_TEAM_INFO = "CHAMPION_FINAL_TEAM_INFO";
|
||||||
|
|
||||||
public final static String CHAMPION_PROGRESS = "CHAMPION_PROGRESS"; //
|
|
||||||
public final static String CHAMPION_BET_MINE = "CHAMPION_BET_MINE"; // 我的竞猜
|
public final static String CHAMPION_BET_MINE = "CHAMPION_BET_MINE"; // 我的竞猜
|
||||||
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息
|
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息
|
||||||
public final static String CHAMPION_BET_RANK = "CHAMPION_BET_RANK"; // 巅峰赛排名
|
public final static String CHAMPION_BET_RANK = "CHAMPION_BET_RANK"; // 巅峰赛排名
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ljsd.jieling.handler.champion;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.ArenaInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
|
||||||
|
public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.ChampionViewFinalRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.CHAMPION_VIEW_FINAL_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, ArenaInfoProto.ChampionViewFinalRequest proto) throws Exception {
|
||||||
|
ChampionshipLogic.viewFinalInfo(iSession,proto.getType());
|
||||||
|
}
|
||||||
|
}
|
|
@ -245,7 +245,11 @@ public class GlobalDataManaager implements IManager {
|
||||||
new UserLevelEventHandler();
|
new UserLevelEventHandler();
|
||||||
new RemoveEventHeroHandler();
|
new RemoveEventHeroHandler();
|
||||||
new FightMainEventHandler();
|
new FightMainEventHandler();
|
||||||
ChampionshipLogic.whenStart();
|
// ChampionshipLogic. start();
|
||||||
|
ChampionshipLogic.minuteCheck(true);
|
||||||
|
// ChampionshipLogic. selectToBattle();
|
||||||
|
// ChampionshipLogic. switchBet();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("e",e);
|
LOGGER.error("e",e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.*;
|
import com.ljsd.jieling.logic.fight.*;
|
||||||
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||||
|
@ -55,11 +56,43 @@ public class ChampionshipLogic {
|
||||||
|
|
||||||
private static Map<Integer,GameFightType> gameFightTypeMap = new HashMap<>();
|
private static Map<Integer,GameFightType> gameFightTypeMap = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
gameFightTypeMap.put(0,GameFightType.ArenaRobotFight);
|
gameFightTypeMap.put(0,GameFightType.ArenaPersonFight);
|
||||||
gameFightTypeMap.put(1,GameFightType.ArenaPersonFight);
|
gameFightTypeMap.put(1,GameFightType.ArenaRobotFight);
|
||||||
gameFightTypeMap.put(2,GameFightType.Arena2RobotFight);
|
gameFightTypeMap.put(2,GameFightType.Arena2RobotFight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void viewFinalInfo(ISession iSession, int type) throws Exception {
|
||||||
|
if(schedule!=2){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type valueType = new TypeToken<List<Integer>>() {
|
||||||
|
}.getType();
|
||||||
|
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
|
||||||
|
List<String> arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL_JOIN_IDS, "", 0, -1);
|
||||||
|
List<Object> arenaIds = new ArrayList<>(arenaRecodeds);
|
||||||
|
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.class);
|
||||||
|
Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class);
|
||||||
|
for(ArenaRecord arenaRecord : arenaRecords){
|
||||||
|
int attackId = arenaRecord.getAttackId();
|
||||||
|
int defUid = arenaRecord.getDefUid();
|
||||||
|
String attackName = getRoleNameById(attackId,config);
|
||||||
|
String defName = getRoleNameById(attackId,config);
|
||||||
|
int fightResult = arenaRecord.getFightResult();
|
||||||
|
if(progress%10%4 != 0){
|
||||||
|
fightResult =-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRoleNameById(int uid,Map<Integer,SArenaRobotConfig> config ) throws Exception {
|
||||||
|
if(config.containsKey(uid)){
|
||||||
|
return config.get(uid).getRobotName();
|
||||||
|
}
|
||||||
|
return UserManager.getUser(uid).getPlayerInfoManager().getNickName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class MemberInfo{
|
public static class MemberInfo{
|
||||||
private int uid;
|
private int uid;
|
||||||
|
@ -368,6 +401,10 @@ public class ChampionshipLogic {
|
||||||
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue();
|
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue();
|
||||||
String myCurJoinBattleId = getMyCurJoinBattleId(uid);
|
String myCurJoinBattleId = getMyCurJoinBattleId(uid);
|
||||||
ArenaInfoProto.ChampionGetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetInfoResponse.newBuilder().setProgress(progress).setEndTime(endTime).setMyrank(myRank);
|
ArenaInfoProto.ChampionGetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetInfoResponse.newBuilder().setProgress(progress).setEndTime(endTime).setMyrank(myRank);
|
||||||
|
if(myRank!=-1){
|
||||||
|
MemberInfo memberInfo = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_JOIN, "", Integer.toString(uid), MemberInfo.class);
|
||||||
|
builder.setMyscore(memberInfo.getScore());
|
||||||
|
}
|
||||||
if(!StringUtil.isEmpty(myCurJoinBattleId)){
|
if(!StringUtil.isEmpty(myCurJoinBattleId)){
|
||||||
builder.setJoinState(1);
|
builder.setJoinState(1);
|
||||||
ArenaRecord arenaRecord =RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD,"",myCurJoinBattleId,ArenaRecord.class);
|
ArenaRecord arenaRecord =RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD,"",myCurJoinBattleId,ArenaRecord.class);
|
||||||
|
@ -377,10 +414,13 @@ public class ChampionshipLogic {
|
||||||
enemyId = arenaRecord.getAttackId();
|
enemyId = arenaRecord.getAttackId();
|
||||||
fightResult=1^fightResult;
|
fightResult=1^fightResult;
|
||||||
}
|
}
|
||||||
|
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder();
|
||||||
if(progress%10%4 != 0){
|
if(progress%10%4 != 0){
|
||||||
fightResult =-1;
|
fightResult =-1;
|
||||||
|
}else{
|
||||||
|
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||||
}
|
}
|
||||||
builder.setChampionBattleInfo(CommonProto.ChampionBattleInfo.newBuilder()
|
builder.setChampionBattleInfo(builder1
|
||||||
.setMyInfo(getChampionBattleInfo(uid))
|
.setMyInfo(getChampionBattleInfo(uid))
|
||||||
.setEnemyInfo(getChampionBattleInfo(enemyId))
|
.setEnemyInfo(getChampionBattleInfo(enemyId))
|
||||||
.setResult(fightResult)
|
.setResult(fightResult)
|
||||||
|
@ -393,11 +433,14 @@ public class ChampionshipLogic {
|
||||||
|
|
||||||
public static void getChampionBetInfo(ISession session,int type) throws Exception {
|
public static void getChampionBetInfo(ISession session,int type) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
|
if(progress==-1){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
String selectIdForRedis = getSelectIdForRedis();
|
String selectIdForRedis = getSelectIdForRedis();
|
||||||
ArenaInfoProto.ChampionGetBetResponse.Builder builder = ArenaInfoProto.ChampionGetBetResponse.newBuilder();
|
ArenaInfoProto.ChampionGetBetResponse.Builder builder = ArenaInfoProto.ChampionGetBetResponse.newBuilder();
|
||||||
if(!StringUtil.isEmpty(selectIdForRedis)){
|
if(!StringUtil.isEmpty(selectIdForRedis)){
|
||||||
builder.setChampionBetInfo(getBetOdds());
|
builder.setChampionBetInfo(getBetOdds());
|
||||||
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_JOIN, "", selectIdForRedis, ArenaRecord.class);
|
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", selectIdForRedis, ArenaRecord.class);
|
||||||
if(type == 0){
|
if(type == 0){
|
||||||
int fightResult=arenaRecord.getFightResult();
|
int fightResult=arenaRecord.getFightResult();
|
||||||
if(progress%10%4 != 0){
|
if(progress%10%4 != 0){
|
||||||
|
@ -412,14 +455,19 @@ public class ChampionshipLogic {
|
||||||
if(coins == null){
|
if(coins == null){
|
||||||
myGuessID = 0;
|
myGuessID = 0;
|
||||||
}
|
}
|
||||||
builder.setChampionBattleInfo(CommonProto.ChampionBattleInfo.newBuilder()
|
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder()
|
||||||
.setMyInfo(getChampionBattleInfo(arenaRecord.getAttackId()))
|
.setMyInfo(getChampionBattleInfo(arenaRecord.getAttackId()))
|
||||||
.setEnemyInfo(getChampionBattleInfo(arenaRecord.getDefUid()))
|
.setEnemyInfo(getChampionBattleInfo(arenaRecord.getDefUid()))
|
||||||
.setResult(fightResult)
|
.setResult(fightResult);
|
||||||
|
if(fightResult!=-1){
|
||||||
|
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||||
|
}
|
||||||
|
builder.setChampionBattleInfo(builder1
|
||||||
.build());
|
.build());
|
||||||
builder.setWinUid(myGuessID);
|
builder.setWinUid(myGuessID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_BET_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CommonProto.TeamOneInfo.Builder getChampionBattleInfo(int uid) throws Exception {
|
private static CommonProto.TeamOneInfo.Builder getChampionBattleInfo(int uid) throws Exception {
|
||||||
|
@ -440,23 +488,21 @@ public class ChampionshipLogic {
|
||||||
.setHeadFrame(playerManager.getHeadFrame())
|
.setHeadFrame(playerManager.getHeadFrame())
|
||||||
.setLevel(playerManager.getLevel())
|
.setLevel(playerManager.getLevel())
|
||||||
.setName(playerManager.getNickName()).setUid(uid);
|
.setName(playerManager.getNickName()).setUid(uid);
|
||||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
|
||||||
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||||
teamInfo.setTotalForce(fightInfo.getForce());
|
teamInfo.setTotalForce(fightInfo.getForce());
|
||||||
// teamInfo.addPokemonInfos(fightInfo.getPokenmonIds());
|
if(!fightInfo.getPokenmonIds().isEmpty()){
|
||||||
/* if(teamPosManager.getTeamPosForHero().containsKey(teamId)){
|
teamInfo.addAllPokemonInfos(fightInfo.getPokenmonIds());
|
||||||
for (TeamPosHeroInfo heroInfo:teamPosManager.getTeamPosForHero().get(teamId)) {
|
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
|
||||||
teamInfo.addTeam(CBean2Proto.getSimpleTeamInfoByHero(hero));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
|
||||||
if(guildId!=0){
|
|
||||||
if(GuilidManager.guildInfoMap.containsKey(guildId)){
|
|
||||||
String name = GuilidManager.guildInfoMap.get(guildId).getName();
|
|
||||||
oneInfo.setGuildName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Map.Entry<String, FamilyHeroInfo> entry:fightInfo.getHeroAttribute().entrySet()){
|
||||||
|
FamilyHeroInfo familyHeroInfo = entry.getValue();
|
||||||
|
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder()
|
||||||
|
.setHeroid(entry.getKey())
|
||||||
|
.setHeroTid(familyHeroInfo.getTempleteId())
|
||||||
|
.setStar(familyHeroInfo.getStar())
|
||||||
|
.setLevel(familyHeroInfo.getLevel())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
oneInfo.setTeam(teamInfo);
|
oneInfo.setTeam(teamInfo);
|
||||||
return oneInfo;
|
return oneInfo;
|
||||||
|
@ -483,10 +529,10 @@ public class ChampionshipLogic {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
MemberInfo memberInfo = getJoinMemberInfo(uid);
|
MemberInfo memberInfo = getJoinMemberInfo(uid);
|
||||||
if(memberInfo == null){
|
if(memberInfo == null){
|
||||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
int teamId = memberInfo.getTeamId();
|
|
||||||
List<Integer> memberIds = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_CHOSE_TEAM_INFO, "", Integer.toString(teamId), List.class);
|
List<Integer> memberIds = getMermberTeam().get(memberInfo.getTeamId());
|
||||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||||
|
|
||||||
List<CommonProto.ChampionTeamPersonInfo> championTeamPersonInfoList = new ArrayList<>(memberIds.size());
|
List<CommonProto.ChampionTeamPersonInfo> championTeamPersonInfoList = new ArrayList<>(memberIds.size());
|
||||||
|
@ -530,6 +576,7 @@ public class ChampionshipLogic {
|
||||||
List<Object> ids = new ArrayList<>(mapValues.keySet());
|
List<Object> ids = new ArrayList<>(mapValues.keySet());
|
||||||
List<ArenaRecord> myArenaRecordInfos = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
List<ArenaRecord> myArenaRecordInfos = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
||||||
ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.Builder builder = ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.newBuilder();
|
ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.Builder builder = ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.newBuilder();
|
||||||
|
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||||
for(ArenaRecord arenaRecord : myArenaRecordInfos){
|
for(ArenaRecord arenaRecord : myArenaRecordInfos){
|
||||||
int enemyId = arenaRecord.getDefUid();
|
int enemyId = arenaRecord.getDefUid();
|
||||||
if(arenaRecord.getDefUid() == uid){
|
if(arenaRecord.getDefUid() == uid){
|
||||||
|
@ -548,7 +595,8 @@ public class ChampionshipLogic {
|
||||||
if(fightResult!=-1 && enemyId!=arenaRecord.getDefUid()){
|
if(fightResult!=-1 && enemyId!=arenaRecord.getDefUid()){
|
||||||
fightResult = 1^0;
|
fightResult = 1^0;
|
||||||
}
|
}
|
||||||
CommonProto.ArenaEnemy arenaEnemy = ArenaLogic.getInstance().getArenaEnemy(enemyId, arenaRecord.getType());
|
int enemyType = robotConfigMap.containsKey(enemyId)?0:1;
|
||||||
|
CommonProto.ArenaEnemy arenaEnemy = ArenaLogic.getInstance().getArenaEnemy(enemyId, enemyType);
|
||||||
ArenaInfoProto.ChampionTwoEnemInfo build = ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setBlueEnemy(arenaEnemy).setRoundTimes(arenaRecord.getRoundTims()).setFightResult(fightResult).build();
|
ArenaInfoProto.ChampionTwoEnemInfo build = ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setBlueEnemy(arenaEnemy).setRoundTimes(arenaRecord.getRoundTims()).setFightResult(fightResult).build();
|
||||||
builder.addEnemyPairInfo(build);
|
builder.addEnemyPairInfo(build);
|
||||||
}
|
}
|
||||||
|
@ -567,11 +615,25 @@ public class ChampionshipLogic {
|
||||||
snapOneFightInfo(attackId,memberInfoMap);
|
snapOneFightInfo(attackId,memberInfoMap);
|
||||||
snapOneFightInfo(defUid,memberInfoMap);
|
snapOneFightInfo(defUid,memberInfoMap);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long id =FightDispatcher.getFIghtId();
|
long id =FightDispatcher.getFIghtId();
|
||||||
EndFightProcessor endFightProcessor = new AreFightPro();
|
EndFightProcessor endFightProcessor = new AreFightPro();
|
||||||
((AreFightPro) endFightProcessor).setArenaRecord(arenaRecord);
|
((AreFightPro) endFightProcessor).setArenaRecord(arenaRecord);
|
||||||
FightDispatcher.getMap().put(id, endFightProcessor) ;
|
FightDispatcher.getMap().put(id, endFightProcessor) ;
|
||||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(attackId,snapTeamId,warTime,"",gameFightTypeMap.get(arenaRecord.getType()),defUid,snapTeamId);
|
PVPFightEvent pvpFightEvent = new PVPFightEvent(attackId,snapTeamId,warTime,"",gameFightTypeMap.get(arenaRecord.getType()),defUid,snapTeamId);
|
||||||
|
|
||||||
|
MemberInfo attackMemberInfo = memberInfoMap.get(attackId);
|
||||||
|
MemberInfo defMemberInfo = memberInfoMap.get(defUid);
|
||||||
|
if(defMemberInfo.getType() == 0){
|
||||||
|
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
|
||||||
|
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(),fightInfo.getHeroSkills(),fightInfo.getPokenmonSkills()));
|
||||||
|
}
|
||||||
|
if(attackMemberInfo.getType() == 0){
|
||||||
|
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
|
||||||
|
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(),fightInfo.getHeroSkills(),fightInfo.getPokenmonSkills()));
|
||||||
|
}
|
||||||
|
|
||||||
FightDispatcher.dispatcherAsync(pvpFightEvent,id);
|
FightDispatcher.dispatcherAsync(pvpFightEvent,id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -610,8 +672,10 @@ public class ChampionshipLogic {
|
||||||
}
|
}
|
||||||
String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user, snapTeamId);
|
String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user, snapTeamId);
|
||||||
fightInfo.setPokenmonSkills(pokenmonSkills);
|
fightInfo.setPokenmonSkills(pokenmonSkills);
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_FIGHT, "", String.valueOf(uid), fightInfo);
|
// RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_FIGHT, "", String.valueOf(uid), fightInfo);
|
||||||
memberInfo.setFightInfo(fightInfo);
|
memberInfo.setFightInfo(fightInfo);
|
||||||
|
joinMembers.put(memberInfo.getUid(),memberInfo);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_JOIN,"",String.valueOf(uid),memberInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -671,7 +735,7 @@ public class ChampionshipLogic {
|
||||||
public static void guess(ISession session, int winUid,int chip) throws Exception {
|
public static void guess(ISession session, int winUid,int chip) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
String selectUid = getSelectIdForRedis();
|
String selectUid = getSelectIdForRedis();
|
||||||
if(progress%10%4!=2 || StringUtil.isEmpty(selectUid)){
|
if(progress%10%4!=1 || StringUtil.isEmpty(selectUid)){
|
||||||
LOGGER.error("the uid={} not in time",uid);
|
LOGGER.error("the uid={} not in time",uid);
|
||||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||||
}
|
}
|
||||||
|
@ -693,7 +757,7 @@ public class ChampionshipLogic {
|
||||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.CHAMPION_BET_ALL,"",selectUid +":" + winUid,chip);
|
RedisUtil.getInstence().incrementZsetScore(RedisKey.CHAMPION_BET_ALL,"",selectUid +":" + winUid,chip);
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_MINE,selectUid +":" + winUid,Integer.toString(uid),chip);
|
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_MINE,selectUid +":" + winUid,Integer.toString(uid),chip);
|
||||||
|
|
||||||
// MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_BET_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_BET_GUESS_RESPONSE_VALUE,null,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,9 +840,12 @@ public class ChampionshipLogic {
|
||||||
List<Object> ids = new ArrayList<>(guessIds);
|
List<Object> ids = new ArrayList<>(guessIds);
|
||||||
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
||||||
String selectIdForRedis = getSelectIdForRedis();
|
String selectIdForRedis = getSelectIdForRedis();
|
||||||
|
Map<Integer, SArenaRobotConfig> arenaRobotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||||
for(ArenaRecord arenaRecord: arenaRecords){
|
for(ArenaRecord arenaRecord: arenaRecords){
|
||||||
CommonProto.ArenaEnemy attackEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getAttackId(), arenaRecord.getType());
|
int attactkUidType = arenaRobotConfigMap.containsKey(arenaRecord.getAttackId())?0:1;
|
||||||
CommonProto.ArenaEnemy defEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getDefUid(), arenaRecord.getType());
|
int defUidType = arenaRobotConfigMap.containsKey(arenaRecord.getAttackId())?0:1;
|
||||||
|
CommonProto.ArenaEnemy attackEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getAttackId(), attactkUidType);
|
||||||
|
CommonProto.ArenaEnemy defEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getDefUid(), defUidType);
|
||||||
int fightResult = arenaRecord.getFightResult();
|
int fightResult = arenaRecord.getFightResult();
|
||||||
int guessState = 3;
|
int guessState = 3;
|
||||||
if(arenaRecord.getId().equals(selectIdForRedis)){
|
if(arenaRecord.getId().equals(selectIdForRedis)){
|
||||||
|
@ -795,6 +862,7 @@ public class ChampionshipLogic {
|
||||||
if(fightResult == -2){
|
if(fightResult == -2){
|
||||||
fightResult =-1;
|
fightResult =-1;
|
||||||
}
|
}
|
||||||
|
ArenaInfoProto.ChampionMyBetDetail.Builder betDetailBuilder = ArenaInfoProto.ChampionMyBetDetail.newBuilder();
|
||||||
if(fightResult>=0){
|
if(fightResult>=0){
|
||||||
int winner = arenaRecord.getAttackId();
|
int winner = arenaRecord.getAttackId();
|
||||||
if(fightResult == 0){
|
if(fightResult == 0){
|
||||||
|
@ -804,8 +872,9 @@ public class ChampionshipLogic {
|
||||||
if(coins!=null){
|
if(coins!=null){
|
||||||
guessState = 2;
|
guessState = 2;
|
||||||
}
|
}
|
||||||
|
// betDetailBuilder.setFightData(CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||||
}
|
}
|
||||||
builder.addChampionMyBetDetails(ArenaInfoProto.ChampionMyBetDetail.newBuilder().setBetResult(guessState).setEnemyPairInfo(
|
builder.addChampionMyBetDetails(betDetailBuilder.setBetResult(guessState).setEnemyPairInfo(
|
||||||
ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setRedEnemy(attackEnemy).setBlueEnemy(defEnemy).setFightResult(fightResult)
|
ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setRedEnemy(attackEnemy).setBlueEnemy(defEnemy).setFightResult(fightResult)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -847,7 +916,6 @@ public class ChampionshipLogic {
|
||||||
Map<Integer, MemberInfo> joinMembers = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_JOIN, "", Integer.class, MemberInfo.class);
|
Map<Integer, MemberInfo> joinMembers = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_JOIN, "", Integer.class, MemberInfo.class);
|
||||||
if(joinIndexs != null){
|
if(joinIndexs != null){
|
||||||
Map<Integer, List<Integer>> memberOfTeam =getMermberTeam();
|
Map<Integer, List<Integer>> memberOfTeam =getMermberTeam();
|
||||||
RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_CUR_JOIN_IDS, "", Integer.class, List.class);
|
|
||||||
for(int[] joinIndex : joinIndexs){
|
for(int[] joinIndex : joinIndexs){
|
||||||
int joinIndexRed = joinIndex[0]-1;
|
int joinIndexRed = joinIndex[0]-1;
|
||||||
int joinIndexBlue = joinIndex[1]-1;
|
int joinIndexBlue = joinIndex[1]-1;
|
||||||
|
@ -907,6 +975,7 @@ public class ChampionshipLogic {
|
||||||
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecordMap);
|
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecordMap);
|
||||||
arenaRecordIds.addAll(arenaRecordMap.keySet());
|
arenaRecordIds.addAll(arenaRecordMap.keySet());
|
||||||
RedisUtil.getInstence().lSet(RedisKey.CHAMPION_CUR_JOIN_IDS,"",arenaRecordIds);
|
RedisUtil.getInstence().lSet(RedisKey.CHAMPION_CUR_JOIN_IDS,"",arenaRecordIds);
|
||||||
|
RedisUtil.getInstence().lSet(RedisKey.CHAMPION_FINAL_JOIN_IDS,"",arenaRecordIds);
|
||||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||||
arenaRecordMap.forEach((id,arenaRecord)->{
|
arenaRecordMap.forEach((id,arenaRecord)->{
|
||||||
int defUid = arenaRecord.getDefUid();
|
int defUid = arenaRecord.getDefUid();
|
||||||
|
@ -1092,7 +1161,7 @@ public class ChampionshipLogic {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void minuteCheck() throws Exception {
|
public static void minuteCheck(boolean isServerStart) throws Exception {
|
||||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.TopBattle);
|
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.TopBattle);
|
||||||
if( null == timeControllerOfFunction){
|
if( null == timeControllerOfFunction){
|
||||||
progress = -1;
|
progress = -1;
|
||||||
|
@ -1127,9 +1196,11 @@ public class ChampionshipLogic {
|
||||||
if(progressTmp == progress){
|
if(progressTmp == progress){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
endTime = (int)( startTime/1000 + round*duration + getDuratimeByProgressState(progressState));
|
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(progressState));
|
||||||
progress = progressTmp;
|
progress = progressTmp;
|
||||||
RedisUtil.getInstence().set(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_PROGRESS,""),Integer.toString(progress));
|
if(isServerStart){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(progress%10%4==0){
|
if(progress%10%4==0){
|
||||||
selectToBattle();
|
selectToBattle();
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
public class PlayerManager extends MongoBase {
|
public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
private String openId;
|
private transient String openId;
|
||||||
|
|
||||||
private int pid;
|
private int pid;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.ljsd.jieling.logic.fight;
|
package com.ljsd.jieling.logic.fight;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||||
import com.ljsd.jieling.logic.dao.ArenaRecord;
|
import com.ljsd.jieling.logic.dao.ArenaRecord;
|
||||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import manager.STableManager;
|
||||||
|
|
||||||
public class AreFightPro implements EndFightProcessor {
|
public class AreFightPro implements EndFightProcessor {
|
||||||
ArenaRecord arenaRecord;
|
ArenaRecord arenaRecord;
|
||||||
|
@ -19,6 +22,9 @@ public class AreFightPro implements EndFightProcessor {
|
||||||
failerUid = arenaRecord.getAttackId();
|
failerUid = arenaRecord.getAttackId();
|
||||||
}
|
}
|
||||||
ChampionshipLogic.setScoreForSuccess(winnerUid,failerUid);
|
ChampionshipLogic.setScoreForSuccess(winnerUid,failerUid);
|
||||||
|
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
|
||||||
|
CommonProto.FightData build = CommonProto.FightData.newBuilder().setFightType(9).setHeroFightInfos(fightResult.getFightTeamInfo()).addMonsterList(fightResult.getDefFightTeamInfo()).setFightSeed(fightResult.getSeed()).setFightMaxTime(warTime).build();
|
||||||
|
arenaRecord.setFightData(build.toByteArray());
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecord.getId(),arenaRecord);
|
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecord.getId(),arenaRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,12 @@ public class FightUtil {
|
||||||
|
|
||||||
public static FightResult getFightForPVP(FightEvent fightEvent){
|
public static FightResult getFightForPVP(FightEvent fightEvent){
|
||||||
PVPFightEvent pvpFightEvent = (PVPFightEvent)fightEvent;
|
PVPFightEvent pvpFightEvent = (PVPFightEvent)fightEvent;
|
||||||
|
|
||||||
int fightSeed =getFightSeed();
|
int fightSeed =getFightSeed();
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = null;
|
CommonProto.FightTeamInfo fightTeamInfo = null;
|
||||||
CommonProto.FightTeamInfo deffightTeamInfo = null;
|
CommonProto.FightTeamInfo deffightTeamInfo = null;
|
||||||
|
if(pvpFightEvent.getAttackFightSnapData()!=null){
|
||||||
|
fightTeamInfo = makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
|
||||||
|
}
|
||||||
if(pvpFightEvent.getDefFightSnapData()!=null){
|
if(pvpFightEvent.getDefFightSnapData()!=null){
|
||||||
deffightTeamInfo = makeFightWithSnapData(pvpFightEvent.getDefFightSnapData());
|
deffightTeamInfo = makeFightWithSnapData(pvpFightEvent.getDefFightSnapData());
|
||||||
} else{
|
} else{
|
||||||
|
@ -100,8 +102,10 @@ public class FightUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
if( fightEvent.getFightType()!=GameFightType.Arena2RobotFight){
|
if( fightEvent.getFightType()!=GameFightType.Arena2RobotFight){
|
||||||
|
if(fightTeamInfo==null){
|
||||||
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
||||||
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap());
|
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getDefUid());
|
fightTeamInfo = makeRobotFightData(pvpFightEvent.getDefUid());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ public class PVPFightEvent extends FightEvent {
|
||||||
|
|
||||||
//对手快照
|
//对手快照
|
||||||
private DefFightSnapData defFightSnapData;
|
private DefFightSnapData defFightSnapData;
|
||||||
|
//进攻快照
|
||||||
|
private DefFightSnapData attackFightSnapData;
|
||||||
|
|
||||||
public PVPFightEvent(int attackUid, int teamId, int mostTime, String frams, GameFightType fightType, int defUid, int defTeamId) {
|
public PVPFightEvent(int attackUid, int teamId, int mostTime, String frams, GameFightType fightType, int defUid, int defTeamId) {
|
||||||
super(attackUid, teamId, mostTime, frams, fightType);
|
super(attackUid, teamId, mostTime, frams, fightType);
|
||||||
|
@ -30,4 +32,12 @@ public class PVPFightEvent extends FightEvent {
|
||||||
public void setDefFightSnapData(DefFightSnapData defFightSnapData) {
|
public void setDefFightSnapData(DefFightSnapData defFightSnapData) {
|
||||||
this.defFightSnapData = defFightSnapData;
|
this.defFightSnapData = defFightSnapData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DefFightSnapData getAttackFightSnapData() {
|
||||||
|
return attackFightSnapData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttackFightSnapData(DefFightSnapData attackFightSnapData) {
|
||||||
|
this.attackFightSnapData = attackFightSnapData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ public class FightResult {
|
||||||
this.defFightTeamInfo = defFightTeamInfo;
|
this.defFightTeamInfo = defFightTeamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FightResult build(){
|
public FightResult build(){
|
||||||
FightResult fightResult = new FightResult();
|
FightResult fightResult = new FightResult();
|
||||||
fightResult.setCheckResult(this.checkResult);
|
fightResult.setCheckResult(this.checkResult);
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class MinuteTask extends Thread {
|
||||||
CoreLogic.getInstance().checkCoreCdk();
|
CoreLogic.getInstance().checkCoreCdk();
|
||||||
BuyGoodsLogic.minuteCheckReharge();
|
BuyGoodsLogic.minuteCheckReharge();
|
||||||
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
||||||
ChampionshipLogic.minuteCheck();
|
ChampionshipLogic.minuteCheck(false);
|
||||||
LOGGER.info("MinuteTask end...");
|
LOGGER.info("MinuteTask end...");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("e",e);
|
LOGGER.error("e",e);
|
||||||
|
|
Loading…
Reference in New Issue