是否是当前竞猜信息,0

back_recharge
wangyuan 2019-12-20 14:12:02 +08:00
parent a84a8213d3
commit 80fbfd6f7f
2 changed files with 153 additions and 41 deletions

View File

@ -81037,6 +81037,24 @@ public final class CommonProto {
* </pre> * </pre>
*/ */
int getPosition(); int getPosition();
// optional int32 isGUess = 8;
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
boolean hasIsGUess();
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
int getIsGUess();
} }
/** /**
* Protobuf type {@code com.ljsd.jieling.protocols.ChampionBattlePairInfo} * Protobuf type {@code com.ljsd.jieling.protocols.ChampionBattlePairInfo}
@ -81124,6 +81142,11 @@ public final class CommonProto {
position_ = input.readInt32(); position_ = input.readInt32();
break; break;
} }
case 64: {
bitField0_ |= 0x00000080;
isGUess_ = input.readInt32();
break;
}
} }
} }
} catch (com.google.protobuf.InvalidProtocolBufferException e) { } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -81401,6 +81424,30 @@ public final class CommonProto {
return position_; return position_;
} }
// optional int32 isGUess = 8;
public static final int ISGUESS_FIELD_NUMBER = 8;
private int isGUess_;
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public boolean hasIsGUess() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public int getIsGUess() {
return isGUess_;
}
private void initFields() { private void initFields() {
attackName_ = ""; attackName_ = "";
defName_ = ""; defName_ = "";
@ -81409,6 +81456,7 @@ public final class CommonProto {
roundTImes_ = 0; roundTImes_ = 0;
teamId_ = 0; teamId_ = 0;
position_ = 0; position_ = 0;
isGUess_ = 0;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
@ -81443,6 +81491,9 @@ public final class CommonProto {
if (((bitField0_ & 0x00000040) == 0x00000040)) { if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeInt32(7, position_); output.writeInt32(7, position_);
} }
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeInt32(8, isGUess_);
}
getUnknownFields().writeTo(output); getUnknownFields().writeTo(output);
} }
@ -81480,6 +81531,10 @@ public final class CommonProto {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeInt32Size(7, position_); .computeInt32Size(7, position_);
} }
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(8, isGUess_);
}
size += getUnknownFields().getSerializedSize(); size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size; memoizedSerializedSize = size;
return size; return size;
@ -81610,6 +81665,8 @@ public final class CommonProto {
bitField0_ = (bitField0_ & ~0x00000020); bitField0_ = (bitField0_ & ~0x00000020);
position_ = 0; position_ = 0;
bitField0_ = (bitField0_ & ~0x00000040); bitField0_ = (bitField0_ & ~0x00000040);
isGUess_ = 0;
bitField0_ = (bitField0_ & ~0x00000080);
return this; return this;
} }
@ -81666,6 +81723,10 @@ public final class CommonProto {
to_bitField0_ |= 0x00000040; to_bitField0_ |= 0x00000040;
} }
result.position_ = position_; result.position_ = position_;
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000080;
}
result.isGUess_ = isGUess_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
onBuilt(); onBuilt();
return result; return result;
@ -81709,6 +81770,9 @@ public final class CommonProto {
if (other.hasPosition()) { if (other.hasPosition()) {
setPosition(other.getPosition()); setPosition(other.getPosition());
} }
if (other.hasIsGUess()) {
setIsGUess(other.getIsGUess());
}
this.mergeUnknownFields(other.getUnknownFields()); this.mergeUnknownFields(other.getUnknownFields());
return this; return this;
} }
@ -82178,6 +82242,55 @@ public final class CommonProto {
return this; return this;
} }
// optional int32 isGUess = 8;
private int isGUess_ ;
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public boolean hasIsGUess() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public int getIsGUess() {
return isGUess_;
}
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public Builder setIsGUess(int value) {
bitField0_ |= 0x00000080;
isGUess_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 isGUess = 8;</code>
*
* <pre>
*0 1
* </pre>
*/
public Builder clearIsGUess() {
bitField0_ = (bitField0_ & ~0x00000080);
isGUess_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:com.ljsd.jieling.protocols.ChampionBattlePairInfo) // @@protoc_insertion_point(builder_scope:com.ljsd.jieling.protocols.ChampionBattlePairInfo)
} }
@ -82886,11 +82999,11 @@ public final class CommonProto {
"\022:\n\tenemyInfo\030\002 \001(\0132\'.com.ljsd.jieling.p" + "\022:\n\tenemyInfo\030\002 \001(\0132\'.com.ljsd.jieling.p" +
"rotocols.TeamOneInfo\022\016\n\006result\030\003 \001(\005\0228\n\t" + "rotocols.TeamOneInfo\022\016\n\006result\030\003 \001(\005\0228\n\t" +
"fightData\030\004 \001(\0132%.com.ljsd.jieling.proto" + "fightData\030\004 \001(\0132%.com.ljsd.jieling.proto" +
"cols.FightData\"\224\001\n\026ChampionBattlePairInf" + "cols.FightData\"\245\001\n\026ChampionBattlePairInf" +
"o\022\022\n\nattackName\030\001 \001(\t\022\017\n\007defName\030\002 \001(\t\022\023", "o\022\022\n\nattackName\030\001 \001(\t\022\017\n\007defName\030\002 \001(\t\022\023",
"\n\013fightResult\030\003 \001(\005\022\n\n\002id\030\004 \001(\t\022\022\n\nround" + "\n\013fightResult\030\003 \001(\005\022\n\n\002id\030\004 \001(\t\022\022\n\nround" +
"TImes\030\005 \001(\005\022\016\n\006teamId\030\006 \001(\005\022\020\n\010position\030" + "TImes\030\005 \001(\005\022\016\n\006teamId\030\006 \001(\005\022\020\n\010position\030" +
"\007 \001(\005B\002H\001" "\007 \001(\005\022\017\n\007isGUess\030\010 \001(\005B\002H\001"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -83436,7 +83549,7 @@ public final class CommonProto {
internal_static_com_ljsd_jieling_protocols_ChampionBattlePairInfo_fieldAccessorTable = new internal_static_com_ljsd_jieling_protocols_ChampionBattlePairInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_com_ljsd_jieling_protocols_ChampionBattlePairInfo_descriptor, internal_static_com_ljsd_jieling_protocols_ChampionBattlePairInfo_descriptor,
new java.lang.String[] { "AttackName", "DefName", "FightResult", "Id", "RoundTImes", "TeamId", "Position", }); new java.lang.String[] { "AttackName", "DefName", "FightResult", "Id", "RoundTImes", "TeamId", "Position", "IsGUess", });
return null; return null;
} }
}; };

