Merge branch 'master_test_gn_arena' of http://60.1.1.230/backend/jieling_server into master_test_gn_arena
commit
ec519b4fb9
|
|
@ -7,6 +7,7 @@ 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;
|
||||
|
|
@ -61,6 +62,7 @@ public class GameApplication {
|
|||
NetManager.getInstance().init();
|
||||
SkyEyeService.getInstance().onStart();
|
||||
CrossDeathPathLogic.getInstance().serverInit();
|
||||
CrossRankManager.getInstance().guildCacheHandle();
|
||||
//控制台gm
|
||||
Scanner sc = new Scanner(System.in);
|
||||
while(sc.hasNext())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ljsd.jieling.db.redis;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -342,6 +342,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<>();//进程排行 合区统一
|
||||
|
|
@ -437,7 +441,4 @@ public class RedisKey {
|
|||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -984,10 +984,12 @@ public class RedisUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long getZSetreverseRank(String type,String key, String value){
|
||||
String rkey = getKey(type,key);
|
||||
return getZSetreverseRank(type,key,value,true);
|
||||
}
|
||||
|
||||
public Long getZSetreverseRank(String type,String key, String value, boolean choice){
|
||||
String rkey = getKey(type,key,choice);
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
Long rank = redisTemplate.opsForZSet().reverseRank(rkey, value);
|
||||
|
|
@ -1003,9 +1005,12 @@ public class RedisUtil {
|
|||
return -1L;
|
||||
}
|
||||
|
||||
|
||||
public Double getZSetScore(String type,String key, String value){
|
||||
String rkey = getKey(type, key);
|
||||
return getZSetScore(type,key,value,true);
|
||||
}
|
||||
|
||||
public Double getZSetScore(String type,String key, String value, boolean choice){
|
||||
String rkey = getKey(type, key, choice);
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
Double score = redisTemplate.opsForZSet().score(rkey, value);
|
||||
|
|
@ -1034,12 +1039,20 @@ public class RedisUtil {
|
|||
|
||||
}
|
||||
|
||||
public void incrementZsetScore(String type,String key, String value, int changeScore){
|
||||
incrementZsetScore(type,key,value,(double)(changeScore));
|
||||
public void incrementZsetScore(String type,String key, String value, int changeScore){
|
||||
incrementZsetScore(type,key,value,(double)(changeScore), true);
|
||||
}
|
||||
|
||||
public void incrementZsetScore(String type,String key, String value, double changeScore){
|
||||
String rkey = getKey(type, key);
|
||||
public void incrementZsetScore(String type,String key, String value, int changeScore, boolean choice){
|
||||
incrementZsetScore(type,key,value,(double)(changeScore), choice);
|
||||
}
|
||||
|
||||
public void incrementZsetScore(String type,String key, String value, double changeScore){
|
||||
incrementZsetScore(type,key,value,changeScore, true);
|
||||
}
|
||||
|
||||
public void incrementZsetScore(String type,String key, String value, double changeScore, boolean choice){
|
||||
String rkey = getKey(type, key,choice);
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
redisTemplate.opsForZSet().incrementScore(rkey,value,changeScore);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -251,6 +252,10 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
|
||||
index++;
|
||||
}
|
||||
// 跨服排行榜处理
|
||||
CrossRankManager.getInstance().cleanCrossRank();
|
||||
CrossRankManager.getInstance().crossRankHandle(true);
|
||||
|
||||
redisUtil.putMapEntrys(RedisKey.SERVER_SPLIT_INFO,"",split);
|
||||
//发分组邮件
|
||||
split.keySet().forEach(server->redisUtil.putMapEntry(RedisKey.SERVER_SPLIT_MAIL_INFO,"",server,0));
|
||||
|
|
|
|||
|
|
@ -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,14 +197,16 @@ public class CrossServiceLogic {
|
|||
arenaOfHero.setJewelInfo(new HashSet<>(hero.getJewelInfo()));
|
||||
arenaOfHero.setCreateTime(hero.getCreateType());
|
||||
arenaOfHero.setChangeId(hero.getChangeId());
|
||||
Map<Integer, Long> attribute = new HashMap<>();
|
||||
try {
|
||||
attribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, GlobalsDef.WORLD_TEAM_ARENA_DEFENSE);
|
||||
}catch (Exception e){
|
||||
LOGGER.error("英雄熟悉报错:{}",e.getMessage());
|
||||
attribute = new HashMap<>();
|
||||
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);
|
||||
}
|
||||
arenaOfHero.setAttributeMap(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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import com.ljsd.jieling.db.mongo.core.CServerInfo;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.GuildInfoCache;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.tools.Utils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -16,10 +19,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;
|
||||
|
||||
/**
|
||||
|
|
@ -93,26 +93,30 @@ public class CrossDeathPathLogic {
|
|||
//操作每个关的公会、个人数据
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(damage)).divide(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
long everyGuildChangeScore = (long)damage*1000;
|
||||
if(redisUtil.getZSetScore(groupId+":"+RedisKey.DEATH_PATH_EVERY_PERSON_RANK,String.valueOf(pathId), String.valueOf(uid))==-1){
|
||||
AbstractRank everyPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_EVERY_PERSON_RANK.getType());
|
||||
if(redisUtil.getZSetScore(everyPerson.getCrossRedisKey(),String.valueOf(pathId), String.valueOf(uid), false)==-1){
|
||||
//记录人数操作
|
||||
everyGuildChangeScore = everyGuildChangeScore+1;
|
||||
}
|
||||
|
||||
String before = firstGuild(redisUtil, groupId, pathId);
|
||||
redisUtil.incrementZsetScore(groupId+":"+RedisKey.DEATH_PATH_EVERY_GUILD_RANK,String.valueOf(pathId),String.valueOf(guildId), everyGuildChangeScore);
|
||||
AbstractRank everyGuild = RankContext.getRankEnum(RankEnum.DEATH_PATH_EVERY_GUILD_RANK.getType());
|
||||
redisUtil.incrementZsetScore(everyGuild.getCrossRedisKey(),String.valueOf(pathId),String.valueOf(guildId), everyGuildChangeScore, false);
|
||||
String after = firstGuild(redisUtil, groupId, pathId);
|
||||
AbstractRank totalGuild = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
if(!before.equals(after)){
|
||||
decimal = decimal.add(new BigDecimal(1));
|
||||
if(!"".equals(before)){
|
||||
redisUtil.incrementZsetScore(groupId+":"+RedisKey.DEATH_PATH_TOTAL_GUILD_RANK,"",before, -1);
|
||||
redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",before, -1,false);
|
||||
}
|
||||
}
|
||||
AbstractRank totalPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType());
|
||||
// 个人单个排行
|
||||
redisUtil.incrementZsetScore(groupId+":"+RedisKey.DEATH_PATH_EVERY_PERSON_RANK,String.valueOf(pathId),String.valueOf(uid), damage);
|
||||
redisUtil.incrementZsetScore(everyPerson.getCrossRedisKey(),String.valueOf(pathId),String.valueOf(uid), damage,false);
|
||||
//操作总的个人伤害
|
||||
redisUtil.incrementZsetScore(groupId+":"+RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,"",String.valueOf(uid), damage);
|
||||
redisUtil.incrementZsetScore(totalPerson.getCrossRedisKey(),"",String.valueOf(uid), damage,false);
|
||||
//操作总的工会伤害
|
||||
redisUtil.incrementZsetScore(groupId+":"+RedisKey.DEATH_PATH_TOTAL_GUILD_RANK,"",String.valueOf(guildId), decimal.doubleValue());
|
||||
redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",String.valueOf(guildId), decimal.doubleValue(),false);
|
||||
// 结算标识设置
|
||||
redisUtil.hset(RedisKey.DEATH_PATH_EVERY_OVER_HASH,String.valueOf(GameApplication.serverId),1);
|
||||
}
|
||||
|
|
@ -160,9 +164,10 @@ public class CrossDeathPathLogic {
|
|||
*/
|
||||
public Map<Integer,Integer> crossDeathPathReward(int groupId,int serverId){
|
||||
if(TimeUtils.getHourOfDay()!=0){
|
||||
return new HashMap<>();
|
||||
return new HashMap<>(1);
|
||||
}
|
||||
Set<ZSetOperations.TypedTuple<String>> values = RedisUtil.getInstence().getZsetreverseRangeWithScores(groupId+":" + RedisKey.DEATH_PATH_TOTAL_GUILD_RANK, "", 0, -1);
|
||||
AbstractRank totalGuild = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> values = RedisUtil.getInstence().getZsetreverseRangeWithScores(totalGuild.getCrossRedisKey(), "", 0, -1, false);
|
||||
HashMap<Integer, Integer> hashMap = new HashMap<>();
|
||||
int rank =0;
|
||||
for(ZSetOperations.TypedTuple<String> value:values){
|
||||
|
|
@ -178,7 +183,7 @@ public class CrossDeathPathLogic {
|
|||
|
||||
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(RedisKey.DEATH_PATH_EVERY_OVER_HASH);
|
||||
if (hmget == null || hmget.size() < 1) {
|
||||
Cursor<String> cursor = RedisUtil.getInstence().scan(groupId + ":DEATH_PATH*", -1);
|
||||
Cursor<String> cursor = RedisUtil.getInstence().scan("DEATH_PATH*"+groupId+":*", -1);
|
||||
while (cursor.hasNext()) {
|
||||
//找到一次就添加一次
|
||||
String next = cursor.next();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,15 @@ public class DeathPathLogic {
|
|||
/**
|
||||
* 是否跨服
|
||||
*/
|
||||
private int groupId;
|
||||
private int groupId = -1;
|
||||
|
||||
public int getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(int groupId) {
|
||||
this.groupId = -1;
|
||||
}
|
||||
|
||||
private BlockingQueue<DeathPathTask> tasks = new BlockingUniqueQueue<>();
|
||||
|
||||
|
|
@ -190,9 +198,9 @@ public class DeathPathLogic {
|
|||
if(dayStats==-1){
|
||||
//领奖阶段
|
||||
currStatus = 2;
|
||||
if(groupId==0 && isOpenCrossDeathPath()){
|
||||
groupId = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
LOGGER.info("========================跨服十绝阵开启:{}",groupId);
|
||||
if(getGroupId()==0 && isOpenCrossDeathPath()){
|
||||
setGroupId(GlobleSystemLogic.getInstence().getCrossGroup());
|
||||
LOGGER.info("========================跨服十绝阵开启:{}",getGroupId());
|
||||
}
|
||||
}else if (dayStats==1){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
|
@ -221,8 +229,8 @@ public class DeathPathLogic {
|
|||
case 0:
|
||||
try {
|
||||
deleteDeathPathInfo();
|
||||
groupId = 0;
|
||||
LOGGER.info("========================跨服十绝阵关闭:{}",groupId);
|
||||
setGroupId(0);
|
||||
LOGGER.info("========================跨服十绝阵关闭:{}",getGroupId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -236,8 +244,8 @@ public class DeathPathLogic {
|
|||
taskExecutor.start();
|
||||
}
|
||||
if(isOpenCrossDeathPath()){
|
||||
groupId = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
LOGGER.info("========================跨服十绝阵开启:{}",groupId);
|
||||
setGroupId(GlobleSystemLogic.getInstence().getCrossGroup());
|
||||
LOGGER.info("========================跨服十绝阵开启:{}",getGroupId());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -305,14 +313,16 @@ public class DeathPathLogic {
|
|||
for (int i = 1; i <= 10; i++) {
|
||||
String key;
|
||||
// 是否是跨服
|
||||
if (groupId > 0) {
|
||||
key = groupId + ":" + guildRank.getRedisKey();
|
||||
Set<ZSetOperations.TypedTuple<String>> zSetReverseRangeWithScores;
|
||||
if (getGroupId() > 0) {
|
||||
key = guildRank.getCrossRedisKey();
|
||||
zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0,false);
|
||||
LOGGER.info("========================获取十绝阵内部信息,跨服:{}",uid);
|
||||
} else {
|
||||
key = guildRank.getRedisKey();
|
||||
zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0,true);
|
||||
LOGGER.info("========================获取十绝阵内部信息,本地:{}",uid);
|
||||
}
|
||||
Set<ZSetOperations.TypedTuple<String>> zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0);
|
||||
Iterator<ZSetOperations.TypedTuple<String>> iterator = zSetReverseRangeWithScores.iterator();
|
||||
if (!iterator.hasNext()) {
|
||||
continue;
|
||||
|
|
@ -363,7 +373,7 @@ public class DeathPathLogic {
|
|||
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||
|
||||
//更新排行榜数据
|
||||
tasks.offer(new DeathPathTask(uid,guildId,damage,pathId,groupId));
|
||||
tasks.offer(new DeathPathTask(uid,guildId,damage,pathId,getGroupId()));
|
||||
//挑战次数记录
|
||||
RedisUtil.getInstence().increment(RedisKey.getKey(RedisKey.DEATH_PATH_CHALLENGE_COUNT,String.valueOf(uid),false));
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
|
|
@ -425,7 +435,6 @@ public class DeathPathLogic {
|
|||
LOGGER.info("==================跨服十绝阵上榜处理:{}",task.toString());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("==================跨服十绝阵上榜异常:{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -551,15 +560,16 @@ public class DeathPathLogic {
|
|||
}
|
||||
//根据排名进行随机奖励
|
||||
int rank;
|
||||
String key;
|
||||
if(groupId>0){
|
||||
key = groupId + ":" + RedisKey.DEATH_PATH_TOTAL_GUILD_RANK;
|
||||
LOGGER.info("==================获取十绝阵奖励,跨服,分组:{},玩家:{}",groupId,uid);
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
if(getGroupId()>0){
|
||||
String key = rankEnum.getCrossRedisKey();
|
||||
rank = RedisUtil.getInstence().getZSetreverseRank(key, "", String.valueOf(user.getPlayerInfoManager().getGuildId()),false).intValue();
|
||||
LOGGER.info("==================获取十绝阵奖励,跨服,分组:{},玩家:{}",getGroupId(),uid);
|
||||
}else {
|
||||
key = RedisKey.DEATH_PATH_TOTAL_GUILD_RANK;
|
||||
LOGGER.info("==================获取十绝阵奖励,本地,分组:{},玩家:{}",groupId,uid);
|
||||
String key = rankEnum.getRedisKey();
|
||||
rank = RedisUtil.getInstence().getZSetreverseRank(key, "", String.valueOf(user.getPlayerInfoManager().getGuildId()),true).intValue();
|
||||
LOGGER.info("==================获取十绝阵奖励,本地,分组:{},玩家:{}",getGroupId(),uid);
|
||||
}
|
||||
rank = RedisUtil.getInstence().getZSetreverseRank(key, "", String.valueOf(user.getPlayerInfoManager().getGuildId())).intValue();
|
||||
if(rank==-1||rank==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
|
@ -605,10 +615,10 @@ public class DeathPathLogic {
|
|||
String mailContent = SErrorCodeEerverConfig.getI18NMessage("guildwar_reward_txt");
|
||||
// 本服id
|
||||
int serverId = GameApplication.serverId;
|
||||
if(groupId > 0){
|
||||
if(getGroupId() > 0){
|
||||
//是否跨服
|
||||
LOGGER.info("===================跨服十绝阵排行榜结束处理,分组:{},区服:{}",groupId,serverId);
|
||||
Map<Integer, Integer> map = CrossDeathPathLogic.getInstance().crossDeathPathReward(groupId, serverId);
|
||||
LOGGER.info("===================跨服十绝阵排行榜结束处理,分组:{},区服:{}",getGroupId(),serverId);
|
||||
Map<Integer, Integer> map = CrossDeathPathLogic.getInstance().crossDeathPathReward(getGroupId(), serverId);
|
||||
if(map.isEmpty()){
|
||||
LOGGER.error("===================无跨服十绝阵排行信息");
|
||||
return;
|
||||
|
|
@ -626,7 +636,7 @@ public class DeathPathLogic {
|
|||
}
|
||||
}
|
||||
}else {
|
||||
LOGGER.info("===================本地十绝阵排行榜结束处理,分组:{},区服:{}",groupId,serverId);
|
||||
LOGGER.info("===================本地十绝阵排行榜结束处理,分组:{},区服:{}",getGroupId(),serverId);
|
||||
//本服发奖
|
||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
AbstractRank personRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType());
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.MailingSystem;
|
||||
|
|
@ -424,6 +425,19 @@ public class MailLogic {
|
|||
MongoUtil.getInstence().getMyMongoTemplate().saveWithoutMongoRoot(serverConfigTmp);
|
||||
|
||||
MailLogic.getInstance().sendSystemMail(title,new ArrayList<>(),content,nowTime,"",30*24*60*60,"system",TimeUtils.now(),"0");
|
||||
sendCrossServerIndication();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨服推送全部在线玩家
|
||||
*/
|
||||
public void sendCrossServerIndication(){
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
int result = crossGroup == -1 ? 0 : 1;
|
||||
PlayerInfoProto.IsCrossResponse build = PlayerInfoProto.IsCrossResponse.newBuilder().setIsCross(result).build();
|
||||
for(ISession session:OnlineUserManager.sessionMap.values()){
|
||||
MessageUtil.sendIndicationMessage(session.getUid(),build);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -750,9 +750,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);
|
||||
|
||||
|
|
@ -764,7 +769,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,127 @@
|
|||
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 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);
|
||||
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("==================工会缓存处理=============");
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理跨服排行榜
|
||||
*/
|
||||
public void cleanCrossRank(){
|
||||
for (RankEnum value : RankEnum.values()) {
|
||||
int type = value.getType();
|
||||
if (RankContext.isCrossRank2(type)) {
|
||||
//跨服
|
||||
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);
|
||||
RedisUtil.getInstence().del(key);
|
||||
LOGGER.info("=====================跨服排行榜清理========,key:{}", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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,11 +74,10 @@ 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){
|
||||
rankResponse = rank.getCrossRank(session.getUid(),String.valueOf(crossGroup),index/20+1, 20);
|
||||
if(GlobleSystemLogic.getInstence().getCrossGroup() > 0){
|
||||
rankResponse = rank.getCrossRank(session.getUid(),rkey,index/20+1, 20);
|
||||
}
|
||||
}else{
|
||||
rankResponse = rank.getRank(session.getUid(),rkey,index/20+1, 20);
|
||||
|
|
@ -208,7 +207,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,40 @@ 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(getCrossRedisKey(), 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) {
|
||||
LOGGER.error("================跨服排行榜缓存玩家数据报错=========,uid:{},error:{}",uid,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -104,6 +135,11 @@ public abstract class AbstractRank implements IRank {
|
|||
return redisKey;
|
||||
}
|
||||
|
||||
public String getCrossRedisKey() {
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
return RedisUtil.getInstence().getKey(redisKey,String.valueOf(crossGroup),false);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
@ -133,6 +169,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,12 +2,11 @@ package com.ljsd.jieling.logic.rank.rankImpl;
|
|||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -20,6 +19,7 @@ public class DeathPathEveryGuildRank extends AbstractRank {
|
|||
super(type, redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(data.getValue()));
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
|
|
@ -39,6 +39,7 @@ public class DeathPathEveryGuildRank extends AbstractRank {
|
|||
return new long[]{(long)(score/1000),(int)(score%1000)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
long result = (long) (data[0]*1000);
|
||||
if(data.length>1){
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ 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.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
|
|
@ -31,14 +32,14 @@ public class DeathPathTotalGuildRank extends AbstractRank{
|
|||
|
||||
@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))));
|
||||
BigDecimal 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();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(data.getValue()));
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(guildInfo.getId()), DeathChallengeCount.class);
|
||||
|
|
|
|||
|
|
@ -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(false);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("跨服排行榜初始化一次,Exception::=>{}",e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
ArenaLogic.getInstance().worldSendReward();
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
Loading…
Reference in New Issue