跨服服务器
parent
29b4dc5fdd
commit
b7b1154a68
File diff suppressed because it is too large
Load Diff
|
|
@ -4061,6 +4061,14 @@ public final class MessageTypeProto {
|
|||
* <code>SeletSubRewardPoolResponse = 303672;</code>
|
||||
*/
|
||||
SeletSubRewardPoolResponse(655, 303672),
|
||||
/**
|
||||
* <code>WorldLevelIndication = 303673;</code>
|
||||
*
|
||||
* <pre>
|
||||
*世界等级推送
|
||||
* </pre>
|
||||
*/
|
||||
WorldLevelIndication(656, 303673),
|
||||
/**
|
||||
* <code>NewGeneralAttackRequest = 303691;</code>
|
||||
*
|
||||
|
|
@ -4068,11 +4076,11 @@ public final class MessageTypeProto {
|
|||
*303691 - 303692 新将来袭
|
||||
* </pre>
|
||||
*/
|
||||
NewGeneralAttackRequest(656, 303691),
|
||||
NewGeneralAttackRequest(657, 303691),
|
||||
/**
|
||||
* <code>NewGeneralAttackResponse = 303692;</code>
|
||||
*/
|
||||
NewGeneralAttackResponse(657, 303692),
|
||||
NewGeneralAttackResponse(658, 303692),
|
||||
/**
|
||||
* <code>UpgradeGodTreeRequest = 303701;</code>
|
||||
*
|
||||
|
|
@ -4080,11 +4088,11 @@ public final class MessageTypeProto {
|
|||
* 303701 - 303702 建木神树
|
||||
* </pre>
|
||||
*/
|
||||
UpgradeGodTreeRequest(658, 303701),
|
||||
UpgradeGodTreeRequest(659, 303701),
|
||||
/**
|
||||
* <code>UpgradeGodTreeResponse = 303702;</code>
|
||||
*/
|
||||
UpgradeGodTreeResponse(659, 303702),
|
||||
UpgradeGodTreeResponse(660, 303702),
|
||||
/**
|
||||
* <code>GetWorldServerRequest = 800001;</code>
|
||||
*
|
||||
|
|
@ -4092,11 +4100,11 @@ public final class MessageTypeProto {
|
|||
*800000起为global 协议
|
||||
* </pre>
|
||||
*/
|
||||
GetWorldServerRequest(660, 800001),
|
||||
GetWorldServerRequest(661, 800001),
|
||||
/**
|
||||
* <code>GetWorldServerResponse = 800002;</code>
|
||||
*/
|
||||
GetWorldServerResponse(661, 800002),
|
||||
GetWorldServerResponse(662, 800002),
|
||||
/**
|
||||
* <code>GetWorldArenaInfoRequest = 900001;</code>
|
||||
*
|
||||
|
|
@ -4104,11 +4112,11 @@ public final class MessageTypeProto {
|
|||
*900000起为跨服消息 世界服服返回消息gs只负责透传
|
||||
* </pre>
|
||||
*/
|
||||
GetWorldArenaInfoRequest(662, 900001),
|
||||
GetWorldArenaInfoRequest(663, 900001),
|
||||
/**
|
||||
* <code>GetWorldArenaInfoResponse = 900002;</code>
|
||||
*/
|
||||
GetWorldArenaInfoResponse(663, 900002),
|
||||
GetWorldArenaInfoResponse(664, 900002),
|
||||
/**
|
||||
* <code>GetWorldArenaChallengeRequest = 900003;</code>
|
||||
*
|
||||
|
|
@ -4116,11 +4124,11 @@ public final class MessageTypeProto {
|
|||
*跨服天梯挑战
|
||||
* </pre>
|
||||
*/
|
||||
GetWorldArenaChallengeRequest(664, 900003),
|
||||
GetWorldArenaChallengeRequest(665, 900003),
|
||||
/**
|
||||
* <code>GetWorldArenaChallengeResponse = 900004;</code>
|
||||
*/
|
||||
GetWorldArenaChallengeResponse(665, 900004),
|
||||
GetWorldArenaChallengeResponse(666, 900004),
|
||||
/**
|
||||
* <code>GetWorldArenaProudRequest = 900005;</code>
|
||||
*
|
||||
|
|
@ -4128,11 +4136,11 @@ public final class MessageTypeProto {
|
|||
*膜拜
|
||||
* </pre>
|
||||
*/
|
||||
GetWorldArenaProudRequest(666, 900005),
|
||||
GetWorldArenaProudRequest(667, 900005),
|
||||
/**
|
||||
* <code>GetWorldArenaProudResponse = 900006;</code>
|
||||
*/
|
||||
GetWorldArenaProudResponse(667, 900006),
|
||||
GetWorldArenaProudResponse(668, 900006),
|
||||
/**
|
||||
* <code>GetWorldArenaRecordInfoRequest = 900007;</code>
|
||||
*
|
||||
|
|
@ -4140,11 +4148,11 @@ public final class MessageTypeProto {
|
|||
*跨服天梯挑战与被挑战 战斗记录
|
||||
* </pre>
|
||||
*/
|
||||
GetWorldArenaRecordInfoRequest(668, 900007),
|
||||
GetWorldArenaRecordInfoRequest(669, 900007),
|
||||
/**
|
||||
* <code>GetWorldArenaRecordInfoResponse = 900008;</code>
|
||||
*/
|
||||
GetWorldArenaRecordInfoResponse(669, 900008),
|
||||
GetWorldArenaRecordInfoResponse(670, 900008),
|
||||
/**
|
||||
* <code>GetGSUserArenaInfoRequest = 900009;</code>
|
||||
*
|
||||
|
|
@ -4152,31 +4160,43 @@ public final class MessageTypeProto {
|
|||
*gs --》word
|
||||
* </pre>
|
||||
*/
|
||||
GetGSUserArenaInfoRequest(670, 900009),
|
||||
GetGSUserArenaInfoRequest(671, 900009),
|
||||
/**
|
||||
* <code>GetGSUserArenaInfoResponse = 900010;</code>
|
||||
*/
|
||||
GetGSUserArenaInfoResponse(671, 900010),
|
||||
GetGSUserArenaInfoResponse(672, 900010),
|
||||
/**
|
||||
* <code>GetRankRequest = 900011;</code>
|
||||
*/
|
||||
GetRankRequest(672, 900011),
|
||||
GetRankRequest(673, 900011),
|
||||
/**
|
||||
* <code>AddDeathPathRankRequest = 900012;</code>
|
||||
*/
|
||||
AddDeathPathRankRequest(673, 900012),
|
||||
AddDeathPathRankRequest(674, 900012),
|
||||
/**
|
||||
* <code>GetDeathPathFirstRequest = 900013;</code>
|
||||
*/
|
||||
GetDeathPathFirstRequest(674, 900013),
|
||||
GetDeathPathFirstRequest(675, 900013),
|
||||
/**
|
||||
* <code>GetDeathPathRewardRequest = 900014;</code>
|
||||
*/
|
||||
GetDeathPathRewardRequest(675, 900014),
|
||||
GetDeathPathRewardRequest(676, 900014),
|
||||
/**
|
||||
* <code>DeathPathWorldRewardRequest = 900015;</code>
|
||||
* <code>ViewHeroInfoRequest = 9000015;</code>
|
||||
*/
|
||||
DeathPathWorldRewardRequest(676, 900015),
|
||||
ViewHeroInfoRequest(677, 9000015),
|
||||
/**
|
||||
* <code>ViewHeroInfoResponse = 900016;</code>
|
||||
*/
|
||||
ViewHeroInfoResponse(678, 900016),
|
||||
/**
|
||||
* <code>GetPlayerOneTeamInfoRequest = 900017;</code>
|
||||
*/
|
||||
GetPlayerOneTeamInfoRequest(679, 900017),
|
||||
/**
|
||||
* <code>GetPlayerOneTeamInfoResponse = 900018;</code>
|
||||
*/
|
||||
GetPlayerOneTeamInfoResponse(680, 900018),
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
@ -8227,6 +8247,14 @@ public final class MessageTypeProto {
|
|||
* <code>SeletSubRewardPoolResponse = 303672;</code>
|
||||
*/
|
||||
public static final int SeletSubRewardPoolResponse_VALUE = 303672;
|
||||
/**
|
||||
* <code>WorldLevelIndication = 303673;</code>
|
||||
*
|
||||
* <pre>
|
||||
*世界等级推送
|
||||
* </pre>
|
||||
*/
|
||||
public static final int WorldLevelIndication_VALUE = 303673;
|
||||
/**
|
||||
* <code>NewGeneralAttackRequest = 303691;</code>
|
||||
*
|
||||
|
|
@ -8340,9 +8368,21 @@ public final class MessageTypeProto {
|
|||
*/
|
||||
public static final int GetDeathPathRewardRequest_VALUE = 900014;
|
||||
/**
|
||||
* <code>DeathPathWorldRewardRequest = 900015;</code>
|
||||
* <code>ViewHeroInfoRequest = 9000015;</code>
|
||||
*/
|
||||
public static final int DeathPathWorldRewardRequest_VALUE = 900015;
|
||||
public static final int ViewHeroInfoRequest_VALUE = 9000015;
|
||||
/**
|
||||
* <code>ViewHeroInfoResponse = 900016;</code>
|
||||
*/
|
||||
public static final int ViewHeroInfoResponse_VALUE = 900016;
|
||||
/**
|
||||
* <code>GetPlayerOneTeamInfoRequest = 900017;</code>
|
||||
*/
|
||||
public static final int GetPlayerOneTeamInfoRequest_VALUE = 900017;
|
||||
/**
|
||||
* <code>GetPlayerOneTeamInfoResponse = 900018;</code>
|
||||
*/
|
||||
public static final int GetPlayerOneTeamInfoResponse_VALUE = 900018;
|
||||
|
||||
|
||||
public final int getNumber() { return value; }
|
||||
|
|
@ -9005,6 +9045,7 @@ public final class MessageTypeProto {
|
|||
case 303656: return GetShejiAwardResponse;
|
||||
case 303671: return SeletSubRewardPoolRequest;
|
||||
case 303672: return SeletSubRewardPoolResponse;
|
||||
case 303673: return WorldLevelIndication;
|
||||
case 303691: return NewGeneralAttackRequest;
|
||||
case 303692: return NewGeneralAttackResponse;
|
||||
case 303701: return UpgradeGodTreeRequest;
|
||||
|
|
@ -9025,7 +9066,10 @@ public final class MessageTypeProto {
|
|||
case 900012: return AddDeathPathRankRequest;
|
||||
case 900013: return GetDeathPathFirstRequest;
|
||||
case 900014: return GetDeathPathRewardRequest;
|
||||
case 900015: return DeathPathWorldRewardRequest;
|
||||
case 9000015: return ViewHeroInfoRequest;
|
||||
case 900016: return ViewHeroInfoResponse;
|
||||
case 900017: return GetPlayerOneTeamInfoRequest;
|
||||
case 900018: return GetPlayerOneTeamInfoResponse;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -9087,7 +9131,7 @@ public final class MessageTypeProto {
|
|||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\026MessageTypeProto.proto\022\rrpc.protocols*" +
|
||||
"\204\255\001\n\013MessageType\022\027\n\022HEART_BEAT_REQUEST\020\350" +
|
||||
"\374\255\001\n\013MessageType\022\027\n\022HEART_BEAT_REQUEST\020\350" +
|
||||
"\007\022\030\n\023HEART_BEAT_RESPONSE\020\351\007\022\036\n\031ACTIVITE_" +
|
||||
"WORKSHOP_REQUEST\020\224N\022\037\n\032ACTIVITE_WORKSHOP" +
|
||||
"_RESPONSE\020\225N\022\027\n\022ARENA_INFO_REQUEST\020\226N\022\030\n" +
|
||||
|
|
@ -9623,24 +9667,27 @@ public final class MessageTypeProto {
|
|||
"tivityItemResponse\020\246\304\022\022\032\n\024GetShejiAwardR" +
|
||||
"equest\020\247\304\022\022\033\n\025GetShejiAwardResponse\020\250\304\022\022" +
|
||||
"\037\n\031SeletSubRewardPoolRequest\020\267\304\022\022 \n\032Sele" +
|
||||
"tSubRewardPoolResponse\020\270\304\022\022\035\n\027NewGeneral" +
|
||||
"AttackRequest\020\313\304\022\022\036\n\030NewGeneralAttackRes" +
|
||||
"ponse\020\314\304\022\022\033\n\025UpgradeGodTreeRequest\020\325\304\022\022\034",
|
||||
"\n\026UpgradeGodTreeResponse\020\326\304\022\022\033\n\025GetWorld" +
|
||||
"ServerRequest\020\201\3520\022\034\n\026GetWorldServerRespo" +
|
||||
"nse\020\202\3520\022\036\n\030GetWorldArenaInfoRequest\020\241\3676\022" +
|
||||
"\037\n\031GetWorldArenaInfoResponse\020\242\3676\022#\n\035GetW" +
|
||||
"orldArenaChallengeRequest\020\243\3676\022$\n\036GetWorl" +
|
||||
"dArenaChallengeResponse\020\244\3676\022\037\n\031GetWorldA" +
|
||||
"renaProudRequest\020\245\3676\022 \n\032GetWorldArenaPro" +
|
||||
"udResponse\020\246\3676\022$\n\036GetWorldArenaRecordInf" +
|
||||
"oRequest\020\247\3676\022%\n\037GetWorldArenaRecordInfoR" +
|
||||
"esponse\020\250\3676\022\037\n\031GetGSUserArenaInfoRequest",
|
||||
"\020\251\3676\022 \n\032GetGSUserArenaInfoResponse\020\252\3676\022\024" +
|
||||
"\n\016GetRankRequest\020\253\3676\022\035\n\027AddDeathPathRank" +
|
||||
"Request\020\254\3676\022\036\n\030GetDeathPathFirstRequest\020" +
|
||||
"\255\3676\022\037\n\031GetDeathPathRewardRequest\020\256\3676\022!\n\033" +
|
||||
"DeathPathWorldRewardRequest\020\257\3676B\002H\001"
|
||||
"tSubRewardPoolResponse\020\270\304\022\022\032\n\024WorldLevel" +
|
||||
"Indication\020\271\304\022\022\035\n\027NewGeneralAttackReques" +
|
||||
"t\020\313\304\022\022\036\n\030NewGeneralAttackResponse\020\314\304\022\022\033\n",
|
||||
"\025UpgradeGodTreeRequest\020\325\304\022\022\034\n\026UpgradeGod" +
|
||||
"TreeResponse\020\326\304\022\022\033\n\025GetWorldServerReques" +
|
||||
"t\020\201\3520\022\034\n\026GetWorldServerResponse\020\202\3520\022\036\n\030G" +
|
||||
"etWorldArenaInfoRequest\020\241\3676\022\037\n\031GetWorldA" +
|
||||
"renaInfoResponse\020\242\3676\022#\n\035GetWorldArenaCha" +
|
||||
"llengeRequest\020\243\3676\022$\n\036GetWorldArenaChalle" +
|
||||
"ngeResponse\020\244\3676\022\037\n\031GetWorldArenaProudReq" +
|
||||
"uest\020\245\3676\022 \n\032GetWorldArenaProudResponse\020\246" +
|
||||
"\3676\022$\n\036GetWorldArenaRecordInfoRequest\020\247\3676" +
|
||||
"\022%\n\037GetWorldArenaRecordInfoResponse\020\250\3676\022",
|
||||
"\037\n\031GetGSUserArenaInfoRequest\020\251\3676\022 \n\032GetG" +
|
||||
"SUserArenaInfoResponse\020\252\3676\022\024\n\016GetRankReq" +
|
||||
"uest\020\253\3676\022\035\n\027AddDeathPathRankRequest\020\254\3676\022" +
|
||||
"\036\n\030GetDeathPathFirstRequest\020\255\3676\022\037\n\031GetDe" +
|
||||
"athPathRewardRequest\020\256\3676\022\032\n\023ViewHeroInfo" +
|
||||
"Request\020\317\250\245\004\022\032\n\024ViewHeroInfoResponse\020\260\3676" +
|
||||
"\022!\n\033GetPlayerOneTeamInfoRequest\020\261\3676\022\"\n\034G" +
|
||||
"etPlayerOneTeamInfoResponse\020\262\3676B\002H\001"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -8,7 +8,7 @@ public class ServiceKey {
|
|||
public static final String RPCCore = "RPCCORE";
|
||||
public static final String RPCMATCH = "RPCMATCH";
|
||||
public static final String GM_CANCLE_SCENE = "GM_CANCLE_SCENE";
|
||||
public static final String RPC_GLOBAL = "RPC_GGLOBAL";
|
||||
public static final String RPC_GLOBAL = "RPC_GLOBAL";
|
||||
public static final String RPC_WORLD = "RPC_WORLD";
|
||||
public static final String RPC_GS= "RPC_GS";
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,56 @@
|
|||
package com.ljsd.jieling;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.world.thrift.idl.InnerResult;
|
||||
import com.world.thrift.idl.RPCgTwRequestIFace;
|
||||
import com.world.thrift.idl.RPCwTgRequestIFace;
|
||||
import org.apache.thrift.TException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.net.GlobalProtocolsManager;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import util.ErrorPrintUtil;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Description: 处理gs协议
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/11/18 15:32
|
||||
*/
|
||||
public class WorldRpcService extends GlobalProtocolsManager implements RPCwTgRequestIFace.Iface {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(WorldRpcService.class);
|
||||
|
||||
|
||||
@Override
|
||||
public InnerResult messageRequest(int uid, int protpId, ByteBuffer message) throws TException {
|
||||
try {
|
||||
return processMessage(new RpcMessage(AreaManager.areaId,uid, protpId, message));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e));
|
||||
}
|
||||
return new InnerResult();
|
||||
}
|
||||
|
||||
private InnerResult processMessage(RpcMessage message) throws Exception {
|
||||
|
||||
gtGBaseHandler baseHandler = getHandlers().get(message.getProtpId());
|
||||
if (baseHandler == null) {
|
||||
//检查一下 没有定义handler
|
||||
LOGGER.info("request unknow commond : " + message.getProtpId());
|
||||
throw new Exception("request unknow commond");
|
||||
} else {
|
||||
InnerResult result = new InnerResult();
|
||||
RpcMessage execute = baseHandler.execute(message);
|
||||
result.setMessage(execute.getMessage());
|
||||
result.setProtpId(execute.getProtpId());
|
||||
result.setMessage(execute.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -97,6 +97,7 @@ public interface GlobalsDef {
|
|||
int CAR_DELAY_TEAM =1101; //车迟斗法
|
||||
int DEATH_PATH_TEAM = 1201;//十绝阵
|
||||
int CHAMPION_TEAM = 1301; //巅峰赛
|
||||
int WORLD_TEAM_ARENA_DEFENSE =1601;//跨服竞技场防御编队
|
||||
|
||||
//特权解锁类型
|
||||
int LEVEL_UNLOCK_PRIVILEGE = 1;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.core.FunctionManager;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.arenaworld.ArenaWorldLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import config.SMServerArenaSetting;
|
||||
import manager.STableManager;
|
||||
|
|
@ -46,6 +47,6 @@ public class WorldArenaFunction implements FunctionManager {
|
|||
|
||||
@Override
|
||||
public void closeAction() throws Exception {
|
||||
// ChampionshipLogic.close();
|
||||
ArenaWorldLogic.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,6 +303,8 @@ public class RedisKey {
|
|||
public static final String WORLD_CALCUL_LEVE_RAND = "WORLD_CALCUL_LEVE_RAND";
|
||||
|
||||
public final static String WORLD_ARE_JOIN = "WORLD_ARE_JOIN";//跨服参与人员
|
||||
public final static String WARLD_DIS_ARENA_RANK = "WARLD_DIS_ARENA_RANK";//跨服榜单
|
||||
|
||||
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
|
|
|
|||
|
|
@ -156,9 +156,14 @@ public enum ErrorCode implements IErrorCode {
|
|||
NOT_IN_TAKE_TIME(126, "不在领取期间"),
|
||||
USER_LEVE_DOWN(127,"玩家等级不够"),
|
||||
HAS_AWAKE(130,"已达最大星级"),
|
||||
|
||||
WORLD_LEVELIMIT(132, "世界等级达到100级后开启"),
|
||||
WORLD_CHANGE(134, "无法挑战,目标玩家排名出现变化,已重新匹配对手!"),
|
||||
|
||||
|
||||
SERVER_DEFINE_SELF(20000,"操作失败"),
|
||||
|
||||
RANKLIMIT(20000, "不在榜单"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setExpeditionLeve(user.getExpeditionManager().getExpeditionLeve())
|
||||
.setHadLuckTime( user.getPlayerInfoManager().getLuckWheelLimitTime())
|
||||
.setHadAdvanceLuckTime(user.getPlayerInfoManager().getLuckAdvanceWheelLimitTime())
|
||||
.setWorldLeve(GlobleSystemLogic.getGloableWorldLeveCache())
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -2,18 +2,25 @@ package com.ljsd.jieling.handler.gtw;
|
|||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
/**
|
||||
* rpc get userinfo
|
||||
* 世界服请求逻辑服玩家信息
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GetGSUserArenaInfoRequestHandler extends gtGBaseHandler<WorldProto.GetGSUserArenaInfoRequest> {
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.GetGSUserArenaInfoRequest proto) throws Exception {
|
||||
return ArenaLogic.getInstance().getArenaEnemy(proto.getUid(), 1);
|
||||
CommonProto.ArenaEnemy arenaEnemy = ArenaLogic.getInstance().getWorldArenaEnemy(proto.getUid());
|
||||
return WorldProto.GetGSUserArenaInfoResponse.newBuilder().setArenaEnemys(arenaEnemy).setTotalForce(arenaEnemy.getPersonInfo().getTotalForce())
|
||||
.setFightTeamInfo(FightUtil.getFightTeamInfo(UserManager.getUser(rpcMessage.getUid()),1)).build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.handler.gtw;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2021/1/9 1:30
|
||||
*/
|
||||
public class GetPlayerOneTeamInfoRequestHandler extends gtGBaseHandler<WorldProto.GetPlayerOneTeamInfoRequest>{
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
|
||||
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo( proto.getPlayerId(), proto.getTeamId());
|
||||
// WorldProto.ViewHeroInfoResponse build = WorldProto.ViewHeroInfoResponse.newBuilder().addAllEquip(viewHeroInfoResponse.getEquipList())
|
||||
// .setHero(viewHeroInfoResponse.getHero()).setForce(viewHeroInfoResponse.getForce())
|
||||
// .setGuildSkill(viewHeroInfoResponse.getGuildSkill()).addAllSpecialEffects(viewHeroInfoResponse.getSpecialEffectsList()).build();
|
||||
return oneTeamInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,8 +7,10 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.arenaworld.ArenaWorldLogic;
|
||||
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.logic.fight.FightUtil;
|
||||
|
|
@ -51,7 +53,8 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
if(setting==null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
long diff = System.currentTimeMillis() - sGlobalSystemConfig.getSeasonOpenLong();
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
|
||||
if (diff > setting.getBattleTime()[0] && diff < setting.getBattleTime()[1]) {
|
||||
|
||||
|
|
@ -64,15 +67,15 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
// if(user.getArenaManager().getCostDallyTime()>=setting.getCostMax()){
|
||||
// throw new ErrorCodeException(ErrorCode.NOTIME2);
|
||||
// }
|
||||
boolean check = PlayerLogic.getInstance().check(user, VipPrivilegeType.WORLD_ARENA_CHALLENGE_TIMES, 1);
|
||||
|
||||
//rank limit
|
||||
if (!ArenaWorldLogic.checkJoin(String.valueOf(iSession.getUid()))) {
|
||||
throw new ErrorCodeException(ErrorCode.WORLD_LEVELIMIT);
|
||||
}
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.WORLD_ARENA_CHALLENGE_TIMES, 1);
|
||||
if(!check){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
//rank limit
|
||||
if (!ArenaWorldLogic.checkJoin(String.valueOf(iSession.getUid()))) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
|
||||
|
||||
//走特权
|
||||
// if(user.getArenaManager().getWorldFreeChallengeTime()>0){
|
||||
|
|
@ -80,13 +83,18 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
// user.getArenaManager().setWorldFreeChallengeTime(user.getArenaManager().getWorldFreeChallengeTime() -1);
|
||||
// }else {
|
||||
//check costs
|
||||
int[][] costItems = new int[1][];
|
||||
costItems[0]=setting.getCost();
|
||||
boolean enough = ItemUtil.itemCost(user, costItems, BIReason.WORLD_ARENA, 0);
|
||||
if (!enough) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
// }
|
||||
// int[][] costItems = new int[1][];
|
||||
// costItems[0]=setting.getCost();
|
||||
// boolean enough = ItemUtil.itemCost(user, costItems, BIReason.WORLD_ARENA, 0);
|
||||
// if (!enough) {
|
||||
// throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
// }
|
||||
// PlayerLogic.getInstance().checkAndUpdate()
|
||||
// boolean b1 = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.SIGN_AGAIN, 1);
|
||||
// if(!b1){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
// }
|
||||
// }
|
||||
|
||||
boolean b;
|
||||
if (proto.getSkipFight() == 0) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.network.server.GlobalidHelper;
|
||||
import com.ljsd.jieling.network.server.WorldHelper;
|
||||
|
|
@ -15,6 +17,8 @@ import manager.STableManager;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description: gs 继承basehandler 做消息拦截 然后再转发到w
|
||||
* Author: zsx
|
||||
|
|
@ -30,6 +34,7 @@ public class GetWorldArenaInfoRequestHandler extends BaseHandler<WorldProto.GetW
|
|||
@Override
|
||||
public void processWithProto(ISession iSession, WorldProto.GetWorldArenaInfoRequest proto) throws Exception {
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.World_Arena.getFunctionType());
|
||||
|
||||
if (!HandlerLogicThread.checkOpen(UserManager.getUser(iSession.getUid()),sGlobalSystemConfig)) {
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
|
|
@ -38,13 +43,17 @@ public class GetWorldArenaInfoRequestHandler extends BaseHandler<WorldProto.GetW
|
|||
if(setting==null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
long diff = System.currentTimeMillis() - sGlobalSystemConfig.getSeasonOpenLong();
|
||||
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
|
||||
if(diff>setting.getRestTime()[0]&&diff<setting.getRestTime()[1]){
|
||||
WorldProto.GetWorldArenaInfoRequest.Builder builder = WorldProto.GetWorldArenaInfoRequest.newBuilder(proto);
|
||||
builder.setIsPro(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GlobalidHelper.WorldInfo worldInfo = GlobalidHelper.getWorldInfo();
|
||||
if (null == worldInfo){
|
||||
throw new ErrorCodeException("world unavailable or play not open");
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.arenaworld.ArenaWorldLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
|
@ -35,19 +38,23 @@ public class GetWorldArenaInfoResponseHandler extends gtGBaseHandler<WorldProto.
|
|||
if (setting == null) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.World_Arena.getFunctionType());
|
||||
long seasonOpenLong = sGlobalSystemConfig.getSeasonOpenLong();
|
||||
long diff = System.currentTimeMillis() - seasonOpenLong;
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
|
||||
if (diff > setting.getRestTime()[0] && diff < setting.getRestTime()[1]) {
|
||||
builder.setStage(3);
|
||||
builder.setEndTime((int)(seasonOpenLong/1000+setting.getRestTime()[1]));
|
||||
builder.setEndTime((int)(timeControllerOfFunction.getStartTime()/1000+setting.getRestTime()[1]));
|
||||
} else if (diff > setting.getBattleTime()[0] && diff < setting.getBattleTime()[1]) {
|
||||
builder.setStage(2);
|
||||
builder.setEndTime((int)(seasonOpenLong/1000+setting.getBattleTime()[1]));
|
||||
builder.setEndTime((int)(timeControllerOfFunction.getStartTime()/1000+setting.getBattleTime()[1]));
|
||||
} else {
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
|
||||
if (!ArenaWorldLogic.checkJoin(String.valueOf(rpcMessage.getUid()))) {
|
||||
builder.setEnterable(-1);
|
||||
}
|
||||
|
||||
proto = builder.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.arenaworld.ArenaWorldLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.network.server.GlobalidHelper;
|
||||
import com.ljsd.jieling.network.server.WorldHelper;
|
||||
|
|
@ -45,7 +47,8 @@ public class GetWorldArenaProudRequestHandler extends BaseHandler<WorldCommonPro
|
|||
if(setting==null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
long diff = System.currentTimeMillis() - sGlobalSystemConfig.getSeasonOpenLong();
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
|
||||
if(diff>setting.getRestTime()[0]&&diff<setting.getRestTime()[1]){
|
||||
}else {
|
||||
|
|
@ -54,7 +57,7 @@ public class GetWorldArenaProudRequestHandler extends BaseHandler<WorldCommonPro
|
|||
|
||||
//rank limit
|
||||
if (!ArenaWorldLogic.checkJoin(String.valueOf(iSession.getUid()))) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
throw new ErrorCodeException(ErrorCode.WORLD_LEVELIMIT);
|
||||
}
|
||||
|
||||
//转发到world服
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.gtw;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2021/1/3 1:13
|
||||
*/
|
||||
public class ViewHeroInfoRequestHandler extends gtGBaseHandler<WorldProto.ViewHeroInfoRequest> {
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.ViewHeroInfoRequest proto) throws Exception {
|
||||
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewHeroInfo(proto.getTargetUid(), proto.getHeroId());
|
||||
// WorldProto.ViewHeroInfoResponse build = WorldProto.ViewHeroInfoResponse.newBuilder().addAllEquip(viewHeroInfoResponse.getEquipList())
|
||||
// .setHero(viewHeroInfoResponse.getHero()).setForce(viewHeroInfoResponse.getForce())
|
||||
// .setGuildSkill(viewHeroInfoResponse.getGuildSkill()).addAllSpecialEffects(viewHeroInfoResponse.getSpecialEffectsList()).build();
|
||||
return viewHeroInfoResponse;
|
||||
}
|
||||
}
|
||||
|
|
@ -2074,7 +2074,7 @@ public class MapLogic {
|
|||
.addAllTrialRewardInfo(mapManager.getTrialInfo().getTowerReceivedReward())
|
||||
.setBombUsed(mapManager.getTrialInfo().getBombUseTimes())
|
||||
.build();
|
||||
builder.setTowerCopyInfo(towerCopyInfo);
|
||||
// builder.setTowerCopyInfo(towerCopyInfo);
|
||||
builder.addAllPlayedGenMapId(mapManager.getPlayGenMaps());
|
||||
|
||||
for(Map.Entry<Integer,Integer> entry:mapManager.getDifficultyOptions().entrySet()){
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.server.WorldHelper;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
@Component
|
||||
public class GetPlayerOneTeamInfo extends BaseHandler<PlayerInfoProto.GetPlayerOneTeamInfoRequest> {
|
||||
|
|
@ -16,6 +20,24 @@ public class GetPlayerOneTeamInfo extends BaseHandler<PlayerInfoProto.GetPlayerO
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
|
||||
PlayerLogic.getInstance().getOneTeamInfo(iSession, proto.getPlayerId(),proto.getTeamId(), MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE);
|
||||
|
||||
|
||||
|
||||
if(proto.getServerId()!=0&&proto.getServerId()!= AreaManager.areaId){
|
||||
WorldProto.GetPlayerOneTeamInfoRequest build = WorldProto.GetPlayerOneTeamInfoRequest.newBuilder().setPlayerId(proto.getPlayerId()).setTeamId(proto.getTeamId()).build();
|
||||
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse rewardResponse = WorldHelper.sendMessageToWorldWithResult(0, build,PlayerInfoProto.GetPlayerOneTeamInfoResponse.class);
|
||||
if(rewardResponse==null){
|
||||
rewardResponse = PlayerInfoProto.GetPlayerOneTeamInfoResponse.newBuilder().build();
|
||||
}
|
||||
// PlayerInfoProto.GetPlayerOneTeamInfoResponse viewHeroInfoResponse = PlayerInfoProto.GetPlayerOneTeamInfoResponse.newBuilder().setTeamInfo(rewardResponse.getTeamInfo()).build();
|
||||
|
||||
int resMsgId = MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE_VALUE;
|
||||
MessageUtil.sendMessage(iSession,1,resMsgId,rewardResponse,true);
|
||||
}else {
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo( proto.getPlayerId(), proto.getTeamId());
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE.getNumber(),oneTeamInfo,true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.EquipManager;
|
||||
import com.ljsd.jieling.logic.dao.PropertyItem;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.server.WorldHelper;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SArenaRobotConfig;
|
||||
import config.SCHero;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInfoRequest> {
|
||||
@Override
|
||||
|
|
@ -14,6 +27,27 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.ViewHeroInfoRequest proto) throws Exception {
|
||||
PlayerLogic.getInstance().viewHeroInfo(iSession,proto.getTargetUid(),proto.getHeroId());
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(Integer.valueOf(proto.getHeroId()));
|
||||
if(sArenaRobotConfig!=null){
|
||||
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId());
|
||||
return;
|
||||
}
|
||||
if(proto.getServerId()!=0&&proto.getServerId()!= AreaManager.areaId){
|
||||
WorldProto.ViewHeroInfoRequest build = WorldProto.ViewHeroInfoRequest.newBuilder().setTargetUid(proto.getTargetUid()).setHeroId(proto.getHeroId()).build();
|
||||
PlayerInfoProto.ViewHeroInfoResponse rewardResponse = WorldHelper.sendMessageToWorldWithResult(0, build,PlayerInfoProto.ViewHeroInfoResponse.class);
|
||||
if(rewardResponse==null){
|
||||
rewardResponse = PlayerInfoProto.ViewHeroInfoResponse.newBuilder().build();
|
||||
}
|
||||
// PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerInfoProto.ViewHeroInfoResponse.newBuilder().addAllEquip(rewardResponse.getEquipList())
|
||||
// .setHero(rewardResponse.getHero()).setForce(rewardResponse.getForce())
|
||||
// .setGuildSkill(rewardResponse.getGuildSkill()).addAllSpecialEffects(rewardResponse.getSpecialEffectsList()).build();
|
||||
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
|
||||
MessageUtil.sendMessage(iSession,1,resMsgId,rewardResponse,true);
|
||||
}else {
|
||||
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewHeroInfo(proto.getTargetUid(), proto.getHeroId());
|
||||
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
|
||||
MessageUtil.sendMessage(iSession,1,resMsgId,viewHeroInfoResponse,true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
|||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thread.task.RPCWorldServerTask;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
|
@ -242,6 +243,7 @@ public class GlobalDataManaager implements IManager {
|
|||
StoreLogic.checkGlobalStore(true);
|
||||
new RPCServerTask().start();
|
||||
new RPCGmServerTask().start();
|
||||
new RPCWorldServerTask().start();
|
||||
new UserLevelEventHandler();
|
||||
new RemoveEventHeroHandler();
|
||||
new FightMainEventHandler();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,13 @@ public class ArenaLogic {
|
|||
for(ArenaEnemy arenaEnemy : arenaEnemies){
|
||||
int enemyId = arenaEnemy.getEnemyId();
|
||||
int enemyType = arenaEnemy.getEnemyType();
|
||||
arenaEnemyList.add(getArenaEnemy(enemyId,enemyType));
|
||||
try {
|
||||
arenaEnemyList.add(getArenaEnemy(enemyId,enemyType));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return arenaEnemyList;
|
||||
}
|
||||
|
|
@ -121,6 +127,31 @@ public class ArenaLogic {
|
|||
}
|
||||
}
|
||||
|
||||
public CommonProto.ArenaEnemy getWorldArenaEnemy( int uid) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.WORLD_TEAM_ARENA_DEFENSE,false);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE);
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
|
||||
for(TeamPosHeroInfo teamPosHeroInfo:teamPosHeroInfoList){
|
||||
heroTids.add(heroMap.get(teamPosHeroInfo.getHeroId()).getTemplateId());
|
||||
}
|
||||
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(heroTids).build();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(uid)
|
||||
.setLevel(playerInfoManager.getLevel())
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setHead(playerInfoManager.getHead())
|
||||
.setTotalForce(totalForce)
|
||||
.build();
|
||||
return CommonProto.ArenaEnemy.newBuilder()
|
||||
.setPersonInfo(personInfoBuild)
|
||||
.setTeam(teamBuild)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public CommonProto.ArenaEnemy getUserArenaEnemy(int enemyId ,int teamId) throws Exception {
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,30 @@ import com.ljsd.jieling.core.FunctionIdEnum;
|
|||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.network.server.GlobalidHelper;
|
||||
import com.ljsd.jieling.network.server.WorldHelper;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SArenaRobotConfig;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalSystemConfig;
|
||||
import config.SMServerArenaReward;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
|
|
@ -44,4 +61,52 @@ public class ArenaWorldLogic {
|
|||
return HandlerLogicThread.checkOpen(UserManager.getUser(Integer.valueOf(uid)),sGlobalSystemConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void close() throws Exception {
|
||||
int myGroup = GlobalidHelper.getWorldInfo().getMyGroup();
|
||||
PlayerInfoProto.RankResponse rankResponse = WorldHelper.sendMessageToWorldWithResult(0, WorldProto.GetRankRequest.newBuilder().setUid(0).setAcitvityId(0).setType(28).setCrossId(myGroup).build(), PlayerInfoProto.RankResponse.class);
|
||||
|
||||
if(rankResponse==null){
|
||||
LOGGER.error("Exception::rank null");
|
||||
return;
|
||||
}
|
||||
Map<Integer, SMServerArenaReward> config = STableManager.getConfig(SMServerArenaReward.class);
|
||||
Map<Integer, SMServerArenaReward> rewardsMap = new HashMap<>();
|
||||
config.forEach((k, v) -> {
|
||||
int minRank = v.getMinRank();
|
||||
int maxRank = v.getMaxRank();
|
||||
while (minRank <= maxRank) {
|
||||
rewardsMap.put(minRank++, v);
|
||||
}
|
||||
|
||||
});
|
||||
List<CommonProto.UserRank> ranksList = rankResponse.getRanksList();
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.World_Arena.getFunctionType());
|
||||
|
||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
Set<Integer> joinUids = new HashSet<>(128);
|
||||
try {
|
||||
for (CommonProto.UserRank item : ranksList) {
|
||||
int uid = item.getUid();
|
||||
if (robotConfigMap.containsKey(uid)) {
|
||||
continue;
|
||||
}
|
||||
joinUids.add(uid);
|
||||
User user = UserManager.getUser(uid);
|
||||
SMServerArenaReward smServerArenaReward = rewardsMap.get(item.getRankInfo().getRank());
|
||||
if (user.getArenaManager().getTopMaxRank() == 0 || user.getArenaManager().getTopMaxRank() > item.getRankInfo().getRank()) {
|
||||
user.getArenaManager().setTopMaxRank(item.getRankInfo().getRank());
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title", new Object[]{sGlobalSystemConfig.getName()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("receive_activity_txt", new Object[]{sGlobalSystemConfig.getName()});
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, ItemUtil.getMailReward(smServerArenaReward.getSeasonReward()), nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.info("Exception e = "+"size"+ ranksList.size()+ e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -622,7 +622,7 @@ public class PlayerLogic {
|
|||
|
||||
}
|
||||
|
||||
public void getOneTeamInfo(ISession session, int id,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public PlayerInfoProto.GetPlayerOneTeamInfoResponse getOneTeamInfo( int id,int teamId) throws Exception {
|
||||
if(id==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
|
@ -632,18 +632,17 @@ public class PlayerLogic {
|
|||
oneInfo=getRobotTeamInfo(sArenaRobotConfig);
|
||||
}else{
|
||||
oneInfo = getUserTeamOneInfo(id, teamId);
|
||||
if(UserManager.getUser(session.getUid()).getFriendManager().getMyApplyFriends().contains(id)){
|
||||
if(UserManager.getUser(id).getFriendManager().getMyApplyFriends().contains(id)){
|
||||
oneInfo.setIsApplyed(1);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerOneTeamInfoResponse.newBuilder().setTeamInfo(oneInfo);
|
||||
return playerTeamInfo.build();
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),playerTeamInfo.build(),true);
|
||||
|
||||
}
|
||||
|
||||
private void viewRobotHeroInfo(ISession session, SArenaRobotConfig sArenaRobotConfig,String robotHeroId) throws Exception {
|
||||
public void viewRobotHeroInfo(ISession session, SArenaRobotConfig sArenaRobotConfig,String robotHeroId) throws Exception {
|
||||
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
|
||||
|
||||
int[] differDemonsId = sArenaRobotConfig.getDifferDemonsId();
|
||||
|
|
@ -664,14 +663,10 @@ public class PlayerLogic {
|
|||
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
|
||||
}
|
||||
|
||||
public void viewHeroInfo(ISession session,int uid,String heroId) throws Exception {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(uid);
|
||||
if(sArenaRobotConfig!=null){
|
||||
viewRobotHeroInfo(session,sArenaRobotConfig,heroId);
|
||||
return;
|
||||
}
|
||||
public PlayerInfoProto.ViewHeroInfoResponse viewHeroInfo(int uid,String heroId) throws Exception {
|
||||
|
||||
User userInMem = UserManager.getUserInMem(uid);
|
||||
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
|
||||
|
||||
if(userInMem == null){
|
||||
throw new ErrorCodeException(ErrorCode.FRIENDS_USER_NULL);
|
||||
}
|
||||
|
|
@ -698,7 +693,8 @@ public class PlayerLogic {
|
|||
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
|
||||
Integer skill = guildSkill.getOrDefault(profession, 0);
|
||||
builder.setGuildSkill(skill);
|
||||
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
|
||||
public void takeSevenScoreReward(ISession iSession) throws Exception {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public enum RankEnum {
|
|||
GUILD_CHALLENGE_RANK(26,RedisKey.GUILD_CHALLENGE_RANK,GuildChallengeRank::new,false),//param1:伤害 param2:无 param3:无
|
||||
|
||||
GUILD_SHEJI_SCORE_RANK(27,RedisKey.GUILD_SHEJI_SCORE_RANK,GuildSheJiScoreRank::new,false),//param1:公会社稷贡献 param2:无 param3:无
|
||||
WARLD_DIS_ARENA_RANK(28,RedisKey.WARLD_DIS_ARENA_RANK,ArenaRank::new,true),//世界服排行
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.GmService;
|
||||
import com.ljsd.jieling.WorldRpcService;
|
||||
import com.ljsd.jieling.config.json.CoreSettings;
|
||||
import com.ljsd.jieling.thrift.idl.RPCRequestGMIFace;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import com.world.thrift.idl.RPCwTgRequestIFace;
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.server.TServer;
|
||||
import org.apache.thrift.server.TThreadPoolServer;
|
||||
import org.apache.thrift.transport.TServerSocket;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
/**
|
||||
* 客服平台
|
||||
*/
|
||||
public class RPCWorldServerTask extends Thread{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RPCWorldServerTask.class);
|
||||
|
||||
|
||||
private CoreSettings coreSettings;
|
||||
|
||||
public RPCWorldServerTask(){
|
||||
Gson gson = new Gson();
|
||||
this.coreSettings = ConfigurableApplicationContextManager.getBean(CoreSettings.class);
|
||||
setName("rpcWorld");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
TServerSocket serverTransport = new TServerSocket(new InetSocketAddress(coreSettings.getIp(), coreSettings.getWorldport()));
|
||||
LOGGER.info("run->coreip={},corePort={}", coreSettings.getIp(), coreSettings.getWorldport());
|
||||
TThreadPoolServer.Args trArgs = new TThreadPoolServer.Args(serverTransport);
|
||||
TProcessor processor = new RPCwTgRequestIFace.Processor(new WorldRpcService());
|
||||
trArgs.processor(processor);
|
||||
TBinaryProtocol.Factory proFactory = new TBinaryProtocol.Factory(true, true);
|
||||
trArgs.protocolFactory(proFactory);
|
||||
trArgs.maxWorkerThreads(16);
|
||||
LOGGER.info("run->RPC services is starting.");
|
||||
final TServer server = new TThreadPoolServer(trArgs);
|
||||
while (true) {
|
||||
try {
|
||||
server.serve();
|
||||
} catch (Exception e) {
|
||||
server.stop();
|
||||
LOGGER.error("run->{}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (TTransportException e) {
|
||||
LOGGER.error("run->{}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||
public class SGlobalSystemConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
private int[] openRules;
|
||||
|
||||
private String systemOpen;
|
||||
|
|
@ -47,6 +47,7 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
public static Map<Integer, List<Integer>> idsByType;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SGlobalSystemConfig> config = STableManager.getConfig(SGlobalSystemConfig.class);
|
||||
Map<Integer, List<Integer>> idsByTypeTmp = new HashMap<>();
|
||||
STableManager.getConfig(SGlobalSystemConfig.class).forEach((id,item)->{
|
||||
if(!idsByTypeTmp.containsKey(item.getIsIDdSame())){
|
||||
|
|
@ -57,6 +58,13 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
idsByType = idsByTypeTmp;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="MServerArenaReward")
|
||||
public class SMServerArenaReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int minRank;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private int[][] seasonReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMinRank() {
|
||||
return minRank;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public int[][] getSeasonReward() {
|
||||
return seasonReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.world.config.ConfigurableApplicationContextManager;
|
||||
import com.world.config.WorldCoreSettings;
|
||||
|
|
@ -9,6 +8,7 @@ import com.world.logic.arean.ArenaLogic;
|
|||
import com.world.redis.RedisUtil;
|
||||
import com.world.thread.ThreadManager;
|
||||
import com.world.thrift.idl.pool.RPCServerTask;
|
||||
import com.world.thrift.idl.pool.ThriftPoolUtils;
|
||||
import com.world.thrift.idl.pool.WorldRpcService;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -62,7 +62,7 @@ public class WorldServerApplication {
|
|||
|
||||
KeyGenUtils.setMachineNum(0);
|
||||
WorldRpcService.initHandler("com.world.handler", WorldServerApplication.class.getClassLoader());
|
||||
|
||||
ThriftPoolUtils.getInstance().initContext();
|
||||
|
||||
new RPCServerTask().start();
|
||||
//切换netty通信
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.world.handler;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.world.network.server.gsHelper;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2021/1/9 1:30
|
||||
*/
|
||||
public class GetPlayerOneTeamInfoRequestHandler extends gtGBaseHandler<WorldProto.GetPlayerOneTeamInfoRequest>{
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse getPlayerOneTeamInfoResponse = gsHelper.sendMessageToGs(rpcMessage.getServerId(), rpcMessage.getUid(), proto, PlayerInfoProto.GetPlayerOneTeamInfoResponse.class);
|
||||
if (getPlayerOneTeamInfoResponse == null) {
|
||||
return null;
|
||||
}
|
||||
return getPlayerOneTeamInfoResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.world.handler;
|
||||
|
||||
import com.world.logic.arean.ArenaLogic;
|
||||
import com.world.logic.rank.DeathPathCrossEveryGuildRank;
|
||||
import com.world.logic.rank.DeathPathCrossEveryPersonRank;
|
||||
import com.world.logic.rank.DeathPathCrossTotalGuildRank;
|
||||
|
|
@ -28,6 +29,8 @@ public class GetRankRequestHandler extends gtGBaseHandler<WorldProto.GetRankRequ
|
|||
return new DeathPathCrossEveryPersonRank(proto.getCrossId()+":"+RedisKey.DEATH_PATH_TOTAL_PERSON_RANK).getRank(proto.getUid(),"",1,-1);
|
||||
case 18:
|
||||
return new DeathPathCrossTotalGuildRank(proto.getCrossId()+":"+RedisKey.DEATH_PATH_TOTAL_GUILD_RANK).getRank(proto.getUid(),"",1,-1);
|
||||
case 28:
|
||||
return ArenaLogic.getInstance().getRank(rpcMessage.getUid(),rpcMessage.getServerId());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@ package com.world.handler;
|
|||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.fight.ArenaRecordWrap;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||
import com.ljsd.jieling.logic.dao.FamilyFightInfo;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import com.world.logic.arean.ArenaEnemy;
|
||||
|
|
@ -85,6 +76,10 @@ public class GetWorldArenaChallengeRequestHandler extends gtGBaseHandler<WorldPr
|
|||
builder1.setErr(-2);
|
||||
return builder1.build();
|
||||
}
|
||||
|
||||
//更新缓存数据
|
||||
ArenaLogic.getUserCacheMap().put(arenaEnemy.getEnemyId(),getGSUserArenaInfoResponse.getArenaEnemys());
|
||||
|
||||
force = getGSUserArenaInfoResponse.getTotalForce();
|
||||
teamInfo = getGSUserArenaInfoResponse.getFightTeamInfo();
|
||||
arenaEnemys = getGSUserArenaInfoResponse.getArenaEnemys();
|
||||
|
|
@ -110,6 +105,12 @@ public class GetWorldArenaChallengeRequestHandler extends gtGBaseHandler<WorldPr
|
|||
WorldProto.WroldBattleRecord.Builder builder = WorldProto.WroldBattleRecord.newBuilder();
|
||||
builder.setFightData(fightResult.getFightData());
|
||||
builder.setResult(fightResult.getCheckResult()[0]);
|
||||
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, rpcMessage.getUid());
|
||||
builder.setRecordId(s);
|
||||
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
|
||||
//record
|
||||
builder.setRedEnemy(proto.getArenaEnemys());
|
||||
builder.setBlueEnemy(arenaEnemys);
|
||||
if (fightResult.getCheckResult()[0] > 0) {
|
||||
|
||||
//交换队伍
|
||||
|
|
@ -132,21 +133,16 @@ public class GetWorldArenaChallengeRequestHandler extends gtGBaseHandler<WorldPr
|
|||
List<ArenaEnemy> arenaEnemies = ArenaLogic.randomRank(integerIntegerHashMap, rpcMessage.getUid(), myRank == null ? 9999 : myRank.getKey());
|
||||
|
||||
//notify client
|
||||
List<CommonProto.ArenaEnemy> arenaEnemyList = ArenaLogic.getInstance().getArenaEnemyList(new LinkedList<>(arenaEnemies),new LinkedList<>());
|
||||
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.WORLD_ARENA_MY_PRON,String.valueOf(rpcMessage.getUid()), 0, -1);
|
||||
List<CommonProto.ArenaEnemy> arenaEnemyList = ArenaLogic.getInstance().getArenaEnemyList(new LinkedList<>(arenaEnemies),new LinkedList<>(strings));
|
||||
arenaInfoBuild.addAllArenaEnemys(arenaEnemyList);
|
||||
arenaInfoBuild.setScore(proto.getChallengeRank());
|
||||
|
||||
//record
|
||||
builder.setRedEnemy(proto.getArenaEnemys());
|
||||
builder.setBlueEnemy(arenaEnemys);
|
||||
builder.setRank(myRank == null ? 9999 : myRank.getKey());
|
||||
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, rpcMessage.getUid());
|
||||
builder.setRecordId(s);
|
||||
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(proto.getChallengeUid()), s, builder.build().toByteArray());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.WORLD_ARENA_RRECORD,Integer.toString(rpcMessage.getUid()), s, builder.build().toByteArray());
|
||||
}
|
||||
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(proto.getChallengeUid()), s, builder.build().toByteArray());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.WORLD_ARENA_RRECORD,Integer.toString(rpcMessage.getUid()), s, builder.build().toByteArray());
|
||||
|
||||
builder1.setArenaInfo(arenaInfoBuild);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -30,15 +30,12 @@ public class GetWorldArenaRecordInfoRequestHandler extends gtGBaseHandler<WorldP
|
|||
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.Entry<Integer, ArenaEnemy> challRank = ArenaLogic.getKey(integerIntegerHashMap, rpcMessage.getUid());
|
||||
// if (challRank == null) {
|
||||
// return builder.build();
|
||||
// }
|
||||
Map<String, byte[]> result = RedisUtil.getInstence().getMapValues(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(rpcMessage.getUid()), String.class, byte[].class);
|
||||
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
List< byte[]> arenaRecordList = new ArrayList<>(result.values());
|
||||
List<WorldProto.WroldBattleRecord> collect = arenaRecordList.stream().map(bytes -> {try {
|
||||
|
|
@ -47,6 +44,7 @@ public class GetWorldArenaRecordInfoRequestHandler extends gtGBaseHandler<WorldP
|
|||
return null;
|
||||
}).collect(Collectors.toList());
|
||||
collect.sort(Comparator.comparingInt(WorldProto.WroldBattleRecord::getAttackTime));
|
||||
Collections.reverse(collect);
|
||||
int size = arenaRecordList.size();
|
||||
if (size > 20) {
|
||||
String[] removeMapKeys = new String[size - 10];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.world.handler;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.world.network.server.gsHelper;
|
||||
import rpc.net.RpcMessage;
|
||||
import rpc.net.gtGBaseHandler;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2021/1/3 1:13
|
||||
*/
|
||||
public class ViewHeroInfoRequestHandler extends gtGBaseHandler<WorldProto.ViewHeroInfoRequest> {
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.ViewHeroInfoRequest proto) throws Exception {
|
||||
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = gsHelper.sendMessageToGs(rpcMessage.getServerId(), rpcMessage.getUid(), proto, PlayerInfoProto.ViewHeroInfoResponse.class);
|
||||
if (viewHeroInfoResponse == null) {
|
||||
return null;
|
||||
}
|
||||
return viewHeroInfoResponse;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,12 +7,18 @@ import com.ljsd.jieling.config.clazzStaticCfg.SArenaRobotStaticConfig;
|
|||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.Lockey;
|
||||
import com.ljsd.jieling.core.SimpleTransaction;
|
||||
import com.ljsd.jieling.logic.dao.PlayerInfoCache;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.DeathChallengeCount;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVPFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import com.world.db.mongo.MongoUtil;
|
||||
import com.world.logic.arean.fight.FightUtil;
|
||||
import com.world.logic.rank.AbstractCrossRank;
|
||||
import com.world.network.server.gsHelper;
|
||||
import com.world.redis.RedisKey;
|
||||
import com.world.redis.RedisUtil;
|
||||
|
|
@ -24,6 +30,7 @@ import org.springframework.data.redis.core.Cursor;
|
|||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.ArenaInfoProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
|
|
@ -50,7 +57,7 @@ public class ArenaLogic {
|
|||
public static ConcurrentHashMap<Integer, HashSet<String>> map = new ConcurrentHashMap<>();//服务器分组信息
|
||||
public static volatile Map<String, Integer> serverSplit = new HashMap<>();
|
||||
public static ConcurrentHashMap<Integer, HashMap<Integer, ArenaEnemy>> ranInfo = new ConcurrentHashMap<>();//每个分组内排行榜信息
|
||||
|
||||
private static Map<Integer, CommonProto.ArenaEnemy> userCacheMap = new ConcurrentHashMap<>();
|
||||
// public static ConcurrentHashMap<Integer, ArenaEnemy> userInfoCache = new ConcurrentHashMap<>();//成员信息缓存
|
||||
|
||||
// private static ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock();
|
||||
|
|
@ -85,15 +92,15 @@ public class ArenaLogic {
|
|||
|
||||
public void minCheck() {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String matched = redisUtil.getObject(RedisKey.MATCHED_VERSION, String.class);
|
||||
String matched = redisUtil.getObject(RedisKey.MATCHED_VERSION, String.class);//global 分组日期
|
||||
String myVersion = redisUtil.getObject(RedisKey.MATCHED_MY_VERSION, String.class);
|
||||
if (null == matched || Integer.valueOf(matched) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null != myVersion && !myVersion.equals("")) {
|
||||
if (null == matched || Integer.valueOf(matched) == 0 || !myVersion.equals(matched)) {
|
||||
map.clear();
|
||||
//TODO finish
|
||||
}
|
||||
} else {
|
||||
if (null != matched && Integer.valueOf(matched) != 0) {
|
||||
if (!myVersion.equals(matched) ) {
|
||||
onfinish();
|
||||
//TODO start
|
||||
//重新获取分组信息
|
||||
redisUtil.set(RedisKey.MATCHED_MY_VERSION, matched);
|
||||
|
|
@ -118,13 +125,29 @@ public class ArenaLogic {
|
|||
RedisUtil.getInstence().set(RedisKey.WORLD_ARENA_RANK, String.valueOf(integer), orDefault, new TypeToken<HashMap<Integer, ArenaEnemy>>() {
|
||||
}.getType());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
//定时入库
|
||||
lastSaved();
|
||||
}
|
||||
|
||||
private void onfinish(){
|
||||
map.clear();
|
||||
|
||||
List<String> delKeys = new ArrayList<>();
|
||||
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.WORLD_ARENA_RANK_MY_MATH, ""));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.WORLD_ARENA_RRECORD, ""));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.WORLD_ARENA_MY_PRON, ""));
|
||||
|
||||
// Cursor<String> cursor = RedisUtil.getInstence().scan("WORLD_ARENA_MY_PRON:*", -1);
|
||||
// while (cursor.hasNext()) {
|
||||
// delKeys.add(cursor.next());
|
||||
// }
|
||||
RedisUtil.getInstence().del(delKeys.toArray(new String[0]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<CommonProto.ArenaEnemy> getArenaEnemyList(List<ArenaEnemy> arenaEnemies,List<String> myPro) throws Exception {
|
||||
List<CommonProto.ArenaEnemy> arenaEnemyList = new ArrayList<>(arenaEnemies.size());
|
||||
|
|
@ -137,7 +160,6 @@ public class ArenaLogic {
|
|||
return arenaEnemyList;
|
||||
}
|
||||
|
||||
|
||||
public CommonProto.ArenaEnemy getRobotArenaEnemy(int enemyId) throws Exception {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(enemyId);
|
||||
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(sArenaRobotConfig.getHeroList()).build();
|
||||
|
|
@ -157,6 +179,7 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
public CommonProto.ArenaEnemy getArenaEnemy(int enemyId, int serverId, int enemyType, int rank,int proTime,boolean isContain) throws Exception {
|
||||
|
||||
if (enemyType == 0) { //机器人
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(enemyId);
|
||||
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(sArenaRobotConfig.getHeroList()).build();
|
||||
|
|
@ -167,6 +190,7 @@ public class ArenaLogic {
|
|||
.setScore(sArenaRobotConfig.getRobotScore())
|
||||
.setTotalForce(sArenaRobotConfig.getTotalForce())
|
||||
.setRank(rank)
|
||||
.setServername(MongoUtil.getInstence().getServerNameById(serverId))
|
||||
.build();
|
||||
return CommonProto.ArenaEnemy.newBuilder()
|
||||
.setPersonInfo(personInfoBuild)
|
||||
|
|
@ -175,66 +199,36 @@ public class ArenaLogic {
|
|||
.setHadProud(isContain)
|
||||
.build();
|
||||
} else {
|
||||
WorldProto.GetGSUserArenaInfoResponse getGSUserArenaInfoResponse = gsHelper.sendMessageToGs(serverId, enemyId, WorldProto.GetGSUserArenaInfoRequest.newBuilder().setUid(enemyId).build(), WorldProto.GetGSUserArenaInfoResponse.class);
|
||||
if (getGSUserArenaInfoResponse == null) {
|
||||
return null;
|
||||
boolean b = userCacheMap.containsKey(enemyId);
|
||||
CommonProto.ArenaPersonInfo.Builder builder;
|
||||
CommonProto.Team.Builder teamBuilder;
|
||||
if(b){
|
||||
builder= CommonProto.ArenaPersonInfo.newBuilder().mergeFrom(userCacheMap.get(enemyId).getPersonInfo());
|
||||
teamBuilder= CommonProto.Team.newBuilder().mergeFrom(userCacheMap.get(enemyId).getTeam());
|
||||
}else {
|
||||
WorldProto.GetGSUserArenaInfoResponse getGSUserArenaInfoResponse = gsHelper.sendMessageToGs(serverId, enemyId, WorldProto.GetGSUserArenaInfoRequest.newBuilder().setUid(enemyId).build(), WorldProto.GetGSUserArenaInfoResponse.class);
|
||||
if (getGSUserArenaInfoResponse == null) {
|
||||
return null;
|
||||
}
|
||||
builder = CommonProto.ArenaPersonInfo.newBuilder().mergeFrom(getGSUserArenaInfoResponse.getArenaEnemys().getPersonInfo());
|
||||
teamBuilder = CommonProto.Team.newBuilder().mergeFrom(getGSUserArenaInfoResponse.getArenaEnemys().getTeam());
|
||||
}
|
||||
return CommonProto.ArenaEnemy.newBuilder().mergeFrom(getGSUserArenaInfoResponse.getArenaEnemys()).setWorshipTime(proTime).setHadProud(isContain).build();
|
||||
builder.setRank(rank).setServername(MongoUtil.getInstence().getServerNameById(serverId));
|
||||
CommonProto.ArenaEnemy build = CommonProto.ArenaEnemy.newBuilder().setTeam(teamBuilder.build()).setPersonInfo(builder.build()).setWorshipTime(proTime).setHadProud(isContain).build();
|
||||
//缓存数据
|
||||
userCacheMap.put(enemyId,build);
|
||||
return build;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getFightResultByPersonToPerson(User mine, int myteamId, User defUser, int defTeamId, ArenaRecord arenaRecord, ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(), myteamId, SArenaSetting.getSArenaSetting().getMostTime(), "", GameFightType.ArenaPersonFight, defUser.getId(), defTeamId);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
int defForce = HeroLogic.getInstance().calTeamTotalForce(defUser, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
arenaRecord.setAttackForce(myforce);
|
||||
if (myforce < defForce) {
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
GameFightType fightType = pvpFightEvent.getFightType();
|
||||
FightResult fightResult = fightType.getFightEventProcesor().process(pvpFightEvent);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = fightResult.getFightTeamInfo();
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = fightResult.getDefFightTeamInfo();
|
||||
//设置战斗随机种子
|
||||
int seed = fightResult.getSeed();
|
||||
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||
.setFightSeed(seed)
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addMonsterList(deffightTeamInfo)
|
||||
.build();
|
||||
builder.setFightData(build);
|
||||
//数据互换
|
||||
byte[] snapRecord = build.toByteArray();
|
||||
arenaRecord.setFightData(snapRecord);
|
||||
return fightResult.getCheckResult()[0];
|
||||
public static Map<Integer, CommonProto.ArenaEnemy> getUserCacheMap() {
|
||||
return userCacheMap;
|
||||
}
|
||||
|
||||
|
||||
public int getFightResultByPersonToRobot(User mine, int myteamId, int challengeUid, ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(), myteamId, SArenaSetting.getSArenaSetting().getMostTime(), "", GameFightType.ArenaRobotFight, challengeUid, -1);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(myteamId);
|
||||
if (sArenaRobotConfig != null && myforce < sArenaRobotConfig.getTotalForce()) {
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
GameFightType fightType = pvpFightEvent.getFightType();
|
||||
FightResult fightResult = fightType.getFightEventProcesor().process(pvpFightEvent);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = fightResult.getFightTeamInfo();
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = fightResult.getDefFightTeamInfo();
|
||||
//设置战斗随机种子
|
||||
int seed = fightResult.getSeed();
|
||||
builder.setFightData(CommonProto.FightData.newBuilder()
|
||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||
.setFightSeed(seed)
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addMonsterList(deffightTeamInfo)
|
||||
.build());
|
||||
return fightResult.getCheckResult()[0];
|
||||
public static void setUserCacheMap(Map<Integer, CommonProto.ArenaEnemy> userCacheMap) {
|
||||
ArenaLogic.userCacheMap = userCacheMap;
|
||||
}
|
||||
|
||||
|
||||
public ArenaEnemy getEnemyInList(int challengeUid, List<ArenaEnemy> enemys) {
|
||||
for (ArenaEnemy data : enemys) {
|
||||
if (data.getEnemyId() == challengeUid) {
|
||||
|
|
@ -261,89 +255,6 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
|
||||
// public void toArenaEnemy(int uid, Set<Integer> enemyList, List<ArenaEnemy> arenaEnemies, int type) {
|
||||
// for (Integer enemyId : enemyList) {
|
||||
// if (1 == type && enemyId == uid) {
|
||||
// continue;
|
||||
// }
|
||||
// arenaEnemies.add(new ArenaEnemy(enemyId, type, type));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * 发送结算奖励
|
||||
// *
|
||||
// * @param type
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public void sendReward(int type) throws Exception {
|
||||
//
|
||||
// String title;
|
||||
// String content;
|
||||
// if (type == GlobalsDef.ARENA_DAILY_REWARD) {
|
||||
// title = SErrorCodeEerverConfig.getI18NMessage("arena_daily_reward_title");
|
||||
// } else {
|
||||
// title = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_title");
|
||||
// }
|
||||
// Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK, Integer.toString(curSeason), 0, -1);
|
||||
// if (type == GlobalsDef.ARENA_SEASON_REWARD) {
|
||||
// curSeason = 0;
|
||||
// }
|
||||
// int rank = 1;
|
||||
// int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
// for (ZSetOperations.TypedTuple<String> item : arenaRankInfo) {
|
||||
// String value = item.getValue();
|
||||
// int uid = Integer.parseInt(value);
|
||||
// User user = UserManager.getUser(uid, true);
|
||||
// if (null == user) {
|
||||
// continue;
|
||||
// }
|
||||
// if (type == GlobalsDef.ARENA_DAILY_REWARD) {
|
||||
// MissionEventDistributor.requestStart();
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.ARENA_UPDATE_RANK, rank);
|
||||
// ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
|
||||
// if (sessionByUid != null) {
|
||||
// MissionEventDistributor.requestEnd(sessionByUid, true);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if (type == GlobalsDef.ARENA_DAILY_REWARD) {
|
||||
// content = SErrorCodeEerverConfig.getI18NMessage("arena_daily_reward_txt", new Object[]{rank});
|
||||
// } else {
|
||||
// content = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_txt", new Object[]{rank});
|
||||
// user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||
// String key = RedisUtil.getInstence().getKey(RedisKey.ARENA_RRECORD, Integer.toString(uid));
|
||||
// RedisUtil.getInstence().del(key);
|
||||
//
|
||||
// }
|
||||
// String rewardByRank = getRewardByRank(rank++, type);
|
||||
// if (!"".equals(rewardByRank)) {
|
||||
// MailLogic.getInstance().sendMail(user.getId(), title, content, rewardByRank, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
// }
|
||||
// }
|
||||
// MongoUtil.getInstence().lastUpdate();
|
||||
// }
|
||||
|
||||
public String getRewardByRank(int rank, int type) {
|
||||
Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
|
||||
for (SArenaReward sArenaReward : config.values()) {
|
||||
int minRank = sArenaReward.getMinRank();
|
||||
int maxRank = sArenaReward.getMaxRank();
|
||||
if (rank >= minRank && rank <= maxRank) {
|
||||
if (type == GlobalsDef.ARENA_DAILY_REWARD) {
|
||||
int[][] dailyReward = sArenaReward.getDailyReward();
|
||||
return StringUtil.parseArrayToString(dailyReward);
|
||||
} else {
|
||||
int[][] seasonReward = sArenaReward.getSeasonReward();
|
||||
return StringUtil.parseArrayToString(seasonReward);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public void lastSaved() {
|
||||
map.forEach((integer, strings) -> {
|
||||
HashMap<Integer, ArenaEnemy> orDefault = ranInfo.getOrDefault(integer, new HashMap<>());
|
||||
|
|
@ -429,4 +340,65 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
|
||||
public PlayerInfoProto.RankResponse getRank(int uid,int serverID) throws Exception {
|
||||
|
||||
Integer integer = ArenaLogic.serverSplit.get(String.valueOf(serverID));
|
||||
HashMap<Integer, ArenaEnemy> integerIntegerHashMap = ArenaLogic.ranInfo.get(integer);
|
||||
//获取我的排名
|
||||
Map.Entry<Integer, ArenaEnemy> myRank = ArenaLogic.getKey(integerIntegerHashMap,uid);
|
||||
//根据我的排名获取
|
||||
int myIndex = 9999;
|
||||
if (myRank != null) {
|
||||
myIndex = myRank.getKey();
|
||||
}
|
||||
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
|
||||
for (int i = 1; i < (uid==0?integerIntegerHashMap.size():100); i++) {
|
||||
ArenaEnemy arenaEnemy = integerIntegerHashMap.get(i);
|
||||
if (arenaEnemy.getEnemyType() == 1) {
|
||||
int enemyId = arenaEnemy.getEnemyId();
|
||||
int enemyType = arenaEnemy.getEnemyType();
|
||||
int rank = arenaEnemy.getRank();//only robot
|
||||
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.WORLD_ARENA_MY_PRON,String.valueOf(uid), 0, -1);
|
||||
CommonProto.ArenaEnemy arenaEnemy1 = getArenaEnemy(enemyId, arenaEnemy.getServerID(), enemyType, rank, arenaEnemy.getWorshipTime(), strings.contains(arenaEnemy.getEnemyId_UUid()));
|
||||
CommonProto.RankInfo everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(i).setParam1(arenaEnemy1.getPersonInfo().getTotalForce()).build();
|
||||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setUid(arenaEnemy1.getPersonInfo().getUid())
|
||||
.setUserName(arenaEnemy1.getPersonInfo().getName())
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setServerName(arenaEnemy1.getPersonInfo().getServername());
|
||||
builder.addRanks(everyRank);
|
||||
|
||||
} else {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(arenaEnemy.getEnemyId());
|
||||
CommonProto.RankInfo everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(i).setParam1(sArenaRobotConfig.getTotalForce()).build();
|
||||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setUid(arenaEnemy.getEnemyId())
|
||||
.setUserName(sArenaRobotConfig.getRobotName())
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setForce(sArenaRobotConfig.getTotalForce())
|
||||
.setServerName(MongoUtil.getInstence().getServerNameById(arenaEnemy.getServerID()));
|
||||
builder.addRanks(everyRank);
|
||||
}
|
||||
}
|
||||
|
||||
if(uid!=0){
|
||||
CommonProto.ArenaEnemy arenaEnemy1 = getArenaEnemy(uid, serverID, 1, myIndex,0, true);
|
||||
CommonProto.RankInfo everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(myIndex)
|
||||
.setParam1(arenaEnemy1.getPersonInfo().getTotalForce())
|
||||
.build();
|
||||
builder.setMyRankInfo(everyRankInfo);
|
||||
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ public abstract class AbstractCrossRank extends AbstractRank {
|
|||
|
||||
private static Map<Integer, GuildInfoCache> crossGuildMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static Map<Integer, PlayerInfoCache> getCrossUserMap() {
|
||||
return crossUserMap;
|
||||
}
|
||||
|
||||
public AbstractCrossRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.world.logic.rank;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.logic.dao.GuildInfoCache;
|
||||
import com.ljsd.jieling.logic.family.DeathChallengeCount;
|
||||
import com.world.db.mongo.MongoUtil;
|
||||
import com.world.redis.RedisUtil;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/12/11
|
||||
* @discribe
|
||||
*/
|
||||
public class WorldArenaRank extends AbstractCrossRank {
|
||||
public WorldArenaRank(String redisKey) {
|
||||
super(1, redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] getDataByScore(Double score) {
|
||||
BigDecimal bigDecimal = new BigDecimal(score.toString()).subtract(new BigDecimal(score.intValue())).multiply(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
return new long[]{bigDecimal.longValue(),score.intValue()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
BigDecimal decimal = null;
|
||||
decimal = new BigDecimal(String.valueOf(data[0])).divide(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
if(data.length>1){
|
||||
decimal = decimal.add(new BigDecimal(data[1]));
|
||||
}
|
||||
return decimal.doubleValue();
|
||||
}
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
|
||||
GuildInfoCache crossGuild = getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().getObject(crossGuild.getServerId()+":"+RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT+":"+String.valueOf(data.getValue()), DeathChallengeCount.class);
|
||||
GuildInfoCache everyGuild =getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size());
|
||||
CommonProto.UserRank.Builder oneUserRank = getOneUserRank(everyGuild, everyRankInfo);
|
||||
builder.addRanks(oneUserRank);
|
||||
}
|
||||
|
||||
public CommonProto.UserRank.Builder getOneUserRank(GuildInfoCache everyGuild,CommonProto.RankInfo.Builder everyRankInfo) throws Exception {
|
||||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setUid(everyGuild.getGuildId())
|
||||
.setGuildName(everyGuild.getGuildName())
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setServerName(MongoUtil.getInstence().getServerNameById(everyGuild.getServerId()));
|
||||
|
||||
return everyRank;
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ public class gsHelper extends GlobalProtocolsManager {
|
|||
|
||||
public static <T extends GeneratedMessage> T sendMessageToGs(int serverId,int uid, GeneratedMessage message,Class<T> protoClazz)throws Exception{
|
||||
|
||||
ClientAdapterPo<RPCwTgRequestIFace.Client> rPCClient = null;
|
||||
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisKey.LOGIC_SERVER_INFO, String.valueOf(serverId), String.class, -1);
|
||||
if (null == rpcString) {
|
||||
LOGGER.error("Exception send err rpcString dsid=>{},uid=>{},cmd=>{}", serverId, uid);
|
||||
|
|
@ -73,10 +73,11 @@ public class gsHelper extends GlobalProtocolsManager {
|
|||
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
ClientAdapterPo<RPCwTgRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = StringUtil.getServiceKey(ServiceKey.RPC_WORLD, thriftIp,thriftPort);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
InnerResult innerResult = rPCClient.getClient().messageRequest(uid,getProtoIdBySimpleName(message.getClass().getSimpleName()) , ByteBuffer.wrap(message.toByteArray()));
|
||||
InnerResult innerResult = rPCClient.getClient().messageRequest(uid,getProtoIdBySimpleName(message.getClass().getSimpleName()) , ByteBuffer.wrap(message.toByteArray()));
|
||||
return gtGBaseHandler.getProto(protoClazz,innerResult.getMessage());
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("callback=>",e);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.world.thrift.idl.pool;
|
|||
|
||||
|
||||
import com.world.thrift.idl.RPCgTwRequestIFace;
|
||||
import com.world.thrift.idl.RPCwTgRequestIFace;
|
||||
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
|
|
@ -39,6 +40,9 @@ public class ClientAdapterPo<T>{
|
|||
if(key[0].equals(ServiceKey.RPC_GS)){
|
||||
return new RPCgTwRequestIFace.Client(protocol);
|
||||
}
|
||||
if(key[0].equals(ServiceKey.RPC_WORLD)){
|
||||
return new RPCwTgRequestIFace.Client(protocol);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.world.thrift.idl.pool;
|
||||
|
||||
import com.world.config.ConfigurableApplicationContextManager;
|
||||
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
|
@ -43,9 +44,8 @@ public class ThriftPoolUtils {
|
|||
}
|
||||
return instance;
|
||||
}
|
||||
public void initContext(ConfigurableApplicationContext configurableApplicationContext){
|
||||
this.configurableApplicationContext = configurableApplicationContext;
|
||||
WorldThriftPoolAutoConfiguration thriftPool = configurableApplicationContext.getBean(WorldThriftPoolAutoConfiguration.class);
|
||||
public void initContext(){
|
||||
WorldThriftPoolAutoConfiguration thriftPool = ConfigurableApplicationContextManager.getBean(WorldThriftPoolAutoConfiguration.class);
|
||||
|
||||
pool = thriftPool.thriftPool();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ public class WorldThriftFactory extends BaseKeyedPooledObjectFactory<String, TTr
|
|||
|
||||
if (key.equals(ServiceKey.RPCCore)){
|
||||
transport = new TSocket(host, port);
|
||||
}else if (key.equals(ServiceKey.RPC_WORLD)){
|
||||
transport = new TSocket(host, port);
|
||||
}
|
||||
|
||||
if (transport!=null){
|
||||
|
|
|
|||
Loading…
Reference in New Issue