View File

@ -23,7 +23,6 @@ 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.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.player.PlayerLogic; import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager; import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
@ -49,8 +48,6 @@ public class ChampionshipLogic {
//启动服务器应该去redis获取 //启动服务器应该去redis获取
private static int progress = -1; //阶段 private static int progress = -1; //阶段
private static Gson gson = new Gson();
private static int roundTimes; //比赛进行第几轮 private static int roundTimes; //比赛进行第几轮
private static int endTime; private static int endTime;
@ -71,7 +68,7 @@ public class ChampionshipLogic {
}.getType(); }.getType();
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType); Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
Map<Integer, Integer> memberPerOfTeam = new HashMap<>(); Map<Integer, Integer> memberPerOfTeam = new HashMap<>();
List<String> arenaRecodeds = new ArrayList<>(); List<String> arenaRecodeds =null;
if(type == 1){ if(type == 1){
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL32_JOIN_IDS, "", 0, -1); arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL32_JOIN_IDS, "", 0, -1);
finalmemberOfTeam.forEach((k,v)->{ finalmemberOfTeam.forEach((k,v)->{
@ -82,12 +79,11 @@ public class ChampionshipLogic {
}else{ }else{
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL4_JOIN_IDS, "", 0, -1); arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL4_JOIN_IDS, "", 0, -1);
} }
SChampionshipSetting sChampionshipSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting();
List<Object> arenaIds = new ArrayList<>(arenaRecodeds); List<Object> arenaIds = new ArrayList<>(arenaRecodeds);
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.class); List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.class);
Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class); Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class);
List<String> curArenaRecordIds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_CUR_JOIN_IDS, "", 0, -1);
ArenaInfoProto.ChampionViewFinalResponse.Builder builder = ArenaInfoProto.ChampionViewFinalResponse.newBuilder(); ArenaInfoProto.ChampionViewFinalResponse.Builder builder = ArenaInfoProto.ChampionViewFinalResponse.newBuilder();
String selectIdForRedis = getSelectIdForRedis();
for (ArenaRecord arenaRecord : arenaRecords) { for (ArenaRecord arenaRecord : arenaRecords) {
int attackId = arenaRecord.getAttackId(); int attackId = arenaRecord.getAttackId();
int defUid = arenaRecord.getDefUid(); int defUid = arenaRecord.getDefUid();
@ -104,14 +100,19 @@ public class ChampionshipLogic {
if(type == 1){ if(type == 1){
teamId = memberPerOfTeam.get(attackId) +1; teamId = memberPerOfTeam.get(attackId) +1;
} }
int isGuess = 0;
if(arenaRecord.getId().equals(selectIdForRedis)){
isGuess = 1;
}
builder.addChampionBattlePairInfo(CommonProto.ChampionBattlePairInfo.newBuilder() builder.addChampionBattlePairInfo(CommonProto.ChampionBattlePairInfo.newBuilder()
.setAttackName(attackName) .setAttackName(attackName)
.setDefName(defName) .setDefName(defName)
.setFightResult(fightResult) .setFightResult(fightResult)
.setRoundTImes(arenaRecord.getRoundTims()) .setRoundTImes(arenaRecord.getRoundTims()-1)
.setTeamId(teamId) .setTeamId(teamId)
.setId(arenaRecord.getId()) .setId(arenaRecord.getId())
.setIsGUess(isGuess)
.setPosition(arenaRecord.getNums()+1) .setPosition(arenaRecord.getNums()+1)
); );
} }
@ -376,22 +377,23 @@ public class ChampionshipLogic {
for(int i=1;i<8;i++){ for(int i=1;i<8;i++){
roundTimes=i; roundTimes=i;
selectToBattle(); selectToBattle();
switchBet(47); switchBet(57);
scoreToRedis(); scoreToRedis();
} }
selectToJoinFinal(); selectToJoinFinal();
schedule=2; schedule=2;
for(int i=8;i<13;i++){ for(int i=8;i<13;i++){
roundTimes=i; roundTimes=i;
selectToBattle(); selectToBattle();
switchBet(47); switchBet(57);
scoreToRedis(); scoreToRedis();
} }
close(); // close();
} }
@ -404,6 +406,7 @@ public class ChampionshipLogic {
* @return * @return
*/ */
private static List<List<Integer>> getMemberOfTeamOfGroup(List<MemberInfo> memberInfoList,int groupNums,boolean teamUpdate){ private static List<List<Integer>> getMemberOfTeamOfGroup(List<MemberInfo> memberInfoList,int groupNums,boolean teamUpdate){
Collections.shuffle(memberInfoList); Collections.shuffle(memberInfoList);
int index=0; int index=0;
List<List<Integer>> memberOfTeamTmp = new ArrayList<>(); List<List<Integer>> memberOfTeamTmp = new ArrayList<>();
@ -433,6 +436,9 @@ public class ChampionshipLogic {
* @throws Exception * @throws Exception
*/ */
public static void getChampionInfo(ISession session) throws Exception { public static void getChampionInfo(ISession session) throws Exception {
progress= 253;
endTime =1576809560;
schedule=2;
int uid = session.getUid(); int uid = session.getUid();
//组装数据 //组装数据
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue(); int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue();
@ -568,10 +574,18 @@ public class ChampionshipLogic {
ArenaInfoProto.ChampionGetWorldRankResponse.Builder builder = ArenaInfoProto.ChampionGetWorldRankResponse.newBuilder(); ArenaInfoProto.ChampionGetWorldRankResponse.Builder builder = ArenaInfoProto.ChampionGetWorldRankResponse.newBuilder();
List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(8); List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(8);
Map<Integer,Integer> uidRankMap = new HashMap<>(); Map<Integer,Integer> uidRankMap = new HashMap<>();
for(int uidTmp : memberIds){ Set<ZSetOperations.TypedTuple<String>> zsetRangeWithScore = RedisUtil.getInstence().getZsetRangeWithScore(RedisKey.CHAMPION_RANK, 0, -1);
int score = getJoinMemberInfo(uidTmp).getScore(); zsetRangeWithScore.forEach(item->{
uidRankMap.put(uidTmp,score); String value = item.getValue();
} int uidTmp = Integer.parseInt(value);
if(memberIds.contains(uidTmp)){
int score = item.getScore().intValue();
if(score>=100){
score = getJoinMemberInfo(uidTmp).getScore();
}
uidRankMap.put(uidTmp,score);
}
});
//这里将map.entrySet()转换成list //这里将map.entrySet()转换成list
List<Map.Entry<Integer,Integer>> list = new ArrayList<Map.Entry<Integer,Integer>>(uidRankMap.entrySet()); List<Map.Entry<Integer,Integer>> list = new ArrayList<Map.Entry<Integer,Integer>>(uidRankMap.entrySet());
@ -1013,6 +1027,12 @@ public class ChampionshipLogic {
} }
}); });
} }
Map<Integer,Integer> memberPerOfTeam = new HashMap<>();
finalmemberOfTeam.forEach((k,v)->{
v.forEach(memberId->{
memberPerOfTeam.put(memberId,k);
});
});
int times = 0; int times = 0;
int length = possibleJoin.size(); int length = possibleJoin.size();
if(length<8){ if(length<8){
@ -1040,6 +1060,7 @@ public class ChampionshipLogic {
}else{ }else{
arenaRecord.setNums(times++%length); arenaRecord.setNums(times++%length);
} }
LOGGER.info("the attackId={},the defid={},the rountTImes={},the team={},the position={}",attackUid,defUid,roundTimes,memberPerOfTeam.get(attackUid),arenaRecord.getNums());
arenaRecordMap.put(arenaRecord.getId(),arenaRecord); arenaRecordMap.put(arenaRecord.getId(),arenaRecord);
} }
@ -1132,25 +1153,6 @@ public class ChampionshipLogic {
*/ */
public static void switchBet(int functionId) throws Exception { public static void switchBet(int functionId) throws Exception {
int[][] itemNum = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getItemNum(); int[][] itemNum = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getItemNum();
/* InnerMessageUtil.broadcastWithRandom(user1 -> {
if(user1==null){
return;
}
ISession session = OnlineUserManager.getSessionByUid(user1.getId());
if(null ==session){
return;
}
Map<Integer, SGlobalSystemConfig> sGlobalSystemConfigMap = STableManager.getConfig(SGlobalSystemConfig.class);
if(!HandlerLogicThread.checkOpen(user1, sGlobalSystemConfigMap.get(8))){
return;
}
MissionEventDistributor.requestStart();
CommonProto.Drop.Builder drop =
LOGGER.info("drop--->>>>>>>>> uid ={},drop={}",session.getUid(), JsonFormat.printToString(drop.build()));
MissionEventDistributor.requestEnd(session,true);
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}, new LinkedList<>(OnlineUserManager.sessionMap.keySet()),1);*/
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(functionId); SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(functionId);
OnlineUserManager.sessionMap.values().forEach(session->{ OnlineUserManager.sessionMap.values().forEach(session->{
try { try {
@ -1303,18 +1305,15 @@ public class ChampionshipLogic {
if(diff>totalWiner){ if(diff>totalWiner){
if(isServerStart){ if(isServerStart){
schedule=2; schedule=2;
progress= 253; progress= -2;
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(3));
} }
return; return;
} }
if(Math.pow(2,diff)>=totalWiner){ if(Math.pow(2,diff)>=totalWiner){
if(isServerStart){ if(isServerStart){
schedule=2; schedule=2;
progress= 253; progress= -2;
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(3));
} }
return; return;
} }