Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into master_test_gn
commit
346feae774
|
@ -208,12 +208,15 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
|
||||
}
|
||||
public void doSplit(){
|
||||
LOGGER.info("跨服分组验证处理");
|
||||
if(!GameApplication.serverProperties.isArenaCross()){
|
||||
LOGGER.error("跨服分组,测试服不做分组");
|
||||
return;
|
||||
}
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
Object matched = redisUtil.get(RedisKey.MATCHED_SPLIT_KEY);
|
||||
if(matched!=null){
|
||||
LOGGER.error("跨服分组,获取key:【MATCHED_SPLIT_KEY】失败, info:{}",matched.toString());
|
||||
return;
|
||||
}
|
||||
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(1);
|
||||
|
@ -221,6 +224,7 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
boolean lock = redisUtil.lock("SERVER_SPLIT_REDIS_LOCK", TimeUtils.ONE_MINUTE * 2);
|
||||
if(!lock){
|
||||
//没有拿到锁直接返回
|
||||
LOGGER.error("跨服分组,未获取到锁");
|
||||
return;
|
||||
}
|
||||
//这里为所有服务器的世界等级
|
||||
|
|
|
@ -214,7 +214,7 @@ public class CrossServiceLogic {
|
|||
if (collect.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
Map<Integer, Long> attribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
Map<Integer, Long> attribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, true, teamId);
|
||||
arenaOfHero.putAttributeMapByTeam(teamId,attribute);
|
||||
}
|
||||
return arenaOfHero;
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.fight.*;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
@ -860,7 +861,7 @@ public class ArenaLogic {
|
|||
int server = random.nextInt(groupList.size());
|
||||
rank.addRank(robotIndex,String.valueOf(crossGroup),robotNum-robotIndex);
|
||||
SArenaRobotConfig config = SArenaRobotConfig.getsArenaRobotConfigById(robotIds.get(robotIndex));
|
||||
robotInfo.put(String.valueOf(robotIndex),new CrossArenaEnemy(robotIds.get(robotIndex),robotIndex,groupList.get(server),0,0,random.nextBoolean(),PlayerLogic.getInstance().getRandomName2WithOutVerify(),config.getTotalForce()));
|
||||
robotInfo.put(String.valueOf(robotIndex),new CrossArenaEnemy(robotIds.get(robotIndex),robotIndex,groupList.get(server),0,0,random.nextBoolean(),PlayerLogic.getInstance().getRandomName2WithOutVerify(),config.getTotalForce(),config.getRoleLv()));
|
||||
|
||||
}
|
||||
LOGGER.info("跨服信息初始化结束");
|
||||
|
@ -969,11 +970,12 @@ public class ArenaLogic {
|
|||
Object get = RedisUtil.getInstence().hget(RedisKey.ARENA_PROUD_COUNT, String.valueOf(enemy.getId()));
|
||||
int proudTime = get==null?1:Integer.parseInt((String)get);
|
||||
int enemyId = enemy.getId();
|
||||
String serverName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(enemy.getPlayerManager().getServerId());
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemyId)
|
||||
.setLevel(enemy.getPlayerManager().getLevel())
|
||||
.setName(enemy.getPlayerManager().getName())
|
||||
.setServername(enemy.getPlayerManager().getServerName())
|
||||
.setServername(serverName)
|
||||
.setTotalForce(enemy.getHeroManager().getTotalForce())
|
||||
.setUserTitle(enemy.getPlayerManager().getUserTitle())
|
||||
.setUserMount(enemy.getPlayerManager().getUserMount())
|
||||
|
@ -993,13 +995,14 @@ public class ArenaLogic {
|
|||
int enemyId = enemy.getEnemyId();
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(enemyId);
|
||||
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(sArenaRobotConfig.getHeroList()).build();
|
||||
String serverName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(enemy.getServerID());
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemy.getEnemyId_UUid())
|
||||
.setLevel(sArenaRobotConfig.getRobotLevel())
|
||||
.setName(enemy.getRandomName()==null?"":enemy.getRandomName())
|
||||
.setScore(sArenaRobotConfig.getRobotScore())
|
||||
.setTotalForce(sArenaRobotConfig.getTotalForce())
|
||||
.setServername(CrossServiceLogic.getInstance().findServerName(enemy.getServerID()))
|
||||
.setServername(serverName)
|
||||
.setUserSkin(80012)
|
||||
.setGender(enemy.isGender()?1:0)
|
||||
.setRank(rank)
|
||||
|
|
|
@ -17,6 +17,7 @@ public class CrossArenaEnemy {
|
|||
private boolean gender;
|
||||
private String randomName;
|
||||
private int totalForce;
|
||||
private int level;
|
||||
|
||||
public CrossArenaEnemy(int enemyId, int enemyId_UUid, int serverID, int enemyType, int enemyStatus, int rank) {
|
||||
this.enemyId = enemyId;
|
||||
|
@ -27,12 +28,13 @@ public class CrossArenaEnemy {
|
|||
this.rank = rank;
|
||||
}
|
||||
|
||||
public CrossArenaEnemy(int enemyId,int enemyId_UUid, int serverID, int enemyType, int enemyStatus,boolean gender,String randomName,int totalForce) {
|
||||
public CrossArenaEnemy(int enemyId,int enemyId_UUid, int serverID, int enemyType, int enemyStatus,boolean gender,String randomName,int totalForce,int level) {
|
||||
|
||||
this(enemyId,enemyId_UUid,serverID,enemyType,enemyStatus);
|
||||
this.gender=gender;
|
||||
this.randomName = randomName;
|
||||
this.totalForce = totalForce;
|
||||
this.level = level;
|
||||
}
|
||||
public CrossArenaEnemy(int enemyId,int enemyId_UUid, int serverID, int enemyType, int enemyStatus) {
|
||||
this.enemyId = enemyId;
|
||||
|
@ -91,4 +93,8 @@ public class CrossArenaEnemy {
|
|||
public int getTotalForce() {
|
||||
return totalForce;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -823,7 +823,7 @@ public class GuildLogic {
|
|||
throw new ErrorCodeException(ErrorCode.FAMILY_IN_SENSITIVE);
|
||||
}else{
|
||||
if(type==1){
|
||||
if(content.length()<0||content.length()>32){
|
||||
if(content.length() > 32){
|
||||
throw new ErrorCodeException(ErrorCode.ANNOUNCE_SIZE);
|
||||
}
|
||||
guildInfo.setAnnounce(content);
|
||||
|
@ -835,6 +835,8 @@ public class GuildLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
guildInfo.setName(content);
|
||||
// 缓存同步
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo));
|
||||
}
|
||||
MessageUtil.sendMessage(session,resultCode,msgId,response,true);
|
||||
}
|
||||
|
|
|
@ -434,9 +434,10 @@ public class MailLogic {
|
|||
public void sendCrossServerIndication(){
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
int result = crossGroup == -1 ? 0 : 1;
|
||||
PlayerInfoProto.IsCrossResponse build = PlayerInfoProto.IsCrossResponse.newBuilder().setIsCross(result).build();
|
||||
PlayerInfoProto.IsCrossIndication build = PlayerInfoProto.IsCrossIndication.newBuilder().setIsCross(result).build();
|
||||
for(ISession session:OnlineUserManager.sessionMap.values()){
|
||||
MessageUtil.sendIndicationMessage(session.getUid(),build);
|
||||
LOGGER.info("=====================开始跨服,推送数据到玩家信息:{},分组id:{}",session.getUid(),crossGroup);
|
||||
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.IsCrossIndication_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -771,6 +771,7 @@ public class PlayerLogic {
|
|||
}
|
||||
CommonProto.Hero.Builder heroBuilder = CommonProto.Hero.newBuilder().setLevel(hero.getLevel()).setEspecialEquipLevel(hero.getEspecialEquipLevel()).setStar(hero.getStar()).setId(hero.getId()).setHeroId(hero.getTemplateId()).setBreakId(hero.getBreakId()).setStarBreakId(hero.getStarBreakId());
|
||||
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
|
||||
|
||||
Map<Integer, Long> heroNotBufferAttribute = hero.getAttributeMapByTeam().getOrDefault(teamId,new HashMap<>());
|
||||
for(Map.Entry<Integer,Long> item : heroNotBufferAttribute.entrySet()){
|
||||
builder.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue().intValue()).build());
|
||||
|
|
|
@ -47,38 +47,40 @@ public class CrossRankManager {
|
|||
* 跨服排行处理
|
||||
*/
|
||||
public void crossRankHandle(boolean choice){
|
||||
if (choice || !isTime()){
|
||||
// 不是处理数据的服务器
|
||||
return;
|
||||
}
|
||||
for (RankEnum value : RankEnum.values()) {
|
||||
int type = value.getType();
|
||||
boolean rank2 = RankContext.isCrossRank2(type);
|
||||
if (rank2){
|
||||
//跨服
|
||||
if(RankContext.isCrossRank(type)){
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(crossGroup != -1){
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
Map<Integer, GuildCache> cacheMap = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_INFO, "", Integer.class, GuildCache.class);
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(rank.getRedisKey(), "", 0, 100, true);
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
if (tuple.getValue().length() == 8){
|
||||
rank.crossUserCache(Integer.parseInt(tuple.getValue()));
|
||||
}else {
|
||||
GuildCache cache = cacheMap.get(Integer.valueOf(tuple.getValue()));
|
||||
if (cache != null){
|
||||
rank.crossUserCache(cache.getLeaderUId());
|
||||
// 时间验证
|
||||
if (choice || isTime()){
|
||||
// 全部排行遍历
|
||||
for (RankEnum value : RankEnum.values()) {
|
||||
int type = value.getType();
|
||||
boolean rank2 = RankContext.isCrossRank2(type);
|
||||
if (rank2){
|
||||
//跨服
|
||||
if(RankContext.isCrossRank(type)){
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(crossGroup != -1){
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
Map<Integer, GuildCache> cacheMap = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_INFO, "", Integer.class, GuildCache.class);
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(rank.getRedisKey(), "", 0, 100, true);
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
if (tuple.getValue().length() == 8){
|
||||
rank.crossUserCache(Integer.parseInt(tuple.getValue()));
|
||||
}else {
|
||||
GuildCache cache = cacheMap.get(Integer.valueOf(tuple.getValue()));
|
||||
if (cache != null && cache.getLeaderUId() != 0){
|
||||
rank.crossUserCache(cache.getLeaderUId());
|
||||
}
|
||||
}
|
||||
RedisUtil.getInstence().zsetAddOne(key,tuple.getValue(),tuple.getScore());
|
||||
}
|
||||
RedisUtil.getInstence().zsetAddOne(key,tuple.getValue(),tuple.getScore());
|
||||
LOGGER.info("=====================跨服排行榜处理========,key:{}",key);
|
||||
}
|
||||
LOGGER.info("=====================跨服排行榜处理========,key:{}",key);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新时间
|
||||
isTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class CrossArenaRank extends AbstractRank {
|
|||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setUid(mapEntry.getEnemyId_UUid())
|
||||
.setUserName(mapEntry.getRandomName())
|
||||
.setLevel(100)
|
||||
.setLevel(mapEntry.getLevel()==0?100:mapEntry.getLevel())
|
||||
.setUserSkin(80012)
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setServerName(CrossServiceLogic.getInstance().findServerName(mapEntry.getServerID()))
|
||||
|
@ -108,6 +108,7 @@ public class CrossArenaRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
rkey = Integer.toString(GlobleSystemLogic.getInstence().getCrossGroup());
|
||||
return getRank(uid,rkey,page,rankEndLine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.rank.rankImpl;
|
|||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -60,6 +61,6 @@ public class MainLevelRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0]+ data[1]/Math.pow(10,8);
|
||||
return data[0]+ TimeUtils.getDoubleTime();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import util.TimeUtils;
|
||||
|
||||
public class ShanHeSheJiTuChapterRank extends AbstractRank{
|
||||
|
||||
public ShanHeSheJiTuChapterRank(int type, String redisKey) {
|
||||
|
@ -12,7 +14,7 @@ public class ShanHeSheJiTuChapterRank extends AbstractRank{
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0];
|
||||
return data[0]+ TimeUtils.getDoubleTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import util.TimeUtils;
|
||||
|
||||
public class ShanHeSheJiTuStarRank extends AbstractRank{
|
||||
|
||||
public ShanHeSheJiTuStarRank(int type, String redisKey) {
|
||||
|
@ -12,7 +14,7 @@ public class ShanHeSheJiTuStarRank extends AbstractRank{
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0];
|
||||
return data[0]+ TimeUtils.getDoubleTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.ktbeans.ReportUserEvent;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@Component
|
||||
public class DataReportTask extends Thread {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.dao.*;
|
|||
import com.ljsd.jieling.logic.dao.gm.ArenaOfHero;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
|
@ -550,7 +551,8 @@ public class CBean2Proto {
|
|||
chatInfo.setMessageId(messageId);
|
||||
chatInfo.setUserTitle(playerInfoManager.getUserTitle());
|
||||
chatInfo.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
chatInfo.setServerName(CrossServiceLogic.getInstance().findServerName(GameApplication.serverId));
|
||||
String serverName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(GameApplication.serverId);
|
||||
chatInfo.setServerName(serverName);
|
||||
return chatInfo.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue