罗浮优化
parent
ead65db5c4
commit
7d52ab08a1
|
@ -325,8 +325,8 @@ public class RedisKey {
|
|||
//我自己的膜拜信息
|
||||
public static final String WORLD_ARENA_MY_PRON = "WORLD_ARENA_MY_PRON";
|
||||
|
||||
public static final String WORLD_ARENA_RRECORD = "WORLD_ARENA_RRECORD";
|
||||
|
||||
public static final String WORLD_ARENA_RRECORD = "WORLD_ARENA_RRECORD";
|
||||
public static final String GUILD_SERVERID = "GUILD_SERVERID";
|
||||
|
||||
public static final String CROSS_RANK_UPDATE = "CROSS_RANK_UPDATE";
|
||||
|
|
|
@ -184,8 +184,8 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
WorldProto.WroldBattleRecord.Builder builder = WorldProto.WroldBattleRecord.newBuilder();
|
||||
builder.setFightData(fightResult.getFightData());
|
||||
builder.setResult(result);
|
||||
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
|
||||
builder.setRecordId(s);
|
||||
String uniqueId = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
|
||||
builder.setRecordId(uniqueId);
|
||||
builder.setAttackTime(TimeUtils.nowInt());
|
||||
//record
|
||||
builder.setRedEnemy(arenaAttack);
|
||||
|
@ -239,19 +239,24 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
builder1.setDrop(drop);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GetWorldArenaChallengeResponse.getNumber(), builder1.build(), true);
|
||||
|
||||
builder.setRank(newRank==-1?9999:newRank);
|
||||
builder.setOldrank(myRank==-1?9999:myRank);
|
||||
RedisUtil.getInstence().old_putmap(RedisKey.WORLD_ARENA_RRECORD,Integer.toString(iSession.getUid()), s, builder.build().toByteArray());
|
||||
RedisUtil.getInstence().expire(RedisUtil.getInstence().getKeyLocal(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid())), 86400 * 7);
|
||||
int newRankes = newRank == -1 ? 9999 : newRank;
|
||||
int myRankes = myRank == -1 ? 9999 : myRank;
|
||||
|
||||
putWorldArenaRecord(user.getId(), uniqueId, newRankes, myRankes, builder);
|
||||
if(challengeUid > 1000){
|
||||
builder.setRank(myRank==-1?9999:myRank);
|
||||
builder.setOldrank(newRank==-1?9999:newRank);
|
||||
RedisUtil.getInstence().old_putmap(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(challengeUid), s, builder.build().toByteArray());
|
||||
RedisUtil.getInstence().expire(RedisUtil.getInstence().getKeyLocal(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(challengeUid)), 86400 * 7);
|
||||
putWorldArenaRecord(challengeUid, uniqueId, myRankes, newRankes, builder);
|
||||
}
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.WORLD_ARENA_CHALLENGE_TIMES, 1);
|
||||
}
|
||||
|
||||
public void putWorldArenaRecord(int uid, String uniqueId, int rank, int oldRank, WorldProto.WroldBattleRecord.Builder builder){
|
||||
builder.setRank(rank);
|
||||
builder.setOldrank(oldRank);
|
||||
String uidForStr = String.valueOf(uid);
|
||||
RedisUtil.getInstence().old_putmap(RedisKey.WORLD_ARENA_RRECORD, uidForStr, uniqueId, builder.build().toByteArray());
|
||||
RedisUtil.getInstence().expire(RedisUtil.getInstence().getKeyLocal(RedisKey.WORLD_ARENA_RRECORD, uidForStr), 86400);
|
||||
}
|
||||
|
||||
public static FightResult getFightForPVP(int attachId,int defUid,CommonProto.FightTeamInfo fightTeamInfo, CommonProto.FightTeamInfo deffightTeamInfo,int seed,boolean isRever,FightType fightType) throws Exception {
|
||||
return getFightForPVP(attachId,fightTeamInfo,deffightTeamInfo,seed,isRever,fightType,SArenaSetting.getSArenaSetting().getMostTime());
|
||||
}
|
||||
|
|
|
@ -41,13 +41,7 @@ public class GetWorldArenaRecordInfoRequestHandler extends BaseHandler<WorldProt
|
|||
}
|
||||
|
||||
WorldProto.GetWorldArenaRecordInfoResponse.Builder builder = WorldProto.GetWorldArenaRecordInfoResponse.newBuilder();
|
||||
// Integer integer = ArenaLogic.serverSplit.get(String.valueOf(serverId));
|
||||
// HashMap<Integer, ArenaEnemy> integerIntegerHashMap = ArenaLogic.ranInfo.get(integer);
|
||||
//个人信息
|
||||
// Map.Entry<Integer, ArenaEnemy> challRank = ArenaLogic.getKey(integerIntegerHashMap, rpcMessage.getUid());
|
||||
// if (challRank == null) {
|
||||
// return builder.build();
|
||||
// }
|
||||
|
||||
Map<String, byte[]> result = RedisUtil.getInstence().old_getmapvalue_toclass(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), String.class, byte[].class);
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
|
@ -65,26 +59,17 @@ public class GetWorldArenaRecordInfoRequestHandler extends BaseHandler<WorldProt
|
|||
Collections.reverse(collect);
|
||||
int size = arenaRecordList.size();
|
||||
if (size > 15) {
|
||||
String[] removeMapKeys = new String[size - 15];
|
||||
ArrayList<String> list = new ArrayList<>(size - 15);
|
||||
for (int i = 0; i < size - 15; i++) {
|
||||
WorldProto.WroldBattleRecord remove = collect.remove(size-i-1);
|
||||
String removeId = remove.getRecordId();
|
||||
removeMapKeys[i] = (removeId);
|
||||
list.add(remove.getRecordId());
|
||||
}
|
||||
RedisUtil.getInstence().old_removemapentry(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), (Object) removeMapKeys);
|
||||
RedisUtil.getInstence().old_removemapentry(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), list.toArray());
|
||||
}
|
||||
|
||||
builder.addAllWroldBattleRecord(collect);
|
||||
}
|
||||
|
||||
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GetWorldArenaRecordInfoResponse.getNumber(),builder.build(),true);
|
||||
|
||||
// //转发到world服
|
||||
// boolean b = WorldHelper.sendMessageToWord(iSession.getUid(),proto);
|
||||
// if(!b){
|
||||
// throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,5 @@ public class GetWorldArenaReplayHandler extends BaseHandler<WorldProto.ReplayWor
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -418,7 +418,7 @@ public class ArenaLogic {
|
|||
}
|
||||
int start = (page - 1) * 20, end = page * 20 - 1;
|
||||
List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(20);
|
||||
|
||||
// todo 这里会批量请求其他玩家缓存,需要处理
|
||||
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.ARENA_RANKINGSHOWNUM);
|
||||
if (end < rankEndLine) {
|
||||
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK, Integer.toString(viewSeason), start, end);
|
||||
|
@ -431,7 +431,7 @@ public class ArenaLogic {
|
|||
continue;
|
||||
}
|
||||
long totalForce = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.TEAM_ARENA_DEFENSE.getTeamId());
|
||||
LOGGER.info("获取世界排行榜信息===========玩家id:{}", uid);
|
||||
// LOGGER.info("获取世界排行榜信息===========玩家id:{}", uid);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(TeamEnum.TEAM_ARENA_DEFENSE.getTeamId());
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
|
||||
|
|
|
@ -527,6 +527,9 @@ public class TrainingLogic {
|
|||
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
Hero hero = heroMap.get(heroId);
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"英雄不存在:"+heroId);
|
||||
}
|
||||
Training training = hero.getTraining();
|
||||
STrain sTrain = STrain.getTrainByHeroMap().get(hero.getTemplateId()).get(training.getLv());
|
||||
if (sTrain == null){
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package com.ljsd.network.client;
|
||||
|
||||
import com.google.protobuf.*;
|
||||
import com.ljsd.jieling.netty.PackageConstant;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.MessageLite;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.codec.base64.Base64Encoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.*;
|
||||
|
@ -17,7 +16,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
public class NettyClient {
|
||||
|
@ -32,12 +30,8 @@ public class NettyClient {
|
|||
public static void main(String[] args) throws InterruptedException, InvalidProtocolBufferException {
|
||||
EventLoopGroup group = new NioEventLoopGroup(1);
|
||||
|
||||
// try{
|
||||
|
||||
Bootstrap b = new Bootstrap();
|
||||
b.group(group)
|
||||
.channel(NioSocketChannel.class)
|
||||
.handler(new NettyTCPClientInitializer());
|
||||
b.group(group).channel(NioSocketChannel.class).handler(new NettyTCPClientInitializer());
|
||||
Channel ch = b.connect("api.gamegs.cn",8741).sync().channel();
|
||||
|
||||
PlayerInfoProto.SignInRequest.Builder builder = PlayerInfoProto.SignInRequest.newBuilder().setDayIndex(1203);
|
||||
|
|
Loading…
Reference in New Issue