跨服排行榜
parent
657519a083
commit
66c2617d7f
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.db.mongo.MongoUtil;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.ServerConfig;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.rank.CrossRankManager;
|
||||
import com.ljsd.jieling.network.NetManager;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import config.SGameSetting;
|
||||
|
@ -59,6 +61,8 @@ public class GameApplication {
|
|||
GameLogicService.getInstance().onStart();
|
||||
NetManager.getInstance().init();
|
||||
SkyEyeService.getInstance().onStart();
|
||||
CrossDeathPathLogic.getInstance().serverInit();
|
||||
CrossRankManager.getInstance().guildCacheHandle();
|
||||
//控制台gm
|
||||
Scanner sc = new Scanner(System.in);
|
||||
while(sc.hasNext())
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.db.redis;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -336,6 +335,10 @@ public class RedisKey {
|
|||
|
||||
public static final String WORLD_ARENA_RRECORD = "WORLD_ARENA_RRECORD";
|
||||
|
||||
public static final String GUILD_LEADER_CACHE = "GUILD_LEADER_CACHE";
|
||||
|
||||
public static final String CROSS_RANK_UPDATE_VERSION = "CROSS_RANK_UPDATE_VERSION";
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
|
||||
public static Set<String> newAreaCacChe = new HashSet<>();//进程排行 合区统一
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler;
|
|||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
|
@ -11,11 +12,12 @@ import rpc.protocols.PlayerInfoProto;
|
|||
* @Description: 跨服信息
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class GetCrossServerHandler extends BaseHandler<PlayerInfoProto.IsCrossRequert> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GetCrossServerRequest;
|
||||
return MessageTypeProto.MessageType.IsCrossRequert;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,7 +95,7 @@ public class FamilyFeteRequestHandler extends BaseHandler<Family.FamilyFeteReque
|
|||
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
int defendForce = 0;
|
||||
if (proto.getChallengeUid()>1000) {
|
||||
ArenaOfUser arenaOfUser = CrossServiceLogic.getInstance().query(proto.getChallengeUid());
|
||||
teamInfo = FightUtil.makeCrossPersonData(arenaOfUser);
|
||||
teamInfo = FightUtil.makeCrossPersonData(arenaOfUser,proto.getTeamId());
|
||||
arenaEnemys =ArenaLogic.getInstance().getUserCrossArenaEnemy(crossGroup,arenaOfUser,proto.getChallengeRank(),false).build();
|
||||
defendForce = arenaOfUser.getHeroManager().getTotalForce();
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -8,23 +7,15 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.CrossArenaEnemy;
|
||||
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 org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import rpc.world.WorldProto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInfoRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
@ -62,7 +53,7 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
|
|||
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId());
|
||||
}else{
|
||||
//真人
|
||||
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossHeroInfo(proto.getTargetUid(), proto.getHeroId());
|
||||
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE,viewHeroInfoResponse,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -36,7 +35,7 @@ public class Cmd_addfete extends GmRoleAbstract {
|
|||
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.activity.IEventHandler;
|
|||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.rank.CrossRankManager;
|
||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGlobalActivity;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.springframework.data.mongodb.core.query.Update;
|
|||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
|
@ -164,7 +165,7 @@ public class CrossServiceLogic {
|
|||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
set.forEach(v->{
|
||||
Hero hero = heroMap.get(v.getHeroId());
|
||||
heroes.put(v.getHeroId(),buildArenaOfHero(user,hero));
|
||||
heroes.put(v.getHeroId(),buildArenaOfHero(user,hero,teams));
|
||||
});
|
||||
// 魂宝灵宝
|
||||
Map<String, PropertyItem> jewels = new HashMap<>();
|
||||
|
@ -180,7 +181,7 @@ public class CrossServiceLogic {
|
|||
return arenaOfHeroManager;
|
||||
}
|
||||
|
||||
private ArenaOfHero buildArenaOfHero(User user,Hero hero){
|
||||
private ArenaOfHero buildArenaOfHero(User user,Hero hero, Map<Integer,List<TeamPosHeroInfo>> teamMap){
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
ArenaOfHero arenaOfHero = new ArenaOfHero();
|
||||
arenaOfHero.setId(hero.getId());
|
||||
|
@ -196,8 +197,16 @@ public class CrossServiceLogic {
|
|||
arenaOfHero.setJewelInfo(new HashSet<>(hero.getJewelInfo()));
|
||||
arenaOfHero.setCreateTime(hero.getCreateType());
|
||||
arenaOfHero.setChangeId(hero.getChangeId());
|
||||
Map<Integer, Long> attribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, GlobalsDef.WORLD_TEAM_ARENA_DEFENSE);
|
||||
arenaOfHero.setAttributeMap(attribute);
|
||||
for (Map.Entry<Integer, List<TeamPosHeroInfo>> entry : teamMap.entrySet()) {
|
||||
Integer teamId = entry.getKey();
|
||||
List<TeamPosHeroInfo> teamList = entry.getValue();
|
||||
List<TeamPosHeroInfo> collect = teamList.stream().filter(v -> v.getHeroId().equals(hero.getId())).collect(Collectors.toList());
|
||||
if (collect.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
Map<Integer, Long> attribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
arenaOfHero.putAttributeMapByTeam(teamId,attribute);
|
||||
}
|
||||
return arenaOfHero;
|
||||
}
|
||||
|
||||
|
|
|
@ -645,7 +645,7 @@ public class ArenaLogic {
|
|||
//跨服切磋
|
||||
ArenaOfUser user = CrossServiceLogic.getInstance().query(challengeUid);
|
||||
deforce= user.getHeroManager().getTotalForce();
|
||||
deffightTeamInfo = FightUtil.makeCrossPersonData(user);
|
||||
deffightTeamInfo = FightUtil.makeCrossPersonData(user,myteamId);
|
||||
}
|
||||
if(myforce<deforce){
|
||||
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
||||
|
|
|
@ -26,6 +26,7 @@ public class ArenaOfHero {
|
|||
private int changeId;
|
||||
private Set<String> jewelInfo = new HashSet<>();
|
||||
private Map<Integer,Long> attributeMap = new HashMap<>();
|
||||
private Map<Integer,Map<Integer,Long>> attributeMapByTeam = new HashMap<>();
|
||||
|
||||
public ArenaOfHero(String id, int templateId, int level, int star, Map<Integer, Integer> equipByPositionMap, Map<Integer, Integer> soulEquipByPositionMap, int breakId, int starBreakId, int createTime, int especialEquipLevel, int createType, int changeId, Set<String> jewelInfo) {
|
||||
this.id = id;
|
||||
|
@ -158,4 +159,20 @@ public class ArenaOfHero {
|
|||
public void setAttributeMap(Map<Integer, Long> attributeMap) {
|
||||
this.attributeMap = attributeMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, Long>> getAttributeMapByTeam() {
|
||||
return attributeMapByTeam;
|
||||
}
|
||||
|
||||
public void setAttributeMapByTeam(Map<Integer, Map<Integer, Long>> attributeMapByTeam) {
|
||||
this.attributeMapByTeam = attributeMapByTeam;
|
||||
}
|
||||
|
||||
public void putAttributeMapByTeam(int teamId,Map<Integer, Long> attributeMap) {
|
||||
if (attributeMapByTeam == null){
|
||||
attributeMapByTeam = new HashMap<>();
|
||||
}
|
||||
attributeMapByTeam.put(teamId,attributeMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
package com.ljsd.jieling.logic.dao.gm;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/17 15:16
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class GuildCache {
|
||||
|
||||
private int serverId;
|
||||
|
@ -10,6 +15,8 @@ public class GuildCache {
|
|||
|
||||
private String name;
|
||||
|
||||
private int leaderUId;
|
||||
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
@ -42,10 +49,31 @@ public class GuildCache {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public GuildCache(int serverId, int icon, int level, String name) {
|
||||
public int getLeaderUId() {
|
||||
return leaderUId;
|
||||
}
|
||||
|
||||
public void setLeaderUId(int leaderUId) {
|
||||
this.leaderUId = leaderUId;
|
||||
}
|
||||
|
||||
public GuildCache(int serverId, int icon, int level, String name, int leaderUId) {
|
||||
this.serverId = serverId;
|
||||
this.icon = icon;
|
||||
this.level = level;
|
||||
this.name = name;
|
||||
this.leaderUId = leaderUId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建工会缓存
|
||||
* @param guildInfo
|
||||
* @return
|
||||
*/
|
||||
public static GuildCache create(GuildInfo guildInfo){
|
||||
int serverId = GameApplication.serverId;
|
||||
Set<Integer> set = guildInfo.getMembers().get(GlobalsDef.CHAIRMAN);
|
||||
Integer userId = set.iterator().next();
|
||||
return new GuildCache(serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName(), userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,7 @@ import util.TimeUtils;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
|
@ -137,11 +134,14 @@ public class CrossDeathPathLogic {
|
|||
* @return
|
||||
*/
|
||||
public String getServerName(int serverId){
|
||||
String name = String.valueOf(serverId);
|
||||
CServerInfo cServerInfo = cServerInfoMap.get(serverId);
|
||||
if(cServerInfo==null){
|
||||
return String.valueOf(serverId);
|
||||
serverInit();
|
||||
cServerInfo = cServerInfoMap.get(serverId);
|
||||
}
|
||||
return cServerInfo.getName();
|
||||
name = cServerInfo!=null?cServerInfo.getName():name;
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getServerNameByDeathPath(int serverId){
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.RewardStaticConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -26,20 +25,26 @@ import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
|||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.Family;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.AyyncWorker;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.*;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGuildCheckpointConfig;
|
||||
import config.SGuildCheckpointRank;
|
||||
import config.SGuildLevelConfig;
|
||||
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.Family;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
|
@ -218,7 +223,7 @@ public class GuildChallengeLogic {
|
|||
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
||||
}
|
||||
|
@ -249,7 +254,7 @@ public class GuildChallengeLogic {
|
|||
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), new GuildCache(GameApplication.serverId, guildInfo.getIcon(), guildInfo.getLevel(), guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ public class GuildFightLogic {
|
|||
// GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
|
||||
.setLevel(enemyInfo.getLevel())
|
||||
.setName(enemyInfo.getName())
|
||||
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse(""))
|
||||
.setPictureId(enemyInfo.getIcon())
|
||||
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
||||
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildInfo.getId()),Integer.class))
|
||||
|
@ -567,7 +567,7 @@ public class GuildFightLogic {
|
|||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder()
|
||||
.setId(enemyFamily)
|
||||
.setLevel(enemyInfo.getLevel())
|
||||
.setName(enemyInfo.getName())
|
||||
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse(""))
|
||||
.setPictureId(enemyInfo.getIcon())
|
||||
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
||||
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildId),Integer.class))
|
||||
|
@ -819,7 +819,7 @@ public class GuildFightLogic {
|
|||
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),new GuildCache(GameApplication.serverId,guildInfo.getIcon(),guildInfo.getLevel(),guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo));
|
||||
}else{
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,8 @@ public class GuildLogic {
|
|||
GuilidManager.addGuildInfo(guildInfo);
|
||||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),new GuildCache(GameApplication.serverId,guildInfo.getIcon(),guildInfo.getLevel(),guildInfo.getName()));
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo));
|
||||
|
||||
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||
cache.setGuildPosition(GlobalsDef.CHAIRMAN);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(uid),cache);
|
||||
|
@ -1145,8 +1146,9 @@ public class GuildLogic {
|
|||
if (!b){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(playerInfoManager.getGuildId()),new GuildCache(GameApplication.serverId,iconId,GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getLevel(),GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getName()));
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId());
|
||||
guildInfo.updateIcon(iconId);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(playerInfoManager.getGuildId()),GuildCache.create(guildInfo));
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.Hero;
|
|||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfHero;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfHeroManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
|
@ -569,17 +570,18 @@ public class FightUtil {
|
|||
robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid,property.getSkillPool()-1));
|
||||
return robotInfo;
|
||||
}
|
||||
public static CommonProto.FightTeamInfo makeCrossPersonData(ArenaOfUser arenaOfUser){
|
||||
public static CommonProto.FightTeamInfo makeCrossPersonData(ArenaOfUser arenaOfUser,int teamId){
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = arenaOfUser.getHeroManager().getTeams().get(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE);
|
||||
ArenaOfHeroManager heroManager = arenaOfUser.getHeroManager();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = heroManager.getTeams().get(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE);
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
ArenaOfHero hero = arenaOfUser.getHeroManager().getHeros().get(teamPosHeroInfo.getHeroId());
|
||||
ArenaOfHero hero = heroManager.getHeros().get(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = HeroLogic.getInstance().getCrossHeroSkillStr(arenaOfUser,hero).toString();
|
||||
Map<Integer, Long> attributeMap = arenaOfUser.getHeroManager().getHeros().get(hero.getId()).getAttributeMap();
|
||||
Map<Integer, Long> attributeMap = heroManager.getHeros().get(hero.getId()).getAttributeMapByTeam().get(teamId);
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb,hero.getTemplateId(),hero.getLevel(),attributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
|
|
|
@ -747,9 +747,14 @@ public class PlayerLogic {
|
|||
|
||||
}
|
||||
|
||||
//查看跨服英雄信息
|
||||
public PlayerInfoProto.ViewHeroInfoResponse viewCrossHeroInfo(int uid,String heroId) throws Exception {
|
||||
|
||||
/**
|
||||
* 查看跨服英雄信息
|
||||
* @param uid
|
||||
* @param heroId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PlayerInfoProto.ViewHeroInfoResponse viewCrossHeroInfo(int uid,String heroId,int teamId) throws Exception {
|
||||
|
||||
ArenaOfUser query = CrossServiceLogic.getInstance().query(uid);
|
||||
|
||||
|
@ -761,7 +766,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.getAttributeMap();
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/7/28 18:09:00
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class CrossRankManager {
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CrossRankManager.class);
|
||||
|
||||
/**
|
||||
* 单例
|
||||
*/
|
||||
private CrossRankManager(){}
|
||||
public static class Instance {
|
||||
private final static CrossRankManager INSTANCE = new CrossRankManager();
|
||||
}
|
||||
public static CrossRankManager getInstance() {
|
||||
return CrossRankManager.Instance.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上次排行榜初始化时间
|
||||
*/
|
||||
private long time = 0L;
|
||||
|
||||
/**
|
||||
* 是否需要进行数据处理
|
||||
*/
|
||||
// public void isDataHandle(){
|
||||
// LOGGER.info("==========================开始验证是否需要进行跨服数据处理");
|
||||
// // 获取全部服务器分组信息
|
||||
// Map<Integer, Integer> groupValues = RedisUtil.getInstence().getMapValues(RedisKey.SERVER_SPLIT_INFO, "", Integer.class, Integer.class);
|
||||
// if (groupValues == null || groupValues.isEmpty()){
|
||||
// return;
|
||||
// }
|
||||
// // 获取本服id和本服的分组信息
|
||||
// int serverId = GameApplication.serverId;
|
||||
// Integer groupId = groupValues.get(serverId);
|
||||
// if (groupId == null || groupId <= 0){
|
||||
// return;
|
||||
// }
|
||||
// // stream聚合, 筛选条件value==groupId, 正序返回
|
||||
// List<Integer> list = groupValues.entrySet().stream().filter(v -> v.getValue().equals(groupId)).map(Map.Entry::getKey).sorted().collect(Collectors.toList());
|
||||
// // 缓存服务器列表,其他地方会用
|
||||
// serverListByGroup.clear();
|
||||
// serverListByGroup.addAll(list);
|
||||
// LOGGER.info("==========================验证是否需要进行跨服数据处理结果");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 跨服排行处理
|
||||
*/
|
||||
public void crossRankHandle(){
|
||||
if (!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.getRedisKey(),String.valueOf(crossGroup),false);
|
||||
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()));
|
||||
}
|
||||
RedisUtil.getInstence().zsetAddOne(key,tuple.getValue(),tuple.getScore());
|
||||
}
|
||||
LOGGER.info("=====================跨服排行榜处理========,key:{}",key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 每隔两小时刷新一次
|
||||
* @return
|
||||
*/
|
||||
private boolean isTime(){
|
||||
long now = TimeUtils.now();
|
||||
long twoHour = TimeUtils.HOUR * 2;
|
||||
if (now >= twoHour+time){
|
||||
time = now;
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工会缓存处理
|
||||
*/
|
||||
public void guildCacheHandle(){
|
||||
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
|
||||
for (Map.Entry<Integer, GuildInfo> entry : guildInfoMap.entrySet()) {
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(entry.getValue().getId()), GuildCache.create(entry.getValue()));
|
||||
}
|
||||
LOGGER.info("==================工会缓存处理=============");
|
||||
}
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@ public class RankContext {
|
|||
public static boolean isCrossRank(int type){
|
||||
return RankEnum.isCross(type);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isCrossRank2(int type){
|
||||
return RankEnum.isCross2(type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,18 @@ 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),//世界服排行
|
||||
SHAN_HE_SHE_JI_CHAPTER_RANK(29,RedisKey.SHAN_HE_SHE_JI_CHAPTER_RANK,ShanHeSheJiTuChapterRank::new,false),//山河社稷章节排行榜
|
||||
SHAN_HE_SHE_JI_STAR_RANK(30,RedisKey.SHAN_HE_SHE_JI_STAR_RANK,ShanHeSheJiTuStarRank::new,false),//山河社稷星星排行榜
|
||||
TA_SUI_LING_XIAO_RANK(31,RedisKey.TA_SUI_LING_XIAO_RANK,TaSuiLingXiaoRank::new,false),
|
||||
|
||||
CROSS_SERVICE_ARENA(32,RedisKey.CROSS_SERVICE_ARENA,CrossArenaRank::new,true)
|
||||
// 以下为跨服排行榜
|
||||
WARLD_DIS_ARENA_RANK(28,RedisKey.WARLD_DIS_ARENA_RANK,ArenaRank::new,true),//世界服排行
|
||||
CROSS_SERVICE_ARENA(32,RedisKey.CROSS_SERVICE_ARENA,CrossArenaRank::new,true),// 跨服罗浮争锋
|
||||
|
||||
CROSS_FORCE_CURR_RANK(33,RedisKey.FORCE_CURR_RANK,ForceRank::new,true),// 跨服战力排行榜
|
||||
CROSS_MONSTER_ATTACK_RANK(34,RedisKey.MONSTER_ATTACK_RANK,ForceRank::new,true),//跨服心魔
|
||||
CROSS_SHAN_HE_SHE_JI_STAR_RANK(35,RedisKey.SHAN_HE_SHE_JI_STAR_RANK,ForceRank::new,true),//山河社稷星星排行榜
|
||||
CROSS_GUILD_FORCE_RANK(36,RedisKey.GUILD_FORCE_RANK,CrossGuildForceRank::new,true),//跨服公会总战力排行
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
@ -83,6 +89,21 @@ public enum RankEnum {
|
|||
RankEnum rankEnum = rankMap.get(type);
|
||||
return rankEnum.isCross();
|
||||
}
|
||||
public static boolean isCross2(int type){
|
||||
boolean result = false;
|
||||
RankEnum rankEnum = rankMap.get(type);
|
||||
switch (rankEnum){
|
||||
case CROSS_FORCE_CURR_RANK:
|
||||
case CROSS_MONSTER_ATTACK_RANK:
|
||||
case CROSS_SHAN_HE_SHE_JI_STAR_RANK:
|
||||
case CROSS_GUILD_FORCE_RANK:
|
||||
result = rankEnum.isCross();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class RankLogic {
|
|||
}
|
||||
PlayerInfoProto.RankResponse rankResponse=null;
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
if(RankContext.isCrossRank(type) || isCross == 1){
|
||||
if(RankContext.isCrossRank(type) && isCross == 1){
|
||||
//跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(crossGroup>0){
|
||||
|
@ -208,7 +208,13 @@ public class RankLogic {
|
|||
int type = rankTypes.get(i);
|
||||
int param = activityId.get(i);
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(type);
|
||||
CommonProto.UserRank.Builder first = rankEnum.getFirst(param);
|
||||
CommonProto.UserRank.Builder first;
|
||||
int group = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (RankContext.isCrossRank2(type) && group != -1){
|
||||
first = rankEnum.getFirstByCross(String.valueOf(group));
|
||||
}else {
|
||||
first = rankEnum.getFirst(param);
|
||||
}
|
||||
response.addRanks(first.build());
|
||||
response.addProud(playerManager.getProudInfo().contains(type)?1:0);
|
||||
}
|
||||
|
|
|
@ -67,9 +67,39 @@ public abstract class AbstractRank implements IRank {
|
|||
* @throws Exception
|
||||
*/
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
int groupId = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
redisKey = RedisUtil.getInstence().getKey(String.valueOf(groupId),redisKey,false);
|
||||
return getRank(uid,rkey,page,rankEndLine);
|
||||
if(rankEndLine==-1){
|
||||
rankEndLine = 100;
|
||||
}
|
||||
User user = UserManager.getUser(uid);
|
||||
if (page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1;
|
||||
Set<ZSetOperations.TypedTuple<String>> scores = RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end, false);
|
||||
if(start%rankEndLine == 0){
|
||||
start++;
|
||||
}
|
||||
PlayerInfoProto.RankResponse.Builder allUserResponse = getAllUserResponse(scores,start);
|
||||
//当前用户信息
|
||||
getMyInfo(user,rkey,allUserResponse);
|
||||
return allUserResponse.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨服缓存玩家数据
|
||||
* @param uid
|
||||
* @throws Exception
|
||||
*/
|
||||
public void crossUserCache(int uid){
|
||||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null){
|
||||
return;
|
||||
}
|
||||
CrossServiceLogic.getInstance().dispose(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,6 +163,33 @@ public abstract class AbstractRank implements IRank {
|
|||
builder = getOneUserRank(everyUser,everyRankInfo);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取跨服排行第一
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CommonProto.UserRank.Builder getFirstByCross(String rKey) throws Exception {
|
||||
Set<ZSetOperations.TypedTuple<String>> rankByKey = RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey,rKey, 0, 0, false);
|
||||
CommonProto.UserRank.Builder builder = CommonProto.UserRank.newBuilder();
|
||||
if(rankByKey.size()!=1){
|
||||
return builder;
|
||||
}
|
||||
ZSetOperations.TypedTuple<String> data = rankByKey.iterator().next();
|
||||
LOGGER.info("有问题的ArenaId{}",Integer.parseInt(data.getValue()));
|
||||
User everyUser = UserManager.getUser(Integer.parseInt(data.getValue()), true);
|
||||
if (everyUser == null){
|
||||
return builder;
|
||||
}
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(1)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(getParam3(data.getScore()));
|
||||
builder = getOneUserRank(everyUser,everyRankInfo);
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores,int start) throws Exception{
|
||||
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
|
||||
forEach(start,zsetreverseRangeWithScores,(index,data)->{
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/6/8
|
||||
* @discribe
|
||||
*/
|
||||
public class CrossGuildForceRank extends GuildForceRank {
|
||||
public CrossGuildForceRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", data.getValue(), GuildCache.class);
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(getParam3(data.getScore()));
|
||||
ArenaOfUser query = CrossServiceLogic.getInstance().query(mapEntry.getLeaderUId());
|
||||
if (query == null){
|
||||
return;
|
||||
}
|
||||
CommonProto.UserRank.Builder oneUserRank = getOneUserRank(query, Integer.valueOf(data.getValue()), everyRankInfo);
|
||||
builder.addRanks(oneUserRank);
|
||||
}
|
||||
|
||||
private CommonProto.UserRank.Builder getOneUserRank(ArenaOfUser query, int guildId, CommonProto.RankInfo.Builder everyRankInfo){
|
||||
String serverName = CrossServiceLogic.getInstance().getServerNameByUId(query.getId());
|
||||
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildId), GuildCache.class);
|
||||
return CommonProto.UserRank.newBuilder()
|
||||
.setUid(query.getId())
|
||||
.setLevel(query.getPlayerManager().getLevel())
|
||||
.setGuildName(Optional.ofNullable(mapEntry).map(GuildCache::getName).orElse(""))
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setSex(query.getPlayerManager().getGender())
|
||||
.setHead(query.getPlayerManager().getHead())
|
||||
.setHeadFrame(query.getPlayerManager().getHeadFrame())
|
||||
.setUserMount(query.getPlayerManager().getUserMount())
|
||||
.setUserSkin(query.getPlayerManager().getSkin())
|
||||
.setUserTitle(query.getPlayerManager().getUserTitle())
|
||||
.setServerName(serverName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getMyInfo(User user, String rkey, PlayerInfoProto.RankResponse.Builder allUserResponse){
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if(guildId==0){
|
||||
return;
|
||||
}
|
||||
int myRank= RedisUtil.getInstence().getZSetreverseRank(redisKey,rkey,Integer.toString(guildId)).intValue();
|
||||
Double zSetScore = RedisUtil.getInstence().getZSetScore(redisKey, rkey, Integer.toString(guildId));
|
||||
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(myRank)
|
||||
.setParam1(getParam1(zSetScore))
|
||||
.setParam2(getParam2(zSetScore)).build();
|
||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonProto.UserRank.Builder getFirstByCross(String rKey) throws UnknownHostException {
|
||||
Set<ZSetOperations.TypedTuple<String>> rankByKey = RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey,rKey, 0, 0, false);
|
||||
CommonProto.UserRank.Builder builder = CommonProto.UserRank.newBuilder();
|
||||
if(rankByKey.size()!=1){
|
||||
return builder;
|
||||
}
|
||||
ZSetOperations.TypedTuple<String> data = rankByKey.iterator().next();
|
||||
|
||||
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", data.getValue(), GuildCache.class);
|
||||
if (mapEntry == null){
|
||||
return builder;
|
||||
}
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(1)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(getParam3(data.getScore()));
|
||||
ArenaOfUser query = CrossServiceLogic.getInstance().query(mapEntry.getLeaderUId());
|
||||
if (query == null){
|
||||
return builder;
|
||||
}
|
||||
builder = getOneUserRank(query, Integer.valueOf(data.getValue()), everyRankInfo);
|
||||
return builder;
|
||||
}
|
||||
}
|
|
@ -49,7 +49,6 @@ public class ForceCurrRank extends AbstractRank implements IEventHandler{
|
|||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
RankContext.getRankEnum(RankEnum.FORCE_CURR_RANK.getType());
|
||||
if(event instanceof UserMainTeamForceEvent){
|
||||
infoQueue.offer((UserMainTeamForceEvent)event);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/27
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.ljsd.jieling.logic.family.GuildLogic;
|
|||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.question.QuestionLogic;
|
||||
import com.ljsd.jieling.logic.rank.CrossRankManager;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
|
@ -144,6 +145,13 @@ public class MinuteTask extends Thread {
|
|||
LOGGER.error("Exception::=>{}",e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
CrossRankManager.getInstance().crossRankHandle();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("跨服排行榜初始化一次,Exception::=>{}",e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
ArenaLogic.getInstance().worldSendReward();
|
||||
if(STableManager.getConfig(SRechargeCommodityNewConfig.class).size()!= SRechargeCommodityNewConfig.configMap.size()){
|
||||
|
@ -245,8 +253,6 @@ public class MinuteTask extends Thread {
|
|||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
}
|
||||
// 跨服服务器刷新
|
||||
CrossDeathPathLogic.getInstance().serverInit();
|
||||
// LOGGER.info("{}更新公会援助完毕",guildInfoEntry.getValue().getName());
|
||||
|
||||
// //统一清除
|
||||
|
|
Loading…
Reference in New Issue