是否是当前竞猜信息,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>
*/
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}
@ -81124,6 +81142,11 @@ public final class CommonProto {
position_ = input.readInt32();
break;
}
case 64: {
bitField0_ |= 0x00000080;
isGUess_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -81401,6 +81424,30 @@ public final class CommonProto {
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() {
attackName_ = "";
defName_ = "";
@ -81409,6 +81456,7 @@ public final class CommonProto {
roundTImes_ = 0;
teamId_ = 0;
position_ = 0;
isGUess_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@ -81443,6 +81491,9 @@ public final class CommonProto {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeInt32(7, position_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeInt32(8, isGUess_);
}
getUnknownFields().writeTo(output);
}
@ -81480,6 +81531,10 @@ public final class CommonProto {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(7, position_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(8, isGUess_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@ -81610,6 +81665,8 @@ public final class CommonProto {
bitField0_ = (bitField0_ & ~0x00000020);
position_ = 0;
bitField0_ = (bitField0_ & ~0x00000040);
isGUess_ = 0;
bitField0_ = (bitField0_ & ~0x00000080);
return this;
}
@ -81666,6 +81723,10 @@ public final class CommonProto {
to_bitField0_ |= 0x00000040;
}
result.position_ = position_;
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000080;
}
result.isGUess_ = isGUess_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@ -81709,6 +81770,9 @@ public final class CommonProto {
if (other.hasPosition()) {
setPosition(other.getPosition());
}
if (other.hasIsGUess()) {
setIsGUess(other.getIsGUess());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@ -82178,6 +82242,55 @@ public final class CommonProto {
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)
}
@ -82886,11 +82999,11 @@ public final class CommonProto {
"\022:\n\tenemyInfo\030\002 \001(\0132\'.com.ljsd.jieling.p" +
"rotocols.TeamOneInfo\022\016\n\006result\030\003 \001(\005\0228\n\t" +
"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",
"\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" +
"\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 =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -83436,7 +83549,7 @@ public final class CommonProto {
internal_static_com_ljsd_jieling_protocols_ChampionBattlePairInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
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;
}
};

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.hero.HeroLogic;
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.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
@ -49,8 +48,6 @@ public class ChampionshipLogic {
//启动服务器应该去redis获取
private static int progress = -1; //阶段
private static Gson gson = new Gson();
private static int roundTimes; //比赛进行第几轮
private static int endTime;
@ -71,7 +68,7 @@ public class ChampionshipLogic {
}.getType();
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
Map<Integer, Integer> memberPerOfTeam = new HashMap<>();
List<String> arenaRecodeds = new ArrayList<>();
List<String> arenaRecodeds =null;
if(type == 1){
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL32_JOIN_IDS, "", 0, -1);
finalmemberOfTeam.forEach((k,v)->{
@ -82,12 +79,11 @@ public class ChampionshipLogic {
}else{
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<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.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();
String selectIdForRedis = getSelectIdForRedis();
for (ArenaRecord arenaRecord : arenaRecords) {
int attackId = arenaRecord.getAttackId();
int defUid = arenaRecord.getDefUid();
@ -104,14 +100,19 @@ public class ChampionshipLogic {
if(type == 1){
teamId = memberPerOfTeam.get(attackId) +1;
}
int isGuess = 0;
if(arenaRecord.getId().equals(selectIdForRedis)){
isGuess = 1;
}
builder.addChampionBattlePairInfo(CommonProto.ChampionBattlePairInfo.newBuilder()
.setAttackName(attackName)
.setDefName(defName)
.setFightResult(fightResult)
.setRoundTImes(arenaRecord.getRoundTims())
.setRoundTImes(arenaRecord.getRoundTims()-1)
.setTeamId(teamId)
.setId(arenaRecord.getId())
.setIsGUess(isGuess)
.setPosition(arenaRecord.getNums()+1)
);
}
@ -376,22 +377,23 @@ public class ChampionshipLogic {
for(int i=1;i<8;i++){
roundTimes=i;
selectToBattle();
switchBet(47);
switchBet(57);
scoreToRedis();
}
selectToJoinFinal();
schedule=2;
for(int i=8;i<13;i++){
roundTimes=i;
selectToBattle();
switchBet(47);
switchBet(57);
scoreToRedis();
}
close();
// close();
}
@ -404,6 +406,7 @@ public class ChampionshipLogic {
* @return
*/
private static List<List<Integer>> getMemberOfTeamOfGroup(List<MemberInfo> memberInfoList,int groupNums,boolean teamUpdate){
Collections.shuffle(memberInfoList);
int index=0;
List<List<Integer>> memberOfTeamTmp = new ArrayList<>();
@ -433,6 +436,9 @@ public class ChampionshipLogic {
* @throws Exception
*/
public static void getChampionInfo(ISession session) throws Exception {
progress= 253;
endTime =1576809560;
schedule=2;
int uid = session.getUid();
//组装数据
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();
List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(8);
Map<Integer,Integer> uidRankMap = new HashMap<>();
for(int uidTmp : memberIds){
int score = getJoinMemberInfo(uidTmp).getScore();
uidRankMap.put(uidTmp,score);
}
Set<ZSetOperations.TypedTuple<String>> zsetRangeWithScore = RedisUtil.getInstence().getZsetRangeWithScore(RedisKey.CHAMPION_RANK, 0, -1);
zsetRangeWithScore.forEach(item->{
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
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 length = possibleJoin.size();
if(length<8){
@ -1040,6 +1060,7 @@ public class ChampionshipLogic {
}else{
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);
}
@ -1132,25 +1153,6 @@ public class ChampionshipLogic {
*/
public static void switchBet(int functionId) throws Exception {
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);
OnlineUserManager.sessionMap.values().forEach(session->{
try {
@ -1303,18 +1305,15 @@ public class ChampionshipLogic {
if(diff>totalWiner){
if(isServerStart){
schedule=2;
progress= 253;
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(3));
progress= -2;
}
return;
}
if(Math.pow(2,diff)>=totalWiner){
if(isServerStart){
schedule=2;
progress= 253;
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(3));
progress= -2;
}
return;
}